4 #include "G4UnitsTable.hh" 5 #include "G4Poisson.hh" 6 #include "Randomize.hh" 34 double BA = sqrt(4*pow(pDy1,2) + pow(pDx2,2)) ;
41 int nsteps = aHit->
GetPos().size();
47 x = y = z = lx = ly = lz = 0;
48 vector<G4ThreeVector> pos = aHit->
GetPos();
49 vector<G4ThreeVector> Lpos = aHit->
GetLPos();
55 vector<G4double> Edep = aHit->
GetEdep();
57 for(
int s=0; s<nsteps; s++)
63 if(view==1) latt=xlocal+(pDx2/(2.*pDy1))*(ylocal+pDy1);
64 if(view==2) latt=BA*(pDy1-ylocal)/2./pDy1;
65 if(view==3) latt=BA*(ylocal+pDy1-xlocal*2*pDy1/pDx2)/4/pDy1;
66 Etot = Etot + Edep[s];
68 Etota = Etota + Edep[s]*exp(-latt/attlen);
72 Etot = Etot + Edep[s];
73 Etota = Etota + Edep[s];
78 for(
int s=0; s<nsteps; s++)
80 x = x + pos[s].x()*Edep[s]/Etot;
81 y = y + pos[s].y()*Edep[s]/Etot;
82 z = z + pos[s].z()*Edep[s]/Etot;
83 lx = lx + Lpos[s].x()*Edep[s]/Etot;
84 ly = ly + Lpos[s].y()*Edep[s]/Etot;
85 lz = lz + Lpos[s].z()*Edep[s]/Etot;
99 vector<G4double> times = aHit->
GetTime();
100 for(
int s=0; s<nsteps; s++) time = time + times[s]/nsteps;
103 double Ene = aHit->
GetE();
105 out.
raws.push_back(Etot);
106 out.
raws.push_back(x);
107 out.
raws.push_back(y);
108 out.
raws.push_back(z);
109 out.
raws.push_back(lx);
110 out.
raws.push_back(ly);
111 out.
raws.push_back(lz);
112 out.
raws.push_back(time);
117 out.
raws.push_back(Ene);
139 double ec_tdc_time_to_channel = 20.;
140 double ECfactor = 3.5;
141 int EC_TDC_MAX = 4095;
142 double ec_MeV_to_channel = 10.;
146 int EC_TDC = EC_TDC_MAX;
150 double EC_npe = G4Poisson(Etota*ECfactor);
154 double sigma = sqrt(EC_npe)/1.22;
155 double EC_MeV = G4RandGauss::shoot(EC_npe,sigma)*ec_MeV_to_channel/ECfactor;
156 if (EC_MeV <= 0) EC_MeV=0.0;
157 EC_ADC = (int) EC_MeV;
161 EC_TDC = (int) (time*ec_tdc_time_to_channel);
162 if (EC_TDC > EC_TDC_MAX) EC_TDC = EC_TDC_MAX;
164 out.
dgtz.push_back(sector);
165 out.
dgtz.push_back(stack);
166 out.
dgtz.push_back(view);
167 out.
dgtz.push_back(strip);
168 out.
dgtz.push_back(EC_ADC);
169 out.
dgtz.push_back(EC_TDC);
178 vector<identifier> yid = id;
183 int view = yid[2].id;
185 G4StepPoint *prestep = aStep->GetPreStepPoint();
186 G4StepPoint *poststep = aStep->GetPostStepPoint();
187 G4VTouchable* TH = (G4VTouchable*) aStep->GetPreStepPoint()->GetTouchable();
189 string name = TH->GetVolume(0)->GetName();
190 G4ThreeVector xyz = poststep->GetPosition();
191 G4ThreeVector Lxyz = prestep->GetTouchableHandle()->GetHistory()
192 ->GetTopTransform().TransformPoint(xyz);
194 double xlocal = Lxyz.x();
195 double ylocal = Lxyz.y();
200 string detName = Detector.
name;
230 double BA = sqrt(4*pow(pDy1,2) + pow(pDx2,2)) ;
238 strip = (int) floor((ylocal + pDy1)*NSTRIPS/(2*pDy1)) + 1;
241 else if (view == 3) {
242 double CFtop = (xlocal - pDx2)*2*pDy1 + (ylocal - pDy1)*pDx2;
243 double CF = abs(CFtop/BA);
245 double CDtop = -4*pDx2*pDy1;
246 double CD = abs(CDtop/BA);
248 strip = (int) floor(CF*NSTRIPS/CD)+1 ;
251 else if (view == 2) {
252 double BHtop = (xlocal + pDx2)*(-2*pDy1) + (ylocal - pDy1)*(pDx2);
253 double BH = abs(BHtop/BA);
255 double BGtop = 4*pDx2*pDy1;
256 double BG = abs(BGtop/BA);
258 strip = (int) floor(BH*NSTRIPS/BG)+1 ;
261 cout <<
"WARNING: No view found." << endl;
265 if (strip <=0 ) strip=1;
266 if (strip >=36) strip=36;
269 yid[3].id_sharing = 1;
vector< double > raws
Raw information.
vector< identifier > GetId()
string HCname
Hit Collection name.
vector< identifier > identity
Identifier.
vector< G4ThreeVector > GetLPos()
vector< G4ThreeVector > GetPos()
string name
Name of the volume. Since this is the key of the STL map, it has to be unique.
vector< double > GetTime()
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()
PH_output ProcessHit(MHit *, gemc_opts)
Method to process the hit.
vector< int > dgtz
Digitized information.