CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ZdcTestAnalysis Class Reference
Inheritance diagram for ZdcTestAnalysis:
SimWatcher Observer< const BeginOfJob *> Observer< const BeginOfRun *> Observer< const EndOfRun *> Observer< const BeginOfEvent *> Observer< const EndOfEvent *> Observer< const G4Step *>

Public Member Functions

 ZdcTestAnalysis (const edm::ParameterSet &p)
 
 ~ZdcTestAnalysis () override
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfJob *>
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfRun *>
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfRun *>
 Observer ()
 
void slotForUpdate (const EndOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent *>
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent *>
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step *>
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 

Private Member Functions

void finish ()
 
void update (const BeginOfJob *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *step) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

int doNTzdcevent
 
int doNTzdcstep
 
int eventIndex
 
std::string eventNtFileName
 
int stepIndex
 
std::string stepNtFileName
 
ZdcNumberingSchemetheZdcNumScheme
 
int verbosity
 
Float_t zdceventarray [16]
 
TNtuple * zdceventntuple
 
TFile * zdcOutputEventFile
 
TFile * zdcOutputStepFile
 
Float_t zdcsteparray [18]
 
TNtuple * zdcstepntuple
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 57 of file ZdcTestAnalysis.cc.

Constructor & Destructor Documentation

◆ ZdcTestAnalysis()

ZdcTestAnalysis::ZdcTestAnalysis ( const edm::ParameterSet p)

Definition at line 140 of file ZdcTestAnalysis.cc.

References doNTzdcevent, doNTzdcstep, eventNtFileName, edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, stepNtFileName, AlCaHLTBitMon_QueryRunRegistry::string, theZdcNumScheme, verbosity, zdceventntuple, and zdcstepntuple.

140  {
141  //constructor
142  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("ZdcTestAnalysis");
143  verbosity = m_Anal.getParameter<int>("Verbosity");
144  doNTzdcstep = m_Anal.getParameter<int>("StepNtupleFlag");
145  doNTzdcevent = m_Anal.getParameter<int>("EventNtupleFlag");
146  stepNtFileName = m_Anal.getParameter<std::string>("StepNtupleFileName");
147  eventNtFileName = m_Anal.getParameter<std::string>("EventNtupleFileName");
148 
149  if (verbosity > 0)
150  edm::LogVerbatim("ZdcAnalysis") << "\n============================================================================";
151  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis:: Initialized as observer";
152  if (doNTzdcstep > 0) {
153  edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple will be created";
154  edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple file: " << stepNtFileName;
155  }
156  if (doNTzdcevent > 0) {
157  edm::LogVerbatim("ZdcAnalysis") << " Event Ntuple will be created";
158  edm::LogVerbatim("ZdcAnalysis") << " Step Ntuple file: " << stepNtFileName;
159  }
160  edm::LogVerbatim("ZdcAnalysis") << "============================================================================"
161  << std::endl;
162 
163  if (doNTzdcstep > 0)
164  zdcstepntuple =
165  new TNtuple("NTzdcstep",
166  "NTzdcstep",
167  "evt:trackid:charge:pdgcode:x:y:z:stepl:stepe:eta:phi:vpx:vpy:vpz:idx:idl:pvtype:ncherphot");
168 
169  if (doNTzdcevent > 0)
171  new TNtuple("NTzdcevent",
172  "NTzdcevent",
173  "evt:ihit:fiberid:zside:subdet:layer:fiber:channel:enem:enhad:hitenergy:x:y:z:time:etot");
174 
175  theZdcNumScheme = nullptr;
176  //theZdcSD = new ZdcSD("ZDCHITSB", new ZdcNumberingScheme());
177 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string stepNtFileName
TNtuple * zdceventntuple
ZdcNumberingScheme * theZdcNumScheme
TNtuple * zdcstepntuple
std::string eventNtFileName

◆ ~ZdcTestAnalysis()

ZdcTestAnalysis::~ZdcTestAnalysis ( )
override

Definition at line 179 of file ZdcTestAnalysis.cc.

References finish(), and theZdcNumScheme.

179  {
180  // destructor
181  finish();
182  delete theZdcNumScheme;
183 }
ZdcNumberingScheme * theZdcNumScheme

Member Function Documentation

◆ finish()

void ZdcTestAnalysis::finish ( )
private

Definition at line 485 of file ZdcTestAnalysis.cc.

References doNTzdcevent, doNTzdcstep, eventIndex, zdceventntuple, zdcOutputEventFile, zdcOutputStepFile, and zdcstepntuple.

Referenced by progressbar.ProgressBar::__next__(), and ~ZdcTestAnalysis().

485  {
486  if (doNTzdcstep) {
487  zdcOutputStepFile->cd();
488  zdcstepntuple->Write();
489  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple step written for event: " << eventIndex;
490  zdcOutputStepFile->Close();
491  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Step file closed";
492  }
493 
494  if (doNTzdcevent) {
495  zdcOutputEventFile->cd();
496  zdceventntuple->Write("", TObject::kOverwrite);
497  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple event written for event: " << eventIndex;
498  zdcOutputEventFile->Close();
499  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Event file closed";
500  }
501 }
Log< level::Info, true > LogVerbatim
TFile * zdcOutputEventFile
TFile * zdcOutputStepFile
TNtuple * zdceventntuple
TNtuple * zdcstepntuple

◆ update() [1/6]

void ZdcTestAnalysis::update ( const BeginOfJob )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob *>.

Definition at line 185 of file ZdcTestAnalysis.cc.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

185  {
186  //job
187  edm::LogVerbatim("ZdcAnalysis") << "beggining of job";
188 }
Log< level::Info, true > LogVerbatim

◆ update() [2/6]

void ZdcTestAnalysis::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 191 of file ZdcTestAnalysis.cc.

References doNTzdcevent, doNTzdcstep, eventIndex, eventNtFileName, stepNtFileName, zdcOutputEventFile, and zdcOutputStepFile.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

191  {
192  //run
193 
194  edm::LogVerbatim("ZdcAnalysis") << "\nZdcTestAnalysis: Begining of Run";
195  if (doNTzdcstep) {
196  edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output step file created";
197  TString stepfilename = stepNtFileName;
198  zdcOutputStepFile = new TFile(stepfilename, "RECREATE");
199  }
200 
201  if (doNTzdcevent) {
202  edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output event file created";
203  TString stepfilename = eventNtFileName;
204  zdcOutputEventFile = new TFile(stepfilename, "RECREATE");
205  }
206 
207  eventIndex = 0;
208 }
Log< level::Info, true > LogVerbatim
TFile * zdcOutputEventFile
std::string stepNtFileName
TFile * zdcOutputStepFile
std::string eventNtFileName

◆ update() [3/6]

void ZdcTestAnalysis::update ( const EndOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfRun *>.

Definition at line 483 of file ZdcTestAnalysis.cc.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

483 {}

◆ update() [4/6]

void ZdcTestAnalysis::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 210 of file ZdcTestAnalysis.cc.

References eventIndex, and stepIndex.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

210  {
211  //event
212  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest: Processing Event Number: " << eventIndex;
213  eventIndex++;
214  stepIndex = 0;
215 }
Log< level::Info, true > LogVerbatim

◆ update() [5/6]

void ZdcTestAnalysis::update ( const EndOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent *>.

Definition at line 338 of file ZdcTestAnalysis.cc.

References TauDecayModes::dec, doNTzdcevent, eventIndex, dqmMemoryStats::float, CaloG4Hit::getEM(), CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getHadr(), CaloG4Hit::getPosition(), CaloG4Hit::getTimeSliceID(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), mps_fire::i, createfilelist::int, HLT_2022v15_cff::maxTime, npart, ntzdce_channel, ntzdce_enem, ntzdce_enhad, ntzdce_etot, ntzdce_evt, ntzdce_fiber, ntzdce_fiberid, ntzdce_hitenergy, ntzdce_ihit, ntzdce_layer, ntzdce_subdet, ntzdce_time, ntzdce_x, ntzdce_y, ntzdce_z, ntzdce_zside, funct::pow(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mathSSE::sqrt(), stepIndex, theZdcNumScheme, protons_cff::time, ZdcNumberingScheme::unpackZdcIndex(), verbosity, zdceventarray, and zdceventntuple.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

338  {
339  //end of event
340 
341  // Look for the Hit Collection
342  edm::LogVerbatim("ZdcAnalysis") << "\nZdcTest::upDate(const EndOfEvent * evt) - event #" << (*evt)()->GetEventID()
343  << "\n # of aSteps followed in event = " << stepIndex;
344 
345  // access to the G4 hit collections
346  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
347  edm::LogVerbatim("ZdcAnalysis") << " accessed all HC";
348 
349  int theZDCHCid = G4SDManager::GetSDMpointer()->GetCollectionID("ZDCHITS");
350  edm::LogVerbatim("ZdcAnalysis") << " - theZDCHCid = " << theZDCHCid;
351 
352  CaloG4HitCollection* theZDCHC = (CaloG4HitCollection*)allHC->GetHC(theZDCHCid);
353  edm::LogVerbatim("ZdcAnalysis") << " - theZDCHC = " << theZDCHC;
354 
355  if (!theZdcNumScheme) {
357  }
358 
359  //float ETot = 0.;
360  int maxTime = 0;
361  int fiberID = 0;
362  unsigned int unsignedfiberID = 0;
363  std::map<int, float, std::less<int> > energyInFibers;
364  std::map<int, float, std::less<int> > primaries;
365  float totalEnergy = 0;
366  int nentries = theZDCHC->entries();
367  edm::LogVerbatim("ZdcAnalysis") << " theZDCHC has " << nentries << " entries";
368 
369  if (doNTzdcevent) {
370  if (nentries > 0) {
371  for (int ihit = 0; ihit < nentries; ihit++) {
372  CaloG4Hit* caloHit = (*theZDCHC)[ihit];
373  totalEnergy += caloHit->getEnergyDeposit();
374  }
375 
376  for (int ihit = 0; ihit < nentries; ihit++) {
377  CaloG4Hit* aHit = (*theZDCHC)[ihit];
378  fiberID = aHit->getUnitID();
379  unsignedfiberID = aHit->getUnitID();
380  double enEm = aHit->getEM();
381  double enHad = aHit->getHadr();
382  math::XYZPoint hitPoint = aHit->getPosition();
383  double hitEnergy = aHit->getEnergyDeposit();
384  if (verbosity >= 1)
385  edm::LogVerbatim("ZdcAnalysis")
386  << " entry #" << ihit << ": fiberID=0x" << std::hex << fiberID << std::dec << "; enEm=" << enEm
387  << "; enHad=" << enHad << "; hitEnergy=" << hitEnergy << "z=" << hitPoint.z();
388  energyInFibers[fiberID] += enEm + enHad;
389  primaries[aHit->getTrackID()] += enEm + enHad;
390  float time = aHit->getTimeSliceID();
391  if (time > maxTime)
392  maxTime = (int)time;
393 
394  int thesubdet, thelayer, thefiber, thechannel, thez;
395  theZdcNumScheme->unpackZdcIndex(fiberID, thesubdet, thelayer, thefiber, thechannel, thez);
396  int unsignedsubdet, unsignedlayer, unsignedfiber, unsignedchannel, unsignedz;
398  unsignedfiberID, unsignedsubdet, unsignedlayer, unsignedfiber, unsignedchannel, unsignedz);
399 
400  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
401  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
402  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
403  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
404 
407  zdceventarray[ntzdce_fiberid] = (float)fiberID;
409  zdceventarray[ntzdce_subdet] = (float)thesubdet;
410  zdceventarray[ntzdce_layer] = (float)thelayer;
411  zdceventarray[ntzdce_fiber] = (float)thefiber;
412  zdceventarray[ntzdce_channel] = (float)thechannel;
413  zdceventarray[ntzdce_enem] = enEm;
414  zdceventarray[ntzdce_enhad] = enHad;
415  zdceventarray[ntzdce_hitenergy] = hitEnergy;
416  zdceventarray[ntzdce_x] = hitPoint.x();
417  zdceventarray[ntzdce_y] = hitPoint.y();
418  zdceventarray[ntzdce_z] = hitPoint.z();
420  zdceventarray[ntzdce_etot] = totalEnergy;
422  }
423 
424  /*
425  for (std::map<int, float, std::less<int> >::iterator is = energyInFibers.begin(); is != energyInFibers.end();
426  is++) {
427  ETot = (*is).second;
428  }
429  */
430 
431  // Find Primary info:
432  int trackID = 0;
433  G4PrimaryParticle* thePrim = nullptr;
434  G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
435  edm::LogVerbatim("ZdcAnalysis") << "Event has " << nvertex << " vertex";
436  if (nvertex == 0)
437  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERROR: no vertex";
438 
439  for (int i = 0; i < nvertex; i++) {
440  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
441  if (avertex == nullptr) {
442  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: pointer to vertex = 0";
443  } else {
444  edm::LogVerbatim("ZdcAnalysis") << "Vertex number :" << i;
445  int npart = avertex->GetNumberOfParticle();
446  if (npart == 0)
447  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: no primary!";
448  if (thePrim == nullptr)
449  thePrim = avertex->GetPrimary(trackID);
450  }
451  }
452 
453  double px = 0., py = 0., pz = 0.;
454  double pInit = 0.;
455 
456  if (thePrim != nullptr) {
457  px = thePrim->GetPx();
458  py = thePrim->GetPy();
459  pz = thePrim->GetPz();
460  pInit = sqrt(pow(px, 2.) + pow(py, 2.) + pow(pz, 2.));
461  if (pInit == 0) {
462  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: primary has p=0 ";
463  }
464  } else {
465  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: could not find primary ";
466  }
467 
468  } // nentries > 0
469 
470  } // createNTzdcevent
471 
472  int iEvt = (*evt)()->GetEventID();
473  if (iEvt < 10)
474  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
475  else if ((iEvt < 100) && (iEvt % 10 == 0))
476  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
477  else if ((iEvt < 1000) && (iEvt % 100 == 0))
478  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
479  else if ((iEvt < 10000) && (iEvt % 1000 == 0))
480  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
481 }
Log< level::Info, true > LogVerbatim
int getTrackID() const
Definition: CaloG4Hit.h:64
Float_t zdceventarray[16]
double getEM() const
Definition: CaloG4Hit.h:55
double npart
Definition: HydjetWrapper.h:46
double getHadr() const
Definition: CaloG4Hit.h:58
math::XYZPoint getPosition() const
Definition: CaloG4Hit.h:52
T sqrt(T t)
Definition: SSEVec.h:19
TNtuple * zdceventntuple
ZdcNumberingScheme * theZdcNumScheme
int getTimeSliceID() const
Definition: CaloG4Hit.h:68
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static void unpackZdcIndex(const unsigned int &idx, int &subDet, int &layer, int &fiber, int &channel, int &z)
double getEnergyDeposit() const
Definition: CaloG4Hit.h:79
uint32_t getUnitID() const
Definition: CaloG4Hit.h:66
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ update() [6/6]

void ZdcTestAnalysis::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step *>.

Definition at line 217 of file ZdcTestAnalysis.cc.

References doNTzdcstep, PVValHelper::eta, eventIndex, dqmMemoryStats::float, eventwithhistoryproducer_cfi::historyDepth, heavyIonCSV_trainingSettings::idx, findQualityFiles::jj, dqm-mbProfile::log, ntzdcs_charge, ntzdcs_eta, ntzdcs_evt, ntzdcs_idl, ntzdcs_idx, ntzdcs_ncherphot, ntzdcs_pdgcode, ntzdcs_phi, ntzdcs_pvtype, ntzdcs_stepe, ntzdcs_stepl, ntzdcs_trackid, ntzdcs_vpx, ntzdcs_vpy, ntzdcs_vpz, ntzdcs_x, ntzdcs_y, ntzdcs_z, PbPb_ZMuSkimMuonDPG_cff::particleType, phi, stepIndex, AlignmentTrackSelector_cfi::theCharge, verbosity, zdcsteparray, and zdcstepntuple.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

217  {
218  //step;
219  stepIndex++;
220 
221  if (doNTzdcstep) {
222  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
223  // G4StepPoint * postStepPoint= aStep->GetPostStepPoint();
224  G4double stepL = aStep->GetStepLength();
225  G4double stepE = aStep->GetTotalEnergyDeposit();
226 
227  if (verbosity >= 2)
228  edm::LogVerbatim("ZdcAnalysis") << "Step " << stepL << "," << stepE;
229 
230  G4Track* theTrack = aStep->GetTrack();
231  G4int theTrackID = theTrack->GetTrackID();
232  G4double theCharge = theTrack->GetDynamicParticle()->GetCharge();
233  G4String particleType = theTrack->GetDefinition()->GetParticleName();
234  G4int pdgcode = theTrack->GetDefinition()->GetPDGEncoding();
235 
236  const G4ThreeVector& vert_mom = theTrack->GetVertexMomentumDirection();
237  G4double vpx = vert_mom.x();
238  G4double vpy = vert_mom.y();
239  G4double vpz = vert_mom.z();
240  double eta = 0.5 * log((1. + vpz) / (1. - vpz));
241  double phi = atan2(vpy, vpx);
242 
243  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
244  G4ThreeVector localPoint = theTrack->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
245 
246  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
247  int idx = touch->GetReplicaNumber(0);
248  int idLayer = -1;
249  int thePVtype = -1;
250 
251  int historyDepth = touch->GetHistoryDepth();
252 
253  if (historyDepth > 0) {
254  std::vector<int> theReplicaNumbers(historyDepth);
255  std::vector<G4VPhysicalVolume*> thePhysicalVolumes(historyDepth);
256  std::vector<G4String> thePVnames(historyDepth);
257  std::vector<G4LogicalVolume*> theLogicalVolumes(historyDepth);
258  std::vector<G4String> theLVnames(historyDepth);
259  std::vector<G4Material*> theMaterials(historyDepth);
260  std::vector<G4String> theMaterialNames(historyDepth);
261 
262  for (int jj = 0; jj < historyDepth; jj++) {
263  theReplicaNumbers[jj] = touch->GetReplicaNumber(jj);
264  thePhysicalVolumes[jj] = touch->GetVolume(jj);
265  thePVnames[jj] = thePhysicalVolumes[jj]->GetName();
266  theLogicalVolumes[jj] = thePhysicalVolumes[jj]->GetLogicalVolume();
267  theLVnames[jj] = theLogicalVolumes[jj]->GetName();
268  theMaterials[jj] = theLogicalVolumes[jj]->GetMaterial();
269  theMaterialNames[jj] = theMaterials[jj]->GetName();
270  if (verbosity >= 2)
271  edm::LogVerbatim("ZdcAnalysis") << " GHD " << jj << ": " << theReplicaNumbers[jj] << "," << thePVnames[jj]
272  << "," << theLVnames[jj] << "," << theMaterialNames[jj];
273  }
274 
275  idLayer = theReplicaNumbers[1];
276  if (thePVnames[0] == "ZDC_EMLayer")
277  thePVtype = 1;
278  else if (thePVnames[0] == "ZDC_EMAbsorber")
279  thePVtype = 2;
280  else if (thePVnames[0] == "ZDC_EMFiber")
281  thePVtype = 3;
282  else if (thePVnames[0] == "ZDC_HadLayer")
283  thePVtype = 7;
284  else if (thePVnames[0] == "ZDC_HadAbsorber")
285  thePVtype = 8;
286  else if (thePVnames[0] == "ZDC_HadFiber")
287  thePVtype = 9;
288  else if (thePVnames[0] == "ZDC_PhobosLayer")
289  thePVtype = 11;
290  else if (thePVnames[0] == "ZDC_PhobosAbsorber")
291  thePVtype = 12;
292  else if (thePVnames[0] == "ZDC_PhobosFiber")
293  thePVtype = 13;
294  else {
295  thePVtype = 0;
296  if (verbosity >= 2)
297  edm::LogVerbatim("ZdcAnalysis") << " pvtype=0 hd=" << historyDepth << " " << theReplicaNumbers[0] << ","
298  << thePVnames[0] << "," << theLVnames[0] << "," << theMaterialNames[0];
299  }
300  } else if (historyDepth == 0) {
301  int theReplicaNumber = touch->GetReplicaNumber(0);
302  G4VPhysicalVolume* thePhysicalVolume = touch->GetVolume(0);
303  const G4String& thePVname = thePhysicalVolume->GetName();
304  G4LogicalVolume* theLogicalVolume = thePhysicalVolume->GetLogicalVolume();
305  const G4String& theLVname = theLogicalVolume->GetName();
306  G4Material* theMaterial = theLogicalVolume->GetMaterial();
307  const G4String& theMaterialName = theMaterial->GetName();
308  if (verbosity >= 2)
309  edm::LogVerbatim("ZdcAnalysis") << " hd=0 " << theReplicaNumber << "," << thePVname << "," << theLVname << ","
310  << theMaterialName;
311  } else {
312  edm::LogVerbatim("ZdcAnalysis") << " hd<0: hd=" << historyDepth;
313  }
314 
315  double NCherPhot = -1;
317  zdcsteparray[ntzdcs_trackid] = (float)theTrackID;
319  zdcsteparray[ntzdcs_pdgcode] = (float)pdgcode;
320  zdcsteparray[ntzdcs_x] = hitPoint.x();
321  zdcsteparray[ntzdcs_y] = hitPoint.y();
322  zdcsteparray[ntzdcs_z] = hitPoint.z();
323  zdcsteparray[ntzdcs_stepl] = stepL;
324  zdcsteparray[ntzdcs_stepe] = stepE;
327  zdcsteparray[ntzdcs_vpx] = vpx;
328  zdcsteparray[ntzdcs_vpy] = vpy;
329  zdcsteparray[ntzdcs_vpz] = vpz;
331  zdcsteparray[ntzdcs_idl] = (float)idLayer;
332  zdcsteparray[ntzdcs_pvtype] = thePVtype;
333  zdcsteparray[ntzdcs_ncherphot] = NCherPhot;
335  }
336 }
Log< level::Info, true > LogVerbatim
TNtuple * zdcstepntuple
Float_t zdcsteparray[18]

Member Data Documentation

◆ doNTzdcevent

int ZdcTestAnalysis::doNTzdcevent
private

Definition at line 81 of file ZdcTestAnalysis.cc.

Referenced by finish(), update(), and ZdcTestAnalysis().

◆ doNTzdcstep

int ZdcTestAnalysis::doNTzdcstep
private

Definition at line 80 of file ZdcTestAnalysis.cc.

Referenced by finish(), update(), and ZdcTestAnalysis().

◆ eventIndex

int ZdcTestAnalysis::eventIndex
private

Definition at line 91 of file ZdcTestAnalysis.cc.

Referenced by finish(), and update().

◆ eventNtFileName

std::string ZdcTestAnalysis::eventNtFileName
private

Definition at line 83 of file ZdcTestAnalysis.cc.

Referenced by update(), and ZdcTestAnalysis().

◆ stepIndex

int ZdcTestAnalysis::stepIndex
private

Definition at line 92 of file ZdcTestAnalysis.cc.

Referenced by update().

◆ stepNtFileName

std::string ZdcTestAnalysis::stepNtFileName
private

Definition at line 82 of file ZdcTestAnalysis.cc.

Referenced by update(), and ZdcTestAnalysis().

◆ theZdcNumScheme

ZdcNumberingScheme* ZdcTestAnalysis::theZdcNumScheme
private

Definition at line 97 of file ZdcTestAnalysis.cc.

Referenced by update(), ZdcTestAnalysis(), and ~ZdcTestAnalysis().

◆ verbosity

int ZdcTestAnalysis::verbosity
private

Definition at line 79 of file ZdcTestAnalysis.cc.

Referenced by update(), and ZdcTestAnalysis().

◆ zdceventarray

Float_t ZdcTestAnalysis::zdceventarray[16]
private

Definition at line 95 of file ZdcTestAnalysis.cc.

Referenced by update().

◆ zdceventntuple

TNtuple* ZdcTestAnalysis::zdceventntuple
private

Definition at line 89 of file ZdcTestAnalysis.cc.

Referenced by finish(), update(), and ZdcTestAnalysis().

◆ zdcOutputEventFile

TFile* ZdcTestAnalysis::zdcOutputEventFile
private

Definition at line 85 of file ZdcTestAnalysis.cc.

Referenced by finish(), and update().

◆ zdcOutputStepFile

TFile* ZdcTestAnalysis::zdcOutputStepFile
private

Definition at line 86 of file ZdcTestAnalysis.cc.

Referenced by finish(), and update().

◆ zdcsteparray

Float_t ZdcTestAnalysis::zdcsteparray[18]
private

Definition at line 94 of file ZdcTestAnalysis.cc.

Referenced by update().

◆ zdcstepntuple

TNtuple* ZdcTestAnalysis::zdcstepntuple
private

Definition at line 88 of file ZdcTestAnalysis.cc.

Referenced by finish(), update(), and ZdcTestAnalysis().