SatAndLight  2.2.2-hubble
Simulation toolkit for space telescopes
Camera Class Reference

CCD camera. More...

#include <Camera.h>

Inheritance diagram for Camera:
Collaboration diagram for Camera:

Public Member Functions

void AddCosmicRay (const double aEnergy, const double aY, const double aZ, const double aCosTheta, const double aSinTheta, const double aCosPhi, const double aSinPhi, const int aSourceIndex=0, const int aParticleIndex=0)
 Adds one cosmic ray to the current amplitude map. More...
 
void AddPhoton (const double aEnergy, const double aY, const double aZ, const int aSourceIndex=0, const int aParticleIndex=0)
 Adds one photon to the current amplitude map. More...
 
void AddPixelAmplitudeValue (const int aPixIndexY, const int aPixIndexZ, const int aValue)
 Increments the amplitude value of a given pixel. More...
 
void GenAmplitudeNoiseMap (void)
 Fills the raw amplitude map with intrinsic pixel noise. More...
 
TH2S * GetMap (const CAMERA_MAPTYPE aMapType)
 Returns a camera map. More...
 
int GetMapNy (void)
 Returns the number of pixels in the Y direction. More...
 
int GetMapNz (void)
 Returns the number of pixels in the Z direction. More...
 
string GetName (void)
 Returns the camera name. More...
 
double GetPixelError (const CAMERA_MAPTYPE aMapType, const int aPixIndexY, const int aPixIndexZ)
 Returns the error value of a given pixel. More...
 
int GetPixelValue (const CAMERA_MAPTYPE aMapType, const int aPixIndexY, const int aPixIndexZ)
 Returns the value of a given pixel and a given map. More...
 
ULong64_t GetTime (void)
 Returns the camera time [ms]. More...
 
UInt_t GetTimeResolution (void)
 Returns the camera electronic integration time [ms]. More...
 
double GetXsize (void)
 Returns the camera physical size in the X direction [mm]. More...
 
double GetYsize (void)
 Returns the camera physical size in the Y direction [mm]. More...
 
double GetZsize (void)
 Returns the camera physical size in the Z direction [mm]. More...
 
void ResetMap (const CAMERA_MAPTYPE aMapType)
 Resets a given map. More...
 
void SetCosmicRayEnergyLoss (const double aEnergyLoss=1.0)
 Sets the energy loss per pixel for cosmic rays. More...
 
void SetFrozenBrightY (const int aPixIndexY)
 Sets an entire line of pixels (Y) at amplitude saturation. More...
 
void SetFrozenBrightZ (const int aPixIndexZ)
 Sets an entire line of pixels (Z) at amplitude saturation. More...
 
void SetGain (TH2F *aGainMap)
 Sets a gain map. More...
 
void SetGainUniform (const double aGain)
 Sets a uniform gain map. More...
 
void SetMap (const CAMERA_MAPTYPE aMapType, TH2S *aMap)
 Sets an external camera map. More...
 
void SetName (const string aName)
 Sets the camera name. More...
 
void SetPhotonResolution (const double aPixelResY=1.0, const double aPixelResZ=1.0)
 Sets the spatial resolution to inject photons in the camera frame. More...
 
void SetPixelDistributions (const CAMERA_MAPTYPE aMapType, double aPar1=-1.0, double aPar2=-1.0, double aPar3=-1.0, double aPar4=-1.0)
 Sets a Gaussian distribution for a given pixel map. More...
 
void SetPixelValue (const CAMERA_MAPTYPE aMapType, const int aPixIndexY, const int aPixIndexZ, const int aValue, const double aValueErr=0.0)
 Assigns a value to a given pixel of a given map. More...
 
void SetRandomPixelBright (const int aN)
 Sets a given number of pixels, randomly chosen, at amplitude saturation (dark and read noise maps). More...
 
void SetRandomPixelDead (const int aN)
 Sets a given number of pixels, randomly chosen, at 0 amplitude (dark and read noise maps). More...
 
void SetSize (const double aXsize=1.0, const double aYsize=1.0, const double aZsize=1.0)
 Sets the physical size of the camera CCD. More...
 
void SetTime (const ULong64_t aTime=0)
 Sets the camera time [ms]. More...
 
void SetTimeResolution (const UInt_t aTimeResolution=100)
 Sets the camera electronic integration time [ms]. More...
 
void TreeDelete (void)
 Deletes the TTree. More...
 
int TreeFill (void)
 Fills all the TTree branches with current parameters. More...
 
void TreeInit (void)
 Initializes a camera TTree. More...
 
