SND@LHC Software
Loading...
Searching...
No Matches
sndScifiHit Class Reference

#include <sndScifiHit.h>

Inheritance diagram for sndScifiHit:
Collaboration diagram for sndScifiHit:

Public Member Functions

 sndScifiHit ()
 
 sndScifiHit (const sndScifiHit &hit)=default
 
sndScifiHitoperator= (const sndScifiHit &hit)=default
 
 sndScifiHit (Int_t detID)
 
 sndScifiHit (int detID, std::vector< ScifiPoint * >, std::vector< Float_t >)
 
virtual ~sndScifiHit ()
 
void Print ()
 
Float_t GetEnergy ()
 
void setInvalid ()
 
bool isValid () const
 
Int_t GetStation ()
 
bool isVertical ()
 
Int_t GetMat ()
 
Int_t GetSiPM ()
 
Int_t GetSiPMChan ()
 
Int_t GetChannelID ()
 
- Public Member Functions inherited from SndlhcHit
 SndlhcHit ()
 
 SndlhcHit (Int_t detID, Int_t nSiPMs=1, Int_t nSides=0)
 
virtual ~SndlhcHit ()
 
Int_t GetDetectorID () const
 
Float_t GetSignal (Int_t nChannel=0)
 
Float_t GetTime (Int_t nChannel=0)
 
Int_t GetnSiPMs () const
 
Int_t GetnSides () const
 
void SetDigi (Float_t s, Float_t t, Int_t i=0)
 
void SetDetectorID (Int_t detID)
 
void SetDaqID (Int_t i, Int_t k, Int_t board_id, Int_t tofpet_id, Int_t tofpet_channel)
 
Int_t GetBoardID (Int_t i)
 
Int_t GetTofpetID (Int_t i)
 
Int_t Getchannel (Int_t i)
 
Int_t GetRawHitIndex (Int_t i=0)
 
virtual void Print (const Option_t *opt="") const
 
virtual void GetPosition (TVector3 L, TVector3 R) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

Float_t ly_loss (Float_t distance)
 
Float_t sipm_saturation (Float_t ly, Float_t nphe_max)
 
Float_t npix_to_qdc (Float_t npix)
 
 ClassDef (sndScifiHit, 4)
 

Private Attributes

Float_t flag
 flag
 

Additional Inherited Members

- Protected Member Functions inherited from SndlhcHit
 ClassDef (SndlhcHit, 2)
 encodes rawhitindex*100000+(board_id * 1000) + (tofpet_id * 100) + tofpet_channel
 
- Protected Attributes inherited from SndlhcHit
Int_t fDetectorID
 Detector unique identifier.
 
Int_t nSiPMs
 
Int_t nSides
 number of SiPMs per side
 
Float_t signals [16]
 number of sides
 
Float_t times [16]
 SiPM signal.
 
Int_t fDaqID [16]
 SiPM time.
 

Detailed Description

Definition at line 9 of file sndScifiHit.h.

Constructor & Destructor Documentation

◆ sndScifiHit() [1/4]

sndScifiHit::sndScifiHit ( )

Default constructor

Definition at line 18 of file sndScifiHit.cxx.

19 : SndlhcHit()
20{
21 flag = true;
22}
Float_t flag
flag
Definition sndScifiHit.h:48

◆ sndScifiHit() [2/4]

sndScifiHit::sndScifiHit ( const sndScifiHit hit)
default

Copy constructor

◆ sndScifiHit() [3/4]

sndScifiHit::sndScifiHit ( Int_t  detID)
explicit

Definition at line 24 of file sndScifiHit.cxx.

25 : SndlhcHit(detID)
26{
27 flag = true;
28}

◆ sndScifiHit() [4/4]

sndScifiHit::sndScifiHit ( int  detID,
std::vector< ScifiPoint * >  V,
std::vector< Float_t >  W 
)

Definition at line 30 of file sndScifiHit.cxx.

