2 #include "G4Poisson.hh" 3 #include "Randomize.hh" 9 #include "CLHEP/Units/PhysicalConstants.h" 10 using namespace CLHEP;
14 string hd_msg =
" > cnd hit process";
16 map<string, double> dgtz;
17 vector<identifier> identity = aHit->
GetId();
20 int layer = identity[0].id;
21 int paddle = identity[1].id;
30 double att_length = 1.5*m;
31 double att_length_lg = 9.5*m;
33 double sensor_surface = pow(2.5*cm,2)*pi;
34 double paddle_xsec = 0.;
35 if (layer == 1) paddle_xsec = 22.8*cm*cm;
36 else if (layer == 2) paddle_xsec = 26.4*cm*cm;
37 else if (layer == 3) paddle_xsec = 27.7*cm*cm;
39 if (sensor_surface < paddle_xsec) light_coll = 0.7 * sensor_surface / paddle_xsec;
40 else light_coll = 0.7;
47 double light_yield = 10000/MeV;
48 double sensor_qe = 0.2;
49 double sensor_gain = 0.24;
51 double signal_split = 0.5;
52 double adc_conv = 10.;
58 double veff = 16*cm/ns;
65 double sigmaTD = 0.14*ns/sqrt(MeV);
66 double sigmaTN = 0.14*ns/sqrt(MeV);
68 double tdc_conv = 40/ns;
75 double birks_constant=aHit->
GetDetector().
GetLogical()->GetMaterial()->GetIonisation()->GetBirksConstant();
77 vector<G4ThreeVector> Lpos = aHit->
GetLPos();
78 vector<double> Edep = aHit->
GetEdep();
81 vector<double> times = aHit->
GetTime();
82 vector<double> dx = aHit->
GetDx();
84 unsigned nsteps = times.size();
117 for(
unsigned int s=0; s<nsteps; s++)
121 dDir = length + Lpos[s].z();
122 dNeigh = 3*length - Lpos[s].z();
128 Edep_B = BirksAttenuation(Edep[s],dx[s],charge[s],birks_constant);
134 e_dir = (Edep_B/2) * exp(-dDir/att_length - Lg[layer-1]/att_length_lg) * light_coll;
135 e_neigh = (Edep_B/2) * exp(-dNeigh/att_length - Lg[layer-1]/att_length_lg) * uturn[layer-1] * light_coll;
138 etotD = etotD + e_dir;
139 etotN = etotN + e_neigh;
163 et_D = et_D + ((times[s] + dDir/veff) * e_dir);
164 et_N = et_N + ((times[s] + dNeigh/veff + t_u[layer-1]) * e_neigh);
172 timeD = et_D / etotD;
173 timeN = et_N / etotN;
198 TDCD = (int) ((timeD + G4RandGauss::shoot(0.,sigmaTD/sqrt(etotD))) * tdc_conv);
199 ADCD = (int) (G4Poisson(etotD*light_yield*sensor_qe)*signal_split*sensor_gain*adc_conv + adc_ped);
203 TDCN = (int) ((timeN + G4RandGauss::shoot(0.,sigmaTN/sqrt(etotN))) * tdc_conv);
204 ADCN = (int) (G4Poisson(etotN*light_yield*sensor_qe)*signal_split*sensor_gain*adc_conv + adc_ped);
207 if(TDCD < 0) TDCD = 0;
208 else if (TDCD > 4096) TDCD = 4096;
209 if(TDCN < 0) TDCN = 0;
210 else if(TDCN > 4096) TDCN = 4096;
212 if(ADCD < 0) ADCD = 0;
213 if(ADCN < 0) ADCN = 0;
220 cout << hd_msg <<
" layer: " << layer <<
", paddle: " << paddle <<
" x=" << tInfos.
x/cm <<
"cm, y=" << tInfos.
y/cm <<
"cm, z=" << tInfos.
z/cm <<
"cm" << endl;
221 cout << hd_msg <<
" Etot=" << tInfos.
eTot/MeV <<
"MeV, average time=" << tInfos.
time <<
"ns" << endl;
222 cout << hd_msg <<
" TDCD= " << TDCD <<
", TDCN= " << TDCN <<
", ADCD= " << ADCD <<
", ADCN= " << ADCN << endl;
227 dgtz[
"layer"] = layer;
228 dgtz[
"paddle"] = paddle;
240 id[
id.size()-1].id_sharing = 1;
252 double response = destep;
253 if (birks*destep*stepl*charge != 0.)
255 response = destep/(1. + birks*destep/stepl);
263 map< string, vector <int> > MH;
map< string, double > integrateDgt(MHit *, int)
G4LogicalVolume * GetLogical()
Returns Logical Volume pointer.
map< string, vector< int > > multiDgt(MHit *, int)
vector< identifier > GetId()
double BirksAttenuation(double, double, int, double)
vector< G4ThreeVector > GetLPos()
vector< double > GetTime()
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
vector< identifier > processID(vector< identifier >, G4Step *, detector)
vector< double > GetEdep()
vector< int > GetCharges()