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
 
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 138 of file ZdcTestAnalysis.cc.

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

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

◆ ~ZdcTestAnalysis()

ZdcTestAnalysis::~ZdcTestAnalysis ( )
override

Definition at line 176 of file ZdcTestAnalysis.cc.

References finish().

176  {
177  // destructor
178  finish();
179 }

Member Function Documentation

◆ finish()

void ZdcTestAnalysis::finish ( )
private

Definition at line 477 of file ZdcTestAnalysis.cc.

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

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

477  {
478  if (doNTzdcstep) {
479  zdcOutputStepFile->cd();
480  zdcstepntuple->Write();
481  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple step written for event: " << eventIndex;
482  zdcOutputStepFile->Close();
483  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Step file closed";
484  }
485 
486  if (doNTzdcevent) {
487  zdcOutputEventFile->cd();
488  zdceventntuple->Write("", TObject::kOverwrite);
489  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Ntuple event written for event: " << eventIndex;
490  zdcOutputEventFile->Close();
491  edm::LogVerbatim("ZdcAnalysis") << "ZdcTestAnalysis: Event file closed";
492  }
493 }
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 181 of file ZdcTestAnalysis.cc.

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

181  {
182  //job
183  edm::LogVerbatim("ZdcAnalysis") << "beggining of job";
184 }
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 187 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().

187  {
188  //run
189 
190  edm::LogVerbatim("ZdcAnalysis") << "\nZdcTestAnalysis: Begining of Run";
191  if (doNTzdcstep) {
192  edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output step file created";
193  TString stepfilename = stepNtFileName;
194  zdcOutputStepFile = new TFile(stepfilename, "RECREATE");
195  }
196 
197  if (doNTzdcevent) {
198  edm::LogVerbatim("ZdcAnalysis") << "ZDCTestAnalysis: output event file created";
199  TString stepfilename = eventNtFileName;
200  zdcOutputEventFile = new TFile(stepfilename, "RECREATE");
201  }
202 
203  eventIndex = 0;
204 }
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 475 of file ZdcTestAnalysis.cc.

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

475 {}

◆ 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 206 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().

206  {
207  //event
208  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest: Processing Event Number: " << eventIndex;
209  eventIndex++;
210  stepIndex = 0;
211 }
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 334 of file ZdcTestAnalysis.cc.

References TauDecayModes::dec, doNTzdcevent, eventIndex, nano_mu_digi_cff::float, CaloG4Hit::getEM(), CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getHadr(), CaloG4Hit::getPosition(), CaloG4Hit::getTimeSliceID(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), mps_fire::i, createfilelist::int, HLT_2024v12_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, hcalRecHitTable_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().

