CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
ZdcShowerLibrary Class Reference

#include <ZdcShowerLibrary.h>

Classes

struct  Hit
 

Public Member Functions

int getEnergyFromLibrary (const G4ThreeVector &posHit, const G4ThreeVector &momDir, double energy, G4int parCode, HcalZDCDetId::Section section, bool side, int channel)
 
std::vector< Hit > & getHits (const G4Step *aStep, bool &ok)
 
int photonFluctuation (double eav, double esig, double edis)
 
 ZdcShowerLibrary (const std::string &name, edm::ParameterSet const &p)
 
 ~ZdcShowerLibrary ()
 

Private Attributes

std::vector< ZdcShowerLibrary::Hithits
 
int npe
 
bool verbose
 

Detailed Description

Definition at line 21 of file ZdcShowerLibrary.h.

Constructor & Destructor Documentation

◆ ZdcShowerLibrary()

ZdcShowerLibrary::ZdcShowerLibrary ( const std::string &  name,
edm::ParameterSet const &  p 
)

Definition at line 20 of file ZdcShowerLibrary.cc.

20  {
21  edm::ParameterSet m_HS = p.getParameter<edm::ParameterSet>("ZdcShowerLibrary");
22  verbose = m_HS.getUntrackedParameter<int>("Verbosity", 0);
23 
24  npe = 9; // number of channels or fibers where the energy will be deposited
25  hits.reserve(npe);
26 }

References edm::ParameterSet::getUntrackedParameter(), hits, npe, AlCaHLTBitMon_ParallelJobs::p, and verbose.

◆ ~ZdcShowerLibrary()

ZdcShowerLibrary::~ZdcShowerLibrary ( )

Definition at line 28 of file ZdcShowerLibrary.cc.

28 {}

Member Function Documentation

◆ getEnergyFromLibrary()

int ZdcShowerLibrary::getEnergyFromLibrary ( const G4ThreeVector &  posHit,
const G4ThreeVector &  momDir,
double  energy,
G4int  parCode,
HcalZDCDetId::Section  section,
bool  side,
int  channel 
)

Definition at line 130 of file ZdcShowerLibrary.cc.

136  {
137  int nphotons = -1;
138 
139  energy = energy / GeV;
140 
141  LogDebug("ZdcShower") << "\n ZdcShowerLibrary::getEnergyFromLibrary input/output variables:"
142  << " phi: " << 59.2956 * momDir.phi() << " theta: " << 59.2956 * momDir.theta()
143  << " xin : " << hitPoint.x() << " yin : " << hitPoint.y() << " zin : " << hitPoint.z()
144  << " track en: " << energy << "(GeV)"
145  << " section: " << section << " side: " << side << " channel: " << channel
146  << " partID: " << parCode;
147 
148  double eav = 0.;
149  double esig = 0.;
150  double edis = 0.;
151 
152  float xin = hitPoint.x();
153  float yin = hitPoint.y();
154  float fact = 0.;
155 
157 
158  if (section == 1 && !isEM) {
159  if (channel < 5)
160  if (((theXChannelBoundaries[channel - 1]) < (xin + X0)) && ((xin + X0) <= theXChannelBoundaries[channel]))
161  fact = 0.18;
162  if (channel == 5)
163  if (theXChannelBoundaries[channel - 1] < xin + X0)
164  fact = 0.18;
165  }
166 
167  if (section == 2 && !isEM) {
168  if (channel == 1)
169  fact = 0.34;
170  if (channel == 2)
171  fact = 0.24;
172  if (channel == 3)
173  fact = 0.17;
174  if (channel == 4)
175  fact = 0.07;
176  }
177  if (section == 1 && isEM) {
178  if (channel < 5)
179  if (((theXChannelBoundaries[channel - 1]) < (xin + X0)) && ((xin + X0) <= theXChannelBoundaries[channel]))
180  fact = 1.;
181  if (channel == 5)
182  if (theXChannelBoundaries[channel - 1] < xin + X0)
183  fact = 1.0;
184  }
185 
186  //change to cm for parametrization
187  yin = yin / cm;
188  xin = xin / cm;
189 
190  if (isEM) {
191  eav = ((((((-0.0002 * xin - 2.0e-13) * xin + 0.0022) * xin + 1.0e-11) * xin - 0.0217) * xin - 3.0e-10) * xin +
192  1.0028) *
193  (((0.0001 * yin + 0.0056) * yin + 0.0508) * yin + 1.0) * 300.0 * pow((energy / 300.0), 0.99); // EM
194  esig = ((((((0.0005 * xin - 1.0e-12) * xin - 0.0052) * xin + 5.0e-11) * xin + 0.032) * xin - 2.0e-10) * xin + 1.0) *
195  (((0.0006 * yin + 0.0071) * yin - 0.031) * yin + 1.0) * 30.0 * pow((energy / 300.0), 0.54); // EM
196  edis = 1.0;
197  } else {
198  eav = ((((((-0.0002 * xin - 2.0e-13) * xin + 0.0022) * xin + 1.0e-11) * xin - 0.0217) * xin - 3.0e-10) * xin +
199  1.0028) *
200  (((0.0001 * yin + 0.0056) * yin + 0.0508) * yin + 1.0) * 300.0 * pow((energy / 300.0), 1.12); // HD
201  esig = ((((((0.0005 * xin - 1.0e-12) * xin - 0.0052) * xin + 5.0e-11) * xin + 0.032) * xin - 2.0e-10) * xin + 1.0) *
202  (((0.0006 * yin + 0.0071) * yin - 0.031) * yin + 1.0) * 54.0 * pow((energy / 300.0), 0.93); //HD
203  edis = 3.0;
204  }
205 
206  if (eav < 0. || esig < 0.) {
207  LogDebug("ZdcShower") << " Negative everage energy or esigma from parametrization \n"
208  << " xin: " << xin << "(cm)"
209  << " yin: " << yin << "(cm)"
210  << " track en: " << energy << "(GeV)"
211  << " eaverage: " << eav << " (GeV)"
212  << " esigma: " << esig << " (GeV)"
213  << " edist: " << edis << " (GeV)";
214  return 0;
215  }
216 
217  // Convert from GeV to MeV for the code
218  eav = eav * GeV;
219  esig = esig * GeV;
220 
221  while (nphotons == -1 || nphotons > int(eav + 5. * esig))
222  nphotons = (int)(fact * photonFluctuation(eav, esig, edis));
223 
224  LogDebug("ZdcShower")
225  //std::cout
226  << " track en: " << energy << "(GeV)"
227  << " eaverage: " << eav / GeV << " (GeV)"
228  << " esigma: " << esig / GeV << " (GeV)"
229  << " edist: " << edis << " (GeV)"
230  << " dE hit: " << nphotons / GeV << " (GeV)";
231 
232  return nphotons;
233 }

References HCALHighEnergyHPDFilter_cfi::energy, fact, GeV, createfilelist::int, G4TrackToParticleID::isGammaElectronPositron(), LogDebug, HMesonGammaMonitor_cff::nphotons, photonFluctuation(), funct::pow(), hgcalPlots::section, theXChannelBoundaries, and MonitorAlCaEcalPi0_cfi::X0.

Referenced by getHits().

◆ getHits()

std::vector< ZdcShowerLibrary::Hit > & ZdcShowerLibrary::getHits ( const G4Step *  aStep,
bool &  ok 
)

Definition at line 30 of file ZdcShowerLibrary.cc.

