16 #include "G4SDManager.hh" 19 #include "G4VProcess.hh" 21 #include "G4Cerenkov.hh" 22 #include "G4ParticleTable.hh" 23 #include "CLHEP/Units/GlobalSystemOfUnits.h" 24 #include "CLHEP/Units/GlobalPhysicalConstants.h" 25 #include "Randomize.hh" 26 #include "G4Poisson.hh" 45 edm::LogVerbatim(
"ForwardSim") <<
"***************************************************\n" 47 <<
"* Constructing a ZdcSD with name " <<
name <<
" *\n" 49 <<
"***************************************************";
69 auto const preStepPoint = aStep->GetPreStepPoint();
71 double etrack = preStepPoint->GetKineticEnergy();
83 auto const theTrack = aStep->GetTrack();
84 edm::LogVerbatim(
"ForwardSim") <<
"----------------New track------------------------------\n" 85 <<
"Incident EnergyTrack: " << etrack <<
" MeV \n" 87 <<
"ZdcSD::getFromLibrary " <<
hits.size() <<
" hits for " << GetName() <<
" of " 88 << primaryID <<
" with " << theTrack->GetDefinition()->GetParticleName() <<
" of " 89 << etrack <<
" MeV\n";
96 for (
unsigned int i = 0;
i <
hits.size();
i++) {
100 unsigned int unitID =
hits[
i].detID;
121 double NCherPhot = 0.;
124 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
126 const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
127 const G4ThreeVector& hit_mom = preStepPoint->GetMomentumDirection();
128 G4double stepL = aStep->GetStepLength() / cm;
129 G4double
beta = preStepPoint->GetBeta();
130 G4double
charge = preStepPoint->GetCharge();
135 G4Track* theTrack = aStep->GetTrack();
136 G4ThreeVector localPoint = theTrack->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
139 const G4ThreeVector& vert_mom = theTrack->GetVertexMomentumDirection();
143 vert_mom.z() /
sqrt(vert_mom.x() * vert_mom.x() + vert_mom.y() * vert_mom.y() + vert_mom.z() * vert_mom.z());
147 if (vert_mom.x() != 0)
148 phi = std::atan2(vert_mom.y(), vert_mom.x());
153 double stepE = aStep->GetTotalEnergyDeposit();
156 G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
157 G4VPhysicalVolume* postPV = postStepPoint->GetPhysicalVolume();
158 G4VPhysicalVolume* currentPV = preStepPoint->GetPhysicalVolume();
161 G4String
particleType = theTrack->GetDefinition()->GetParticleName();
163 <<
" preStepPoint: " << nameVolume <<
"," << stepL <<
"," << stepE <<
"," <<
beta 165 <<
" postStepPoint: " << postnameVolume <<
"," << costheta <<
"," <<
theta <<
"," 167 <<
" Etot(GeV)= " << theTrack->GetTotalEnergy() / GeV;
169 const double bThreshold = 0.67;
170 if (
beta > bThreshold) {
174 const float nMedium = 1.4925;
178 const float photEnSpectrDE = 1.24;
184 const float effPMTandTransport = 0.15;
187 const float thFullRefl = 23.;
188 float thFullReflRad = thFullRefl *
pi / 180.;
196 float costh = hit_mom.z() /
sqrt(hit_mom.x() * hit_mom.x() + hit_mom.y() * hit_mom.y() + hit_mom.z() * hit_mom.z());
203 float costhcher = 1. / (nMedium *
beta);
207 float DelFibPart =
std::abs(th - thFibDirRad);
221 if (DelFibPart > (thFullReflRad + thcher)) {
228 if ((th + thcher) < (thFibDirRad + thFullReflRad) && (th - thcher) > (thFibDirRad - thFullReflRad)) {
235 if ((thFibDirRad + thFullReflRad) < (th + thcher) && (thFibDirRad - thFullReflRad) > (th - thcher)) {
245 float arg_arcos = 0.;
246 float tan_arcos = 2. *
a *
d;
248 arg_arcos = (
r *
r -
a *
a -
d *
d) / tan_arcos;
251 d_qz = th_arcos / twopi;
254 edm::LogVerbatim(
"ForwardSim") <<
" d_qz: " <<
r <<
"," <<
a <<
"," <<
d <<
" " << tan_arcos <<
" " 264 double meanNCherPhot = 0.;
265 int poissNCherPhot = 0;
267 meanNCherPhot = 370. *
charge *
charge * (1. - 1. / (nMedium * nMedium *
beta *
beta)) * photEnSpectrDE * stepL;
269 poissNCherPhot =
std::max((
int)G4Poisson(meanNCherPhot), 0);
270 NCherPhot = poissNCherPhot * effPMTandTransport * d_qz;
274 edm::LogVerbatim(
"ForwardSim") <<
"ZdcSD:: getEnergyDeposit: gED: " << stepE <<
"," << costh <<
"," << th <<
"," 275 << costhcher <<
"," << thcher <<
"," << DelFibPart <<
"," <<
d <<
"," <<
a <<
"," 276 <<
r <<
"," << hitPoint <<
"," << hit_mom <<
"," << vert_mom <<
"," << localPoint
277 <<
"," <<
charge <<
"," <<
beta <<
"," << stepL <<
"," << d_qz <<
"," << variant
278 <<
"," << meanNCherPhot <<
"," << poissNCherPhot <<
"," << NCherPhot;
296 if (
beta <= bThreshold)
301 if (!(nameVolume ==
"ZDC_EMFiber" || nameVolume ==
"ZDC_HadFiber"))
302 edm::LogVerbatim(
"ForwardSim") <<
"ZdcSD:: getEnergyDeposit: fail nv=" << nameVolume;
315 edm::LogVerbatim(
"ForwardSim") <<
"ZdcSD: updates numbering scheme for " << GetName();
void setNumberingScheme(ZdcNumberingScheme *scheme)
Log< level::Info, true > LogVerbatim
std::unique_ptr< ZdcNumberingScheme > numberingScheme
T getParameter(std::string const &) const
math::XYZPoint getEntryLocal() const
std::vector< ZdcShowerLibrary::Hit > hits
void processHit(const G4Step *step)
void resetForNewPrimary(const G4Step *)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
ZdcSD(const std::string &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
uint32_t getUnitID() const
std::unique_ptr< ZdcShowerLibrary > showerLibrary
virtual int setTrackID(const G4Step *)
std::string getName(const G4String &)
double getIncidentEnergy() const
bool getFromLibrary(const G4Step *) override
Geom::Theta< T > theta() const
uint32_t setDetUnitId(const G4Step *step) override
G4ThreeVector entrancePoint
G4ThreeVector entranceLocal
double getEnergyDeposit(const G4Step *) override
void setParameterized(bool val)