5 #include "CLHEP/Random/RandGaussT.h" 16 double mini_stagger_shift_R2 = Opt.
args[
"DC_MSTAG_R2"].arg*mm;
17 double mini_stagger_shift_R3 = Opt.
args[
"DC_MSTAG_R3"].arg*mm;
18 double mini_stagger_shift;
20 string hd_msg = Opt.
args[
"LOG_MSG"].args +
" DC Hit Process " ;
21 double HIT_VERBOSITY = Opt.
args[
"HIT_VERBOSITY"].arg;
30 mini_stagger_shift = 0;
33 mini_stagger_shift = mini_stagger_shift_R2;
34 if(Layer == 2 || Layer == 4 || Layer == 6) mini_stagger_shift *= -1;
38 mini_stagger_shift = mini_stagger_shift_R3;
39 if(Layer == 2 || Layer == 4 || Layer == 6) mini_stagger_shift *= -1;
45 double deltay = 2.0*ylength/NWIRES;
46 double WIRE_Y = nwire*deltay + mini_stagger_shift;
49 double drift_velocity = 0;
50 if(SL == 1 || SL == 2) drift_velocity = 0.053;
51 if(SL == 3 || SL == 4) drift_velocity = 0.026;
52 if(SL == 5 || SL == 6) drift_velocity = 0.036;
57 int nsteps = aHit->
GetPos().size();
60 double minTime = 10000;
63 vector<int> stepTrackId = aHit->
GetTIds();
64 vector<double> stepTime = aHit->
GetTime();
65 vector<G4double> Edep = aHit->
GetEdep();
66 vector<G4ThreeVector> pos = aHit->
GetPos();
67 vector<G4ThreeVector> Lpos = aHit->
GetLPos();
69 for(
int s=0; s<nsteps; s++)
71 G4ThreeVector DOCA(0, Lpos[s].y() + ylength - WIRE_Y, Lpos[s].z());
72 signal_t = stepTime[s]/ns + DOCA.mag()/drift_velocity;
74 if(signal_t < minTime && Edep[s] >= aHit->
GetThreshold())
76 trackId = stepTrackId[s];
91 for(
int s=0; s<nsteps; s++)
93 G4ThreeVector DOCA(0, Lpos[s].y() + ylength - WIRE_Y, Lpos[s].z());
94 signal_t = stepTime[s]/ns + DOCA.mag()/drift_velocity;
95 if(signal_t < minTime)
97 trackId = stepTrackId[s];
105 int count_track_steps = 0;
106 for(
int s=0; s<nsteps; s++)
107 if(stepTrackId[s] == trackId)
109 Etot = Etot + Edep[s];
117 x = y = z = lx = ly = lz = 0;
120 for(
int s=0; s<nsteps; s++)
122 if(stepTrackId[s] == trackId)
130 x = x + pos[s].x()/count_track_steps;
131 y = y + pos[s].y()/count_track_steps;
132 z = z + pos[s].z()/count_track_steps;
133 lx = lx + Lpos[s].x()/count_track_steps;
134 ly = ly + Lpos[s].y()/count_track_steps;
135 lz = lz + Lpos[s].z()/count_track_steps;
150 vector<G4double> times = aHit->
GetTime();
151 for(
int s=0; s<nsteps; s++)
if(stepTrackId[s] == trackId) time = time + times[s]/count_track_steps;
154 double Ene = aHit->
GetE();
156 out.
raws.push_back(Etot);
157 out.
raws.push_back(x);
158 out.
raws.push_back(y);
159 out.
raws.push_back(z);
160 out.
raws.push_back(lx);
161 out.
raws.push_back(ly);
162 out.
raws.push_back(lz);
163 out.
raws.push_back(time);
168 out.
raws.push_back(Ene);
186 for(
int s=0; s<nsteps; s++)
188 G4ThreeVector DOCA(0, Lpos[s].y() + ylength - WIRE_Y, Lpos[s].z());
189 if(DOCA.mag() <= doca && stepTrackId[s] == trackId )
192 if(DOCA.y() >=0 ) LR = 1;
214 sdoca = fabs(CLHEP::RandGauss::shoot(doca, 0.3));
215 double time1 = doca/drift_velocity;
216 double stime1 = sdoca/drift_velocity;
218 out.
raws.push_back(LR);
219 out.
raws.push_back(doca);
220 out.
raws.push_back(sdoca);
221 out.
raws.push_back(time1);
222 out.
raws.push_back(stime1);
224 out.
dgtz.push_back(sector);
225 out.
dgtz.push_back(SL);
226 out.
dgtz.push_back(Layer);
227 out.
dgtz.push_back(nwire);
231 <<
" PID: " << aHit->
GetPID()
232 <<
" Sector: " << sector
233 <<
" Superlayer: " << SL
234 <<
" Layer: " << Layer
235 <<
" Cell Size: " << deltay
236 <<
" nwire: " << nwire
239 <<
" sdoca: " << sdoca
240 <<
" time1: " << time1
241 <<
" stime1: " << stime1 << endl;
248 vector<identifier> yid = id;
249 double mini_stagger_shift_R2 = Opt.
args[
"DC_MSTAG_R2"].arg*mm;
250 double mini_stagger_shift_R3 = Opt.
args[
"DC_MSTAG_R3"].arg*mm;
251 double mini_stagger_shift;
255 int Layer = yid[2].id;
257 mini_stagger_shift = 0;
258 if(SL > 2 && SL <= 4)
260 mini_stagger_shift = mini_stagger_shift_R2;
261 if(Layer == 2 || Layer == 4 || Layer == 6) mini_stagger_shift *= -1;
265 mini_stagger_shift = mini_stagger_shift_R3;
266 if(Layer == 2 || Layer == 4 || Layer == 6) mini_stagger_shift *= -1;
269 G4StepPoint *prestep = aStep->GetPreStepPoint();
270 G4StepPoint *poststep = aStep->GetPostStepPoint();
271 G4VTouchable* TH = (G4VTouchable*) aStep->GetPreStepPoint()->GetTouchable();
273 string name = TH->GetVolume(0)->GetName();
274 G4ThreeVector xyz = poststep->GetPosition();
275 G4ThreeVector Lxyz = prestep->GetTouchableHandle()->GetHistory()
276 ->GetTopTransform().TransformPoint(xyz);
280 double deltay = 2.0*ylength/NWIRES;
281 double loc_y = Lxyz.y() + ylength - mini_stagger_shift;
283 int nwire = (int) floor(loc_y/deltay);
284 if(nwire <= 0 ) nwire = 1;
285 if(nwire == 113) nwire = 112;
289 if(fabs( (nwire+1)*deltay - loc_y ) < fabs( nwire*deltay - loc_y ) && nwire != 112 )
290 yid[3].
id = nwire + 1;
297 yid[3].id_sharing = 1;
PH_output ProcessHit(MHit *, gemc_opts)
Method to process the hit.
vector< double > raws
Raw information.
vector< identifier > GetId()
string HCname
Hit Collection name.
vector< identifier > identity
Identifier.
vector< G4ThreeVector > GetLPos()
vector< G4ThreeVector > GetPos()
vector< double > GetTime()
map< string, opts > args
Options map.
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
vector< double > GetEdep()
vector< int > dgtz
Digitized information.
vector< identifier > ProcessID(vector< identifier >, G4Step *, detector, gemc_opts)
Method to calculate new identifier.