30  {
31  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
32  const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
33  const G4Track* track = aStep->GetTrack();
34 
35  const G4DynamicParticle* aParticle = track->GetDynamicParticle();
36  const G4ThreeVector& momDir = aParticle->GetMomentumDirection();
37  double energy = preStepPoint->GetKineticEnergy();
38  G4ThreeVector hitPoint = preStepPoint->GetPosition();
39  const G4ThreeVector& hitPointOrig = preStepPoint->GetPosition();
40  G4int parCode = track->GetDefinition()->GetPDGEncoding();
41 
42  hits.clear();
43 
44  ok = false;
47  if (!isEM && !isHad)
48  return hits;
49  ok = true;
50 
51  G4ThreeVector pos;
52  G4ThreeVector posLocal;
53  double tSlice = (postStepPoint->GetGlobalTime()) / nanosecond;
54 
55  int nHit = 0;
57  bool side = false;
58  int channel = 0;
59  double xx, yy, zz;
60  double xxlocal, yylocal, zzlocal;
61 
62  ZdcShowerLibrary::Hit oneHit;
63  side = (hitPointOrig.z() > 0.) ? true : false;
64 
65  float xWidthEM = std::abs(theXChannelBoundaries[0] - theXChannelBoundaries[1]);
66  float zWidthEM = std::abs(theZSectionBoundaries[0] - theZSectionBoundaries[1]);
68 
69  for (int i = 0; i < npe; i++) {
70  if (i < 5) {
72  channel = i + 1;
73  xxlocal = theXChannelBoundaries[i] + (xWidthEM / 2.);
74  xx = xxlocal + X0;
75  yy = 0.0;
76  yylocal = yy + Y0;
77  zzlocal = theZSectionBoundaries[0] + (zWidthEM / 2.);
78  zz = (hitPointOrig.z() > 0.) ? zzlocal + Z0 : zzlocal - Z0;
79  pos = G4ThreeVector(xx, yy, zz);
80  posLocal = G4ThreeVector(xxlocal, yylocal, zzlocal);
81  }
82  if (i > 4) {
84  channel = i - 4;
85  xxlocal = 0.0;
86  xx = xxlocal + X0;
87  yylocal = 0;
88  yy = yylocal + Y0;
89  zzlocal = (hitPointOrig.z() > 0.) ? theZHadChannelBoundaries[i - 5] + (zWidthHAD / 2.)
90  : theZHadChannelBoundaries[i - 5] - (zWidthHAD / 2.);
91  zz = (hitPointOrig.z() > 0.) ? zzlocal + Z0 : zzlocal - Z0;
92  pos = G4ThreeVector(xx, yy, zz);
93  posLocal = G4ThreeVector(xxlocal, yylocal, zzlocal);
94  }
95 
96  oneHit.position = pos;
97  oneHit.entryLocal = posLocal;
98  oneHit.depth = channel;
99  oneHit.time = tSlice;
100  oneHit.detID = HcalZDCDetId(section, side, channel);
101 
102  // Note: coodinates of hit are relative to center of detector (X0,Y0,Z0)
103  hitPoint.setX(hitPointOrig.x() - X0);
104  hitPoint.setY(hitPointOrig.y() - Y0);
105  double setZ = (hitPointOrig.z() > 0.) ? hitPointOrig.z() - Z0 : fabs(hitPointOrig.z()) - Z0;
106  hitPoint.setZ(setZ);
107 
108  int dE = getEnergyFromLibrary(hitPoint, momDir, energy, parCode, section, side, channel);
109 
110  if (isEM) {
111  oneHit.DeEM = dE;
112  oneHit.DeHad = 0.;
113  } else {
114  oneHit.DeEM = 0;
115  oneHit.DeHad = dE;
116  }
117 
118  hits.push_back(oneHit);
119 
120  LogDebug("ZdcShower") << "\nZdcShowerLibrary:Generated Hit " << nHit << " orig hit pos " << hitPointOrig
121  << " orig hit pos local coord" << hitPoint << " new position " << (hits[nHit].position)
122  << " Channel " << (hits[nHit].depth) << " side " << side << " Time " << (hits[nHit].time)
123  << " DetectorID " << (hits[nHit].detID) << " Had Energy " << (hits[nHit].DeHad)
124  << " EM Energy " << (hits[nHit].DeEM) << "\n";
125  nHit++;
126  }
127  return hits;
128 }

References funct::abs(), ZdcShowerLibrary::Hit::DeEM, ZdcShowerLibrary::Hit::DeHad, ZdcShowerLibrary::Hit::depth, LEDCalibrationChannels::depth, ZdcShowerLibrary::Hit::detID, HcalZDCDetId::EM, HCALHighEnergyHPDFilter_cfi::energy, ZdcShowerLibrary::Hit::entryLocal, getEnergyFromLibrary(), HcalZDCDetId::HAD, hits, mps_fire::i, G4TrackToParticleID::isGammaElectronPositron(), G4TrackToParticleID::isStableHadronIon(), LogDebug, npe, convertSQLiteXML::ok, ZdcShowerLibrary::Hit::position, hgcalPlots::section, theXChannelBoundaries, theZHadChannelBoundaries, theZSectionBoundaries, ZdcShowerLibrary::Hit::time, HLT_FULL_cff::track, funct::true, MonitorAlCaEcalPi0_cfi::X0, geometryCSVtoXML::xx, Y0, geometryCSVtoXML::yy, Z0, and geometryCSVtoXML::zz.

◆ photonFluctuation()

int ZdcShowerLibrary::photonFluctuation ( double  eav,
double  esig,
double  edis 
)

Definition at line 235 of file ZdcShowerLibrary.cc.