void TreeReset (void)
 Resets baskets, buffers and entries count in all branches and leaves. More...
 
int TreeWrite (void)
 Writes the TTree to the current directory. More...
 
void WriteMap (const string aOutFileName="./mymaps.root")
 Write the current camera maps in a ROOT file. More...
 
Constructors and destructors
 Camera (const int aNbits=14, const int aNy=256, const int aNz=256)
 Camera class constuctor. More...
 
virtual ~Camera (void)
 Camera class destructor. More...
 
- Public Member Functions inherited from Rotation
double GetAlpha (void)
 Returns the current value of \(\alpha\) [rad]. More...
 
double GetBeta (void)
 Returns the current value of \(\beta\) [rad]. More...
 
double GetCosAlpha (void)
 Returns the current value of \(\cos(\alpha)\). More...
 
double GetCosBeta (void)
 Returns the current value of \(\cos(\beta)\). More...
 
double GetCosGamma (void)
 Returns the current value of \(\cos(\gamma)\). More...
 
double GetGamma (void)
 Returns the current value of \(\gamma\) [rad]. More...
 
double GetOmega (void)
 Returns the current value of \(\omega\). More...
 
double GetPsi (void)
 Returns the current value of \(\Psi\). More...
 
double GetRotationAngle (void)
 Returns the rotation angle from \(\cal{R}^{\prime}\) to \(\cal{R}\) [rad]. More...
 
double GetRotationAxisXp (void)
 Returns the \(x^{\prime}\) component in \(\cal{R}^{\prime}\) of a vector defining the rotation axis from \(\cal{R}^{\prime}\) to \(\cal{R}\). More...
 
double GetRotationAxisYp (void)
 Returns the \(y^{\prime}\) component in \(\cal{R}^{\prime}\) of a vector defining the rotation axis from \(\cal{R}^{\prime}\) to \(\cal{R}\). More...
 
double GetRotationAxisZp (void)
 Returns the \(z^{\prime}\) component in \(\cal{R}^{\prime}\) of a vector defining the rotation axis from \(\cal{R}^{\prime}\) to \(\cal{R}\). More...
 
double GetRxx ()
 Returns the rotation matrix element \(R_{xx}\). More...
 
double GetRxy ()
 Returns the rotation matrix element \(R_{xy}\). More...
 
double GetRxz ()
 Returns the rotation matrix element \(R_{xz}\). More...
 
double GetRyx ()
 Returns the rotation matrix element \(R_{yx}\). More...
 
double GetRyy ()
 Returns the rotation matrix element \(R_{yy}\). More...
 
double GetRyz ()
 Returns the rotation matrix element \(R_{yz}\). More...
 
double GetRzx ()
 Returns the rotation matrix element \(R_{zx}\). More...
 
double GetRzy ()
 Returns the rotation matrix element \(R_{zy}\). More...
 
double GetRzz ()
 Returns the rotation matrix element \(R_{zz}\). More...
 
double GetSinAlpha (void)
 Returns the current value of \(\sin(\alpha)\). More...
 
double GetSinBeta (void)
 Returns the current value of \(\sin(\beta)\). More...
 
double GetSinGamma (void)
 Returns the current value of \(\sin(\gamma)\). More...
 
double GetUpx (const double aThetaPrime, const double aPhiPrime)
 Returns the \(u^{\prime}_x\) coordinate in the \(\cal{R}^{\prime}\) reference frame. More...
 
double GetUpy (const double aThetaPrime, const double aPhiPrime)
 Returns the \(u^{\prime}_y\) coordinate in the \(\cal{R}^{\prime}\) reference frame. More...
 
double GetUpz (const double aThetaPrime)
 Returns the \(u^{\prime}_z\) coordinate in the \(\cal{R}^{\prime}\) reference frame. More...
 
double GetUx (const double aTheta)
 Returns the \(u_x\) coordinate in the \(\cal{R}\) reference frame. More...
 
double GetUy (const double aTheta, const double aPhi)
 Returns the \(u_y\) coordinate in the \(\cal{R}\) reference frame. More...
 
double GetUz (const double aTheta, const double aPhi)
 Returns the \(u_z\) coordinate in the \(\cal{R}\) reference frame. More...
 
void SetAlpha (const double aAlpha=0.0)
 Sets a new \(\alpha\) value. More...
 
void SetAlphaBetaGamma (const double aAlpha, const double aBeta, const double aGamma)
 Sets Euler angles, \(\alpha, \beta, \gamma\), for the rotation. More...
 
