14 #include "G4VPhysicalVolume.hh" 17 #include "Randomize.hh" 18 #include "CLHEP/Units/GlobalSystemOfUnits.h" 34 const G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
35 const G4StepPoint * postStepPoint = aStep->GetPostStepPoint();
36 const G4Track *
track = aStep->GetTrack();
38 const G4DynamicParticle *aParticle = track->GetDynamicParticle();
39 const G4ThreeVector& momDir = aParticle->GetMomentumDirection();
40 double energy = preStepPoint->GetKineticEnergy();
41 G4ThreeVector hitPoint = preStepPoint->GetPosition();
42 const G4ThreeVector& hitPointOrig = preStepPoint->GetPosition();
43 G4int parCode = track->GetDefinition()->GetPDGEncoding();
55 G4ThreeVector posLocal;
56 double tSlice = (postStepPoint->GetGlobalTime())/nanosecond;
63 double xxlocal, yylocal, zzlocal;
66 side = (hitPointOrig.z() > 0.) ?
true :
false;
72 for (
int i = 0;
i <
npe;
i++) {
81 zz = (hitPointOrig.z() > 0.) ? zzlocal +
Z0 : zzlocal -
Z0;
82 pos = G4ThreeVector(xx,yy,zz);
83 posLocal = G4ThreeVector(xxlocal,yylocal,zzlocal);
92 zzlocal = (hitPointOrig.z() > 0.) ?
94 zz = (hitPointOrig.z() > 0.) ? zzlocal +
Z0 : zzlocal -
Z0;
95 pos = G4ThreeVector(xx,yy,zz);
96 posLocal = G4ThreeVector(xxlocal,yylocal,zzlocal);
101 oneHit.
depth = channel;
102 oneHit.
time = tSlice;
107 hitPoint.setX(hitPointOrig.x()-
X0);
108 hitPoint.setY(hitPointOrig.y()-
Y0);
109 double setZ= (hitPointOrig.z()> 0.) ? hitPointOrig.z()-
Z0 : fabs(hitPointOrig.z()) -
Z0;
122 hits.push_back(oneHit);
125 <<
"\nZdcShowerLibrary:Generated Hit " << nHit
126 <<
" orig hit pos " << hitPointOrig
127 <<
" orig hit pos local coord" << hitPoint
128 <<
" new position " << (
hits[nHit].position)
131 <<
" Time " <<(
hits[nHit].time)
132 <<
" DetectorID " << (
hits[nHit].detID)
133 <<
" Had Energy " << (
hits[nHit].DeHad)
134 <<
" EM Energy " << (
hits[nHit].DeEM)
149 <<
"\n ZdcShowerLibrary::getEnergyFromLibrary input/output variables:" 150 <<
" phi: "<<59.2956*momDir.phi()
151 <<
" theta: "<<59.2956*momDir.theta()
152 <<
" xin : "<<hitPoint.x()
153 <<
" yin : "<<hitPoint.y()
154 <<
" zin : "<<hitPoint.z()
155 <<
" track en: " <<energy<<
"(GeV)" 156 <<
" section: "<<section
158 <<
" channel: "<< channel
159 <<
" partID: "<<parCode;
165 float xin = hitPoint.x();
166 float yin = hitPoint.y();
171 if(section == 1 && !isEM){
178 if(section == 2 && !isEM){
179 if(channel == 1)fact = 0.34;
180 if(channel == 2)fact = 0.24;
181 if(channel == 3)fact = 0.17;
182 if(channel == 4)fact = 0.07;
184 if(section == 1 && isEM){
196 eav = ((((((-0.0002*xin-2.0e-13)*xin+0.0022)*xin+1.0e-11)*xin-0.0217)*xin-3.0e-10)*xin+1.0028)*
197 (((0.0001*yin + 0.0056)*yin + 0.0508)*yin + 1.0)*300.0*
pow((energy/300.0),0.99);
198 esig = ((((((0.0005*xin - 1.0e-12)*xin - 0.0052)*xin + 5.0e-11)*xin + 0.032)*xin -
199 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);
202 eav = ((((((-0.0002*xin-2.0e-13)*xin+0.0022)*xin+1.0e-11)*xin-0.0217)*xin-3.0e-10)*xin+1.0028)*
203 (((0.0001*yin + 0.0056)*yin + 0.0508)*yin + 1.0)*300.0*
pow((energy/300.0),1.12);
204 esig = ((((((0.0005*xin - 1.0e-12)*xin - 0.0052)*xin + 5.0e-11)*xin + 0.032)*xin -
205 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);
209 if(eav <0. || edis <0.){
211 <<
" Negative everage energy from parametrization \n" 212 <<
" xin: "<<xin<<
"(cm)" 213 <<
" yin: "<<yin<<
"(cm)" 214 <<
" track en: " <<energy<<
"(GeV)" 215 <<
" eaverage: "<<eav/
GeV <<
" (GeV)" 216 <<
" esigma: "<<esig/
GeV <<
" (GeV)" 217 <<
" edist: "<<edis <<
" (GeV)" 218 <<
" dE hit: "<<nphotons/
GeV<<
" (GeV)";
226 while(nphotons == -1 || nphotons >
int(eav + 5.*esig))
231 <<
" track en: " <<energy<<
"(GeV)" 232 <<
" eaverage: "<<eav/GeV <<
" (GeV)" 233 <<
" esigma: "<<esig/GeV <<
" (GeV)" 234 <<
" edist: "<<edis <<
" (GeV)" 235 <<
" dE hit: "<<nphotons/GeV<<
" (GeV)";
243 if(edis == 1.0) efluct = eav+esig*CLHEP::RandGaussQ::shoot();
244 if(edis == 3.0) efluct = eav+esig*CLHEP::RandLandau::shoot();
246 if(nphot<0)nphot = 0;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
Compact representation of the geometrical detector hierarchy.
int getEnergyFromLibrary(const G4ThreeVector &posHit, const G4ThreeVector &momDir, double energy, G4int parCode, HcalZDCDetId::Section section, bool side, int channel)
static const double theXChannelBoundaries[]
std::vector< ZdcShowerLibrary::Hit > hits
static const double theZHadChannelBoundaries[]
Abs< T >::type abs(const T &t)
static const double theZSectionBoundaries[]
static bool isStableHadronIon(const G4Track *)
int photonFluctuation(double eav, double esig, double edis)
static bool isGammaElectronPositron(int pdgCode)
std::vector< Hit > & getHits(const G4Step *aStep, bool &ok)
ZdcShowerLibrary(const std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
Power< A, B >::type pow(const A &a, const B &b)