12 #include "DetectorConstruction.hh"
13 #include "PhysicsList.hh"
14 #include "PrimaryGeneratorAction.hh"
15 #include "RunAction.hh"
16 #include "EventAction.hh"
35 fMfp = 1./3.641661E+01;
39 Info(
"Constructor",
"Use default Ipot %g",fIpot);
45 Info(
"Constructor",
"Use default W %g",fW);
51 Info(
"Constructor",
"Use default Fano %g",fFano);
57 Info(
"Constructor",
"Use default Mfp %g",fMfp);
67 Info(
"Constructor",
"Use default ModuleX %d",fModuleX);
73 Info(
"Constructor",
"Use default ModuleY %d",fModuleY);
79 Info(
"Constructor",
"Use default ModuleZ %d",fModuleZ);
89 Info(
"~TpcSimIonisationChamber",
"Deleting");
97 Info(
"GenerateTrack",
"start");
103 Double_t p = TMath::Sqrt(px*px+py*py+pz*pz);
105 Double_t dMax = 10000;
107 Info(
"GenerateTrack",
"%f %f %f %f %f %f %f",x,y,z,t,px,py,pz);
108 Bool_t notyet = kTRUE;
110 while((notyet || isin==1) && d<dMax){
112 if(isin==1) notyet = kFALSE;
114 Double_t l =
fMfp*gRandom->Exp(1);
115 Double_t dx = l*px/p;
116 Double_t dy = l*py/p;
117 Double_t dz = l*pz/p;
119 x += dx; y += dy; z += dz; d += l;
122 Int_t Ne =
GetNe(eloss);
129 Info(
"GenerateTrack",
"End track %d %d %f",notyet,isin,d);
139 Info(
"GenerateTrackFromText",
"start");
145 str->getline(line,256);
146 if(strstr(line,
"NEW TRACK") == NULL)
149 Float_t x0 = 0, y0 = 0, z0 = 0, t0 = 0;
150 Float_t px = 0, py = 0, pz = 0, e = 0;
151 Int_t pid = 0, trackId = 0;
152 sscanf(line,
" NEW TRACK %f %f %f %f %f %f %f %f %d %d",
157 if(
gHarpoDebug>1) Info(
"GenerateTrackFromText",
" %s",line);
169 Double_t(px), Double_t(py), Double_t(pz),
177 str->getline(line,256);
178 if(strstr(line,
"END TRACK") != NULL)
190 Float_t x = 10, y = 10, z = 10;
193 Int_t cx = -1, cy = -1, cz = -1, trk = -1;
195 Int_t test = sscanf(line,
"%f %f %f %d %d %d %d %d %f",&x, &y, &z, &Ne, &cx, &cy, &cz, &trk, &time);
197 if(test < 4)
continue;
202 if(cx != -1 && cx !=
fModuleX)
continue;
203 if(cy != -1 && cy !=
fModuleY)
continue;
204 if(cz != -1 && cz !=
fModuleZ)
continue;
210 Info(
"GenerateTrackFromText",
"%f %f %f %d",x,y,z,Ne);
218 Info(
"GenerateTrackFromText",
"End track %s",line);
233 Ne = Int_t((Eloss -
fIpot)/
fW) + 1;
235 Double_t netmp = (Eloss -
fIpot)/
fW;
237 if(netmp<=0){ Ne = 0;
break;}
238 Double_t elosstmp = gRandom->Gaus(netmp, TMath::Sqrt(
fFano*netmp));
239 if(elosstmp<0)
continue;
240 Ne = Int_t(elosstmp);
244 if(Ne>1000) Ne = 1000;
256 Double_t tmprndm = gRandom->Rndm();
261 Eloss =
fIpot*TMath::Power(tmprndm+6e-04,-5./6.);
virtual ~TpcSimIonisationChamber()
Int_t GetNe(Double_t eloss)
Int_t GetVolume(Double_t x, Double_t y, Double_t z)
void AddPoint(TpcSimIonisationPoint *point)
TpcSimIonisationTrack * GenerateTrack(TpcSimMCTrack *tr)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
TpcSimIonisationTrack * GenerateTrackFromText(std::ifstream *str)