void SetBeta (const double aBeta=0.0)
 Sets a new \(\beta\) value. More...
 
void SetGamma (const double aGamma=0.0)
 Sets a new \(\gamma\) value. More...
 
void SetUnitQuaternion (const double aQ0, const double aQ1, const double aQ2, const double aQ3, const bool aRtoRprime=true)
 Sets Euler angles from a unit quaternion. More...
 
double TransformGetCosPhi (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\cos\varphi\) in the reference frame \(\cal{R}\). More...
 
double TransformGetCosPhiPrime (const double aTheta, const double aPhi)
 Returns the \(\cos\varphi^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetCosTheta (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\cos\theta\) in the reference frame \(\cal{R}\). More...
 
double TransformGetCosThetaPrime (const double aTheta, const double aPhi)
 Returns the \(\cos\theta^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetSinPhi (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\sin\varphi\) in the reference frame \(\cal{R}\). More...
 
double TransformGetSinPhiPrime (const double aTheta, const double aPhi)
 Returns the \(\sin\varphi^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetSinTheta (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\sin\theta\) in the reference frame \(\cal{R}\). More...
 
double TransformGetSinThetaPrime (const double aTheta, const double aPhi)
 Returns the \(\sin\theta^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetTanPhi (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\tan\varphi\) in the reference frame \(\cal{R}\). More...
 
double TransformGetTanPhiPrime (const double aTheta, const double aPhi)
 Returns the \(\tan\varphi^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetTanTheta (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\tan\theta\) in the reference frame \(\cal{R}\). More...
 
double TransformGetTanThetaCosPhi (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\tan\theta\cos\varphi\) in the reference frame \(\cal{R}\). More...
 
double TransformGetTanThetaPrime (const double aTheta, const double aPhi)
 Returns the \(\tan\theta^{\prime}\) in the reference frame \(\cal{R}^{\prime}\). More...
 
double TransformGetTanThetaSinPhi (const double aThetaPrime, const double aPhiPrime)
 Returns the \(\tan\theta\sin\varphi\) in the reference frame \(\cal{R}\). More...
 
 Rotation (const double aAlpha, const double aBeta, const double aGamma)
 Rotation class constuctor. More...
 
virtual ~Rotation (void)
 Rotation class destructor. More...
 

Protected Attributes

TTree * cam_tree
 camera tree. More...
 
TRandom3 * randgen
 random generator. More...
 
- Protected Attributes inherited from Rotation
double rot_alpha
 Euler angle \(\alpha\). More...
 
double rot_beta
 Euler angle \(\beta\). More...
 
double rot_gamma
 Euler angle \(\gamma\). More...
 

Private Attributes

int cam_ampmax
 maximum raw amplitude. More...
 
double cam_cosmic_pixenergy
 Energy loss per pixel (comic ray). More...
 
UInt_t cam_dt
 electronic integration time [ms]. More...
 
TH2F * cam_gain
 gain map. More...
 
int cam_hitastro [CAMERA_NHITMAX]
 hit astro-particle index. More...
 
int cam_hitn
 number of hits. More...
 
int cam_hitsrc [CAMERA_NHITMAX]
 hit source index. More...
 
double cam_hity [CAMERA_NHITMAX]
 hit position in the Y direction. More...
 
double cam_hitz [CAMERA_NHITMAX]
 hit position in the Z direction. More...
 
TH2S * cam_map [pixntype]
 pixel amplitude map, pixel intrinsic noise maps. More...
 
string cam_name
 camera name. More...
 
int cam_nbits
 number of bits to encode the raw amplitude. More...
 
TF1 * cam_photon_gaus [2]
 Gaussian energy distribution for photons. More...
 
double cam_photon_resy
 Gaussian width for photons (Y): only used for the TTree!!! See TreeFill(). More...
 
double cam_photon_resz
 Gaussian width for photons (Z): only used for the TTree!!! See TreeFill(). More...
 
ULong64_t cam_time
 camera time [ms] More...
 
double cam_xsize
 physical size in the X direction [mm]. More...
 
double cam_ysize
 physical size in the Y direction [mm]. More...
 
double cam_zsize
 physical size in the Z direction [mm]. More...
 

Detailed Description

CCD camera.

Camera description

A camera object is a plane with \(N_y\times N_z\) pixels. By convention, the camera plane reference axes are Y (horizontal) and Z (vertical). The X axis is perpendicular to the camera plane. Pixels are indexed from 0 to \(N_y-1\) from left to right and from 0 to \(N_z-1\).

Camera object.

Pixels are indexed by \((i,j)\) in the \(yz\) matrix. The properties of pixels are managed with matrices or the so-called "pixel maps". This class implements 4 pixel maps:

  • an intrinsic dark noise level map, defined by a mean \(\Lambda_{ij}\) and a standard deviation \(\lambda_{ij}\) value for each pixel.
  • an intrinsic read noise level map, defined by a mean \(\Xi_{ij}\) and a standard deviation \(\xi_{ij}\) value for each pixel.
  • a raw amplitude \(A_{ij}\) map which is encoded over a given number of bits.
  • a calibration factor or gain \(G_{ij}\) map used to transform amplitudes (after noise subtraction) in energies [keV].

In addition, the camera CCD is also described by several parameters:

  • a name (see SetName())
  • the number of bits to encode the pixel amplitude (see Camera()).
  • the physical size of the CCD plane \(L_x\times L_y \times L_z\) in \([mm]\times [mm]\times [mm]\) (see SetSize()).
  • a time stamp (see SetTime())
  • the electronic integration time (see SetTimeResolution())
  • an orientation in space, managed by the Rotation class.

A sequence of camera objects can be saved in a TTree structure and eventually saved to disk. After opening a TFile, the following functions should be called:

See also
The SatAndLight file structure for camera objects.

The camera orientation

Camera object.

The camera position must be defined in space. The reference frame of the camera is \(\cal{R}\), where the \(x\) axis is the pointing axis and the camera is located in the \(yOz\) plane. The Earth celestial reference frame is noted \(\cal{R}'\). The rotation between the camera reference frame and the Earth reference frame is managed by the Rotation class from which the Camera class inherits. Intrinsic Euler angles, \((\alpha, \beta, \gamma)\) are use to track the camera reference frame in the Earth reference frame. These angles must be set with Rotation::SetAlphaBetaGamma() before taking pictures.

Camera (blue) and Earth celestial (black) reference frames. The rotation to change the system of coordinates is given by the Euler angles and is represented in green.

Camera intrinsic noise

The pixel intrinsic amplitude noise can be decomposed into two contributions: \(N_{ij} = D_{ij} + R_{ij}\). The dark noise component \(D_{ij}\) measures the amplitude induced by statistical fluctuations in thermal electron production. It is modeled with a Gaussian statistic characterized by a per-pixel mean value \(\Lambda_{ij}\) and a standard deviation \(\lambda_{ij}\). Both parameters are functions of time and can be used to account for temperature variations. Similarly, the read noise amplitude \(R_{ij}\) inherent to the camera reading electronics is parameterized by a per-pixel mean value \(\Xi_{ij}\) and a standard deviation \(\xi_{ij}\), both of which are time dependent. \(\Lambda_{ij}\) and \(\lambda_{ij}\) are saved in the dark noise map. \(\Xi_{ij}\) and \(\xi_{ij}\) are saved in the read noise map. The process of taking a picture starts with generating pixel noise \(N_{ij}\). For each pixel, the dark and read noise amplitudes \(D_{ij}\) and \(R_{ij}\) are drawn from a Gaussian distribution with parameters defined above.

See also
GenAmplitudeNoiseMap()

The noise parameters can be used to define corrupted pixels. For example a pixel is dead if \(\Lambda_{ij}=\lambda_{ij}=\Xi_{ij}=\xi_{ij}=0\).

Photon generation

Photons can be added on top of the camera noise with AddPhoton(). The photon energy is distributed using a two-dimensional Gaussian distribution centered on the photon impact position. The width of the Gaussian functions can be set with SetPhotonResolution().

Cosmic ray generation

See also
AddCosmicRay() and SetCosmicRayEnergyLoss().

Configure your camera

A Camera must be parameterized. Make sure all the functions have been used to properly configure your camera.

Author
Florent Robinet

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( const int  aNbits = 14,
const int  aNy = 256,
const int  aNz = 256 
)

Camera class constuctor.

Initializes the TH2 containers to store the camera pixel parameters. Four camera maps are created:

  • a pixel raw amplitude map. The range of pixel raw amplitudes is limited by the number of bits specified by the user. The maximum number of bits is 16. By default, all pixel amplitudes are set to 0.
  • a pixel dark noise amplitude map. By default, the noise values for all pixels are drawn from a Gaussian distribution, the parameters of which are set with the SetPixelDistributions() function.
  • a pixel read noise amplitude map. By default, the noise values for all pixels are drawn from a Gaussian distribution, the parameters of which are set with the SetPixelDistributions() function.
  • a pixel gain map (set to 1 for all pixels by default). The gain is used to transform the pixel raw amplitude to a calibrated energy [keV]: \(E_{ij} = G_{ij}\times (A_{ij}-N_{ij})\).

Default camera parameters are set:

All the maps and parameters above are attached as TTree branches.

Warning
The camera name must be unique if more than one camera are used in the same time. If needed, use SetName() to update the camera name.
Parameters
[in]aNbitsNumber of bits to encode the pixel raw amplitude (must be less or equal to 16).
[in]aNyNumber of pixels in the Y direction. Pixels are indexed from 0 to \(N_y-1\).
[in]aNzNumber of pixels in the Z direction. Pixels are indexed from 0 to \(N_z-1\).

◆ ~Camera()

Camera::~Camera ( void  )
virtual

Camera class destructor.

Member Function Documentation

◆ AddCosmicRay()

void Camera::AddCosmicRay ( const double  aEnergy,
const double  aY,
const double  aZ,
const double  aCosTheta,
const double  aSinTheta,
const double  aCosPhi,
const double  aSinPhi,
const int  aSourceIndex = 0,
const int  aParticleIndex = 0 
)

Adds one cosmic ray to the current amplitude map.

A cosmic ray is usually a very energetic particle. The interaction with the camera is simulated as a straight track through the camera pixels. The track is entirely determined by the incoming direction of the particle \((\theta,\varphi)\). The entry point \((y_c,z_c)\) must be given, using the camera intrinsic coordinates. From this point a straight line is used to identify all the illuminated pixels. For each pixel, a fix amount of energy (see SetCosmicRayEnergyLoss()) is transfered from the particle to the pixels, and is distributed using a 2D Gaussian parameterized with SetPhotonResolution(). If all the available energy has been consumed, the track stops.

Geometry of a cosmic ray crossing the camera plane.
Parameters
[in]aEnergyPhoton energy in keV.
[in]aYEntry position in the Y direction. Use the camera intrinsic coordinates: from 0 to 1.
[in]aZEntry position in the Z direction. Use the camera intrinsic coordinates: from 0 to 1.
[in]aCosThetaIncoming direction \(\cos\theta\).
[in]aSinThetaIncoming direction \(\sin\theta\).
[in]aCosPhiIncoming direction \(\cos\varphi\).
[in]aSinPhiIncoming direction \(\sin\varphi\).
[in]aSourceIndexSource index.
[in]aParticleIndexParticle index.
Todo:
Revisit the 2D distributions for photons and cosmic rays.
Todo:
Use a separate gain for photons and cosmic rays.

◆ AddPhoton()

void Camera::AddPhoton ( const double  aEnergy,
const double  aY,
const double  aZ,
const int  aSourceIndex = 0,
const int  aParticleIndex = 0 
)

Adds one photon to the current amplitude map.

The incoming photon is defined by an energy (in keV) and a YZ position in the detector plane. A 2D normalized Gaussian distribution is centered on the photon position. This Gaussian distribution is used to distribute the energy over the pixels. All the photon energy is distributed over the pixels. The Gaussian size must be previously set with SetPhotonResolution().

The photon energy is only distributed over \(\pm 15 \sigma\) around the central position. The energy outside this limit is considered to be negligible. This can be a problem for very energetic photons.

If both the dark and read noise standard deviation value are set to 0, the pixel is considered to be frozen. In that case the photon energy in this pixel is not injected.

The pixel energy is converted to a raw amplitude using the gain map: \(A_{ij}=E_{ij}/G_{ij}\).

The pixel amplitude is added to the pixel.

When the photon is associated to a Source, a source index and a particle index can be provided to associate the hit to the source.

Warning
If the number of hits for a given picture reaches CAMERA_NHITMAX, the hit will not be saved in the tree (see TreeFill()).
Parameters
[in]aEnergyPhoton energy in keV.
[in]aYPhoton central position in the Y direction. Use the camera intrinsic coordinates: from 0 to 1.
[in]aZPhoton central position in the Z direction. Use the camera intrinsic coordinates: from 0 to 1.
[in]aSourceIndexSource index.
[in]aParticleIndexParticle index.

◆ AddPixelAmplitudeValue()

void Camera::AddPixelAmplitudeValue ( const int  aPixIndexY,
const int  aPixIndexZ,
const int  aValue 
)
inline

Increments the amplitude value of a given pixel.

The pixel of given indices in the amplitude map is incremented by a given value. If the pixel indices are out-of-range, the map overflows are incremented. If the pixel amplitude is, or gets, saturated, this function has no effect.

Parameters
[in]aPixIndexYY pixel index.
[in]aPixIndexZZ pixel index.
[in]aValuePixel amplitude value to increment.

◆ GenAmplitudeNoiseMap()

void Camera::GenAmplitudeNoiseMap ( void  )

Fills the raw amplitude map with intrinsic pixel noise.

The noise amplitude value of a given pixel is the sum of 2 contributions: the dark and read noises. Each component is randomly drawn from a Gaussian distribution defined by the corresponding noise maps.

Warning
If the pixel amplitude value is negative, it is automatically forced to 0. This behavior can create a small bias in the noise distribution compared to input noise amplitude maps.

The computed amplitude value is used to fill both the pixel value and the pixel error of the amplitude map. This way, the pixel noise level value is saved in the error container.

◆ GetMap()

TH2S* Camera::GetMap ( const CAMERA_MAPTYPE  aMapType)
inline

Returns a camera map.

Warning
Do not modify or delete the return object!
Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.

◆ GetMapNy()

int Camera::GetMapNy ( void  )
inline

Returns the number of pixels in the Y direction.

◆ GetMapNz()

int Camera::GetMapNz ( void  )
inline

Returns the number of pixels in the Z direction.

◆ GetName()

string Camera::GetName ( void  )
inline

Returns the camera name.

◆ GetPixelError()

double Camera::GetPixelError ( const CAMERA_MAPTYPE  aMapType,
const int  aPixIndexY,
const int  aPixIndexZ 
)
inline

Returns the error value of a given pixel.

If the pixel indices are out-of-range, the map overflow error is returned.

Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.
[in]aPixIndexYY pixel index.
[in]aPixIndexZZ pixel index.
Returns
Pixel error value.

◆ GetPixelValue()

int Camera::GetPixelValue ( const CAMERA_MAPTYPE  aMapType,
const int  aPixIndexY,
const int  aPixIndexZ 
)
inline

Returns the value of a given pixel and a given map.

If the pixel indices are out-of-range, the map overflow is returned.

Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.
[in]aPixIndexYY pixel index.
[in]aPixIndexZZ pixel index.
Returns
Pixel value.

◆ GetTime()

ULong64_t Camera::GetTime ( void  )
inline

Returns the camera time [ms].

◆ GetTimeResolution()

UInt_t Camera::GetTimeResolution ( void  )
inline

Returns the camera electronic integration time [ms].

◆ GetXsize()

double Camera::GetXsize ( void  )
inline

Returns the camera physical size in the X direction [mm].

◆ GetYsize()

double Camera::GetYsize ( void  )
inline

Returns the camera physical size in the Y direction [mm].

◆ GetZsize()

double Camera::GetZsize ( void  )
inline

Returns the camera physical size in the Z direction [mm].

◆ ResetMap()

void Camera::ResetMap ( const CAMERA_MAPTYPE  aMapType)
inline

Resets a given map.

All pixel values are set to 0.

Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.

◆ SetCosmicRayEnergyLoss()

void Camera::SetCosmicRayEnergyLoss ( const double  aEnergyLoss = 1.0)
inline

Sets the energy loss per pixel for cosmic rays.

This parameter controls how a cosmic ray looses energy when crossing the camera plane. When a cosmic ray travels through a pixel, it looses a fix amount of energy.

Parameters
[in]aEnergyLossFix energy amount lost by the cosmic ray when crossing 1 pixel in keV.

◆ SetFrozenBrightY()

void Camera::SetFrozenBrightY ( const int  aPixIndexY)

Sets an entire line of pixels (Y) at amplitude saturation.

Both the dark and read noise amplitude are set to the maximum value for an entire line of pixels along the Z axis.

Parameters
[in]aPixIndexYY pixel index.

◆ SetFrozenBrightZ()

void Camera::SetFrozenBrightZ ( const int  aPixIndexZ)

Sets an entire line of pixels (Z) at amplitude saturation.

Both the dark and read noise amplitude are set to the maximum value for an entire line of pixels along the Y axis.

Parameters
[in]aPixIndexZZ pixel index.

◆ SetGain()

void Camera::SetGain ( TH2F *  aGainMap)

Sets a gain map.

The pixels are given a gain value according to a user-defined gain map.

Parameters
[in]aGainMapGain map.

◆ SetGainUniform()

void Camera::SetGainUniform ( const double  aGain)

Sets a uniform gain map.

All the pixels are given the same gain value.

Parameters
[in]aGainGain value.

◆ SetMap()

void Camera::SetMap ( const CAMERA_MAPTYPE  aMapType,
TH2S *  aMap 
)

Sets an external camera map.

The input histogram is used to fill a given camera map. Each bin represents a pixel. Both the bin content and error are copied locally. The histogram X (Y) axis is interpreted as the Y (Z) axis of the camera.

Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.
[in]aMapValid pointer to a TH2S histogram used to fill the map.
Note
The input histogram must be a valid object and the number of bins must match the camera pixels as defined in the constructor.
The input histogram can be deleted after using this function.

◆ SetName()

void Camera::SetName ( const string  aName)

Sets the camera name.

The camera name must be unique if more than one camera are used in the same time.

Parameters
[in]aNameCamera name.

◆ SetPhotonResolution()

void Camera::SetPhotonResolution ( const double  aPixelResY = 1.0,
const double  aPixelResZ = 1.0 
)
inline

Sets the spatial resolution to inject photons in the camera frame.

The photon energy is distributed in the camera pixels following a 2D Gaussian law. This function sets the width of the Gaussian distributions in the Y and Z directions. This is measured as a fraction of pixels.

Parameters
[in]aPixelResYGaussian sigma in the Y direction measured as a pixel fraction.
[in]aPixelResZGaussian sigma in the Z direction measured as a pixel fraction.

◆ SetPixelDistributions()

void Camera::SetPixelDistributions ( const CAMERA_MAPTYPE  aMapType,
double  aPar1 = -1.0,
double  aPar2 = -1.0,
double  aPar3 = -1.0,
double  aPar4 = -1.0 
)

Sets a Gaussian distribution for a given pixel map.

A given pixel map can be filled using a Gaussian statistic for each pixel. The pixel content is drawn from a Gaussian distribution parameterized by a mean value and a sigma value. These 2 parameters (mean and sigma) can also be drawn from a Gaussian distribution. This function is used to parameterized the 2 Gaussian distributions from which the mean and sigma values are drawn.

Note
I know, it is a bit confusing!

If one parameter is set to a negative value, a default value is used:

  • aPar1 < 0 → mean = 10% of the amplitude range
  • aPar2 < 0 → sigma = 0 (dirac function)
  • aPar3 < 0 → mean = 0.5% of the amplitude range
  • aPar4 < 0 → sigma = 0 (dirac function)
Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.
[in]aPar1Gaussian mean of the distribution used to draw the pixel mean value.
[in]aPar2Gaussian sigma of the distribution used to draw the pixel mean value.
[in]aPar3Gaussian mean of the distribution used to draw the pixel sigma value.
[in]aPar4Gaussian sigma of the distribution used to draw the pixel sigma value.

◆ SetPixelValue()

void Camera::SetPixelValue ( const CAMERA_MAPTYPE  aMapType,
const int  aPixIndexY,
const int  aPixIndexZ,
const int  aValue,
const double  aValueErr = 0.0 
)
inline

Assigns a value to a given pixel of a given map.

The pixel of given indices is given a value. If the pixel indices are out-of-range, the map overflow is filled.

Parameters
[in]aMapTypeMap type, see CAMERA_MAPTYPE.
[in]aPixIndexYY pixel index.
[in]aPixIndexZZ pixel index.
[in]aValuePixel value.
[in]aValueErrPixel value error.

◆ SetRandomPixelBright()

void Camera::SetRandomPixelBright ( const int  aN)

Sets a given number of pixels, randomly chosen, at amplitude saturation (dark and read noise maps).

Parameters
[in]aNNumber of pixels.

◆ SetRandomPixelDead()

void Camera::SetRandomPixelDead ( const int  aN)

Sets a given number of pixels, randomly chosen, at 0 amplitude (dark and read noise maps).

Parameters
[in]aNNumber of pixels.

◆ SetSize()

void Camera::SetSize ( const double  aXsize = 1.0,
const double  aYsize = 1.0,
const double  aZsize = 1.0 
)
inline

Sets the physical size of the camera CCD.

Parameters
[in]aXsizeSize in the X direction [mm].
[in]aYsizeSize in the Y direction [mm].
[in]aZsizeSize in the Z direction [mm].

◆ SetTime()

void Camera::SetTime ( const ULong64_t  aTime = 0)
inline

Sets the camera time [ms].

Parameters
[in]aTimeCamera electronic integration time [ms].

◆ SetTimeResolution()

void Camera::SetTimeResolution ( const UInt_t  aTimeResolution = 100)
inline

Sets the camera electronic integration time [ms].

Parameters
[in]aTimeResolutionCamera electronic integration time [ms].

◆ TreeDelete()

void Camera::TreeDelete ( void  )
inline

Deletes the TTree.

◆ TreeFill()

int Camera::TreeFill ( void  )

Fills all the TTree branches with current parameters.

Calls the TTree Fill function.

Returns
The number of bytes committed to the individual branches.

◆ TreeInit()

void Camera::TreeInit ( void  )

Initializes a camera TTree.

The TTree is named after the camera and is given the following branches:

  • 'cam_map_amplitude/TH2S' = amplitude map
  • 'cam_map_darknoise/TH2S' = dark noise map
  • 'cam_map_readnoise/TH2S' = read noise map
  • 'cam_map_gain/TH2F' = gain map
  • 'cam_nbits/I' = amplitude number of bits
  • 'cam_ampmax/I' = maximum amplitude
  • 'cam_xsize/D' = CCD size in X
  • 'cam_ysize/D' = CCD size in Y
  • 'cam_zsize/D' = CCD size in Z
  • 'cam_time/l' = time
  • 'cam_dt/i' = time integration
  • 'cam_nhits/I' = number of hits
  • 'cam_hitsrc[cam_nhits]/I' = hit source index array
  • 'cam_hitastro[cam_nhits]/I' = hit astro-particle index array
  • 'cam_hity[cam_nhits]/D' = hit position (Y) array
  • 'cam_hitz[cam_nhits]/D' = hit position (Z) array

◆ TreeReset()

void Camera::TreeReset ( void  )
inline

Resets baskets, buffers and entries count in all branches and leaves.

Calls the TTree Reset function.

◆ TreeWrite()

int Camera::TreeWrite ( void  )
inline

Writes the TTree to the current directory.

Calls the TTree Write function.

Returns
The total number of bytes written to the file. It returns 0 if the object cannot be written.

◆ WriteMap()

void Camera::WriteMap ( const string  aOutFileName = "./mymaps.root")

Write the current camera maps in a ROOT file.

Camera maps (see CAMERA_MAPTYPE + gain) are saved in aROOT file as TH2 objects.

Parameters
[in]aOutFileNameOutput file name
Precondition
The output file must have a ".root" extension.

Member Data Documentation

◆ cam_ampmax

int Camera::cam_ampmax
private

maximum raw amplitude.

◆ cam_cosmic_pixenergy

double Camera::cam_cosmic_pixenergy
private

Energy loss per pixel (comic ray).

◆ cam_dt

UInt_t Camera::cam_dt
private

electronic integration time [ms].

◆ cam_gain

TH2F* Camera::cam_gain
private

gain map.

◆ cam_hitastro

int Camera::cam_hitastro[CAMERA_NHITMAX]
private

hit astro-particle index.

◆ cam_hitn

int Camera::cam_hitn
private

number of hits.

◆ cam_hitsrc

int Camera::cam_hitsrc[CAMERA_NHITMAX]
private

hit source index.

◆ cam_hity

double Camera::cam_hity[CAMERA_NHITMAX]
private

hit position in the Y direction.

◆ cam_hitz

double Camera::cam_hitz[CAMERA_NHITMAX]
private

hit position in the Z direction.

◆ cam_map

TH2S* Camera::cam_map[pixntype]
private

pixel amplitude map, pixel intrinsic noise maps.

◆ cam_name

string Camera::cam_name
private

camera name.

◆ cam_nbits

int Camera::cam_nbits
private

number of bits to encode the raw amplitude.

◆ cam_photon_gaus

TF1* Camera::cam_photon_gaus[2]
private

Gaussian energy distribution for photons.

◆ cam_photon_resy

double Camera::cam_photon_resy
private

Gaussian width for photons (Y): only used for the TTree!!! See TreeFill().

◆ cam_photon_resz

double Camera::cam_photon_resz
private

Gaussian width for photons (Z): only used for the TTree!!! See TreeFill().

◆ cam_time

ULong64_t Camera::cam_time
private

camera time [ms]

◆ cam_tree

TTree* Camera::cam_tree
protected

camera tree.

◆ cam_xsize

double Camera::cam_xsize
private

physical size in the X direction [mm].

◆ cam_ysize

double Camera::cam_ysize
private

physical size in the Y direction [mm].

◆ cam_zsize

double Camera::cam_zsize
private

physical size in the Z direction [mm].

◆ randgen

TRandom3* Camera::randgen
protected

random generator.


The documentation for this class was generated from the following files: