CMS 3D CMS Logo

CastorShowerLibraryMaker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ShowerLibraryProducer
4 // Class : CastorShowerLibraryMaker
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: P. Katsas
10 // Created: 02/2007
11 //
12 // Adapted by W. Carvalho , 02/2009
13 //
22 
25 
27 
28 #include "CLHEP/Units/GlobalSystemOfUnits.h"
29 #include "CLHEP/Units/GlobalPhysicalConstants.h"
30 
31 #include "TFile.h"
32 #include <cmath>
33 #include <iostream>
34 #include <sstream>
35 #include <iomanip>
36 #include <cstdlib>
37 
39  NPGParticle(0),DoHadSL(false),DoEmSL(false),DeActivatePhysicsProcess(false),
40  emShower(nullptr) , hadShower(nullptr) {
41 
42  MapOfSecondaries.clear();
43  hadInfo = nullptr;
44  emInfo = nullptr;
45  edm::ParameterSet p_SLM = p.getParameter<edm::ParameterSet>("CastorShowerLibraryMaker");
46  verbosity = p_SLM.getParameter<int>("Verbosity");
47  eventNtFileName = p_SLM.getParameter<std::string>("EventNtupleFileName");
48  hadSLHolder.nEvtPerBinPhi = p_SLM.getParameter<int>("nhadEvents");
49  emSLHolder.nEvtPerBinPhi = p_SLM.getParameter<int>("nemEvents");
50  hadSLHolder.SLEnergyBins = p_SLM.getParameter<std::vector<double> >("SLhadEnergyBins");
51  hadSLHolder.SLEtaBins = p_SLM.getParameter<std::vector<double> >("SLhadEtaBins");
52  hadSLHolder.SLPhiBins = p_SLM.getParameter<std::vector<double> >("SLhadPhiBins");
53  emSLHolder.SLEnergyBins = p_SLM.getParameter<std::vector<double> >("SLemEnergyBins");
54  emSLHolder.SLEtaBins = p_SLM.getParameter<std::vector<double> >("SLemEtaBins");
55  emSLHolder.SLPhiBins = p_SLM.getParameter<std::vector<double> >("SLemPhiBins");
56  PGParticleIDs = p_SLM.getParameter<std::vector<int> >("PartID");
57  DeActivatePhysicsProcess = p_SLM.getParameter<bool>("DeActivatePhysicsProcess");
58  MaxPhi = p_SLM.getParameter<double>("SLMaxPhi");
59  MaxEta = p_SLM.getParameter<double>("SLMaxEta");
60 //
61  NPGParticle = PGParticleIDs.size();
62  for(unsigned int i=0;i<PGParticleIDs.size();i++) {
63  switch (std::abs(PGParticleIDs.at(i))) {
64  case 11:
65  case 22:
66  DoEmSL = true;
67  break;
68  default:
69  DoHadSL = true;
70  }
71  }
76 
77  std::cout << "============================================================================"<<std::endl;
78  std::cout << "CastorShowerLibraryMaker:: Initialized as observer" << std::endl;
79  std::cout << " Event Ntuple will be created" << std::endl;
80  std::cout << " Event Ntuple file: " << eventNtFileName << std::endl;
81  std::cout << " Number of Hadronic events in E bins: " << hadSLHolder.nEvtPerBinE << std::endl;
82  std::cout << " Number of Hadronic events in Eta bins: " << hadSLHolder.nEvtPerBinEta << std::endl;
83  std::cout << " Number of Hadronic events in Phi bins: " << hadSLHolder.nEvtPerBinPhi << std::endl;
84  std::cout << " Number of Electromag. events in E bins: " << emSLHolder.nEvtPerBinE << std::endl;
85  std::cout << " Number of Electromag. events in Eta bins: " << emSLHolder.nEvtPerBinEta << std::endl;
86  std::cout << " Number of Electromag. events in Phi bins: " << emSLHolder.nEvtPerBinPhi << std::endl;
87  std::cout << "============================================================================"<<std::endl;
88  std::cout << std::endl;
89 
90  // Initializing the SL collections
93 }
95 {
96  int nBinsE,nBinsEta,nBinsPhi,nEvtPerBinPhi;
97  nBinsE = showerholder.SLEnergyBins.size();
98  nBinsEta = showerholder.SLEtaBins.size();
99  nBinsPhi = showerholder.SLPhiBins.size();
100  nEvtPerBinPhi=showerholder.nEvtPerBinPhi;
101 //
102 // Info
103 //
104  showerholder.SLInfo.Energy.setNEvts(nEvtPerBinPhi*nBinsPhi*nBinsEta*nBinsE);
105  showerholder.SLInfo.Energy.setNEvtPerBin(nEvtPerBinPhi*nBinsPhi*nBinsEta);
106  showerholder.SLInfo.Energy.setNBins(nBinsE);
107  showerholder.SLInfo.Energy.setBin(showerholder.SLEnergyBins);
108 //
109  showerholder.SLInfo.Eta.setNEvts(nEvtPerBinPhi*nBinsPhi*nBinsEta);
110  showerholder.SLInfo.Eta.setNEvtPerBin(nEvtPerBinPhi*nBinsPhi);
111  showerholder.SLInfo.Eta.setNBins(nBinsEta);
112  showerholder.SLInfo.Eta.setBin(showerholder.SLEtaBins);
113 //
114  showerholder.SLInfo.Phi.setNEvts(nEvtPerBinPhi*nBinsPhi);
115  showerholder.SLInfo.Phi.setNEvtPerBin(nEvtPerBinPhi);
116  showerholder.SLInfo.Phi.setNBins(nBinsPhi);
117  showerholder.SLInfo.Phi.setBin(showerholder.SLPhiBins);
118 //
119 // Shower
120  showerholder.SLCollection.assign(nBinsE,std::vector<std::vector<std::vector<CastorShowerEvent> > >());
121  showerholder.nEvtInBinE.assign(nBinsE,0);
122  showerholder.nEvtInBinEta.assign(nBinsE,std::vector<int>(0));
123  showerholder.nEvtInBinPhi.assign(nBinsE,std::vector<std::vector<int> >());
124  for(int i=0;i<nBinsE;i++) {
125  showerholder.SLCollection.at(i).assign(nBinsEta,std::vector<std::vector<CastorShowerEvent> >());
126  showerholder.nEvtInBinEta.at(i).assign(nBinsEta,0);
127  showerholder.nEvtInBinPhi.at(i).assign(nBinsEta,std::vector<int>(0));
128  for(int j=0;j<nBinsEta;j++) {
129  showerholder.SLCollection.at(i).at(j).assign(nBinsPhi,std::vector<CastorShowerEvent>());
130  showerholder.nEvtInBinPhi.at(i).at(j).assign(nBinsPhi,0);
131  for(int k=0;k<nBinsPhi;k++)
132  showerholder.SLCollection.at(i).at(j).at(k).assign(nEvtPerBinPhi,CastorShowerEvent());
133  }
134  }
135 }
136 
137 //===============================================================================================
138 
140 
141  Finish();
142 
143  std::cout << "CastorShowerLibraryMaker: End of process" << std::endl;
144 
145 }
146 
147 //=================================================================== per EVENT
149 
150  std::cout << " CastorShowerLibraryMaker::Starting new job " << std::endl;
151 }
152 
153 //==================================================================== per RUN
155 
156  std::cout << std::endl << "CastorShowerLibraryMaker: Starting Run"<< std::endl;
157 
158  std::cout << "CastorShowerLibraryMaker: output event root file created" << std::endl;
159 
160  TString eventfilename = eventNtFileName;
161  theFile = new TFile(eventfilename,"RECREATE");
162  theTree = new TTree("CastorCherenkovPhotons", "Cherenkov Photons");
163 
164  Int_t split = 1;
165  Int_t bsize = 64000;
167  emShower = new CastorShowerEvent();
170  // Create Branchs
171  theTree->Branch("emShowerLibInfo.", "CastorShowerLibraryInfo", &emInfo, bsize, split);
172  theTree->Branch("emParticles.", "CastorShowerEvent", &emShower, bsize, split);
173  theTree->Branch("hadShowerLibInfo.", "CastorShowerLibraryInfo", &hadInfo, bsize, split);
174  theTree->Branch("hadParticles.", "CastorShowerEvent", &hadShower, bsize, split);
175 
176 // set the Info for electromagnetic shower
177 // set the energy bins info
182 // set the eta bins info
187 // set the eta bins info
192 // The same for the hadronic shower
193 // set the energy bins info
198 // set the eta bins info
203 // set the eta bins info
208  // int flag = theTree->GetBranch("CastorShowerLibInfo")->Fill();
209  // Loop on all leaves of this branch to fill Basket buffer.
210  // The function returns the number of bytes committed to the memory basket.
211  // If a write error occurs, the number of bytes returned is -1.
212  // If no data are written, because e.g. the branch is disabled,
213  // the number of bytes returned is 0.
214  // if(flag==-1) {
215  // edm::LogInfo("CastorAnalyzer") << " WARNING: Error writing to Branch \"CastorShowerLibInfo\" \n" ;
216  // } else
217  // if(flag==0) {
218  // edm::LogInfo("CastorAnalyzer") << " WARNING: No data written to Branch \"CastorShowerLibInfo\" \n" ;
219  // }
220 
221  // Initialize "accounting" variables
222 
223  eventIndex = 0;
224 
225 }
226 
227 //=================================================================== per EVENT
229 
230  eventIndex++;
231  stepIndex = 0;
232  InsideCastor = false;
233  PrimaryMomentum.clear();
234  PrimaryPosition.clear();
235  int NAccepted =0;
236 // reset the pointers to the shower objects
237  SLShowerptr = nullptr;
238  MapOfSecondaries.clear();
239  thePrims.clear();
240  G4EventManager *e_mgr = G4EventManager::GetEventManager();
241  if (IsSLReady()) {
242  printSLstatus(-1,-1,-1);
243  update((EndOfRun*)nullptr);
244  return;
245  }
246 
247  thePrims = GetPrimary((*evt)());
248  for(unsigned int i=0;i<thePrims.size();i++) {
249  G4PrimaryParticle* thePrim = thePrims.at(i);
250  int particleType = thePrim->GetPDGcode();
251 
252  std::string SLType("");
253  if (particleType==11) {
255  SLType = "Electromagnetic";
256  }
257  else {
259  SLType = "Hadronic";
260  }
261  double px=0., py=0., pz=0., pInit = 0., eta = 0., phi = 0.;
262  GetKinematics(thePrim,px,py,pz,pInit,eta,phi);
263  int ebin = FindEnergyBin(pInit);
264  int etabin= FindEtaBin(eta);
265  int phibin = FindPhiBin(phi);
266  if (verbosity)
267  std::cout << "\n========================================================================"
268  << "\nBeginOfEvent: E : " << pInit <<"\t bin : " << ebin
269  << "\n Eta : " << eta <<"\t bin : " << etabin
270  << "\n Phi : " << phi <<"\t bin : " << phibin
271  << "\n========================================================================"
272  << std::endl;
273 
274  if (ebin<0||etabin<0||phibin<0) continue;
275  bool accept=false;
276  if (!(SLacceptEvent(ebin,etabin,phibin))) {
277 /*
278 // To increase the chance of a particle arriving at CASTOR inside a not full bin,
279 // check if there is available phase space in the neighboring bins
280  unsigned int ebin_min = std::max(0,ebin-3);
281  unsigned int eta_bin_min = std::max(0,etabin-2);
282  unsigned int eta_bin_max = std::min(etabin,etabin+2);
283  unsigned int phi_bin_min = std::max(0,phibin-2);
284  unsigned int phi_bin_max = std::min(phibin,phibin+2);
285  for(unsigned int i_ebin=ebin_min;i_ebin<=(unsigned int)ebin;i_ebin++) {
286  for (unsigned int i_etabin=eta_bin_min;i_etabin<=eta_bin_max;i_etabin++) {
287  for (unsigned int i_phibin=phi_bin_min;i_phibin<=phi_bin_max;i_phibin++) {
288  if (SLacceptEvent((int)i_ebin,(int)i_etabin,(int)i_phibin)) {accept=true;break;}
289  }
290  if (accept) break;
291  }
292  if (accept) break;
293  }
294 */
295  if (!accept) edm::LogInfo("CastorShowerLibraryMaker") << "Event not accepted for ebin="
296  << ebin<<",etabin="<<etabin<<",phibin="<<phibin<<std::endl;
297  }
298  else {
299  accept=true;
300  }
301  if (accept) NAccepted++;
302  }
303 
304  if (NAccepted==0) {
305  const_cast<G4Event*>((*evt)())->SetEventAborted();
306  const_cast<G4Event*>((*evt)())->KeepTheEvent((G4bool)false);
307  e_mgr->AbortCurrentEvent();
308  }
309  SLShowerptr=nullptr;
310 //
311  std::cout << "CastorShowerLibraryMaker: Processing Event Number: " << eventIndex << std::endl;
312 }
313 
314 //=================================================================== per STEP
315 void CastorShowerLibraryMaker::update(const G4Step * aStep) {
316  static thread_local int CurrentPrimary = 0;
317  G4Track *trk = aStep->GetTrack();
318  if (trk->GetCurrentStepNumber()==1) {
319  if (trk->GetParentID()==0) {
320  CurrentPrimary = (int)trk->GetDynamicParticle()->GetPDGcode();
321  if (CurrentPrimary==0)
322  SimG4Exception("CastorShowerLibraryMaker::update(G4Step) -> Primary particle undefined");
323  InsideCastor=false;
324 // Deactivate the physics process
326  G4ProcessManager *p_mgr = trk->GetDefinition()->GetProcessManager();
327  G4ProcessVector *pvec = p_mgr->GetProcessList();
328  for (int i = 0;i<pvec->size();i++) {
329  G4VProcess *proc = (*pvec)(i);
330  if (proc->GetProcessName()!="Transportation"&&
331  proc->GetProcessName()!="Decay") {
332  std::cout << "DeActivating process: " << proc->GetProcessName() << std::endl;
333  p_mgr->SetProcessActivation(proc,false);
334  }
335  }
336  }
337 // move track to z of CASTOR
338  G4ThreeVector pos;
339  pos.setZ(-14390);
340  double t = std::abs((pos.z()-trk->GetPosition().z()))/trk->GetVelocity();
341  double r = (pos.z()-trk->GetPosition().z())/trk->GetMomentum().cosTheta();
342  pos.setX(r*sin(trk->GetMomentum().theta())*cos(trk->GetMomentum().phi())+trk->GetPosition().x());
343  pos.setY(r*sin(trk->GetMomentum().theta())*sin(trk->GetMomentum().phi())+trk->GetPosition().y());
344  trk->SetPosition(pos);
345  trk->SetGlobalTime(trk->GetGlobalTime()+t);
346  trk->AddTrackLength(r);
347  }
348  else if (!InsideCastor) {
349  std::cout<<"CastorShowerLibraryMaker::update(G4Step) -> Killing spurious track" << std::endl;
350  trk->SetTrackStatus(fKillTrackAndSecondaries);
351  return;
352  }
353  MapOfSecondaries[CurrentPrimary].insert((int)trk->GetTrackID());
354  }
355 // Checks if primary already inside CASTOR
356  std::string CurVolume = trk->GetVolume()->GetName();
357  if (!InsideCastor&&(
358  //CurVolume=="C3EF"||CurVolume=="C4EF"||CurVolume=="CAEL"||
359  //CurVolume=="CAHL"||CurVolume=="C3HF"||CurVolume=="C4HF")) {
360  //CurVolume=="CastorB"||
361  CurVolume=="CAST")) {
362  //CurVolume=="CAIR")) {
363  InsideCastor=true;
364 // Activate the physics process
365  if (trk->GetParentID()==0&&DeActivatePhysicsProcess) {
366  G4ProcessManager *p_mgr = trk->GetDefinition()->GetProcessManager();
367  G4ProcessVector *pvec = p_mgr->GetProcessList();
368  for (int i = 0;i<pvec->size();i++) {
369  G4VProcess *proc = (*pvec)(i);
370  if (proc->GetProcessName()!="Transportation"&&
371  proc->GetProcessName()!="Decay") {
372  std::cout << " Activating process: " << proc->GetProcessName() << std::endl;
373  p_mgr->SetProcessActivation(proc,true);
374  }
375  }
376  }
377  //PrimaryMomentum[CurrentPrimary]=aStep->GetPreStepPoint()->GetMomentum();
378 // check fiducial eta and phi
379  if (trk->GetMomentum().phi()>MaxPhi||trk->GetMomentum().eta()>MaxEta) {
380  trk->SetTrackStatus(fKillTrackAndSecondaries);
381  InsideCastor=false;
382  return;
383  }
384  PrimaryMomentum[CurrentPrimary]=trk->GetMomentum();
385  PrimaryPosition[CurrentPrimary]=trk->GetPosition();
386  KillSecondaries(aStep);
387  return;
388  }
389 // Kill the secondaries if they have been produced before entering castor
390  if (CurrentPrimary!=0&&trk->GetParentID()==0&&!InsideCastor) {
391  KillSecondaries(aStep);
392  if (verbosity) {
393  double pre_phi = aStep->GetPreStepPoint()->GetMomentum().phi();
394  double cur_phi = trk->GetMomentum().phi();
395  if (pre_phi!=cur_phi) {
396  std::cout << "Primary track phi : " << pre_phi << " changed in current step: "
397  << cur_phi << " by processes:" << std::endl;
398  const G4VProcess *proc = aStep->GetPreStepPoint()->GetProcessDefinedStep();
399  std::cout << " " << proc->GetProcessName()
400  << " In volume " << CurVolume << std::endl;
401  }
402  }
403  }
404 
405 //==============================================
406 /*
407 */
408 /*
409  if(aStep->IsFirstStepInVolume()) {
410  edm::LogInfo("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::update(const G4Step * aStep):"
411  << "\n IsFirstStepInVolume , "
412  << "time = " << aStep->GetTrack()->GetGlobalTime() ;
413  }
414  stepIndex++;
415 */
416 }
417 
418 //================= End of EVENT ===============
420 
421 // check if the job is done!
422  if ((*evt)()->IsAborted()) {
423  std::cout << "\n========================================================================"
424  << "\nEndOfEvent: EVENT ABORTED"
425  << "\n========================================================================"
426  << std::endl;
427  return;
428  }
429  //DynamicRangeFlatRandomEGunProducer* pgun = edm::DynamicRangeFlatRandomEGunKernel::get_instance();
430  //std::cout << pgun->EGunMaxE() << std::endl;
431 /*
432  std::cout << "Minimum energy in Particle Gun : " << pgun->EGunMinE() << "\n"
433  << "Maximum energy in Particle Gun : " << pgun->EGunMaxE() << std::endl;
434 */
435  if (verbosity)
436  std::cout << "CastorShowerLibraryMaker: End of Event: " << eventIndex << std::endl;
437 // Get the pointer to the primary particle
438  if (thePrims.empty()) {
439  edm::LogInfo("CastorShowerLibraryMaker") << "No valid primary particle found. Skipping event" << std::endl;
440  return;
441  }
442  // access to the G4 hit collections
443  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
444  int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI");
445  CaloG4HitCollection* theCAFI = (CaloG4HitCollection*) allHC->GetHC(CAFIid);
446  if (verbosity) edm::LogInfo("CastorShowerLibraryMaker") << " update(*evt) --> accessed all HC ";
447  edm::LogInfo("CastorShowerLibraryMaker") << "Found "<<theCAFI->entries() << " hits in G4HitCollection";
448  if (theCAFI->entries()== 0) {
449  edm::LogInfo("CastorShowerLibraryMaker") << "\n Empty G4HitCollection";
450  return;
451  }
452 
453 // Loop over primaries
454  int NEvtAccepted = 0;
455  int NHitInEvent = 0;
456  for(unsigned int i=0;i<thePrims.size();i++) {
457  G4PrimaryParticle* thePrim = thePrims.at(i);
458  if (!thePrim) {
459  edm::LogInfo("CastorShowerLibraryMaker") << "nullptr Pointer to the primary" << std::endl;
460  continue;
461  }
462 // Check primary particle type
463  int particleType = thePrim->GetPDGcode();
464 
465 // set the pointer to the shower collection
466  std::string SLType("");
467  if (particleType==11) {
469  SLType = "Electromagnetic";
470  }
471  else {
473  SLType = "Hadronic";
474  }
475  edm::LogInfo("CastorShowerLibraryMaker") << "\n Primary (thePrim) trackID is " << thePrim->GetTrackID() << "\n" ;
476 
477 // Obtain primary particle's initial momentum (pInit)
478  double px=0., py=0., pz=0., pInit = 0., eta = 0., phi = 0.;
479  GetKinematics(particleType,px,py,pz,pInit,eta,phi);
480 // Check if current event falls into any bin
481 // first: energy
482  if (pInit==0) {
483  edm::LogInfo("CastorShowerLibraryMaker") << "Primary did not hit CASTOR" << std::endl;
484  continue;
485  }
486  int ebin = FindEnergyBin(pInit);
487  int etabin= FindEtaBin(eta);
488  int phibin = FindPhiBin(phi);
489  std::cout << SLType << std::endl;
490  printSLstatus(ebin,etabin,phibin);
491  if (!SLacceptEvent(ebin,etabin,phibin)) {
492  edm::LogInfo("CastorShowerLibraryMaker") << "Event not accepted for ebin="
493  << ebin<<",etabin="<<etabin<<",phibin="<<phibin
494  <<"("<< pInit <<","<<eta<<","<<phi<<")" <<std::endl;
495  continue;
496  }
497 //
498 // event passed. Fill the vector accordingly
499 //
500 // Look for the Hit Collection
501  edm::LogInfo("CastorShowerLibraryMaker")
502  << "\n CastorShowerLibraryMaker::update(EndOfEvent * evt) - event #"
503  << (*evt)()->GetEventID() ;
504 
505 /*
506  std::cout << "Number of collections : " << allHC->GetNumberOfCollections() << std::endl;
507  for(int ii = 0;ii<allHC->GetNumberOfCollections();ii++)
508  std::cout << "Name of collection " << ii << " : " << allHC->GetHC(ii)->GetName() << std::endl;
509 */
510 
511  CastorShowerEvent* shower=nullptr;
512  int cur_evt_idx = SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
513  shower = &(SLShowerptr->SLCollection.at(ebin).at(etabin).at(phibin).at(cur_evt_idx));
514 
515 // Get Hit information
516  if (FillShowerEvent(theCAFI,shower,particleType)) {
517 // Primary particle information
518 /*
519  edm::LogInfo("CastorShowerLibraryMaker") << "New SL event: Primary = " << particleType
520  << "; Energy = " << pInit << "; Eta = " << eta << "; Phi = " << phi
521  << "; Nhits = " << shower->getNhit() << std::endl;
522 */
523  shower->setPrimE(pInit);
524  shower->setPrimEta(eta);
525  shower->setPrimPhi(phi);
526  shower->setPrimX(PrimaryPosition[particleType].x());
527  shower->setPrimY(PrimaryPosition[particleType].y());
528  shower->setPrimZ(PrimaryPosition[particleType].z());
529  SLnEvtInBinE(ebin)++;
530  SLnEvtInBinEta(ebin,etabin)++;
531  SLnEvtInBinPhi(ebin,etabin,phibin)++;
532  NHitInEvent+=shower->getNhit();
533  NEvtAccepted++;
534  }
535  else {shower->Clear();}
536  }
537 // Check for unassociated energy
538 
539  if (NEvtAccepted==int(thePrims.size())&&theCAFI->entries()!=NHitInEvent){
540  std::cout << "WARNING: Inconsistent Number of Hits -> Hits in collection: "<< theCAFI->entries()
541  << " Hits in the showers: " << NHitInEvent << std::endl;
542  double miss_energy=0;
543  double tot_energy=0;
544  GetMissingEnergy(theCAFI,miss_energy,tot_energy);
545  if (miss_energy>0) {
546  std::cout << "Total missing energy: " << miss_energy
547  << " for an incident energy: " << tot_energy
548  << std::endl;
549  }
550  }
551 
552 /*
553  for (int i=emSLHolder.SLEnergyBins.size()-1;i>0;i--) {
554  if (emSLHolder.nEvtInBinE.at(i)==(int)emSLHolder.nEvtPerBinE) {
555  std::ostringstream out;
556  out << emSLHolder.SLEnergyBins.at(i);
557  cout << "Bin Limit: " << out.str() << std::endl;
558  setenv("CASTOR_SL_PG_MAXE",out.str().c_str(),1);
559  }
560  break;
561  }
562 */
563  //int iEvt = (*evt)()->GetEventID();
564  //double xint;
565 /*
566  if (modf(log10(iEvt),&xint)==0)
567  std::cout << " CastorShowerLibraryMaker Event " << iEvt << std::endl;
568 */
569  // std::cout << std::endl << "===>>> Done writing user histograms " << std::endl;
570 }
571 
572 //========================= End of RUN ======================
574 {
575 // Fill the tree with the collected objects
576  if (!IsSLReady()) SimG4Exception("\n\nShower Library NOT READY.\n\n");
577 
578  unsigned int ibine,ibineta,ibinphi,ievt; // indexes for em shower
579  unsigned int jbine,jbineta,jbinphi,jevt;// indexes for had shower
580 
581  ibine=ibineta=ibinphi=ievt=jbine=jbineta=jbinphi=jevt=0;
582 
583  int nEvtInTree = 0;
584  int nEMevt = emSLHolder.nEvtPerBinE*emSLHolder.SLEnergyBins.size();
585  int nHadevt = hadSLHolder.nEvtPerBinE*hadSLHolder.SLEnergyBins.size();
586  int maxEvtInTree=std::max(nEMevt,nHadevt);
587 
590 
591  while(nEvtInTree<maxEvtInTree) {
592  if (emShower) emShower->Clear();
593  if (hadShower) hadShower->Clear();
594  while(ibine<emSLHolder.SLEnergyBins.size()&&nEMevt>0){
595  emShower = &(emSLHolder.SLCollection.at(ibine).at(ibineta).at(ibinphi).at(ievt));
596  ievt++;
597  if (ievt==emSLHolder.nEvtPerBinPhi) {ievt=0;ibinphi++;}
598  if (ibinphi==emSLHolder.SLPhiBins.size()) {ibinphi=0;ibineta++;}
599  if (ibineta==emSLHolder.SLEtaBins.size()) {ibineta=0;ibine++;}
600  break;
601  }
602  while(jbine<hadSLHolder.SLEnergyBins.size()&&nHadevt>0){
603  hadShower = &(hadSLHolder.SLCollection.at(jbine).at(jbineta).at(jbinphi).at(jevt));
604  jevt++;
605  if (jevt==hadSLHolder.nEvtPerBinPhi) {jevt=0;jbinphi++;}
606  if (jbinphi==hadSLHolder.SLPhiBins.size()) {jbinphi=0;jbineta++;}
607  if (jbineta==hadSLHolder.SLEtaBins.size()) {jbineta=0;jbine++;}
608  break;
609  }
610  theTree->Fill();
611  nEvtInTree++;
612  if (nEvtInTree==1) {
613  theTree->SetBranchStatus("emShowerLibInfo.",false);
614  theTree->SetBranchStatus("hadShowerLibInfo.",false);
615  }
616  }
617 // check if run is nullptr and exit
618  if (run==nullptr) throw SimG4Exception("\n\nNumber of needed trigger events reached in CastorShowerLibraryMaker\n\n");
619 }
620 
621 //============================================================
623 
624  // if (doNTcastorevent) {
625 
626  theFile->cd();
627  theTree->Write("",TObject::kOverwrite);
628  std::cout << "CastorShowerLibraryMaker: Ntuple event written" << std::endl;
629  theFile->Close();
630  std::cout << "CastorShowerLibraryMaker: Event file closed" << std::endl;
631 
632  // Delete pointers to objects, now that TTree has been written and TFile closed
633 // delete info;
634 // delete emShower;
635 // delete hadShower;
636  // }
637 }
639  //
640  // returns the integer index of the energy bin, taken from SLenergies vector
641  // returns -1 if ouside valid range
642  //
643  if (!SLShowerptr) {
644  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindEnergyBin can be called only after BeginOfEvent\n\n";
645  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
646  }
647  const std::vector<double>& SLenergies = SLShowerptr->SLEnergyBins;
648  if (energy >= SLenergies.back()) return SLenergies.size()-1;
649 
650  unsigned int i = 0;
651  for(;i<SLenergies.size()-1;i++)
652  if (energy >= SLenergies.at(i) && energy < SLenergies.at(i+1)) return (int)i;
653 
654  // now i points to the last but 1 bin
655  if (energy>=SLenergies.at(i)) return (int)i;
656  // energy outside bin range
657  return -1;
658 }
660  //
661  // returns the integer index of the eta bin, taken from SLetas vector
662  // returns -1 if ouside valid range
663  //
664  if (!SLShowerptr) {
665  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindEtaBin can be called only after BeginOfEvent\n\n";
666  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
667  }
668  const std::vector<double>& SLetas = SLShowerptr->SLEtaBins;
669  if (eta>=SLetas.back()) return SLetas.size()-1;
670  unsigned int i = 0;
671  for(;i<SLetas.size()-1;i++)
672  if (eta >= SLetas.at(i) && eta < SLetas.at(i+1)) return (int)i;
673  // now i points to the last but 1 bin
674  if (eta>=SLetas.at(i)) return (int)i;
675  // eta outside bin range
676  return -1;
677 }
679  //
680  // returns the integer index of the phi bin, taken from SLphis vector
681  // returns -1 if ouside valid range
682  //
683  // needs protection in case phi is outside range -pi,pi
684  //
685  if (!SLShowerptr) {
686  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nFindPhiBin can be called only after BeginOfEvent\n\n";
687  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
688  }
689  const std::vector<double>& SLphis = SLShowerptr->SLPhiBins;
690  if (phi>=SLphis.back()) return SLphis.size()-1;
691  unsigned int i = 0;
692  for(;i<SLphis.size()-1;i++)
693  if (phi >= SLphis.at(i) && phi < SLphis.at(i+1)) return (int)i;
694  // now i points to the last but 1 bin
695  if (phi>=SLphis.at(i)) return (int)i;
696  // phi outside bin range
697  return -1;
698 }
700 {
701 // at this point, the pointer to the shower library should be nullptr
702  if (SLShowerptr) {
703  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nIsSLReady must be called when a new event starts.\n\n";
704  throw SimG4Exception("\n\nNOT nullptr Pointer to the shower library.\n\n");
705  }
706 // it is enough to check if all the energy bin is filled
707  if (DoEmSL) {
709  for(unsigned int i=0;i<SLShowerptr->SLEnergyBins.size();i++) {
710  if (!SLisEBinFilled(i)) {
711  SLShowerptr=nullptr;
712  return false;
713  }
714  }
715  }
716  if (DoHadSL) {
718  for(unsigned int i=0;i<SLShowerptr->SLEnergyBins.size();i++) {
719  if (!SLisEBinFilled(i)) {
720  SLShowerptr=nullptr;
721  return false;
722  }
723  }
724  }
725  SLShowerptr=nullptr;
726  return true;
727 }
728 void CastorShowerLibraryMaker::GetKinematics(int thePrim,double& px, double& py, double& pz, double& pInit, double& eta, double& phi)
729 {
730  if (thePrim==0) return;
731  if (PrimaryMomentum.find(thePrim)==PrimaryMomentum.end()) return;
732  px = PrimaryMomentum[thePrim].x()/GeV;
733  py = PrimaryMomentum[thePrim].y()/GeV;
734  pz = PrimaryMomentum[thePrim].z()/GeV;
735  pInit=PrimaryMomentum[thePrim].mag()/GeV;
736  if (pInit==0) return;
737  double costheta = pz/pInit;
738  double theta = acos(std::min(std::max(costheta,double(-1.)),double(1.)));
739  eta = -log(tan(theta/2.0));
740  phi = (px==0 && py==0) ? 0 : atan2(py,px); // the recommended way of calculating phi
741  phi = PrimaryMomentum[thePrim].phi();
742 }
743 void CastorShowerLibraryMaker::GetKinematics(G4PrimaryParticle* thePrim,double& px, double& py, double& pz, double& pInit, double& eta, double& phi)
744 {
745  px=py=pz=phi=eta=0.0;
746  if (thePrim==nullptr) return;
747  px = thePrim->GetMomentum().x()/GeV;
748  py = thePrim->GetMomentum().y()/GeV;
749  pz = thePrim->GetMomentum().z()/GeV;
750  pInit = thePrim->GetMomentum().mag()/GeV;
751  //pInit = sqrt(pow(px,2.)+pow(py,2.)+pow(pz,2.));
752  if (pInit==0) return;
753  double costheta = pz/pInit;
754  double theta = acos(std::min(std::max(costheta,double(-1.)),double(1.)));
755  eta = -log(tan(theta/2.0));
756  phi = (px==0 && py==0) ? 0 : atan2(py,px); // the recommended way of calculating phi
757  phi = thePrim->GetMomentum().phi();
758  //if (px!=0) phi=atan(py/px);
759 }
760 std::vector<G4PrimaryParticle*> CastorShowerLibraryMaker::GetPrimary(const G4Event * evt)
761 {
762  // Find Primary info:
763  int trackID = 0;
764  std::vector<G4PrimaryParticle*> thePrims;
765  G4PrimaryParticle* thePrim = nullptr;
766  G4int nvertex = evt->GetNumberOfPrimaryVertex();
767  edm::LogInfo("CastorShowerLibraryMaker") << "Event has " << nvertex << " vertex";
768  if (nvertex!=1) {
769  edm::LogInfo("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: no vertex";
770  return thePrims;
771  }
772 
773  for (int i = 0 ; i<nvertex; i++) {
774  G4PrimaryVertex* avertex = evt->GetPrimaryVertex(i);
775  if (avertex == nullptr) {
776  edm::LogInfo("CastorShowerLibraryMaker")
777  << "CastorShowerLibraryMaker::GetPrimary ERROR: pointer to vertex = 0";
778  continue;
779  }
780  unsigned int npart = avertex->GetNumberOfParticle();
781  if (npart!=NPGParticle) continue;
782  for (unsigned int j=0;j<npart;j++) {
783  unsigned int k = 0;
784  //int test_pID = 0;
785  trackID = j;
786  thePrim=avertex->GetPrimary(trackID);
787  while(k<NPGParticle&&PGParticleIDs.at(k++)!=thePrim->GetPDGcode()){;};
788  if (k>NPGParticle) continue; // ID not found in the requested particles
789  thePrims.push_back(thePrim);
790  }
791  }
792  return thePrims;
793 }
795 {
796  if (!SLShowerptr) {
797  edm::LogInfo("CastorShowerLibraryInfo") << "nullptr shower pointer. Printing both";
798  std::cout << "Electromagnetic" << std::endl;
800  this->printSLstatus(ebin,etabin,phibin);
801  std::cout << "Hadronic" << std::endl;
803  this->printSLstatus(ebin,etabin,phibin);
804  SLShowerptr = nullptr;
805  return;
806  }
807  int nBinsE =SLShowerptr->SLEnergyBins.size();
808  int nBinsEta=SLShowerptr->SLEtaBins.size();
809  int nBinsPhi=SLShowerptr->SLPhiBins.size();
810  std::vector<double> SLenergies = SLShowerptr->SLEnergyBins;
811  for(int n=0;n<11+(nBinsEta*nBinsPhi);n++) std::cout << "=";
812  std::cout << std::endl;
813  for(int i=0;i<nBinsE;i++) {
814  std::cout << "E bin " << std::setw(6) << SLenergies.at(i) << " : ";
815  for(int j=0;j<nBinsEta;j++) {
816  for(int k=0;k<nBinsPhi;k++) {
817  (SLisPhiBinFilled(i,j,k))?std::cout << "1":std::cout << "-";
818  }
819  if (j<nBinsEta-1) std::cout << "|";
820  }
821  std::cout << " (" << SLnEvtInBinE(i) << " events)";
822  std::cout << std::endl;
823  if (ebin!=i) continue;
824  std::cout << " ";
825  for(int j=0;j<nBinsEta;j++) {
826  for(int k=0;k<nBinsPhi;k++) {
827  (ebin==i&&etabin==j&&phibin==k)?std::cout << "^":std::cout << " ";
828  }
829  if (j<nBinsEta-1) std::cout << " ";
830  }
831  std::cout << std::endl;
832  }
833  for(int n=0;n<11+(nBinsEta*nBinsPhi);n++) std::cout << "=";
834  std::cout << std::endl;
835 }
837 {
838  if (SLShowerptr==nullptr) {
839  edm::LogInfo("CastorShowerLibraryMaker::SLacceptEvent:") << "Error. nullptr pointer to CastorShowerEvent";
840  return false;
841  }
842  if (ebin<0||ebin>=int(SLShowerptr->SLEnergyBins.size())) return false;
843  if (SLisEBinFilled(ebin)) return false;
844 
845  if (etabin<0||etabin>=int(SLShowerptr->SLEtaBins.size())) return false;
846  if (SLisEtaBinFilled(ebin,etabin)) return false;
847 
848  if (phibin<0||phibin>=int(SLShowerptr->SLPhiBins.size())) return false;
849  if (SLisPhiBinFilled(ebin,etabin,phibin)) return false;
850  return true;
851 }
853 {
854  unsigned int volumeID=0;
855  double en_in_fi = 0.;
856  //double totalEnergy = 0;
857 
858  int nentries = theCAFI->entries();
859 
860 // Compute Total Energy in CastorFI volume
861 /*
862  for(int ihit = 0; ihit < nentries; ihit++) {
863  CaloG4Hit* aHit = (*theCAFI)[ihit];
864  totalEnergy += aHit->getEnergyDeposit();
865  }
866 */
867  if (!shower) {
868  edm::LogInfo("CastorShowerLibraryMaker") << "Error. nullptr pointer to CastorShowerEvent";
869  return false;
870  }
871 
872  CastorNumberingScheme *theCastorNumScheme = new CastorNumberingScheme();
873 // Hit position
876  int nHits;
877  nHits=0;
878  for (int ihit = 0; ihit < nentries; ihit++) {
879  CaloG4Hit* aHit = (*theCAFI)[ihit];
880  int hit_particleID = aHit->getTrackID();
881  if (MapOfSecondaries[ipart].find(hit_particleID)==MapOfSecondaries[ipart].end()) {
882  if (verbosity) edm::LogInfo("CastorShowerLibraryMaker")
883  << "Skipping hit from trackID " << hit_particleID;
884  continue;
885  }
886  volumeID = aHit->getUnitID();
887  double hitEnergy = aHit->getEnergyDeposit();
888  en_in_fi += aHit->getEnergyDeposit();
889  float time = aHit->getTimeSlice();
890  int zside, sector, zmodule;
891  theCastorNumScheme->unpackIndex(volumeID, zside, sector,zmodule);
892  entry = aHit->getEntry();
893  position = aHit->getPosition();
894  if (verbosity) edm::LogInfo("CastorShowerLibraryMaker")
895  << "\n side , sector , module = " << zside << " , "
896  << sector << " , " << zmodule
897  << "\n nphotons = " << hitEnergy ;
898 
899  if (verbosity) edm::LogInfo("CastorShowerLibraryMaker")
900  << "\n packIndex = "
901  << theCastorNumScheme->packIndex(zside, sector,zmodule);
902 
903  if(verbosity&&time>100.) {
904  edm::LogInfo("CastorShowerLibraryMaker")
905  << "\n nentries = " << nentries
906  << "\n time[" << ihit << "] = " << time
907  << "\n trackID[" << ihit << "] = " << aHit->getTrackID()
908  << "\n volumeID[" << ihit << "] = " << volumeID
909  << "\n nphotons[" << ihit << "] = " << hitEnergy
910  << "\n side, sector, module = " << zside <<", " << sector<<", " << zmodule
911  << "\n packIndex " << theCastorNumScheme->packIndex(zside,sector,zmodule)
912  << "\n X,Y,Z = " << entry.x() << ","<< entry.y() << "," << entry.z();
913  }
914  if (verbosity) edm::LogInfo("CastorShowerLibraryMaker") << "\n Incident Energy = "
915  << aHit->getIncidentEnergy() << " \n" ;
916 
917 // CaloG4Hit information
918  shower->setDetID(volumeID);
919  shower->setHitPosition(position);
920  shower->setNphotons(hitEnergy);
921  shower->setTime(time);
922  nHits++;
923  }
924 // Write number of hits to CastorShowerEvent instance
925  if (nHits==0) {
926  edm::LogInfo("CastorShowerLibraryMaker") << "No hits found for this track (trackID=" << ipart << ")." << std::endl;
927  if (theCastorNumScheme) delete theCastorNumScheme;
928  return false;
929  }
930  shower->setNhit(nHits);
931 
932 // update the event counters
933  if (theCastorNumScheme) delete theCastorNumScheme;
934  return true;
935 }
937 {
938  if (!SLShowerptr) {
939  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinE can be called only after BeginOfEvent\n\n";
940  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
941  }
942  return SLShowerptr->nEvtInBinE.at(ebin);
943 }
944 
946 {
947  if (!SLShowerptr) {
948  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinEta can be called only after BeginOfEvent\n\n";
949  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
950  }
951  return SLShowerptr->nEvtInBinEta.at(ebin).at(etabin);
952 }
953 
955 {
956  if (!SLShowerptr) {
957  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinPhi can be called only after BeginOfEvent\n\n";
958  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
959  }
960  return SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
961 }
963 {
964  if (!SLShowerptr) {
965  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisEBinFilled can be called only after BeginOfEvent\n\n";
966  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
967  }
968  if (SLShowerptr->nEvtInBinE.at(ebin)<(int)SLShowerptr->nEvtPerBinE) return false;
969  return true;
970 }
972 {
973  if (!SLShowerptr) {
974  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisEtaBinFilled can be called only after BeginOfEvent\n\n";
975  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
976  }
977  if (SLShowerptr->nEvtInBinEta.at(ebin).at(etabin)<(int)SLShowerptr->nEvtPerBinEta) return false;
978  return true;
979 }
981 {
982  if (!SLShowerptr) {
983  edm::LogInfo("CastorShowerLibraryMaker") << "\n\nSLisPhiBinFilled can be called only after BeginOfEvent\n\n";
984  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
985  }
986  if (SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin)<(int)SLShowerptr->nEvtPerBinPhi) return false;
987  return true;
988 }
989 void CastorShowerLibraryMaker::KillSecondaries(const G4Step * aStep) {
990  const G4TrackVector *p_sec = aStep->GetSecondary();
991  for(int i=0;i<int(p_sec->size());i++) {
992  /*if (verbosity)*/ std::cout << "Killing track ID " << p_sec->at(i)->GetTrackID() << " and its secondaries"
993  << " Produced by Process " << p_sec->at(i)->GetCreatorProcess()->GetProcessName()
994  << " in the volume " << aStep->GetTrack()->GetVolume()->GetName()
995  << std::endl;
996  p_sec->at(i)->SetTrackStatus(fKillTrackAndSecondaries);
997  }
998 }
999 
1000 void CastorShowerLibraryMaker::GetMissingEnergy(CaloG4HitCollection* theCAFI,double& miss_energy,double& tot_energy){
1001 // Get the total deposited energy and the one from hit not associated to a primary
1002  miss_energy = 0;
1003  tot_energy = 0;
1004  for (int ihit = 0; ihit < theCAFI->entries(); ihit++) {
1005  int id = (*theCAFI)[ihit]->getTrackID();
1006  tot_energy+=(*theCAFI)[ihit]->getEnergyDeposit();
1007  int hit_prim = 0;
1008  for(unsigned int i=0;i<thePrims.size();i++) {
1009  int particleType = thePrims.at(i)->GetPDGcode();
1010  if (MapOfSecondaries[particleType].find(id)!=MapOfSecondaries[particleType].end())
1011  hit_prim = particleType;
1012  }
1013  if (hit_prim==0) {
1014  std::cout << "Track ID " << id << " produced a hit which is not associated with a primary."
1015  << std::endl;
1016  miss_energy+=(*theCAFI)[ihit]->getEnergyDeposit();
1017  }
1018  }
1019 }
void Clear(Option_t *option="") override
T getParameter(std::string const &) const
void setNBins(unsigned int n)
math::XYZPoint getPosition() const
Definition: CaloG4Hit.h:52
const double GeV
Definition: MathUtil.h:16
void setTime(float t)
void setPrimEta(float eta)
void setPrimZ(float z)
void setDetID(unsigned int id)
int & SLnEvtInBinEta(int ebin, int etabin)
TrainProcessor *const proc
Definition: MVATrainer.cc:101
void setPrimPhi(float phi)
void setBin(double val)
std::vector< G4PrimaryParticle * > thePrims
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define nullptr
Geom::Theta< T > theta() const
bool FillShowerEvent(CaloG4HitCollection *, CastorShowerEvent *, int)
double getIncidentEnergy() const
Definition: CaloG4Hit.h:61
void KillSecondaries(const G4Step *step)
double npart
Definition: HydjetWrapper.h:49
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
bool SLisEtaBinFilled(int ebin, int etabin)
static void unpackIndex(const uint32_t &idx, int &z, int &sector, int &zmodule)
void setNEvtPerBin(unsigned int n)
std::vector< G4PrimaryParticle * > GetPrimary(const G4Event *)
CastorShowerLibraryInfo * hadInfo
std::map< int, G4ThreeVector > PrimaryMomentum
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::map< int, G4ThreeVector > PrimaryPosition
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::vector< std::vector< int > > > nEvtInBinPhi
#define end
Definition: vmac.h:39
T min(T a, T b)
Definition: MathUtil.h:58
std::map< int, std::set< int > > MapOfSecondaries
CastorShowerLibraryInfo * emInfo
CastorShowerLibraryMaker(const edm::ParameterSet &p)
int k[5][pyjets_maxn]
void setPrimE(float e)
void setPrimY(float y)
void GetMissingEnergy(CaloG4HitCollection *, double &, double &)
void GetKinematics(G4PrimaryParticle *, double &px, double &py, double &pz, double &pInit, double &eta, double &phi)
int getTrackID() const
Definition: CaloG4Hit.h:64
void setPrimX(float x)
int & SLnEvtInBinPhi(int ebin, int etabin, int phibin)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< std::vector< int > > nEvtInBinEta
void setNEvts(unsigned int n)
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
static int position[264][3]
Definition: ReadPGInfo.cc:509
bool SLisPhiBinFilled(int ebin, int etabin, int phibin)
double getTimeSlice() const
Definition: CaloG4Hit.h:66
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:46
void update(const BeginOfJob *run) override
This routine will be called when the appropriate signal arrives.
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
static uint32_t packIndex(int z, int sector, int zmodule)
void setNphotons(float np)
double split
Definition: MVATrainer.cc:139
void setNhit(unsigned int i)
void setHitPosition(const Point &p)
unsigned int getNhit()
double getEnergyDeposit() const
Definition: CaloG4Hit.h:77