CMS 3D CMS Logo

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

Classes

struct  ShowerLib
 

Public Member Functions

 CastorShowerLibraryMaker (const edm::ParameterSet &p)
 
 ~CastorShowerLibraryMaker () 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 Types

typedef int ebin
 
typedef int etabin
 
typedef int phibin
 

Private Member Functions

bool FillShowerEvent (CaloG4HitCollection *, CastorShowerEvent *, int)
 
int FindEnergyBin (double e)
 
int FindEtaBin (double eta)
 
int FindPhiBin (double phi)
 
void Finish ()
 
void GetKinematics (G4PrimaryParticle *, double &px, double &py, double &pz, double &pInit, double &eta, double &phi)
 
void GetKinematics (int, double &px, double &py, double &pz, double &pInit, double &eta, double &phi)
 
void GetMissingEnergy (CaloG4HitCollection *, double &, double &)
 
std::vector< G4PrimaryParticle * > GetPrimary (const G4Event *)
 
void InitSLHolder (ShowerLib &)
 
bool IsSLReady ()
 
void KillSecondaries (const G4Step *step)
 
void printSLstatus (int, int, int)
 
bool SLacceptEvent (int, int, int)
 
bool SLisEBinFilled (int ebin)
 
bool SLisEtaBinFilled (int ebin, int etabin)
 
bool SLisPhiBinFilled (int ebin, int etabin, int phibin)
 
int & SLnEvtInBinE (int ebin)
 
int & SLnEvtInBinEta (int ebin, int etabin)
 
int & SLnEvtInBinPhi (int ebin, int etabin, int phibin)
 
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

bool DeActivatePhysicsProcess
 
bool DoEmSL
 
bool DoHadSL
 
CastorShowerLibraryInfoemInfo
 
CastorShowerEventemShower
 
ShowerLib emSLHolder
 
int eventIndex
 
std::string eventNtFileName
 
CastorShowerLibraryInfohadInfo
 
CastorShowerEventhadShower
 
ShowerLib hadSLHolder
 
bool InsideCastor
 
std::map< int, std::set< int > > MapOfSecondaries
 
double MaxEta
 
double MaxPhi
 
unsigned int NPGParticle
 
std::vector< int > PGParticleIDs
 
std::map< int, G4ThreeVector > PrimaryMomentum
 
std::map< int, G4ThreeVector > PrimaryPosition
 
ShowerLibSLShowerptr
 
int stepIndex
 
TFile * theFile
 
std::vector< G4PrimaryParticle * > thePrims
 
TTree * theTree
 
int verbosity
 

Additional Inherited Members

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

Detailed Description

Definition at line 83 of file CastorShowerLibraryMaker.cc.

Member Typedef Documentation

◆ ebin

typedef int CastorShowerLibraryMaker::ebin
private

Definition at line 95 of file CastorShowerLibraryMaker.cc.

◆ etabin

typedef int CastorShowerLibraryMaker::etabin
private

Definition at line 96 of file CastorShowerLibraryMaker.cc.

◆ phibin

typedef int CastorShowerLibraryMaker::phibin
private

Definition at line 97 of file CastorShowerLibraryMaker.cc.

Constructor & Destructor Documentation

◆ CastorShowerLibraryMaker()

CastorShowerLibraryMaker::CastorShowerLibraryMaker ( const edm::ParameterSet p)

Definition at line 182 of file CastorShowerLibraryMaker.cc.

References funct::abs(), DeActivatePhysicsProcess, DoEmSL, DoHadSL, emInfo, emSLHolder, eventNtFileName, edm::ParameterSet::getParameter(), hadInfo, hadSLHolder, mps_fire::i, InitSLHolder(), MapOfSecondaries, MaxEta, MaxPhi, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinE, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinEta, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinPhi, NPGParticle, AlCaHLTBitMon_ParallelJobs::p, PGParticleIDs, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, CastorShowerLibraryMaker::ShowerLib::SLPhiBins, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