334  {
335  //end of event
336 
337  // Look for the Hit Collection
338  edm::LogVerbatim("ZdcAnalysis") << "\nZdcTest::upDate(const EndOfEvent * evt) - event #" << (*evt)()->GetEventID()
339  << "\n # of aSteps followed in event = " << stepIndex;
340 
341  // access to the G4 hit collections
342  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
343  edm::LogVerbatim("ZdcAnalysis") << " accessed all HC";
344 
345  int theZDCHCid = G4SDManager::GetSDMpointer()->GetCollectionID("ZDCHITS");
346  edm::LogVerbatim("ZdcAnalysis") << " - theZDCHCid = " << theZDCHCid;
347 
348  CaloG4HitCollection* theZDCHC = (CaloG4HitCollection*)allHC->GetHC(theZDCHCid);
349  edm::LogVerbatim("ZdcAnalysis") << " - theZDCHC = " << theZDCHC;
350 
351  //float ETot = 0.;
352  int maxTime = 0;
353  int fiberID = 0;
354  unsigned int unsignedfiberID = 0;
355  std::map<int, float, std::less<int> > energyInFibers;
356  std::map<int, float, std::less<int> > primaries;
357  float totalEnergy = 0;
358  int nentries = theZDCHC->entries();
359  edm::LogVerbatim("ZdcAnalysis") << " theZDCHC has " << nentries << " entries";
360 
361  if (doNTzdcevent) {
362  if (nentries > 0) {
363  for (int ihit = 0; ihit < nentries; ihit++) {
364  CaloG4Hit* caloHit = (*theZDCHC)[ihit];
365  totalEnergy += caloHit->getEnergyDeposit();
366  }
367 
368  for (int ihit = 0; ihit < nentries; ihit++) {
369  CaloG4Hit* aHit = (*theZDCHC)[ihit];
370  fiberID = aHit->getUnitID();
371  unsignedfiberID = aHit->getUnitID();
372  double enEm = aHit->getEM();
373  double enHad = aHit->getHadr();
374  math::XYZPoint hitPoint = aHit->getPosition();
375  double hitEnergy = aHit->getEnergyDeposit();
376  if (verbosity >= 1)
377  edm::LogVerbatim("ZdcAnalysis")
378  << " entry #" << ihit << ": fiberID=0x" << std::hex << fiberID << std::dec << "; enEm=" << enEm
379  << "; enHad=" << enHad << "; hitEnergy=" << hitEnergy << "z=" << hitPoint.z();
380  energyInFibers[fiberID] += enEm + enHad;
381  primaries[aHit->getTrackID()] += enEm + enHad;
382  float time = aHit->getTimeSliceID();
383  if (time > maxTime)
384  maxTime = (int)time;
385 
386  int thesubdet, thelayer, thefiber, thechannel, thez;
387  ZdcNumberingScheme::unpackZdcIndex(fiberID, thesubdet, thelayer, thefiber, thechannel, thez);
388  int unsignedsubdet, unsignedlayer, unsignedfiber, unsignedchannel, unsignedz;
390  unsignedfiberID, unsignedsubdet, unsignedlayer, unsignedfiber, unsignedchannel, unsignedz);
391 
392  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
393  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
394  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
395  // unsigned int packidx1 = packZdcIndex(thesubdet, thelayer, thefiber, thechannel, thez);
396 
399  zdceventarray[ntzdce_fiberid] = (float)fiberID;
401  zdceventarray[ntzdce_subdet] = (float)thesubdet;
402  zdceventarray[ntzdce_layer] = (float)thelayer;
403  zdceventarray[ntzdce_fiber] = (float)thefiber;
404  zdceventarray[ntzdce_channel] = (float)thechannel;
405  zdceventarray[ntzdce_enem] = enEm;
406  zdceventarray[ntzdce_enhad] = enHad;
407  zdceventarray[ntzdce_hitenergy] = hitEnergy;
408  zdceventarray[ntzdce_x] = hitPoint.x();
409  zdceventarray[ntzdce_y] = hitPoint.y();
410  zdceventarray[ntzdce_z] = hitPoint.z();
412  zdceventarray[ntzdce_etot] = totalEnergy;
414  }
415 
416  /*
417  for (std::map<int, float, std::less<int> >::iterator is = energyInFibers.begin(); is != energyInFibers.end();
418  is++) {
419  ETot = (*is).second;
420  }
421  */
422 
423  // Find Primary info:
424  int trackID = 0;
425  G4PrimaryParticle* thePrim = nullptr;
426  G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
427  edm::LogVerbatim("ZdcAnalysis") << "Event has " << nvertex << " vertex";
428  if (nvertex == 0)
429  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERROR: no vertex";
430 
431  for (int i = 0; i < nvertex; i++) {
432  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
433  if (avertex == nullptr) {
434  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: pointer to vertex = 0";
435  } else {
436  edm::LogVerbatim("ZdcAnalysis") << "Vertex number :" << i;
437  int npart = avertex->GetNumberOfParticle();
438  if (npart == 0)
439  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: no primary!";
440  if (thePrim == nullptr)
441  thePrim = avertex->GetPrimary(trackID);
442  }
443  }
444 
445  double px = 0., py = 0., pz = 0.;
446  double pInit = 0.;
447 
448  if (thePrim != nullptr) {
449  px = thePrim->GetPx();
450  py = thePrim->GetPy();
451  pz = thePrim->GetPz();
452  pInit = sqrt(pow(px, 2.) + pow(py, 2.) + pow(pz, 2.));
453  if (pInit == 0) {
454  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: primary has p=0 ";
455  }
456  } else {
457  edm::LogVerbatim("ZdcAnalysis") << "ZdcTest End Of Event ERR: could not find primary ";
458  }
459 
460  } // nentries > 0
461 
462  } // createNTzdcevent
463 
464  int iEvt = (*evt)()->GetEventID();
465  if (iEvt < 10)
466  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
467  else if ((iEvt < 100) && (iEvt % 10 == 0))
468  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
469  else if ((iEvt < 1000) && (iEvt % 100 == 0))
470  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
471  else if ((iEvt < 10000) && (iEvt % 1000 == 0))
472  edm::LogVerbatim("ZdcAnalysis") << " ZdcTest Event " << iEvt;
473 }
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:48
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
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 213 of file ZdcTestAnalysis.cc.

References doNTzdcstep, PVValHelper::eta, eventIndex, nano_mu_digi_cff::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().

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

◆ 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().