16 #include "G4VPhysicalVolume.hh" 19 #include "G4NavigationHistory.hh" 20 #include "Randomize.hh" 22 #include "CLHEP/Units/GlobalPhysicalConstants.h" 23 #include "CLHEP/Units/GlobalSystemOfUnits.h" 41 double lambdaMean = m_HF.
getParameter<
double>(
"LambdaMean");
45 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam::Use of shower library is set to " << useShowerLibrary
46 <<
" Use of Gflash is set to " << useGflash <<
" P.E. per GeV " << pePerGeV
47 <<
", ref. index of fibre " << ref_index <<
", Track EM Flag " << trackEM <<
", edMin " 48 << edMin <<
" GeV, use of Short fibre info in" 49 <<
" shower library set to " << !(
onlyLong)
50 <<
", use of parametrization for last part set to " << parametrizeLast
51 <<
", Mean lambda " << lambdaMean <<
", aperture (cutoff) " << aperture
59 <<
"ProfileFromParam";
61 hzvem = showerDir.
make<TH1F>(
"hzvem",
"Longitudinal Profile (EM Part);Number of PE", 330, 0.0, 1650.0);
62 hzvhad = showerDir.
make<TH1F>(
"hzvhad",
"Longitudinal Profile (Had Part);Number of PE", 330, 0.0, 1650.0);
64 "em_2d_1",
"Lateral Profile vs. Shower Depth;cm;Events", 800, 800.0, 1600.0, 100, 50.0, 150.0);
66 showerDir.
make<TH1F>(
"em_long_1",
"Longitudinal Profile;Radiation Length;Number of Spots", 800, 800.0, 1600.0);
68 "em_long_1_tuned",
"Longitudinal Profile;Radiation Length;Number of Spots", 800, 800.0, 1600.0);
69 em_lateral_1 = showerDir.
make<TH1F>(
"em_lateral_1",
"Lateral Profile;cm;Events", 100, 50.0, 150.0);
71 "em_2d_2",
"Lateral Profile vs. Shower Depth;cm;Events", 800, 800.0, 1600.0, 100, 50.0, 150.0);
73 showerDir.
make<TH1F>(
"em_long_2",
"Longitudinal Profile;Radiation Length;Number of Spots", 800, 800.0, 1600.0);
74 em_lateral_2 = showerDir.
make<TH1F>(
"em_lateral_2",
"Lateral Profile;cm;Events", 100, 50.0, 150.0);
76 "em_long_gflash",
"Longitudinal Profile From GFlash;cm;Number of Spots", 800, 800.0, 1600.0);
78 "em_long_sl",
"Longitudinal Profile From Shower Library;cm;Number of Spots", 800, 800.0, 1600.0);
81 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam::No file is available for saving histos so the " 82 <<
"flag is set to false";
110 auto const preStepPoint = aStep->GetPreStepPoint();
111 auto const track = aStep->GetTrack();
113 const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
115 G4ThreeVector localPoint = G4ThreeVector(hitPoint.x(), hitPoint.y(), zv);
117 double pin = (preStepPoint->GetTotalEnergy()) /
GeV;
118 double zint = hitPoint.z();
122 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: getHits " <<
track->GetDefinition()->GetParticleName()
123 <<
" of energy " << pin <<
" GeV Pos x,y,z = " << hitPoint.x() <<
"," << hitPoint.y()
124 <<
"," << zint <<
" (" << zz <<
"," << localPoint.z() <<
", " 125 << (localPoint.z() + 0.5 *
gpar[1]) <<
") Local " << localPoint;
127 std::vector<HFShowerParam::Hit>
hits;
133 double pBeta =
track->GetDynamicParticle()->GetTotalMomentum() /
track->GetDynamicParticle()->GetTotalEnergy();
134 double dirz = (
track->GetDynamicParticle()->GetMomentumDirection()).
z();
135 if (hitPoint.z() < 0)
139 <<
track->GetDynamicParticle()->GetMomentumDirection() <<
" HitPoint " << hitPoint
142 if (!isEM &&
track->GetDefinition()->GetPDGCharge() != 0 && pBeta > (1 /
ref_index) &&
143 aStep->GetTotalEnergyDeposit() > 0.) {
154 }
else if ((
track->GetDefinition()->GetPDGCharge() != 0) && (pBeta > (1 /
ref_index)) && (dirz >
aperture)) {
155 edep = (aStep->GetTotalEnergyDeposit()) /
GeV;
159 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: getHits edep = " << edep <<
" weight " << weight <<
" final " 160 << edep * weight <<
", Kill = " << isKilled <<
", pin = " << pin
161 <<
", edMin = " <<
edMin <<
" Other " <<
other;
168 for (
unsigned int i = 0;
i < hitSL.size();
i++) {
180 hit.
depth = hitSL[
i].depth;
181 hit.
time = hitSL[
i].time;
191 if (hit.
depth == 1) {
195 }
else if (hit.
depth == 2) {
204 <<
"HFShowerParam: Hit at depth " << hit.
depth <<
" with edep " << hit.
edep <<
" Time " << hit.
time;
210 for (
unsigned int i = 0;
i < hitSL.size(); ++
i) {
212 G4ThreeVector pe_effect(hitSL[
i].
position.x(), hitSL[
i].position.y(), hitSL[
i].position.z());
217 if (zv < 0. || zv >
gpar[1]) {
219 std::cout <<
"-#Zcut-HFShowerParam::getHits:z=" << zv <<
",m=" << gpar[1] << std::endl;
226 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam::getHits:#PMT= " << npmt <<
",z = " << zv;
230 edm::LogVerbatim(
"HFShower") <<
"-#PMT=0 cut-HFShowerParam::getHits: npmt = " << npmt;
233 }
else if (npmt > 24) {
238 edm::LogVerbatim(
"HFShower") <<
"-SHORT cut-HFShowerParam::getHits:zMin=" << gpar[0];
245 <<
"HFShowerParam: npmt " << npmt <<
" zv " <<
std::abs(pe_effect.z()) <<
":" << gpar[4] <<
":" << zv
246 <<
":" << gpar[0] <<
" ok " << ok <<
" depth " << depth;
249 if (G4UniformRand() > 0.5)
251 if (depth == 2 && zv < gpar[0])
256 double r1 = G4UniformRand();
258 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam:Distance to PMT (" << npmt <<
") " << dist
264 double r2 = G4UniformRand();
267 <<
"HFShowerParam:Extra exclusion " << r2 <<
">" << weight <<
" " << (r2 >
weight);
274 hit.
time = time + hitSL[
i].time;
283 if (hit.
depth == 1) {
287 }
else if (hit.
depth == 2) {
296 <<
"HFShowerParam: Hit at depth " << hit.
depth <<
" with edep " << hit.
edep <<
" Time " << hit.
time;
305 double tSlice = (aStep->GetPostStepPoint()->GetGlobalTime());
314 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: getHits hitPoint " << hitPoint <<
" flag " <<
ok;
322 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: Hit at depth 1 with edep " << edep <<
" Time " << tSlice
323 <<
":" << time <<
":" << hit.
time;
337 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: Hit at depth 2 with edep " << edep <<
" Time " << tSlice
338 <<
":" << time << hit.
time;
349 for (
unsigned int ii = 0;
ii < hits.size(); ++
ii) {
352 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: Abnormal hit along " << path <<
" in " 353 << preStepPoint->GetPhysicalVolume()->GetLogicalVolume()->GetName() <<
" at " 354 << hits[
ii].position <<
" zz " << zv <<
" Edep " << edep <<
" due to " 355 <<
track->GetDefinition()->GetParticleName() <<
" time " << hit.
time;
357 edm::LogVerbatim(
"HFShower") <<
"HFShowerParam: getHits kill (" << isKilled <<
") track " <<
track->GetTrackID()
358 <<
" at " << hitPoint <<
" and deposit " << edep <<
" " << hits.size() <<
" times" 359 <<
" ZZ " << zz <<
" " <<
gpar[0];
375 const std::vector<double>& fvec = value.
doubles();
376 int nval = fvec.size();
378 edm::LogError(
"HFShower") <<
"HFShowerParam : # of " << str <<
" bins " << nval <<
" < 2 ==> illegal";
379 throw cms::Exception(
"Unknown",
"HFShowerParam") <<
"nval < 2 for array " << str <<
"\n";
384 throw cms::Exception(
"Unknown",
"HFShowerParam") <<
"cannot get array " << str <<
"\n";
double tShift(const G4ThreeVector &point, int depth, int fromEndAbs=0)
T getParameter(std::string const &) const
HFShowerParam(const std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< Hit > gfParameterization(const G4Step *aStep, bool onlyLong=false)
std::vector< Hit > getHits(const G4Step *aStep, bool &ok, double weight, bool onlyLong=false)
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
void initRun(const HcalDDDSimConstants *)
double attLength(double lambda)
void initRun(const HcalDDDSimConstants *)
std::vector< double > gpar
double zShift(const G4ThreeVector &point, int depth, int fromEndAbs=0)
HFShowerLibrary * showerLibrary
Compact representation of the geometrical detector hierarchy.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< Hit > getHits(const G4Step *aStep, double weight, bool &isKilled)
T * make(const Args &...args) const
make new ROOT object
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
int PMTNumber(const G4ThreeVector &pe_effect)
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
static int position[264][3]
static bool isGammaElectronPositron(int pdgCode)
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Power< A, B >::type pow(const A &a, const B &b)
void initRun(G4ParticleTable *, const HcalDDDSimConstants *)