31{
32 Scifi* ScifiDet = dynamic_cast<Scifi*> (gROOT->GetListOfGlobals()->FindObject("Scifi") );
33 Float_t nphe_min = ScifiDet->GetConfParF("Scifi/nphe_min");
34 Float_t nphe_max = ScifiDet->GetConfParF("Scifi/nphe_max");
35 Float_t timeResol = ScifiDet->GetConfParF("Scifi/timeResol");
36 Float_t signalSpeed = ScifiDet->GetConfParF("Scifi/signalSpeed");
37
38 nSides = 1;
39 nSiPMs = 1;
40 for (unsigned int j=0; j<16; ++j){
41 signals[j] = -1;
42 times[j] =-1;
43 }
44
45 fDetectorID = SiPMChan;
46 Float_t ly_total = 0;
47 Float_t earliestToA = 1E20;
48 for( int i = 0; i <V.size();i++) {
49
50 Double_t signal = V[i]->GetEnergyLoss()*W[i];
51
52 // Find distances from MCPoint centre to ends of fibre
53 TVector3 a, b;
54 TVector3 impact(V[i]->GetX(),V[i]->GetY() ,V[i]->GetZ() );
55 ScifiDet->GetSiPMPosition(V[i]->GetDetectorID(),a, b);
56
57 Double_t distance;
58
59 bool verticalHit = int(fDetectorID/100000)%10 == 1;
60
61 // Calculate distance from energy deposit to SiPM.
62 // Vertical
63 if (verticalHit) {
64 distance = (b - impact).Mag();
65 // Horizontal
66 } else {
67 distance = (impact - a).Mag();
68 }
69
70 // convert energy deposit to light yield (here Np.e. == avg. N fired pixels)
71 Float_t ly = signal*1E+6*0.16; //0.16 p.e per 1 keV
72 // account for the light attenuation in the fibers
73 ly*= ly_loss(distance);
74 ly_total+= ly;
75
76 // for the timing, find earliest light to arrive at SiPM and smear with time resolution
77 Float_t arrival_time = V[i]->GetTime() + distance/signalSpeed;
78 if (arrival_time < earliestToA){earliestToA = arrival_time;}
79
80 }
81 // smear the total light yield using Poisson distribution
82 ly_total= gRandom->Poisson(ly_total);
83
84 // account for limited SiPM dyn. range
85 Float_t Npix = sipm_saturation(ly_total,nphe_max);
86 // convert Npix to QDC
87 signals[0] = npix_to_qdc(Npix);
88
89 if (ly_total > nphe_min){ // nominal threshold at 3.5 p.e.
90 flag=true;
91 }else{
92 flag=false;
93 }
94 times[0] = gRandom->Gaus(earliestToA, timeResol);
95
96 LOG(DEBUG) << "signal created";
97}
Definition Scifi.h:20
void GetSiPMPosition(Int_t SiPMChan, TVector3 &A, TVector3 &B)
Definition Scifi.cxx:625
Float_t GetConfParF(TString name)
Definition Scifi.h:49
Int_t nSiPMs
Definition SndlhcHit.h:73
Float_t times[16]
SiPM signal.
Definition SndlhcHit.h:76
Int_t GetDetectorID() const
Definition SndlhcHit.h:36
Int_t fDetectorID
Detector unique identifier.
Definition SndlhcHit.h:72
Int_t nSides
number of SiPMs per side
Definition SndlhcHit.h:74
Float_t signals[16]
number of sides
Definition SndlhcHit.h:75
Float_t ly_loss(Float_t distance)
Float_t npix_to_qdc(Float_t npix)
Float_t sipm_saturation(Float_t ly, Float_t nphe_max)
int i
Definition ShipAna.py:86

◆ ~sndScifiHit()

sndScifiHit::~sndScifiHit ( )
virtual

Destructor

Definition at line 100 of file sndScifiHit.cxx.

100{ }

Member Function Documentation

◆ ClassDef()

sndScifiHit::ClassDef ( sndScifiHit  ,
 
)
private