235  {
236  int nphot = 0;
237  double efluct = 0.;
238  if (edis == 1.0)
239  efluct = eav + esig * CLHEP::RandGaussQ::shoot();
240  if (edis == 3.0)
241  efluct = eav + esig * CLHEP::RandLandau::shoot();
242  nphot = int(efluct);
243  if (nphot < 0)
244  nphot = 0;
245  return nphot;
246 }

References createfilelist::int.

Referenced by getEnergyFromLibrary().

Member Data Documentation

◆ hits

std::vector<ZdcShowerLibrary::Hit> ZdcShowerLibrary::hits
private

Definition at line 53 of file ZdcShowerLibrary.h.

Referenced by getHits(), and ZdcShowerLibrary().

◆ npe

int ZdcShowerLibrary::npe
private

Definition at line 52 of file ZdcShowerLibrary.h.

Referenced by getHits(), and ZdcShowerLibrary().

◆ verbose

bool ZdcShowerLibrary::verbose
private

Definition at line 50 of file ZdcShowerLibrary.h.

Referenced by ZdcShowerLibrary().

mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
HcalZDCDetId::HAD
Definition: HcalZDCDetId.h:23
HcalZDCDetId::Section
Section
Definition: HcalZDCDetId.h:23
ZdcShowerLibrary::hits
std::vector< ZdcShowerLibrary::Hit > hits
Definition: ZdcShowerLibrary.h:53
ZdcShowerLibrary::Hit::DeHad
double DeHad
Definition: ZdcShowerLibrary.h:35
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
ZdcShowerLibrary::verbose
bool verbose
Definition: ZdcShowerLibrary.h:50
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ZdcShowerLibrary::npe
int npe
Definition: ZdcShowerLibrary.h:52
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
G4TrackToParticleID::isGammaElectronPositron
static bool isGammaElectronPositron(int pdgCode)
Definition: G4TrackToParticleID.cc:17
HMesonGammaMonitor_cff.nphotons
nphotons
Definition: HMesonGammaMonitor_cff.py:12
HcalZDCDetId
Definition: HcalZDCDetId.h:16
theXChannelBoundaries
static const double theXChannelBoundaries[]
Definition: CastorGeometryData.h:41
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
theZSectionBoundaries
static const double theZSectionBoundaries[]
Definition: CastorGeometryData.h:40
theZHadChannelBoundaries
static const double theZHadChannelBoundaries[]
Definition: CastorGeometryData.h:42
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
ZdcShowerLibrary::Hit::depth
int depth
Definition: ZdcShowerLibrary.h:32
funct::true
true
Definition: Factorize.h:173
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
ZdcShowerLibrary::Hit::detID
int detID
Definition: ZdcShowerLibrary.h:34
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
ZdcShowerLibrary::Hit
Definition: ZdcShowerLibrary.h:28
GeV
const double GeV
Definition: MathUtil.h:16
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
createfilelist.int
int
Definition: createfilelist.py:10
MonitorAlCaEcalPi0_cfi.X0
X0
Definition: MonitorAlCaEcalPi0_cfi.py:77
ZdcShowerLibrary::Hit::DeEM
double DeEM
Definition: ZdcShowerLibrary.h:36
Y0
static const double Y0
Definition: CastorGeometryData.h:33
G4TrackToParticleID::isStableHadronIon
static bool isStableHadronIon(const G4Track *)
Definition: G4TrackToParticleID.cc:40
hgcalPlots.section
section
Definition: hgcalPlots.py:2670
ZdcShowerLibrary::Hit::time
double time
Definition: ZdcShowerLibrary.h:33
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ZdcShowerLibrary::Hit::position
G4ThreeVector position
Definition: ZdcShowerLibrary.h:31
HcalZDCDetId::EM
Definition: HcalZDCDetId.h:23
ZdcShowerLibrary::getEnergyFromLibrary
int getEnergyFromLibrary(const G4ThreeVector &posHit, const G4ThreeVector &momDir, double energy, G4int parCode, HcalZDCDetId::Section section, bool side, int channel)
Definition: ZdcShowerLibrary.cc:130
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
Z0
static const double Z0
Definition: CastorGeometryData.h:32
ZdcShowerLibrary::photonFluctuation
int photonFluctuation(double eav, double esig, double edis)
Definition: ZdcShowerLibrary.cc:235
ZdcShowerLibrary::Hit::entryLocal
G4ThreeVector entryLocal
Definition: ZdcShowerLibrary.h:30