183  : NPGParticle(0),
184  DoHadSL(false),
185  DoEmSL(false),
187  emShower(nullptr),
188  hadShower(nullptr) {
189  MapOfSecondaries.clear();
190  hadInfo = nullptr;
191  emInfo = nullptr;
192  edm::ParameterSet p_SLM = p.getParameter<edm::ParameterSet>("CastorShowerLibraryMaker");
193  verbosity = p_SLM.getParameter<int>("Verbosity");
194  eventNtFileName = p_SLM.getParameter<std::string>("EventNtupleFileName");
195  hadSLHolder.nEvtPerBinPhi = p_SLM.getParameter<int>("nhadEvents");
196  emSLHolder.nEvtPerBinPhi = p_SLM.getParameter<int>("nemEvents");
197  hadSLHolder.SLEnergyBins = p_SLM.getParameter<std::vector<double> >("SLhadEnergyBins");
198  hadSLHolder.SLEtaBins = p_SLM.getParameter<std::vector<double> >("SLhadEtaBins");
199  hadSLHolder.SLPhiBins = p_SLM.getParameter<std::vector<double> >("SLhadPhiBins");
200  emSLHolder.SLEnergyBins = p_SLM.getParameter<std::vector<double> >("SLemEnergyBins");
201  emSLHolder.SLEtaBins = p_SLM.getParameter<std::vector<double> >("SLemEtaBins");
202  emSLHolder.SLPhiBins = p_SLM.getParameter<std::vector<double> >("SLemPhiBins");
203  PGParticleIDs = p_SLM.getParameter<std::vector<int> >("PartID");
204  DeActivatePhysicsProcess = p_SLM.getParameter<bool>("DeActivatePhysicsProcess");
205  MaxPhi = p_SLM.getParameter<double>("SLMaxPhi");
206  MaxEta = p_SLM.getParameter<double>("SLMaxEta");
207  //
208  NPGParticle = PGParticleIDs.size();
209  for (unsigned int i = 0; i < PGParticleIDs.size(); i++) {
210  switch (std::abs(PGParticleIDs.at(i))) {
211  case 11:
212  case 22:
213  DoEmSL = true;
214  break;
215  default:
216  DoHadSL = true;
217  }
218  }
223 
224  edm::LogVerbatim("HcalSim") << "============================================================================";
225  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker:: Initialized as observer";
226  edm::LogVerbatim("HcalSim") << " Event Ntuple will be created";
227  edm::LogVerbatim("HcalSim") << " Event Ntuple file: " << eventNtFileName;
228  edm::LogVerbatim("HcalSim") << " Number of Hadronic events in E bins: " << hadSLHolder.nEvtPerBinE;
229  edm::LogVerbatim("HcalSim") << " Number of Hadronic events in Eta bins: " << hadSLHolder.nEvtPerBinEta;
230  edm::LogVerbatim("HcalSim") << " Number of Hadronic events in Phi bins: " << hadSLHolder.nEvtPerBinPhi;
231  edm::LogVerbatim("HcalSim") << " Number of Electromag. events in E bins: " << emSLHolder.nEvtPerBinE;
232  edm::LogVerbatim("HcalSim") << " Number of Electromag. events in Eta bins: " << emSLHolder.nEvtPerBinEta;
233  edm::LogVerbatim("HcalSim") << " Number of Electromag. events in Phi bins: " << emSLHolder.nEvtPerBinPhi;
234  edm::LogVerbatim("HcalSim") << "============================================================================\n";
235 
236  // Initializing the SL collections
239 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< int, std::set< int > > MapOfSecondaries
CastorShowerLibraryInfo * hadInfo
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CastorShowerLibraryInfo * emInfo

◆ ~CastorShowerLibraryMaker()

CastorShowerLibraryMaker::~CastorShowerLibraryMaker ( )
override

Definition at line 284 of file CastorShowerLibraryMaker.cc.

References Finish().

284  {
285  Finish();
286 
287  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: End of process";
288 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ FillShowerEvent()

bool CastorShowerLibraryMaker::FillShowerEvent ( CaloG4HitCollection theCAFI,
CastorShowerEvent shower,
int  ipart 
)
private

Definition at line 1014 of file CastorShowerLibraryMaker.cc.

References mps_fire::end, mps_splice::entry, spr::find(), CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getEntry(), CaloG4Hit::getIncidentEnergy(), CaloG4Hit::getPosition(), CaloG4Hit::getTimeSlice(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), MapOfSecondaries, nHits, CastorNumberingScheme::packIndex(), position, nano_mu_digi_cff::sector, CastorShowerEvent::setDetID(), CastorShowerEvent::setHitPosition(), CastorShowerEvent::setNhit(), CastorShowerEvent::setNphotons(), CastorShowerEvent::setTime(), hcalRecHitTable_cff::time, CastorNumberingScheme::unpackIndex(), verbosity, and ecaldqm::zside().

Referenced by update().

1014  {
1015  unsigned int volumeID = 0;
1016  double en_in_fi = 0.;
1017  //double totalEnergy = 0;
1018 
1019  int nentries = theCAFI->entries();
1020 
1021  // Compute Total Energy in CastorFI volume
1022  /*
1023  for(int ihit = 0; ihit < nentries; ihit++) {
1024  CaloG4Hit* aHit = (*theCAFI)[ihit];
1025  totalEnergy += aHit->getEnergyDeposit();
1026  }
1027 */
1028  if (!shower) {
1029  edm::LogVerbatim("CastorShowerLibraryMaker") << "Error. nullptr pointer to CastorShowerEvent";
1030  return false;
1031  }
1032 
1033  CastorNumberingScheme* theCastorNumScheme = new CastorNumberingScheme();
1034  // Hit position
1037  int nHits;
1038  nHits = 0;
1039  for (int ihit = 0; ihit < nentries; ihit++) {
1040  CaloG4Hit* aHit = (*theCAFI)[ihit];
1041  int hit_particleID = aHit->getTrackID();
1042  if (MapOfSecondaries[ipart].find(hit_particleID) == MapOfSecondaries[ipart].end()) {
1043  if (verbosity)
1044  edm::LogVerbatim("CastorShowerLibraryMaker") << "Skipping hit from trackID " << hit_particleID;
1045  continue;
1046  }
1047  volumeID = aHit->getUnitID();
1048  double hitEnergy = aHit->getEnergyDeposit();
1049  en_in_fi += aHit->getEnergyDeposit();
1050  float time = aHit->getTimeSlice();
1051  int zside, sector, zmodule;
1052  theCastorNumScheme->unpackIndex(volumeID, zside, sector, zmodule);
1053  entry = aHit->getEntry();
1054  position = aHit->getPosition();
1055  if (verbosity)
1056  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n side , sector , module = " << zside << " , " << sector
1057  << " , " << zmodule << "\n nphotons = " << hitEnergy;
1058 
1059  if (verbosity)
1060  edm::LogVerbatim("CastorShowerLibraryMaker")
1061  << "\n packIndex = " << theCastorNumScheme->packIndex(zside, sector, zmodule);
1062 
1063  if (verbosity && time > 100.) {
1064  edm::LogVerbatim("CastorShowerLibraryMaker")
1065  << "\n nentries = " << nentries << "\n time[" << ihit << "] = " << time << "\n trackID[" << ihit
1066  << "] = " << aHit->getTrackID() << "\n volumeID[" << ihit << "] = " << volumeID << "\n nphotons[" << ihit
1067  << "] = " << hitEnergy << "\n side, sector, module = " << zside << ", " << sector << ", " << zmodule
1068  << "\n packIndex " << theCastorNumScheme->packIndex(zside, sector, zmodule) << "\n X,Y,Z = " << entry.x()
1069  << "," << entry.y() << "," << entry.z();
1070  }
1071  if (verbosity)
1072  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Incident Energy = " << aHit->getIncidentEnergy() << " \n";
1073 
1074  // CaloG4Hit information
1075  shower->setDetID(volumeID);
1076  shower->setHitPosition(position);
1077  shower->setNphotons(hitEnergy);
1078  shower->setTime(time);
1079  nHits++;
1080  }
1081  // Write number of hits to CastorShowerEvent instance
1082  if (nHits == 0) {
1083  edm::LogVerbatim("CastorShowerLibraryMaker") << "No hits found for this track (trackID=" << ipart << ").";
1084  if (theCastorNumScheme)
1085  delete theCastorNumScheme;
1086  return false;
1087  }
1088  shower->setNhit(nHits);
1089 
1090  // update the event counters
1091  if (theCastorNumScheme)
1092  delete theCastorNumScheme;
1093  return true;
1094 }
Log< level::Info, true > LogVerbatim
int getTrackID() const
Definition: CaloG4Hit.h:64
void setTime(float t)
void setDetID(unsigned int id)
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static void unpackIndex(const uint32_t &idx, int &z, int &sector, int &zmodule)
std::map< int, std::set< int > > MapOfSecondaries
math::XYZPoint getPosition() const
Definition: CaloG4Hit.h:52
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:46
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double getEnergyDeposit() const
Definition: CaloG4Hit.h:79
uint32_t getUnitID() const
Definition: CaloG4Hit.h:66
static int position[264][3]
Definition: ReadPGInfo.cc:289
double getTimeSlice() const
Definition: CaloG4Hit.h:67
static uint32_t packIndex(int z, int sector, int zmodule)
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
void setNphotons(float np)
double getIncidentEnergy() const
Definition: CaloG4Hit.h:61
void setNhit(unsigned int i)
void setHitPosition(const Point &p)

◆ FindEnergyBin()

int CastorShowerLibraryMaker::FindEnergyBin ( double  e)
private

Definition at line 771 of file CastorShowerLibraryMaker.cc.

References HBHEDarkening_cff::energy, mps_fire::i, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, and SLShowerptr.

Referenced by update().

771  {
772  //
773  // returns the integer index of the energy bin, taken from SLenergies vector
774  // returns -1 if ouside valid range
775  //
776  if (!SLShowerptr) {
777  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindEnergyBin can be called only after BeginOfEvent\n\n";
778  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
779  }
780  const std::vector<double>& SLenergies = SLShowerptr->SLEnergyBins;
781  if (energy >= SLenergies.back())
782  return SLenergies.size() - 1;
783 
784  unsigned int i = 0;
785  for (; i < SLenergies.size() - 1; i++)
786  if (energy >= SLenergies.at(i) && energy < SLenergies.at(i + 1))
787  return (int)i;
788 
789  // now i points to the last but 1 bin
790  if (energy >= SLenergies.at(i))
791  return (int)i;
792  // energy outside bin range
793  return -1;
794 }
Log< level::Info, true > LogVerbatim

◆ FindEtaBin()

int CastorShowerLibraryMaker::FindEtaBin ( double  eta)
private

Definition at line 795 of file CastorShowerLibraryMaker.cc.

References PVValHelper::eta, mps_fire::i, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, and SLShowerptr.

Referenced by update().

795  {
796  //
797  // returns the integer index of the eta bin, taken from SLetas vector
798  // returns -1 if ouside valid range
799  //
800  if (!SLShowerptr) {
801  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindEtaBin can be called only after BeginOfEvent\n\n";
802  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
803  }
804  const std::vector<double>& SLetas = SLShowerptr->SLEtaBins;
805  if (eta >= SLetas.back())
806  return SLetas.size() - 1;
807  unsigned int i = 0;
808  for (; i < SLetas.size() - 1; i++)
809  if (eta >= SLetas.at(i) && eta < SLetas.at(i + 1))
810  return (int)i;
811  // now i points to the last but 1 bin
812  if (eta >= SLetas.at(i))
813  return (int)i;
814  // eta outside bin range
815  return -1;
816 }
Log< level::Info, true > LogVerbatim

◆ FindPhiBin()

int CastorShowerLibraryMaker::FindPhiBin ( double  phi)
private

Definition at line 817 of file CastorShowerLibraryMaker.cc.

References mps_fire::i, phi, CastorShowerLibraryMaker::ShowerLib::SLPhiBins, and SLShowerptr.

Referenced by update().

817  {
818  //
819  // returns the integer index of the phi bin, taken from SLphis vector
820  // returns -1 if ouside valid range
821  //
822  // needs protection in case phi is outside range -pi,pi
823  //
824  if (!SLShowerptr) {
825  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindPhiBin can be called only after BeginOfEvent\n\n";
826  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
827  }
828  const std::vector<double>& SLphis = SLShowerptr->SLPhiBins;
829  if (phi >= SLphis.back())
830  return SLphis.size() - 1;
831  unsigned int i = 0;
832  for (; i < SLphis.size() - 1; i++)
833  if (phi >= SLphis.at(i) && phi < SLphis.at(i + 1))
834  return (int)i;
835  // now i points to the last but 1 bin
836  if (phi >= SLphis.at(i))
837  return (int)i;
838  // phi outside bin range
839  return -1;
840 }
Log< level::Info, true > LogVerbatim

◆ Finish()

void CastorShowerLibraryMaker::Finish ( )
private

Definition at line 756 of file CastorShowerLibraryMaker.cc.

References theFile, and theTree.

Referenced by ~CastorShowerLibraryMaker().

756  {
757  // if (doNTcastorevent) {
758 
759  theFile->cd();
760  theTree->Write("", TObject::kOverwrite);
761  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: Ntuple event written";
762  theFile->Close();
763  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: Event file closed";
764 
765  // Delete pointers to objects, now that TTree has been written and TFile closed
766  // delete info;
767  // delete emShower;
768  // delete hadShower;
769  // }
770 }
Log< level::Info, true > LogVerbatim

◆ GetKinematics() [1/2]

void CastorShowerLibraryMaker::GetKinematics ( G4PrimaryParticle *  thePrim,
double &  px,
double &  py,
double &  pz,
double &  pInit,
double &  eta,
double &  phi 
)
private

Definition at line 887 of file CastorShowerLibraryMaker.cc.

References Matriplex::atan2(), PVValHelper::eta, CrabHelper::log, WZElectronSkims53X_cff::max, SiStripPI::min, phi, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::tan(), and tauSpinnerTable_cfi::theta.

Referenced by update().

888  {
889  px = py = pz = phi = eta = 0.0;
890  if (thePrim == nullptr)
891  return;
892  px = thePrim->GetMomentum().x() / GeV;
893  py = thePrim->GetMomentum().y() / GeV;
894  pz = thePrim->GetMomentum().z() / GeV;
895  pInit = thePrim->GetMomentum().mag() / GeV;
896  //pInit = sqrt(pow(px,2.)+pow(py,2.)+pow(pz,2.));
897  if (pInit == 0)
898  return;
899  double costheta = pz / pInit;
900  double theta = acos(std::min(std::max(costheta, double(-1.)), double(1.)));
901  eta = -log(tan(theta / 2.0));
902  phi = (px == 0 && py == 0) ? 0 : atan2(py, px); // the recommended way of calculating phi
903  phi = thePrim->GetMomentum().phi();
904  //if (px!=0) phi=atan(py/px);
905 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ GetKinematics() [2/2]

void CastorShowerLibraryMaker::GetKinematics ( int  thePrim,
double &  px,
double &  py,
double &  pz,
double &  pInit,
double &  eta,
double &  phi 
)
private

Definition at line 869 of file CastorShowerLibraryMaker.cc.

References Matriplex::atan2(), PVValHelper::eta, CrabHelper::log, WZElectronSkims53X_cff::max, SiStripPI::min, phi, PrimaryMomentum, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::tan(), and tauSpinnerTable_cfi::theta.

870  {
871  if (thePrim == 0)
872  return;
873  if (PrimaryMomentum.find(thePrim) == PrimaryMomentum.end())
874  return;
875  px = PrimaryMomentum[thePrim].x() / GeV;
876  py = PrimaryMomentum[thePrim].y() / GeV;
877  pz = PrimaryMomentum[thePrim].z() / GeV;
878  pInit = PrimaryMomentum[thePrim].mag() / GeV;
879  if (pInit == 0)
880  return;
881  double costheta = pz / pInit;
882  double theta = acos(std::min(std::max(costheta, double(-1.)), double(1.)));
883  eta = -log(tan(theta / 2.0));
884  phi = (px == 0 && py == 0) ? 0 : atan2(py, px); // the recommended way of calculating phi
885  phi = PrimaryMomentum[thePrim].phi();
886 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::map< int, G4ThreeVector > PrimaryMomentum
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ GetMissingEnergy()

void CastorShowerLibraryMaker::GetMissingEnergy ( CaloG4HitCollection theCAFI,
double &  miss_energy,
double &  tot_energy 
)
private

Definition at line 1156 of file CastorShowerLibraryMaker.cc.

References mps_fire::end, spr::find(), mps_fire::i, MapOfSecondaries, TrackingDataMCValidation_Standalone_cff::nhits, WZElectronSkims53X_cff::particleType, and thePrims.

Referenced by update().

1156  {
1157  // Get the total deposited energy and the one from hit not associated to a primary
1158  miss_energy = 0;
1159  tot_energy = 0;
1160  int nhits = theCAFI->entries();
1161  for (int ihit = 0; ihit < nhits; ihit++) {
1162  int id = (*theCAFI)[ihit]->getTrackID();
1163  tot_energy += (*theCAFI)[ihit]->getEnergyDeposit();
1164  int hit_prim = 0;
1165  for (unsigned int i = 0; i < thePrims.size(); i++) {
1166  int particleType = thePrims.at(i)->GetPDGcode();
1168  hit_prim = particleType;
1169  }
1170  if (hit_prim == 0) {
1171  edm::LogVerbatim("HcalSim") << "Track ID " << id << " produced a hit which is not associated with a primary.";
1172  miss_energy += (*theCAFI)[ihit]->getEnergyDeposit();
1173  }
1174  }
1175 }
Log< level::Info, true > LogVerbatim
std::vector< G4PrimaryParticle * > thePrims
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::map< int, std::set< int > > MapOfSecondaries

◆ GetPrimary()

std::vector< G4PrimaryParticle * > CastorShowerLibraryMaker::GetPrimary ( const G4Event *  evt)
private

Definition at line 906 of file CastorShowerLibraryMaker.cc.

References mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, npart, NPGParticle, PGParticleIDs, and thePrims.

Referenced by update().

906  {
907  // Find Primary info:
908  int trackID = 0;
909  std::vector<G4PrimaryParticle*> thePrims;
910  G4PrimaryParticle* thePrim = nullptr;
911  G4int nvertex = evt->GetNumberOfPrimaryVertex();
912  edm::LogVerbatim("CastorShowerLibraryMaker") << "Event has " << nvertex << " vertex";
913  if (nvertex != 1) {
914  edm::LogVerbatim("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: no vertex";
915  return thePrims;
916  }
917 
918  for (int i = 0; i < nvertex; i++) {
919  G4PrimaryVertex* avertex = evt->GetPrimaryVertex(i);
920  if (avertex == nullptr) {
921  edm::LogVerbatim("CastorShowerLibraryMaker")
922  << "CastorShowerLibraryMaker::GetPrimary ERROR: pointer to vertex = 0";
923  continue;
924  }
925  unsigned int npart = avertex->GetNumberOfParticle();
926  if (npart != NPGParticle)
927  continue;
928  for (unsigned int j = 0; j < npart; j++) {
929  unsigned int k = 0;
930  //int test_pID = 0;
931  trackID = j;
932  thePrim = avertex->GetPrimary(trackID);
933  while (k < NPGParticle && PGParticleIDs.at(k++) != thePrim->GetPDGcode()) {
934  ;
935  };
936  if (k > NPGParticle)
937  continue; // ID not found in the requested particles
938  thePrims.push_back(thePrim);
939  }
940  }
941  return thePrims;
942 }
Log< level::Info, true > LogVerbatim
std::vector< G4PrimaryParticle * > thePrims
double npart
Definition: HydjetWrapper.h:48

◆ InitSLHolder()

void CastorShowerLibraryMaker::InitSLHolder ( ShowerLib showerholder)
private

Definition at line 240 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryInfo::Energy, CastorShowerLibraryInfo::Eta, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, l1tHGCalTowerMapProducer_cfi::nBinsEta, l1tPhase1JetProducer_cfi::nBinsPhi, CastorShowerLibraryMaker::ShowerLib::nEvtInBinE, CastorShowerLibraryMaker::ShowerLib::nEvtInBinEta, CastorShowerLibraryMaker::ShowerLib::nEvtInBinPhi, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinPhi, CastorShowerLibraryInfo::Phi, SLBin::setBin(), SLBin::setNBins(), SLBin::setNEvtPerBin(), SLBin::setNEvts(), CastorShowerLibraryMaker::ShowerLib::SLCollection, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, CastorShowerLibraryMaker::ShowerLib::SLInfo, CastorShowerLibraryMaker::ShowerLib::SLPhiBins, and trackerHitRTTI::vector.

Referenced by CastorShowerLibraryMaker().

240  {
241  int nBinsE, nBinsEta, nBinsPhi, nEvtPerBinPhi;
242  nBinsE = showerholder.SLEnergyBins.size();
243  nBinsEta = showerholder.SLEtaBins.size();
244  nBinsPhi = showerholder.SLPhiBins.size();
245  nEvtPerBinPhi = showerholder.nEvtPerBinPhi;
246  //
247  // Info
248  //
249  showerholder.SLInfo.Energy.setNEvts(nEvtPerBinPhi * nBinsPhi * nBinsEta * nBinsE);
250  showerholder.SLInfo.Energy.setNEvtPerBin(nEvtPerBinPhi * nBinsPhi * nBinsEta);
251  showerholder.SLInfo.Energy.setNBins(nBinsE);
252  showerholder.SLInfo.Energy.setBin(showerholder.SLEnergyBins);
253  //
254  showerholder.SLInfo.Eta.setNEvts(nEvtPerBinPhi * nBinsPhi * nBinsEta);
255  showerholder.SLInfo.Eta.setNEvtPerBin(nEvtPerBinPhi * nBinsPhi);
256  showerholder.SLInfo.Eta.setNBins(nBinsEta);
257  showerholder.SLInfo.Eta.setBin(showerholder.SLEtaBins);
258  //
259  showerholder.SLInfo.Phi.setNEvts(nEvtPerBinPhi * nBinsPhi);
260  showerholder.SLInfo.Phi.setNEvtPerBin(nEvtPerBinPhi);
261  showerholder.SLInfo.Phi.setNBins(nBinsPhi);
262  showerholder.SLInfo.Phi.setBin(showerholder.SLPhiBins);
263  //
264  // Shower
265  showerholder.SLCollection.assign(nBinsE, std::vector<std::vector<std::vector<CastorShowerEvent> > >());
266  showerholder.nEvtInBinE.assign(nBinsE, 0);
267  showerholder.nEvtInBinEta.assign(nBinsE, std::vector<int>(0));
268  showerholder.nEvtInBinPhi.assign(nBinsE, std::vector<std::vector<int> >());
269  for (int i = 0; i < nBinsE; i++) {
270  showerholder.SLCollection.at(i).assign(nBinsEta, std::vector<std::vector<CastorShowerEvent> >());
271  showerholder.nEvtInBinEta.at(i).assign(nBinsEta, 0);
272  showerholder.nEvtInBinPhi.at(i).assign(nBinsEta, std::vector<int>(0));
273  for (int j = 0; j < nBinsEta; j++) {
274  showerholder.SLCollection.at(i).at(j).assign(nBinsPhi, std::vector<CastorShowerEvent>());
275  showerholder.nEvtInBinPhi.at(i).at(j).assign(nBinsPhi, 0);
276  for (int k = 0; k < nBinsPhi; k++)
277  showerholder.SLCollection.at(i).at(j).at(k).assign(nEvtPerBinPhi, CastorShowerEvent());
278  }
279  }
280 }

◆ IsSLReady()

bool CastorShowerLibraryMaker::IsSLReady ( )
private

Definition at line 841 of file CastorShowerLibraryMaker.cc.

References DoEmSL, DoHadSL, emSLHolder, hadSLHolder, mps_fire::i, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, SLisEBinFilled(), and SLShowerptr.

Referenced by update().

841  {
842  // at this point, the pointer to the shower library should be nullptr
843  if (SLShowerptr) {
844  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nIsSLReady must be called when a new event starts.\n\n";
845  throw SimG4Exception("\n\nNOT nullptr Pointer to the shower library.\n\n");
846  }
847  // it is enough to check if all the energy bin is filled
848  if (DoEmSL) {
850  for (unsigned int i = 0; i < SLShowerptr->SLEnergyBins.size(); i++) {
851  if (!SLisEBinFilled(i)) {
852  SLShowerptr = nullptr;
853  return false;
854  }
855  }
856  }
857  if (DoHadSL) {
859  for (unsigned int i = 0; i < SLShowerptr->SLEnergyBins.size(); i++) {
860  if (!SLisEBinFilled(i)) {
861  SLShowerptr = nullptr;
862  return false;
863  }
864  }
865  }
866  SLShowerptr = nullptr;
867  return true;
868 }
Log< level::Info, true > LogVerbatim

◆ KillSecondaries()

void CastorShowerLibraryMaker::KillSecondaries ( const G4Step *  step)
private

Definition at line 1145 of file CastorShowerLibraryMaker.cc.

References mps_fire::i, and createfilelist::int.

Referenced by update().

1145  {
1146  const G4TrackVector* p_sec = aStep->GetSecondary();
1147  for (int i = 0; i < int(p_sec->size()); i++) {
1148  edm::LogVerbatim("HcalSim") << "Killing track ID " << p_sec->at(i)->GetTrackID()
1149  << " and its secondaries Produced by Process "
1150  << p_sec->at(i)->GetCreatorProcess()->GetProcessName() << " in the volume "
1151  << aStep->GetTrack()->GetVolume()->GetName();
1152  p_sec->at(i)->SetTrackStatus(fKillTrackAndSecondaries);
1153  }
1154 }
Log< level::Info, true > LogVerbatim

◆ printSLstatus()

void CastorShowerLibraryMaker::printSLstatus ( int  ebin,
int  etabin,
int  phibin 
)
private

Definition at line 943 of file CastorShowerLibraryMaker.cc.

References emSLHolder, hadSLHolder, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, create_idmaps::n, l1tHGCalTowerMapProducer_cfi::nBinsEta, l1tPhase1JetProducer_cfi::nBinsPhi, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, SLisPhiBinFilled(), SLnEvtInBinE(), CastorShowerLibraryMaker::ShowerLib::SLPhiBins, and SLShowerptr.

Referenced by update().

943  {
944  if (!SLShowerptr) {
945  edm::LogVerbatim("CastorShowerLibraryInfo") << "nullptr shower pointer. Printing both";
946  edm::LogVerbatim("HcalSim") << "Electromagnetic";
948  this->printSLstatus(ebin, etabin, phibin);
949  edm::LogVerbatim("HcalSim") << "Hadronic";
951  this->printSLstatus(ebin, etabin, phibin);
952  SLShowerptr = nullptr;
953  return;
954  }
955  int nBinsE = SLShowerptr->SLEnergyBins.size();
956  int nBinsEta = SLShowerptr->SLEtaBins.size();
957  int nBinsPhi = SLShowerptr->SLPhiBins.size();
958  std::vector<double> SLenergies = SLShowerptr->SLEnergyBins;
959  std::ostringstream st1;
960  for (int n = 0; n < 11 + (nBinsEta * nBinsPhi); n++)
961  st1 << "=";
962  edm::LogVerbatim("HcalSim") << st1.str();
963  for (int i = 0; i < nBinsE; i++) {
964  std::ostringstream st1;
965  st1 << "E bin " << std::setw(6) << SLenergies.at(i) << " : ";
966  for (int j = 0; j < nBinsEta; j++) {
967  for (int k = 0; k < nBinsPhi; k++) {
968  (SLisPhiBinFilled(i, j, k)) ? st1 << "1" : st1 << "-";
969  }
970  if (j < nBinsEta - 1)
971  st1 << "|";
972  }
973  st1 << " (" << SLnEvtInBinE(i) << " events)";
974  edm::LogVerbatim("HcalSim") << st1.str();
975  if (ebin != i)
976  continue;
977  std::ostringstream st2;
978  st2 << " ";
979  for (int j = 0; j < nBinsEta; j++) {
980  for (int k = 0; k < nBinsPhi; k++) {
981  (ebin == i && etabin == j && phibin == k) ? st2 << "^" : st2 << " ";
982  }
983  if (j < nBinsEta - 1)
984  st2 << " ";
985  }
986  edm::LogVerbatim("HcalSim") << st2.str();
987  }
988  std::ostringstream st2;
989  for (int n = 0; n < 11 + (nBinsEta * nBinsPhi); n++)
990  st2 << "=";
991  edm::LogVerbatim("HcalSim") << st2.str();
992 }
Log< level::Info, true > LogVerbatim
bool SLisPhiBinFilled(int ebin, int etabin, int phibin)

◆ SLacceptEvent()

bool CastorShowerLibraryMaker::SLacceptEvent ( int  ebin,
int  etabin,
int  phibin 
)
private

Definition at line 993 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, SLisEBinFilled(), SLisEtaBinFilled(), SLisPhiBinFilled(), CastorShowerLibraryMaker::ShowerLib::SLPhiBins, and SLShowerptr.

Referenced by update().

993  {
994  if (SLShowerptr == nullptr) {
995  edm::LogVerbatim("CastorShowerLibraryMaker::SLacceptEvent:") << "Error. nullptr pointer to CastorShowerEvent";
996  return false;
997  }
998  if (ebin < 0 || ebin >= int(SLShowerptr->SLEnergyBins.size()))
999  return false;
1000  if (SLisEBinFilled(ebin))
1001  return false;
1002 
1003  if (etabin < 0 || etabin >= int(SLShowerptr->SLEtaBins.size()))
1004  return false;
1006  return false;
1007 
1008  if (phibin < 0 || phibin >= int(SLShowerptr->SLPhiBins.size()))
1009  return false;
1011  return false;
1012  return true;
1013 }
Log< level::Info, true > LogVerbatim
bool SLisEtaBinFilled(int ebin, int etabin)
bool SLisPhiBinFilled(int ebin, int etabin, int phibin)

◆ SLisEBinFilled()

bool CastorShowerLibraryMaker::SLisEBinFilled ( int  ebin)
private

Definition at line 1118 of file CastorShowerLibraryMaker.cc.

References createfilelist::int, CastorShowerLibraryMaker::ShowerLib::nEvtInBinE, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinE, and SLShowerptr.

Referenced by IsSLReady(), and SLacceptEvent().

1118  {
1119  if (!SLShowerptr) {
1120  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEBinFilled can be called only after BeginOfEvent\n\n";
1121  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1122  }
1124  return false;
1125  return true;
1126 }
Log< level::Info, true > LogVerbatim

◆ SLisEtaBinFilled()

bool CastorShowerLibraryMaker::SLisEtaBinFilled ( int  ebin,
int  etabin 
)
private

Definition at line 1127 of file CastorShowerLibraryMaker.cc.

References createfilelist::int, CastorShowerLibraryMaker::ShowerLib::nEvtInBinEta, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinEta, and SLShowerptr.

Referenced by SLacceptEvent().

1127  {
1128  if (!SLShowerptr) {
1129  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEtaBinFilled can be called only after BeginOfEvent\n\n";
1130  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1131  }
1133  return false;
1134  return true;
1135 }
Log< level::Info, true > LogVerbatim
std::vector< std::vector< int > > nEvtInBinEta

◆ SLisPhiBinFilled()

bool CastorShowerLibraryMaker::SLisPhiBinFilled ( int  ebin,
int  etabin,
int  phibin 
)
private

Definition at line 1136 of file CastorShowerLibraryMaker.cc.

References createfilelist::int, CastorShowerLibraryMaker::ShowerLib::nEvtInBinPhi, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinPhi, and SLShowerptr.

Referenced by printSLstatus(), and SLacceptEvent().

1136  {
1137  if (!SLShowerptr) {
1138  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisPhiBinFilled can be called only after BeginOfEvent\n\n";
1139  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1140  }
1142  return false;
1143  return true;
1144 }
Log< level::Info, true > LogVerbatim
std::vector< std::vector< std::vector< int > > > nEvtInBinPhi

◆ SLnEvtInBinE()

int & CastorShowerLibraryMaker::SLnEvtInBinE ( int  ebin)
private

Definition at line 1095 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryMaker::ShowerLib::nEvtInBinE, and SLShowerptr.

Referenced by printSLstatus(), and update().

1095  {
1096  if (!SLShowerptr) {
1097  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinE can be called only after BeginOfEvent\n\n";
1098  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1099  }
1100  return SLShowerptr->nEvtInBinE.at(ebin);
1101 }
Log< level::Info, true > LogVerbatim

◆ SLnEvtInBinEta()

int & CastorShowerLibraryMaker::SLnEvtInBinEta ( int  ebin,
int  etabin 
)
private

Definition at line 1103 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryMaker::ShowerLib::nEvtInBinEta, and SLShowerptr.

Referenced by update().

1103  {
1104  if (!SLShowerptr) {
1105  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinEta can be called only after BeginOfEvent\n\n";
1106  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1107  }
1108  return SLShowerptr->nEvtInBinEta.at(ebin).at(etabin);
1109 }
Log< level::Info, true > LogVerbatim
std::vector< std::vector< int > > nEvtInBinEta

◆ SLnEvtInBinPhi()

int & CastorShowerLibraryMaker::SLnEvtInBinPhi ( int  ebin,
int  etabin,
int  phibin 
)
private

Definition at line 1111 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryMaker::ShowerLib::nEvtInBinPhi, and SLShowerptr.

Referenced by update().

1111  {
1112  if (!SLShowerptr) {
1113  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinPhi can be called only after BeginOfEvent\n\n";
1114  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1115  }
1116  return SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
1117 }
Log< level::Info, true > LogVerbatim
std::vector< std::vector< std::vector< int > > > nEvtInBinPhi

◆ update() [1/6]

void CastorShowerLibraryMaker::update ( const BeginOfJob )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob *>.

Definition at line 291 of file CastorShowerLibraryMaker.cc.

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

291  {
292  edm::LogVerbatim("HcalSim") << " CastorShowerLibraryMaker::Starting new job ";
293 }
Log< level::Info, true > LogVerbatim

◆ update() [2/6]

void CastorShowerLibraryMaker::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 296 of file CastorShowerLibraryMaker.cc.

References emInfo, emShower, emSLHolder, CastorShowerLibraryInfo::Energy, CastorShowerLibraryInfo::Eta, eventIndex, eventNtFileName, hadInfo, hadShower, hadSLHolder, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinE, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinEta, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinPhi, CastorShowerLibraryInfo::Phi, SLBin::setBin(), SLBin::setNBins(), SLBin::setNEvtPerBin(), SLBin::setNEvts(), CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, CastorShowerLibraryMaker::ShowerLib::SLPhiBins, submitPVValidationJobs::split(), theFile, and theTree.

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

296  {
297  edm::LogVerbatim("HcalSim") << "\nCastorShowerLibraryMaker: Starting Run";
298 
299  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: output event root file created";
300 
301  TString eventfilename = eventNtFileName;
302  theFile = new TFile(eventfilename, "RECREATE");
303  theTree = new TTree("CastorCherenkovPhotons", "Cherenkov Photons");
304 
305  Int_t split = 1;
306  Int_t bsize = 64000;
308  emShower = new CastorShowerEvent();
311  // Create Branchs
312  theTree->Branch("emShowerLibInfo.", "CastorShowerLibraryInfo", &emInfo, bsize, split);
313  theTree->Branch("emParticles.", "CastorShowerEvent", &emShower, bsize, split);
314  theTree->Branch("hadShowerLibInfo.", "CastorShowerLibraryInfo", &hadInfo, bsize, split);
315  theTree->Branch("hadParticles.", "CastorShowerEvent", &hadShower, bsize, split);
316 
317  // set the Info for electromagnetic shower
318  // set the energy bins info
323  // set the eta bins info
328  // set the eta bins info
333  // The same for the hadronic shower
334  // set the energy bins info
339  // set the eta bins info
344  // set the eta bins info
349  // int flag = theTree->GetBranch("CastorShowerLibInfo")->Fill();
350  // Loop on all leaves of this branch to fill Basket buffer.
351  // The function returns the number of bytes committed to the memory basket.
352  // If a write error occurs, the number of bytes returned is -1.
353  // If no data are written, because e.g. the branch is disabled,
354  // the number of bytes returned is 0.
355  // if(flag==-1) {
356  // edm::LogVerbatim("CastorAnalyzer") << " WARNING: Error writing to Branch \"CastorShowerLibInfo\" \n" ;
357  // } else
358  // if(flag==0) {
359  // edm::LogVerbatim("CastorAnalyzer") << " WARNING: No data written to Branch \"CastorShowerLibInfo\" \n" ;
360  // }
361 
362  // Initialize "accounting" variables
363 
364  eventIndex = 0;
365 }
Log< level::Info, true > LogVerbatim
void setNBins(unsigned int n)
void setBin(double val)
void setNEvtPerBin(unsigned int n)
CastorShowerLibraryInfo * hadInfo
CastorShowerLibraryInfo * emInfo
void setNEvts(unsigned int n)

◆ update() [3/6]

void CastorShowerLibraryMaker::update ( const EndOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfRun *>.

Definition at line 686 of file CastorShowerLibraryMaker.cc.

References CastorShowerEvent::Clear(), emInfo, emShower, emSLHolder, hadInfo, hadShower, hadSLHolder, IsSLReady(), WZElectronSkims53X_cff::max, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinE, CastorShowerLibraryMaker::ShowerLib::nEvtPerBinPhi, writedatasetfile::run, CastorShowerLibraryMaker::ShowerLib::SLCollection, CastorShowerLibraryMaker::ShowerLib::SLEnergyBins, CastorShowerLibraryMaker::ShowerLib::SLEtaBins, CastorShowerLibraryMaker::ShowerLib::SLInfo, CastorShowerLibraryMaker::ShowerLib::SLPhiBins, and theTree.

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

686  {
687  // Fill the tree with the collected objects
688  if (!IsSLReady())
689  SimG4Exception("\n\nShower Library NOT READY.\n\n");
690 
691  unsigned int ibine, ibineta, ibinphi, ievt; // indexes for em shower
692  unsigned int jbine, jbineta, jbinphi, jevt; // indexes for had shower
693 
694  ibine = ibineta = ibinphi = ievt = jbine = jbineta = jbinphi = jevt = 0;
695 
696  int nEvtInTree = 0;
697  int nEMevt = emSLHolder.nEvtPerBinE * emSLHolder.SLEnergyBins.size();
698  int nHadevt = hadSLHolder.nEvtPerBinE * hadSLHolder.SLEnergyBins.size();
699  int maxEvtInTree = std::max(nEMevt, nHadevt);
700 
703 
704  while (nEvtInTree < maxEvtInTree) {
705  if (emShower)
706  emShower->Clear();
707  if (hadShower)
708  hadShower->Clear();
709  while (ibine < emSLHolder.SLEnergyBins.size() && nEMevt > 0) {
710  emShower = &(emSLHolder.SLCollection.at(ibine).at(ibineta).at(ibinphi).at(ievt));
711  ievt++;
712  if (ievt == emSLHolder.nEvtPerBinPhi) {
713  ievt = 0;
714  ibinphi++;
715  }
716  if (ibinphi == emSLHolder.SLPhiBins.size()) {
717  ibinphi = 0;
718  ibineta++;
719  }
720  if (ibineta == emSLHolder.SLEtaBins.size()) {
721  ibineta = 0;
722  ibine++;
723  }
724  break;
725  }
726  while (jbine < hadSLHolder.SLEnergyBins.size() && nHadevt > 0) {
727  hadShower = &(hadSLHolder.SLCollection.at(jbine).at(jbineta).at(jbinphi).at(jevt));
728  jevt++;
729  if (jevt == hadSLHolder.nEvtPerBinPhi) {
730  jevt = 0;
731  jbinphi++;
732  }
733  if (jbinphi == hadSLHolder.SLPhiBins.size()) {
734  jbinphi = 0;
735  jbineta++;
736  }
737  if (jbineta == hadSLHolder.SLEtaBins.size()) {
738  jbineta = 0;
739  jbine++;
740  }
741  break;
742  }
743  theTree->Fill();
744  nEvtInTree++;
745  if (nEvtInTree == 1) {
746  theTree->SetBranchStatus("emShowerLibInfo.", false);
747  theTree->SetBranchStatus("hadShowerLibInfo.", false);
748  }
749  }
750  // check if run is nullptr and exit
751  if (run == nullptr)
752  throw SimG4Exception("\n\nNumber of needed trigger events reached in CastorShowerLibraryMaker\n\n");
753 }
void Clear(Option_t *option="") override
CastorShowerLibraryInfo * hadInfo
CastorShowerLibraryInfo * emInfo

◆ update() [4/6]

void CastorShowerLibraryMaker::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 368 of file CastorShowerLibraryMaker.cc.

References accept(), emSLHolder, PVValHelper::eta, eventIndex, FindEnergyBin(), FindEtaBin(), FindPhiBin(), GetKinematics(), GetPrimary(), hadSLHolder, mps_fire::i, InsideCastor, IsSLReady(), MapOfSecondaries, WZElectronSkims53X_cff::particleType, phi, PrimaryMomentum, PrimaryPosition, printSLstatus(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, SLacceptEvent(), SLShowerptr, stepIndex, AlCaHLTBitMon_QueryRunRegistry::string, thePrims, update(), and verbosity.

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

368  {
369  eventIndex++;
370  stepIndex = 0;
371  InsideCastor = false;
372  PrimaryMomentum.clear();
373  PrimaryPosition.clear();
374  int NAccepted = 0;
375  // reset the pointers to the shower objects
376  SLShowerptr = nullptr;
377  MapOfSecondaries.clear();
378  thePrims.clear();
379  G4EventManager* e_mgr = G4EventManager::GetEventManager();
380  if (IsSLReady()) {
381  printSLstatus(-1, -1, -1);
382  update((EndOfRun*)nullptr);
383  return;
384  }
385 
386  thePrims = GetPrimary((*evt)());
387  for (unsigned int i = 0; i < thePrims.size(); i++) {
388  G4PrimaryParticle* thePrim = thePrims.at(i);
389  int particleType = thePrim->GetPDGcode();
390 
391  std::string SLType("");
392  if (particleType == 11) {
394  SLType = "Electromagnetic";
395  } else {
397  SLType = "Hadronic";
398  }
399  double px = 0., py = 0., pz = 0., pInit = 0., eta = 0., phi = 0.;
400  GetKinematics(thePrim, px, py, pz, pInit, eta, phi);
401  int ebin = FindEnergyBin(pInit);
402  int etabin = FindEtaBin(eta);
403  int phibin = FindPhiBin(phi);
404  if (verbosity)
405  edm::LogVerbatim("HcalSim") << "\n========================================================================"
406  << "\nBeginOfEvent: E : " << pInit << "\t bin : " << ebin
407  << "\n Eta : " << eta << "\t bin : " << etabin
408  << "\n Phi : " << phi << "\t bin : " << phibin
409  << "\n========================================================================";
410 
411  if (ebin < 0 || etabin < 0 || phibin < 0)
412  continue;
413  bool accept = false;
414  if (!(SLacceptEvent(ebin, etabin, phibin))) {
415  /*
416 // To increase the chance of a particle arriving at CASTOR inside a not full bin,
417 // check if there is available phase space in the neighboring bins
418  unsigned int ebin_min = std::max(0,ebin-3);
419  unsigned int eta_bin_min = std::max(0,etabin-2);
420  unsigned int eta_bin_max = std::min(etabin,etabin+2);
421  unsigned int phi_bin_min = std::max(0,phibin-2);
422  unsigned int phi_bin_max = std::min(phibin,phibin+2);
423  for(unsigned int i_ebin=ebin_min;i_ebin<=(unsigned int)ebin;i_ebin++) {
424  for (unsigned int i_etabin=eta_bin_min;i_etabin<=eta_bin_max;i_etabin++) {
425  for (unsigned int i_phibin=phi_bin_min;i_phibin<=phi_bin_max;i_phibin++) {
426  if (SLacceptEvent((int)i_ebin,(int)i_etabin,(int)i_phibin)) {accept=true;break;}
427  }
428  if (accept) break;
429  }
430  if (accept) break;
431  }
432 */
433  if (!accept)
434  edm::LogVerbatim("CastorShowerLibraryMaker")
435  << "Event not accepted for ebin=" << ebin << ",etabin=" << etabin << ",phibin=" << phibin;
436  } else {
437  accept = true;
438  }
439  if (accept)
440  NAccepted++;
441  }
442 
443  if (NAccepted == 0) {
444  const_cast<G4Event*>((*evt)())->SetEventAborted();
445  const_cast<G4Event*>((*evt)())->KeepTheEvent((G4bool) false);
446  e_mgr->AbortCurrentEvent();
447  }
448  SLShowerptr = nullptr;
449  //
450  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: Processing Event Number: " << eventIndex;
451 }
Log< level::Info, true > LogVerbatim
std::vector< G4PrimaryParticle * > thePrims
std::map< int, G4ThreeVector > PrimaryPosition
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
std::map< int, std::set< int > > MapOfSecondaries
std::vector< G4PrimaryParticle * > GetPrimary(const G4Event *)
void GetKinematics(G4PrimaryParticle *, double &px, double &py, double &pz, double &pInit, double &eta, double &phi)
std::map< int, G4ThreeVector > PrimaryMomentum
void update(const BeginOfJob *run) override
This routine will be called when the appropriate signal arrives.

◆ update() [5/6]

void CastorShowerLibraryMaker::update ( const EndOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent *>.

Definition at line 557 of file CastorShowerLibraryMaker.cc.

References CastorShowerEvent::Clear(), emSLHolder, PVValHelper::eta, eventIndex, FillShowerEvent(), FindEnergyBin(), FindEtaBin(), FindPhiBin(), GetKinematics(), GetMissingEnergy(), CastorShowerEvent::getNhit(), hadSLHolder, mps_fire::i, CastorShowerLibraryMaker::ShowerLib::nEvtInBinPhi, WZElectronSkims53X_cff::particleType, phi, PrimaryPosition, printSLstatus(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, CastorShowerEvent::setPrimE(), CastorShowerEvent::setPrimEta(), CastorShowerEvent::setPrimPhi(), CastorShowerEvent::setPrimX(), CastorShowerEvent::setPrimY(), CastorShowerEvent::setPrimZ(), SLacceptEvent(), CastorShowerLibraryMaker::ShowerLib::SLCollection, SLnEvtInBinE(), SLnEvtInBinEta(), SLnEvtInBinPhi(), SLShowerptr, AlCaHLTBitMon_QueryRunRegistry::string, thePrims, verbosity, x, y, and z.

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

557  {
558  // check if the job is done!
559  if ((*evt)()->IsAborted()) {
560  edm::LogVerbatim("HcalSim") << "\n========================================================================"
561  << "\nEndOfEvent: EVENT ABORTED"
562  << "\n========================================================================";
563  return;
564  }
565  //DynamicRangeFlatRandomEGunProducer* pgun = edm::DynamicRangeFlatRandomEGunKernel::get_instance();
566  //edm::LogVerbatim("HcalSim") << pgun->EGunMaxE();
567  /*
568  edm::LogVerbatim("HcalSim") << "Minimum energy in Particle Gun : " << pgun->EGunMinE() << "\nMaximum energy in Particle Gun : " << pgun->EGunMaxE();
569 */
570  if (verbosity)
571  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: End of Event: " << eventIndex;
572  // Get the pointer to the primary particle
573  if (thePrims.empty()) {
574  edm::LogVerbatim("CastorShowerLibraryMaker") << "No valid primary particle found. Skipping event";
575  return;
576  }
577  // access to the G4 hit collections
578  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
579  int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI");
580  CaloG4HitCollection* theCAFI = (CaloG4HitCollection*)allHC->GetHC(CAFIid);
581  if (verbosity)
582  edm::LogVerbatim("CastorShowerLibraryMaker") << " update(*evt) --> accessed all HC ";
583  edm::LogVerbatim("CastorShowerLibraryMaker") << "Found " << theCAFI->entries() << " hits in G4HitCollection";
584  if (theCAFI->entries() == 0) {
585  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Empty G4HitCollection";
586  return;
587  }
588 
589  // Loop over primaries
590  int NEvtAccepted = 0;
591  int NHitInEvent = 0;
592  for (unsigned int i = 0; i < thePrims.size(); i++) {
593  G4PrimaryParticle* thePrim = thePrims.at(i);
594  if (!thePrim) {
595  edm::LogVerbatim("CastorShowerLibraryMaker") << "nullptr Pointer to the primary";
596  continue;
597  }
598  // Check primary particle type
599  int particleType = thePrim->GetPDGcode();
600 
601  // set the pointer to the shower collection
602  std::string SLType("");
603  if (particleType == 11) {
605  SLType = "Electromagnetic";
606  } else {
608  SLType = "Hadronic";
609  }
610  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Primary (thePrim) trackID is " << thePrim->GetTrackID() << "\n";
611 
612  // Obtain primary particle's initial momentum (pInit)
613  double px = 0., py = 0., pz = 0., pInit = 0., eta = 0., phi = 0.;
614  GetKinematics(particleType, px, py, pz, pInit, eta, phi);
615  // Check if current event falls into any bin
616  // first: energy
617  if (pInit == 0) {
618  edm::LogVerbatim("CastorShowerLibraryMaker") << "Primary did not hit CASTOR";
619  continue;
620  }
621  int ebin = FindEnergyBin(pInit);
622  int etabin = FindEtaBin(eta);
623  int phibin = FindPhiBin(phi);
624  edm::LogVerbatim("HcalSim") << SLType;
626  if (!SLacceptEvent(ebin, etabin, phibin)) {
627  edm::LogVerbatim("CastorShowerLibraryMaker")
628  << "Event not accepted for ebin=" << ebin << ",etabin=" << etabin << ",phibin=" << phibin << "(" << pInit
629  << "," << eta << "," << phi << ")";
630  continue;
631  }
632  //
633  // event passed. Fill the vector accordingly
634  //
635  // Look for the Hit Collection
636  edm::LogVerbatim("CastorShowerLibraryMaker")
637  << "\n CastorShowerLibraryMaker::update(EndOfEvent * evt) - event #" << (*evt)()->GetEventID();
638 
639  /*
640  edm::LogVerbatim("HcalSim") << "Number of collections : " << allHC->GetNumberOfCollections();
641  for(int ii = 0;ii<allHC->GetNumberOfCollections();ii++)
642  edm::LogVerbatim("HcalSim") << "Name of collection " << ii << " : " << allHC->GetHC(ii)->GetName();
643 */
644 
645  CastorShowerEvent* shower = nullptr;
646  int cur_evt_idx = SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
647  shower = &(SLShowerptr->SLCollection.at(ebin).at(etabin).at(phibin).at(cur_evt_idx));
648 
649  // Get Hit information
650  if (FillShowerEvent(theCAFI, shower, particleType)) {
651  // Primary particle information
652  /*
653  edm::LogVerbatim("CastorShowerLibraryMaker") << "New SL event: Primary = " << particleType << "; Energy = " << pInit << "; Eta = " << eta << "; Phi = " << phi << "; Nhits = " << shower->getNhit();
654 */
655  shower->setPrimE(pInit);
656  shower->setPrimEta(eta);
657  shower->setPrimPhi(phi);
661  SLnEvtInBinE(ebin)++;
664  NHitInEvent += shower->getNhit();
665  NEvtAccepted++;
666  } else {
667  shower->Clear();
668  }
669  }
670  // Check for unassociated energy
671  int thecafi_entries = theCAFI->entries();
672  if (NEvtAccepted == int(thePrims.size()) && thecafi_entries != NHitInEvent) {
673  edm::LogWarning("HcalSim") << "WARNING: Inconsistent Number of Hits -> Hits in collection: " << theCAFI->entries()
674  << " Hits in the showers: " << NHitInEvent;
675  double miss_energy = 0;
676  double tot_energy = 0;
677  GetMissingEnergy(theCAFI, miss_energy, tot_energy);
678  if (miss_energy > 0) {
679  edm::LogVerbatim("HcalSim") << "Total missing energy: " << miss_energy
680  << " for an incident energy: " << tot_energy;
681  }
682  }
683 }
void Clear(Option_t *option="") override
Log< level::Info, true > LogVerbatim
void setPrimEta(float eta)
void setPrimZ(float z)
int & SLnEvtInBinEta(int ebin, int etabin)
void setPrimPhi(float phi)
std::vector< G4PrimaryParticle * > thePrims
bool FillShowerEvent(CaloG4HitCollection *, CastorShowerEvent *, int)
std::map< int, G4ThreeVector > PrimaryPosition
std::vector< std::vector< std::vector< int > > > nEvtInBinPhi
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)
void setPrimX(float x)
int & SLnEvtInBinPhi(int ebin, int etabin, int phibin)
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
Log< level::Warning, false > LogWarning
unsigned int getNhit()

◆ update() [6/6]

void CastorShowerLibraryMaker::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step *>.

Definition at line 454 of file CastorShowerLibraryMaker.cc.

References funct::abs(), funct::cos(), DeActivatePhysicsProcess, mps_fire::i, InsideCastor, createfilelist::int, KillSecondaries(), MapOfSecondaries, MaxEta, MaxPhi, PrimaryMomentum, PrimaryPosition, ValidateTausOnZEEFastSim_cff::proc, alignCSCRings::r, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, and verbosity.

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

454  {
455  static thread_local int CurrentPrimary = 0;
456  G4Track* trk = aStep->GetTrack();
457  int pvec_size;
458  if (trk->GetCurrentStepNumber() == 1) {
459  if (trk->GetParentID() == 0) {
460  CurrentPrimary = (int)trk->GetDynamicParticle()->GetPDGcode();
461  if (CurrentPrimary == 0)
462  SimG4Exception("CastorShowerLibraryMaker::update(G4Step) -> Primary particle undefined");
463  InsideCastor = false;
464  // Deactivate the physics process
466  G4ProcessManager* p_mgr = trk->GetDefinition()->GetProcessManager();
467  G4ProcessVector* pvec = p_mgr->GetProcessList();
468  pvec_size = pvec->size();
469  for (int i = 0; i < pvec_size; i++) {
470  G4VProcess* proc = (*pvec)(i);
471  if (proc->GetProcessName() != "Transportation" && proc->GetProcessName() != "Decay") {
472  edm::LogVerbatim("HcalSim") << "DeActivating process: " << proc->GetProcessName();
473  p_mgr->SetProcessActivation(proc, false);
474  }
475  }
476  }
477  // move track to z of CASTOR
478  G4ThreeVector pos;
479  pos.setZ(-14390);
480  double t = std::abs((pos.z() - trk->GetPosition().z())) / trk->GetVelocity();
481  double r = (pos.z() - trk->GetPosition().z()) / trk->GetMomentum().cosTheta();
482  pos.setX(r * sin(trk->GetMomentum().theta()) * cos(trk->GetMomentum().phi()) + trk->GetPosition().x());
483  pos.setY(r * sin(trk->GetMomentum().theta()) * sin(trk->GetMomentum().phi()) + trk->GetPosition().y());
484  trk->SetPosition(pos);
485  trk->SetGlobalTime(trk->GetGlobalTime() + t);
486  trk->AddTrackLength(r);
487  } else if (!InsideCastor) {
488  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker::update(G4Step) -> Killing spurious track";
489  trk->SetTrackStatus(fKillTrackAndSecondaries);
490  return;
491  }
492  MapOfSecondaries[CurrentPrimary].insert((int)trk->GetTrackID());
493  }
494  // Checks if primary already inside CASTOR
495  std::string CurVolume = trk->GetVolume()->GetName();
496  if (!InsideCastor && (
497  //CurVolume=="C3EF"||CurVolume=="C4EF"||CurVolume=="CAEL"||
498  //CurVolume=="CAHL"||CurVolume=="C3HF"||CurVolume=="C4HF")) {
499  //CurVolume=="CastorB"||
500  CurVolume == "CAST")) {
501  //CurVolume=="CAIR")) {
502  InsideCastor = true;
503  // Activate the physics process
504  if (trk->GetParentID() == 0 && DeActivatePhysicsProcess) {
505  G4ProcessManager* p_mgr = trk->GetDefinition()->GetProcessManager();
506  G4ProcessVector* pvec = p_mgr->GetProcessList();
507  pvec_size = pvec->size();
508  for (int i = 0; i < pvec_size; i++) {
509  G4VProcess* proc = (*pvec)(i);
510  if (proc->GetProcessName() != "Transportation" && proc->GetProcessName() != "Decay") {
511  edm::LogVerbatim("HcalSim") << " Activating process: " << proc->GetProcessName();
512  p_mgr->SetProcessActivation(proc, true);
513  }
514  }
515  }
516  //PrimaryMomentum[CurrentPrimary]=aStep->GetPreStepPoint()->GetMomentum();
517  // check fiducial eta and phi
518  if (trk->GetMomentum().phi() > MaxPhi || trk->GetMomentum().eta() > MaxEta) {
519  trk->SetTrackStatus(fKillTrackAndSecondaries);
520  InsideCastor = false;
521  return;
522  }
523  PrimaryMomentum[CurrentPrimary] = trk->GetMomentum();
524  PrimaryPosition[CurrentPrimary] = trk->GetPosition();
525  KillSecondaries(aStep);
526  return;
527  }
528  // Kill the secondaries if they have been produced before entering castor
529  if (CurrentPrimary != 0 && trk->GetParentID() == 0 && !InsideCastor) {
530  KillSecondaries(aStep);
531  if (verbosity) {
532  double pre_phi = aStep->GetPreStepPoint()->GetMomentum().phi();
533  double cur_phi = trk->GetMomentum().phi();
534  if (pre_phi != cur_phi) {
535  edm::LogVerbatim("HcalSim") << "Primary track phi : " << pre_phi << " changed in current step: " << cur_phi
536  << " by processes:";
537  const G4VProcess* proc = aStep->GetPreStepPoint()->GetProcessDefinedStep();
538  edm::LogVerbatim("HcalSim") << " " << proc->GetProcessName() << " In volume " << CurVolume;
539  }
540  }
541  }
542 
543  //==============================================
544  /*
545 */
546  /*
547  if(aStep->IsFirstStepInVolume()) {
548  edm::LogVerbatim("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::update(const G4Step * aStep):"
549  << "\n IsFirstStepInVolume , "
550  << "time = " << aStep->GetTrack()->GetGlobalTime() ;
551  }
552  stepIndex++;
553 */
554 }
Log< level::Info, true > LogVerbatim
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::map< int, G4ThreeVector > PrimaryPosition
void KillSecondaries(const G4Step *step)
std::map< int, std::set< int > > MapOfSecondaries
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< int, G4ThreeVector > PrimaryMomentum

Member Data Documentation

◆ DeActivatePhysicsProcess

bool CastorShowerLibraryMaker::DeActivatePhysicsProcess
private

Definition at line 133 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ DoEmSL

bool CastorShowerLibraryMaker::DoEmSL
private

Definition at line 131 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and IsSLReady().

◆ DoHadSL

bool CastorShowerLibraryMaker::DoHadSL
private

Definition at line 130 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and IsSLReady().

◆ emInfo

CastorShowerLibraryInfo* CastorShowerLibraryMaker::emInfo
private

Definition at line 137 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ emShower

CastorShowerEvent* CastorShowerLibraryMaker::emShower
private

Definition at line 139 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ emSLHolder

ShowerLib CastorShowerLibraryMaker::emSLHolder
private

◆ eventIndex

int CastorShowerLibraryMaker::eventIndex
private

Definition at line 178 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ eventNtFileName

std::string CastorShowerLibraryMaker::eventNtFileName
private

Definition at line 126 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ hadInfo

CastorShowerLibraryInfo* CastorShowerLibraryMaker::hadInfo
private

Definition at line 138 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ hadShower

CastorShowerEvent* CastorShowerLibraryMaker::hadShower
private

Definition at line 140 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ hadSLHolder

ShowerLib CastorShowerLibraryMaker::hadSLHolder
private

◆ InsideCastor

bool CastorShowerLibraryMaker::InsideCastor
private

Definition at line 132 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ MapOfSecondaries

std::map<int, std::set<int> > CastorShowerLibraryMaker::MapOfSecondaries
private

◆ MaxEta

double CastorShowerLibraryMaker::MaxEta
private

Definition at line 149 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ MaxPhi

double CastorShowerLibraryMaker::MaxPhi
private

Definition at line 150 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ NPGParticle

unsigned int CastorShowerLibraryMaker::NPGParticle
private

Definition at line 128 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and GetPrimary().

◆ PGParticleIDs

std::vector<int> CastorShowerLibraryMaker::PGParticleIDs
private

Definition at line 129 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and GetPrimary().

◆ PrimaryMomentum

std::map<int, G4ThreeVector> CastorShowerLibraryMaker::PrimaryMomentum
private

Definition at line 147 of file CastorShowerLibraryMaker.cc.

Referenced by GetKinematics(), and update().

◆ PrimaryPosition

std::map<int, G4ThreeVector> CastorShowerLibraryMaker::PrimaryPosition
private

Definition at line 148 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ SLShowerptr

ShowerLib* CastorShowerLibraryMaker::SLShowerptr
private

◆ stepIndex

int CastorShowerLibraryMaker::stepIndex
private

Definition at line 179 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ theFile

TFile* CastorShowerLibraryMaker::theFile
private

Definition at line 175 of file CastorShowerLibraryMaker.cc.

Referenced by Finish(), and update().

◆ thePrims

std::vector<G4PrimaryParticle*> CastorShowerLibraryMaker::thePrims
private

Definition at line 134 of file CastorShowerLibraryMaker.cc.

Referenced by GetMissingEnergy(), GetPrimary(), and update().

◆ theTree

TTree* CastorShowerLibraryMaker::theTree
private

Definition at line 176 of file CastorShowerLibraryMaker.cc.

Referenced by Finish(), and update().

◆ verbosity

int CastorShowerLibraryMaker::verbosity
private

Definition at line 125 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), FillShowerEvent(), and update().