◆ GetChannelID()

Int_t sndScifiHit::GetChannelID ( )
inline

Definition at line 39 of file sndScifiHit.h.

39{return fDetectorID;}

◆ GetEnergy()

Float_t sndScifiHit::GetEnergy ( )

Definition at line 104 of file sndScifiHit.cxx.

105{
106 // to be calculated from digis and calibration constants, missing!
107 return signals[0];
108}

◆ GetMat()

Int_t sndScifiHit::GetMat ( )
inline

Definition at line 36 of file sndScifiHit.h.

36{return ( int(fDetectorID/10000)%10);}

◆ GetSiPM()

Int_t sndScifiHit::GetSiPM ( )
inline

Definition at line 37 of file sndScifiHit.h.

37{return ( int(fDetectorID/1000)%10);}

◆ GetSiPMChan()

Int_t sndScifiHit::GetSiPMChan ( )
inline

Definition at line 38 of file sndScifiHit.h.

38{return ( fDetectorID%1000);}

◆ GetStation()

Int_t sndScifiHit::GetStation ( )
inline

Definition at line 31 of file sndScifiHit.h.

31{return floor(fDetectorID/1000000);}

◆ isValid()

bool sndScifiHit::isValid ( ) const
inline

Definition at line 30 of file sndScifiHit.h.

30{return flag;}

◆ isVertical()

bool sndScifiHit::isVertical ( )
inline

Definition at line 32 of file sndScifiHit.h.

32 {
33 if ( int(fDetectorID/100000)%10 == 1){return true;}
34 else{return (false);}
35 }

◆ ly_loss()

Float_t sndScifiHit::ly_loss ( Float_t  distance)
private

Definition at line 110 of file sndScifiHit.cxx.

110 {
111// It returns the light yield attenuation depending on the distance to SiPM
112 return TMath::Exp(-(distance-ly_loss_params[0])/ly_loss_params[1]);
113}

◆ npix_to_qdc()

Float_t sndScifiHit::npix_to_qdc ( Float_t  npix)
private

Definition at line 121 of file sndScifiHit.cxx.

121 {
122// It returns QDC per channel after Gaussian smearing of the parameters
123 Float_t A = gRandom->Gaus(npix_to_qdc_params[0], npix_to_qdc_params[2]);
124 Float_t B = gRandom->Gaus(npix_to_qdc_params[1], npix_to_qdc_params[3]);
125 return A*npix + B;
126}

◆ operator=()

sndScifiHit & sndScifiHit::operator= ( const sndScifiHit hit)
default

◆ Print()

void sndScifiHit::Print ( )

Output to screen

Definition at line 129 of file sndScifiHit.cxx.

130{
131 std::cout << "-I- sndScifiHit: Scifi hit " << " in station " << GetStation();
132 if ( isVertical()) { std::cout << " vertical plane ";}
133 else { std::cout << " horizontal plane ";}
134 std::cout << "SiPM nr "<<GetSiPM()<< " SiPM channel "<<GetSiPMChan()<<std::endl;
135}
Int_t GetStation()
Definition sndScifiHit.h:31
Int_t GetSiPMChan()
Definition sndScifiHit.h:38
Int_t GetSiPM()
Definition sndScifiHit.h:37
bool isVertical()
Definition sndScifiHit.h:32

◆ setInvalid()

void sndScifiHit::setInvalid ( )
inline

Definition at line 29 of file sndScifiHit.h.

29{flag = false;}

◆ sipm_saturation()

Float_t sndScifiHit::sipm_saturation ( Float_t  ly,
Float_t  nphe_max 
)
private

Definition at line 115 of file sndScifiHit.cxx.

115 {
116// It returns the number of fired pixels per channel
117 Float_t factor = 1 - TMath::Exp(-ly/nphe_max);
118 return nphe_max*factor;
119}

Member Data Documentation

◆ flag

Float_t sndScifiHit::flag
private

flag

Definition at line 48 of file sndScifiHit.h.


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