13 #include "G4VPhysicalVolume.hh"
16 #include "Randomize.hh"
17 #include "CLHEP/Units/GlobalSystemOfUnits.h"
34 emPDG = theParticleTable->FindParticle(parName=
"e-")->GetPDGEncoding();
35 epPDG = theParticleTable->FindParticle(parName=
"e+")->GetPDGEncoding();
36 gammaPDG = theParticleTable->FindParticle(parName=
"gamma")->GetPDGEncoding();
37 pi0PDG = theParticleTable->FindParticle(parName=
"pi0")->GetPDGEncoding();
38 etaPDG = theParticleTable->FindParticle(parName=
"eta")->GetPDGEncoding();
39 nuePDG = theParticleTable->FindParticle(parName=
"nu_e")->GetPDGEncoding();
40 numuPDG = theParticleTable->FindParticle(parName=
"nu_mu")->GetPDGEncoding();
41 nutauPDG= theParticleTable->FindParticle(parName=
"nu_tau")->GetPDGEncoding();
42 anuePDG = theParticleTable->FindParticle(parName=
"anti_nu_e")->GetPDGEncoding();
43 anumuPDG= theParticleTable->FindParticle(parName=
"anti_nu_mu")->GetPDGEncoding();
44 anutauPDG= theParticleTable->FindParticle(parName=
"anti_nu_tau")->GetPDGEncoding();
45 geantinoPDG= theParticleTable->FindParticle(parName=
"geantino")->GetPDGEncoding();
46 LogDebug(
"ZdcShower")<<
"ZdcShowerLibrary: Particle codes for e- = " <<
emPDG
52 <<
", anti_nu_mu = " <<
anumuPDG <<
", anti_nu_tau = "
58 G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
59 G4StepPoint * postStepPoint = aStep->GetPostStepPoint();
60 G4Track *
track = aStep->GetTrack();
62 const G4DynamicParticle *aParticle = track->GetDynamicParticle();
63 G4ThreeVector momDir = aParticle->GetMomentumDirection();
64 double energy = preStepPoint->GetKineticEnergy();
65 G4ThreeVector hitPoint = preStepPoint->GetPosition();
66 G4ThreeVector hitPointOrig = preStepPoint->GetPosition();
67 G4int parCode = track->GetDefinition()->GetPDGEncoding();
77 G4ThreeVector posLocal;
78 double tSlice = (postStepPoint->GetGlobalTime())/nanosecond;
85 double xxlocal, yylocal, zzlocal;
88 side = (hitPointOrig.z() > 0.) ?
true :
false;
94 for (
int i = 0;
i <
npe;
i++) {
103 zz = (hitPointOrig.z() > 0.) ? zzlocal +
Z0 : zzlocal -
Z0;
104 pos = G4ThreeVector(xx,yy,zz);
105 posLocal = G4ThreeVector(xxlocal,yylocal,zzlocal);
114 zzlocal = (hitPointOrig.z() > 0.) ?
116 zz = (hitPointOrig.z() > 0.) ? zzlocal +
Z0 : zzlocal -
Z0;
117 pos = G4ThreeVector(xx,yy,zz);
118 posLocal = G4ThreeVector(xxlocal,yylocal,zzlocal);
123 oneHit.
depth = channel;
124 oneHit.
time = tSlice;
129 hitPoint.setX(hitPointOrig.x()-
X0);
130 hitPoint.setY(hitPointOrig.y()-
Y0);
131 double setZ= (hitPointOrig.z()> 0.) ? hitPointOrig.z()-
Z0 : fabs(hitPointOrig.z()) -
Z0;
137 if (iparCode == 0 ) {
145 hits.push_back(oneHit);
149 <<
"\nZdcShowerLibrary:Generated Hit " << nHit
150 <<
" orig hit pos " << hitPointOrig
151 <<
" orig hit pos local coord" << hitPoint
152 <<
" new position " << (
hits[nHit].position)
153 <<
" Channel " <<(
hits[nHit].depth)
155 <<
" Time " <<(
hits[nHit].time)
156 <<
" DetectorID " << (
hits[nHit].detID)
157 <<
" Had Energy " << (
hits[nHit].DeHad)
158 <<
" EM Energy " << (
hits[nHit].DeEM)
174 <<
"\n ZdcShowerLibrary::getEnergyFromLibrary input/output variables:"
175 <<
" phi: "<<59.2956*momDir.phi()
176 <<
" theta: "<<59.2956*momDir.theta()
177 <<
" xin : "<<hitPoint.x()
178 <<
" yin : "<<hitPoint.y()
179 <<
" zin : "<<hitPoint.z()
180 <<
" track en: " <<energy<<
"(GeV)"
181 <<
" section: "<<section
183 <<
" channel: "<< channel
184 <<
" partID: "<<parCode;
200 float xin = hitPoint.x();
201 float yin = hitPoint.y();
204 if(section == 1 && iparCode !=0){
211 if(section == 2 && iparCode !=0){
212 if(channel == 1)fact = 0.34;
213 if(channel == 2)fact = 0.24;
214 if(channel == 3)fact = 0.17;
215 if(channel == 4)fact = 0.07;
217 if(section == 1 && iparCode ==0){
229 eav = ((((((-0.0002*xin-2.0e-13)*xin+0.0022)*xin+1.0e-11)*xin-0.0217)*xin-3.0e-10)*xin+1.0028)*
230 (((0.0001*yin + 0.0056)*yin + 0.0508)*yin + 1.0)*300.0*
pow((energy/300.0),0.99);
231 esig = ((((((0.0005*xin - 1.0e-12)*xin - 0.0052)*xin + 5.0e-11)*xin + 0.032)*xin -
232 2.0e-10)*xin + 1.0)*(((0.0006*yin + 0.0071)*yin - 0.031)*yin + 1.0)*30.0*
pow((energy/300.0),0.54);
235 eav = ((((((-0.0002*xin-2.0e-13)*xin+0.0022)*xin+1.0e-11)*xin-0.0217)*xin-3.0e-10)*xin+1.0028)*
236 (((0.0001*yin + 0.0056)*yin + 0.0508)*yin + 1.0)*300.0*
pow((energy/300.0),1.12);
237 esig = ((((((0.0005*xin - 1.0e-12)*xin - 0.0052)*xin + 5.0e-11)*xin + 0.032)*xin -
238 2.0e-10)*xin + 1.0)*(((0.0006*yin + 0.0071)*yin - 0.031)*yin + 1.0)*54.0*
pow((energy/300.0),0.93);
242 if(eav <0. || edis <0.){
244 <<
" Negative everage energy from parametrization \n"
245 <<
" xin: "<<xin<<
"(cm)"
246 <<
" yin: "<<yin<<
"(cm)"
247 <<
" track en: " <<energy<<
"(GeV)"
248 <<
" eaverage: "<<eav/GeV <<
" (GeV)"
249 <<
" esigma: "<<esig/GeV <<
" (GeV)"
250 <<
" edist: "<<edis <<
" (GeV)"
251 <<
" dE hit: "<<nphotons/GeV<<
" (GeV)";
259 while(nphotons == -1 || nphotons >
int(eav + 5.*esig))
264 <<
" track en: " <<energy<<
"(GeV)"
265 <<
" eaverage: "<<eav/GeV <<
" (GeV)"
266 <<
" esigma: "<<esig/GeV <<
" (GeV)"
267 <<
" edist: "<<edis <<
" (GeV)"
268 <<
" dE hit: "<<nphotons/GeV<<
" (GeV)";
277 if(edis == 1.0) efluct = eav+esig*CLHEP::RandGaussQ::shoot();
278 if(edis == 3.0) efluct = eav+esig*CLHEP::RandLandau::shoot();
280 if(nphot<0)nphot = 0;
286 if (parCode ==
emPDG ||
290 }
else {
return iparCode; }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< Hit > & getHits(G4Step *aStep, bool &ok)
type of data representation of DDCompactView
static const double theXChannelBoundaries[]
std::vector< ZdcShowerLibrary::Hit > hits
static const double theZHadChannelBoundaries[]
ZdcShowerLibrary(std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
static const double theZSectionBoundaries[]
int photonFluctuation(double eav, double esig, double edis)
int getEnergyFromLibrary(G4ThreeVector posHit, G4ThreeVector momDir, double energy, G4int parCode, HcalZDCDetId::Section section, bool side, int channel)
int encodePartID(G4int parCode)
void initRun(G4ParticleTable *theParticleTable)
Power< A, B >::type pow(const A &a, const B &b)