4 #include "G4UnitsTable.hh" 5 #include "G4Poisson.hh" 6 #include "Randomize.hh" 17 string hd_msg = Opt.
args[
"LOG_MSG"].args +
" CND Hit Process " ;
18 double HIT_VERBOSITY = Opt.
args[
"HIT_VERBOSITY"].arg;
21 HCname =
"CND Hit Process";
26 int nsteps = aHit->
GetPos().size();
30 vector<G4double> Edep = aHit->
GetEdep();
31 for(
int s=0; s<nsteps; s++) Etot = Etot + Edep[s];
39 x = y = z = lx = ly = lz = 0;
40 vector<G4ThreeVector> pos = aHit->
GetPos();
41 vector<G4ThreeVector> Lpos = aHit->
GetLPos();
44 for(
int s=0; s<nsteps; s++)
46 x = x + pos[s].x()*Edep[s]/Etot;
47 y = y + pos[s].y()*Edep[s]/Etot;
48 z = z + pos[s].z()*Edep[s]/Etot;
49 lx = lx + Lpos[s].x()*Edep[s]/Etot;
50 ly = ly + Lpos[s].y()*Edep[s]/Etot;
51 lz = lz + Lpos[s].z()*Edep[s]/Etot;
65 vector<G4double> times = aHit->
GetTime();
66 for(
int s=0; s<nsteps; s++) time = time + times[s]/nsteps;
72 double Ene = aHit->
GetE();
74 out.
raws.push_back(Etot);
75 out.
raws.push_back(x);
76 out.
raws.push_back(y);
77 out.
raws.push_back(z);
78 out.
raws.push_back(lx);
79 out.
raws.push_back(ly);
80 out.
raws.push_back(lz);
81 out.
raws.push_back(time);
86 out.
raws.push_back(Ene);
101 double light_yield=10000/MeV;
102 double att_length=3*m;
103 double sensor_surface=pow(2.5*cm,2)*
pi;
104 double light_coll=sensor_surface/
108 double sensor_qe=0.2;
109 double sensor_gain=0.08;
114 double veff=16*cm/ns;
115 double u_veff=16*cm/ns;
116 double sigmaT=0.16*ns/sqrt(MeV);
118 double tdc_conv=1/0.050/ns;
119 double u_length = 8*cm;
120 double bend_loss = 0.5;
154 vector<int> pids = aHit->
GetPIDs();
156 double birks_constant=aHit->
GetDetector().
GetLogical()->GetMaterial()->GetIonisation()->GetBirksConstant();
162 int dum[4] = {0,0,0,0};
169 for(
int s=0; s<nsteps; s++)
172 double dLeft = length + Lpos[s].y();
173 double dRight = length - Lpos[s].y();
176 double dBack = length + Lpos[s].y();
177 double dFwd = 3*length - Lpos[s].y();
186 stepl = sqrt(pow((Lpos[s+1].x() - Lpos[s].x()),2) + pow((Lpos[s+1].y() - Lpos[s].y()),2) + pow((Lpos[s+1].z() - Lpos[s].z()),2));
189 stepl = sqrt(pow((Lpos[s].x() - Lpos[s-1].x()),2) + pow((Lpos[s].y() - Lpos[s-1].y()),2) + pow((Lpos[s].z() - Lpos[s-1].z()),2));
197 if (light_coll > 1) light_coll = 1.;
199 etotL = etotL + Edep_B/2 * exp(-dLeft/att_length) * light_coll;
200 etotR = etotR + Edep_B/2 * exp(-dRight/att_length) * light_coll;
202 etotB = etotB + Edep_B/2 * exp(-dBack/att_length) * light_coll;
203 etotF = etotF + Edep_B/2 * exp(-dFwd/att_length) * bend_loss * light_coll;
210 if ((dum[0] == 0) && (etotL >= 0.)){
211 timeL = times[s] + dLeft/veff;
214 if ((dum[1] == 0) && (etotR >= 0.)){
215 timeR = times[s] + dRight/veff;
219 if ((dum[2] == 0) && (etotB >= 0.)){
220 timeB = times[s] + dBack/veff;
223 if ((dum[3] == 0) && (etotF >= 0.)){
224 timeF = times[s] + dFwd/veff + u_length/u_veff;
242 TDCL=(int) ((timeL+G4RandGauss::shoot(0.,sigmaT/sqrt(etotL))) * tdc_conv);
243 TDCR=(int) ((timeR+G4RandGauss::shoot(0.,sigmaT/sqrt(etotR))) * tdc_conv);
247 ADCL=(int) (G4Poisson(etotL*light_yield*sensor_qe)*sensor_gain*adc_conv + adc_ped);
248 ADCR=(int) (G4Poisson(etotR*light_yield*sensor_qe)*sensor_gain*adc_conv + adc_ped);
250 TDCB=(int) ((timeB + G4RandGauss::shoot(0.,sigmaT/sqrt(etotB))) * tdc_conv);
251 TDCF=(int) ((timeF + G4RandGauss::shoot(0.,sigmaT/sqrt(etotF))) * tdc_conv);
258 ADCB=(int) (G4Poisson(etotB*light_yield*sensor_qe)*sensor_gain*adc_conv + adc_ped);
259 ADCF=(int) (G4Poisson(etotF*light_yield*sensor_qe)*sensor_gain*adc_conv + adc_ped);
270 if(HIT_VERBOSITY>4) {
272 cout <<
"WOOF woof WOOF woof WOOF woof WOOF woof WOOF!!!" << endl;
274 cout << hd_msg <<
" layer: " << layer <<
", paddle: " << paddle <<
" x=" << x/cm <<
" y=" << y/cm <<
" z=" << z/cm << endl;
275 cout << hd_msg <<
" Etot=" << Etot/MeV <<
" time=" << time/ns << endl;
276 cout << hd_msg <<
" TDCL=" << TDCL <<
" TDCR=" << TDCR <<
" ADCL=" << ADCL <<
" ADCR=" << ADCR << endl;
277 cout << hd_msg <<
" TDCB=" << TDCB <<
" TDCF=" << TDCF <<
" ADCB=" << ADCB <<
" ADCF=" << ADCF << endl;
280 out.
dgtz.push_back(layer);
281 out.
dgtz.push_back(paddle);
282 out.
dgtz.push_back(ADCL);
283 out.
dgtz.push_back(ADCR);
284 out.
dgtz.push_back(TDCL);
285 out.
dgtz.push_back(TDCR);
286 out.
dgtz.push_back(ADCB);
287 out.
dgtz.push_back(ADCF);
288 out.
dgtz.push_back(TDCB);
289 out.
dgtz.push_back(TDCF);
297 id[
id.size()-1].id_sharing = 1;
310 double response = destep;
311 if (birks*destep*stepl*charge != 0.)
313 response = destep/(1. + birks*destep/stepl);
G4LogicalVolume * GetLogical()
Returns Logical Volume pointer.
vector< double > raws
Raw information.
vector< identifier > GetId()
string HCname
Hit Collection name.
PH_output ProcessHit(MHit *, gemc_opts)
Method to process the hit.
vector< identifier > identity
Identifier.
vector< G4ThreeVector > GetLPos()
vector< G4ThreeVector > GetPos()
double BirksAttenuation(double, double, int, double)
vector< double > GetTime()
map< string, opts > args
Options map.
vector< identifier > ProcessID(vector< identifier >, G4Step *, detector, gemc_opts)
Method to calculate new identifier.
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
vector< double > GetEdep()
vector< int > dgtz
Digitized information.
vector< int > GetCharges()