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 85 of file CastorShowerLibraryMaker.cc.

Member Typedef Documentation

◆ ebin

typedef int CastorShowerLibraryMaker::ebin
private

Definition at line 97 of file CastorShowerLibraryMaker.cc.

◆ etabin

typedef int CastorShowerLibraryMaker::etabin
private

Definition at line 98 of file CastorShowerLibraryMaker.cc.

◆ phibin

typedef int CastorShowerLibraryMaker::phibin
private

Definition at line 99 of file CastorShowerLibraryMaker.cc.

Constructor & Destructor Documentation

◆ CastorShowerLibraryMaker()

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

Definition at line 184 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.

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

References Finish().

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

Member Function Documentation

◆ FillShowerEvent()

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

Definition at line 1035 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, hgcalTBTopologyTester_cfi::sector, CastorShowerEvent::setDetID(), CastorShowerEvent::setHitPosition(), CastorShowerEvent::setNhit(), CastorShowerEvent::setNphotons(), CastorShowerEvent::setTime(), protons_cff::time, CastorNumberingScheme::unpackIndex(), verbosity, and ecaldqm::zside().

Referenced by update().

1035  {
1036  unsigned int volumeID = 0;
1037  double en_in_fi = 0.;
1038  //double totalEnergy = 0;
1039 
1040  int nentries = theCAFI->entries();
1041 
1042  // Compute Total Energy in CastorFI volume
1043  /*
1044  for(int ihit = 0; ihit < nentries; ihit++) {
1045  CaloG4Hit* aHit = (*theCAFI)[ihit];
1046  totalEnergy += aHit->getEnergyDeposit();
1047  }
1048 */
1049  if (!shower) {
1050  edm::LogVerbatim("CastorShowerLibraryMaker") << "Error. nullptr pointer to CastorShowerEvent";
1051  return false;
1052  }
1053 
1054  CastorNumberingScheme* theCastorNumScheme = new CastorNumberingScheme();
1055  // Hit position
1058  int nHits;
1059  nHits = 0;
1060  for (int ihit = 0; ihit < nentries; ihit++) {
1061  CaloG4Hit* aHit = (*theCAFI)[ihit];
1062  int hit_particleID = aHit->getTrackID();
1063  if (MapOfSecondaries[ipart].find(hit_particleID) == MapOfSecondaries[ipart].end()) {
1064  if (verbosity)
1065  edm::LogVerbatim("CastorShowerLibraryMaker") << "Skipping hit from trackID " << hit_particleID;
1066  continue;
1067  }
1068  volumeID = aHit->getUnitID();
1069  double hitEnergy = aHit->getEnergyDeposit();
1070  en_in_fi += aHit->getEnergyDeposit();
1071  float time = aHit->getTimeSlice();
1072  int zside, sector, zmodule;
1073  theCastorNumScheme->unpackIndex(volumeID, zside, sector, zmodule);
1074  entry = aHit->getEntry();
1075  position = aHit->getPosition();
1076  if (verbosity)
1077  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n side , sector , module = " << zside << " , " << sector
1078  << " , " << zmodule << "\n nphotons = " << hitEnergy;
1079 
1080  if (verbosity)
1081  edm::LogVerbatim("CastorShowerLibraryMaker")
1082  << "\n packIndex = " << theCastorNumScheme->packIndex(zside, sector, zmodule);
1083 
1084  if (verbosity && time > 100.) {
1085  edm::LogVerbatim("CastorShowerLibraryMaker")
1086  << "\n nentries = " << nentries << "\n time[" << ihit << "] = " << time << "\n trackID[" << ihit
1087  << "] = " << aHit->getTrackID() << "\n volumeID[" << ihit << "] = " << volumeID << "\n nphotons[" << ihit
1088  << "] = " << hitEnergy << "\n side, sector, module = " << zside << ", " << sector << ", " << zmodule
1089  << "\n packIndex " << theCastorNumScheme->packIndex(zside, sector, zmodule) << "\n X,Y,Z = " << entry.x()
1090  << "," << entry.y() << "," << entry.z();
1091  }
1092  if (verbosity)
1093  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Incident Energy = " << aHit->getIncidentEnergy() << " \n";
1094 
1095  // CaloG4Hit information
1096  shower->setDetID(volumeID);
1097  shower->setHitPosition(position);
1098  shower->setNphotons(hitEnergy);
1099  shower->setTime(time);
1100  nHits++;
1101  }
1102  // Write number of hits to CastorShowerEvent instance
1103  if (nHits == 0) {
1104  edm::LogVerbatim("CastorShowerLibraryMaker") << "No hits found for this track (trackID=" << ipart << ").";
1105  if (theCastorNumScheme)
1106  delete theCastorNumScheme;
1107  return false;
1108  }
1109  shower->setNhit(nHits);
1110 
1111  // update the event counters
1112  if (theCastorNumScheme)
1113  delete theCastorNumScheme;
1114  return true;
1115 }
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 792 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

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

◆ FindEtaBin()

int CastorShowerLibraryMaker::FindEtaBin ( double  eta)
private

Definition at line 816 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

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

◆ FindPhiBin()

int CastorShowerLibraryMaker::FindPhiBin ( double  phi)
private

Definition at line 838 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

838  {
839  //
840  // returns the integer index of the phi bin, taken from SLphis vector
841  // returns -1 if ouside valid range
842  //
843  // needs protection in case phi is outside range -pi,pi
844  //
845  if (!SLShowerptr) {
846  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nFindPhiBin can be called only after BeginOfEvent\n\n";
847  throw SimG4Exception("\n\nnullptr Pointer to the shower library.\n\n");
848  }
849  const std::vector<double>& SLphis = SLShowerptr->SLPhiBins;
850  if (phi >= SLphis.back())
851  return SLphis.size() - 1;
852  unsigned int i = 0;
853  for (; i < SLphis.size() - 1; i++)
854  if (phi >= SLphis.at(i) && phi < SLphis.at(i + 1))
855  return (int)i;
856  // now i points to the last but 1 bin
857  if (phi >= SLphis.at(i))
858  return (int)i;
859  // phi outside bin range
860  return -1;
861 }
Log< level::Info, true > LogVerbatim

◆ Finish()

void CastorShowerLibraryMaker::Finish ( )
private

Definition at line 777 of file CastorShowerLibraryMaker.cc.

References theFile, and theTree.

Referenced by ~CastorShowerLibraryMaker().

777  {
778  // if (doNTcastorevent) {
779 
780  theFile->cd();
781  theTree->Write("", TObject::kOverwrite);
782  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: Ntuple event written";
783  theFile->Close();
784  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: Event file closed";
785 
786  // Delete pointers to objects, now that TTree has been written and TFile closed
787  // delete info;
788  // delete emShower;
789  // delete hadShower;
790  // }
791 }
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 908 of file CastorShowerLibraryMaker.cc.

References PVValHelper::eta, dqm-mbProfile::log, SiStripPI::max, SiStripPI::min, phi, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::tan(), and theta().

Referenced by update().

909  {
910  px = py = pz = phi = eta = 0.0;
911  if (thePrim == nullptr)
912  return;
913  px = thePrim->GetMomentum().x() / GeV;
914  py = thePrim->GetMomentum().y() / GeV;
915  pz = thePrim->GetMomentum().z() / GeV;
916  pInit = thePrim->GetMomentum().mag() / GeV;
917  //pInit = sqrt(pow(px,2.)+pow(py,2.)+pow(pz,2.));
918  if (pInit == 0)
919  return;
920  double costheta = pz / pInit;
921  double theta = acos(std::min(std::max(costheta, double(-1.)), double(1.)));
922  eta = -log(tan(theta / 2.0));
923  phi = (px == 0 && py == 0) ? 0 : atan2(py, px); // the recommended way of calculating phi
924  phi = thePrim->GetMomentum().phi();
925  //if (px!=0) phi=atan(py/px);
926 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Geom::Theta< T > theta() const

◆ GetKinematics() [2/2]

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

Definition at line 890 of file CastorShowerLibraryMaker.cc.

References PVValHelper::eta, dqm-mbProfile::log, SiStripPI::max, SiStripPI::min, phi, PrimaryMomentum, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::tan(), and theta().

891  {
892  if (thePrim == 0)
893  return;
894  if (PrimaryMomentum.find(thePrim) == PrimaryMomentum.end())
895  return;
896  px = PrimaryMomentum[thePrim].x() / GeV;
897  py = PrimaryMomentum[thePrim].y() / GeV;
898  pz = PrimaryMomentum[thePrim].z() / GeV;
899  pInit = PrimaryMomentum[thePrim].mag() / GeV;
900  if (pInit == 0)
901  return;
902  double costheta = pz / pInit;
903  double theta = acos(std::min(std::max(costheta, double(-1.)), double(1.)));
904  eta = -log(tan(theta / 2.0));
905  phi = (px == 0 && py == 0) ? 0 : atan2(py, px); // the recommended way of calculating phi
906  phi = PrimaryMomentum[thePrim].phi();
907 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::map< int, G4ThreeVector > PrimaryMomentum
Geom::Theta< T > theta() const

◆ GetMissingEnergy()

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

Definition at line 1177 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

1177  {
1178  // Get the total deposited energy and the one from hit not associated to a primary
1179  miss_energy = 0;
1180  tot_energy = 0;
1181  int nhits = theCAFI->entries();
1182  for (int ihit = 0; ihit < nhits; ihit++) {
1183  int id = (*theCAFI)[ihit]->getTrackID();
1184  tot_energy += (*theCAFI)[ihit]->getEnergyDeposit();
1185  int hit_prim = 0;
1186  for (unsigned int i = 0; i < thePrims.size(); i++) {
1187  int particleType = thePrims.at(i)->GetPDGcode();
1189  hit_prim = particleType;
1190  }
1191  if (hit_prim == 0) {
1192  edm::LogVerbatim("HcalSim") << "Track ID " << id << " produced a hit which is not associated with a primary.";
1193  miss_energy += (*theCAFI)[ihit]->getEnergyDeposit();
1194  }
1195  }
1196 }
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 927 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

927  {
928  // Find Primary info:
929  int trackID = 0;
930  std::vector<G4PrimaryParticle*> thePrims;
931  G4PrimaryParticle* thePrim = nullptr;
932  G4int nvertex = evt->GetNumberOfPrimaryVertex();
933  edm::LogVerbatim("CastorShowerLibraryMaker") << "Event has " << nvertex << " vertex";
934  if (nvertex != 1) {
935  edm::LogVerbatim("CastorShowerLibraryMaker") << "CastorShowerLibraryMaker::GetPrimary ERROR: no vertex";
936  return thePrims;
937  }
938 
939  for (int i = 0; i < nvertex; i++) {
940  G4PrimaryVertex* avertex = evt->GetPrimaryVertex(i);
941  if (avertex == nullptr) {
942  edm::LogVerbatim("CastorShowerLibraryMaker")
943  << "CastorShowerLibraryMaker::GetPrimary ERROR: pointer to vertex = 0";
944  continue;
945  }
946  unsigned int npart = avertex->GetNumberOfParticle();
947  if (npart != NPGParticle)
948  continue;
949  for (unsigned int j = 0; j < npart; j++) {
950  unsigned int k = 0;
951  //int test_pID = 0;
952  trackID = j;
953  thePrim = avertex->GetPrimary(trackID);
954  while (k < NPGParticle && PGParticleIDs.at(k++) != thePrim->GetPDGcode()) {
955  ;
956  };
957  if (k > NPGParticle)
958  continue; // ID not found in the requested particles
959  thePrims.push_back(thePrim);
960  }
961  }
962  return thePrims;
963 }
Log< level::Info, true > LogVerbatim
std::vector< G4PrimaryParticle * > thePrims
double npart
Definition: HydjetWrapper.h:46

◆ InitSLHolder()

void CastorShowerLibraryMaker::InitSLHolder ( ShowerLib showerholder)
private

Definition at line 242 of file CastorShowerLibraryMaker.cc.

References CastorShowerLibraryInfo::Energy, CastorShowerLibraryInfo::Eta, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, l1tHGCalTowerMapProducer_cfi::nBinsEta, l1tSlwPFPuppiJets_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().

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

◆ IsSLReady()

bool CastorShowerLibraryMaker::IsSLReady ( )
private

Definition at line 862 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

862  {
863  // at this point, the pointer to the shower library should be nullptr
864  if (SLShowerptr) {
865  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nIsSLReady must be called when a new event starts.\n\n";
866  throw SimG4Exception("\n\nNOT nullptr Pointer to the shower library.\n\n");
867  }
868  // it is enough to check if all the energy bin is filled
869  if (DoEmSL) {
871  for (unsigned int i = 0; i < SLShowerptr->SLEnergyBins.size(); i++) {
872  if (!SLisEBinFilled(i)) {
873  SLShowerptr = nullptr;
874  return false;
875  }
876  }
877  }
878  if (DoHadSL) {
880  for (unsigned int i = 0; i < SLShowerptr->SLEnergyBins.size(); i++) {
881  if (!SLisEBinFilled(i)) {
882  SLShowerptr = nullptr;
883  return false;
884  }
885  }
886  }
887  SLShowerptr = nullptr;
888  return true;
889 }
Log< level::Info, true > LogVerbatim

◆ KillSecondaries()

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

Definition at line 1166 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

1166  {
1167  const G4TrackVector* p_sec = aStep->GetSecondary();
1168  for (int i = 0; i < int(p_sec->size()); i++) {
1169  edm::LogVerbatim("HcalSim") << "Killing track ID " << p_sec->at(i)->GetTrackID()
1170  << " and its secondaries Produced by Process "
1171  << p_sec->at(i)->GetCreatorProcess()->GetProcessName() << " in the volume "
1172  << aStep->GetTrack()->GetVolume()->GetName();
1173  p_sec->at(i)->SetTrackStatus(fKillTrackAndSecondaries);
1174  }
1175 }
Log< level::Info, true > LogVerbatim

◆ printSLstatus()

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

Definition at line 964 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

964  {
965  if (!SLShowerptr) {
966  edm::LogVerbatim("CastorShowerLibraryInfo") << "nullptr shower pointer. Printing both";
967  edm::LogVerbatim("HcalSim") << "Electromagnetic";
969  this->printSLstatus(ebin, etabin, phibin);
970  edm::LogVerbatim("HcalSim") << "Hadronic";
972  this->printSLstatus(ebin, etabin, phibin);
973  SLShowerptr = nullptr;
974  return;
975  }
976  int nBinsE = SLShowerptr->SLEnergyBins.size();
977  int nBinsEta = SLShowerptr->SLEtaBins.size();
978  int nBinsPhi = SLShowerptr->SLPhiBins.size();
979  std::vector<double> SLenergies = SLShowerptr->SLEnergyBins;
980  std::ostringstream st1;
981  for (int n = 0; n < 11 + (nBinsEta * nBinsPhi); n++)
982  st1 << "=";
983  edm::LogVerbatim("HcalSim") << st1.str();
984  for (int i = 0; i < nBinsE; i++) {
985  std::ostringstream st1;
986  st1 << "E bin " << std::setw(6) << SLenergies.at(i) << " : ";
987  for (int j = 0; j < nBinsEta; j++) {
988  for (int k = 0; k < nBinsPhi; k++) {
989  (SLisPhiBinFilled(i, j, k)) ? st1 << "1" : st1 << "-";
990  }
991  if (j < nBinsEta - 1)
992  st1 << "|";
993  }
994  st1 << " (" << SLnEvtInBinE(i) << " events)";
995  edm::LogVerbatim("HcalSim") << st1.str();
996  if (ebin != i)
997  continue;
998  std::ostringstream st2;
999  st2 << " ";
1000  for (int j = 0; j < nBinsEta; j++) {
1001  for (int k = 0; k < nBinsPhi; k++) {
1002  (ebin == i && etabin == j && phibin == k) ? st2 << "^" : st2 << " ";
1003  }
1004  if (j < nBinsEta - 1)
1005  st2 << " ";
1006  }
1007  edm::LogVerbatim("HcalSim") << st2.str();
1008  }
1009  std::ostringstream st2;
1010  for (int n = 0; n < 11 + (nBinsEta * nBinsPhi); n++)
1011  st2 << "=";
1012  edm::LogVerbatim("HcalSim") << st2.str();
1013 }
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 1014 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

1014  {
1015  if (SLShowerptr == nullptr) {
1016  edm::LogVerbatim("CastorShowerLibraryMaker::SLacceptEvent:") << "Error. nullptr pointer to CastorShowerEvent";
1017  return false;
1018  }
1019  if (ebin < 0 || ebin >= int(SLShowerptr->SLEnergyBins.size()))
1020  return false;
1021  if (SLisEBinFilled(ebin))
1022  return false;
1023 
1024  if (etabin < 0 || etabin >= int(SLShowerptr->SLEtaBins.size()))
1025  return false;
1027  return false;
1028 
1029  if (phibin < 0 || phibin >= int(SLShowerptr->SLPhiBins.size()))
1030  return false;
1032  return false;
1033  return true;
1034 }
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 1139 of file CastorShowerLibraryMaker.cc.

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

Referenced by IsSLReady(), and SLacceptEvent().

1139  {
1140  if (!SLShowerptr) {
1141  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEBinFilled can be called only after BeginOfEvent\n\n";
1142  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1143  }
1145  return false;
1146  return true;
1147 }
Log< level::Info, true > LogVerbatim

◆ SLisEtaBinFilled()

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

Definition at line 1148 of file CastorShowerLibraryMaker.cc.

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

Referenced by SLacceptEvent().

1148  {
1149  if (!SLShowerptr) {
1150  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisEtaBinFilled can be called only after BeginOfEvent\n\n";
1151  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1152  }
1154  return false;
1155  return true;
1156 }
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 1157 of file CastorShowerLibraryMaker.cc.

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

Referenced by printSLstatus(), and SLacceptEvent().

1157  {
1158  if (!SLShowerptr) {
1159  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLisPhiBinFilled can be called only after BeginOfEvent\n\n";
1160  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1161  }
1163  return false;
1164  return true;
1165 }
Log< level::Info, true > LogVerbatim
std::vector< std::vector< std::vector< int > > > nEvtInBinPhi

◆ SLnEvtInBinE()

int & CastorShowerLibraryMaker::SLnEvtInBinE ( int  ebin)
private

Definition at line 1116 of file CastorShowerLibraryMaker.cc.

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

Referenced by printSLstatus(), and update().

1116  {
1117  if (!SLShowerptr) {
1118  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinE can be called only after BeginOfEvent\n\n";
1119  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1120  }
1121  return SLShowerptr->nEvtInBinE.at(ebin);
1122 }
Log< level::Info, true > LogVerbatim

◆ SLnEvtInBinEta()

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

Definition at line 1124 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

1124  {
1125  if (!SLShowerptr) {
1126  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinEta can be called only after BeginOfEvent\n\n";
1127  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1128  }
1129  return SLShowerptr->nEvtInBinEta.at(ebin).at(etabin);
1130 }
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 1132 of file CastorShowerLibraryMaker.cc.

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

Referenced by update().

1132  {
1133  if (!SLShowerptr) {
1134  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n\nSLnEvtInBinPhi can be called only after BeginOfEvent\n\n";
1135  throw SimG4Exception("\n\nnullptr Pointer to the shower library.");
1136  }
1137  return SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
1138 }
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 293 of file CastorShowerLibraryMaker.cc.

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

293  {
294  edm::LogVerbatim("HcalSim") << " CastorShowerLibraryMaker::Starting new job ";
295 }
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 298 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().

298  {
299  edm::LogVerbatim("HcalSim") << "\nCastorShowerLibraryMaker: Starting Run";
300 
301  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: output event root file created";
302 
303  TString eventfilename = eventNtFileName;
304  theFile = new TFile(eventfilename, "RECREATE");
305  theTree = new TTree("CastorCherenkovPhotons", "Cherenkov Photons");
306 
307  Int_t split = 1;
308  Int_t bsize = 64000;
310  emShower = new CastorShowerEvent();
313  // Create Branchs
314  theTree->Branch("emShowerLibInfo.", "CastorShowerLibraryInfo", &emInfo, bsize, split);
315  theTree->Branch("emParticles.", "CastorShowerEvent", &emShower, bsize, split);
316  theTree->Branch("hadShowerLibInfo.", "CastorShowerLibraryInfo", &hadInfo, bsize, split);
317  theTree->Branch("hadParticles.", "CastorShowerEvent", &hadShower, bsize, split);
318 
319  // set the Info for electromagnetic shower
320  // set the energy bins info
325  // set the eta bins info
330  // set the eta bins info
335  // The same for the hadronic shower
336  // set the energy bins info
341  // set the eta bins info
346  // set the eta bins info
351  // int flag = theTree->GetBranch("CastorShowerLibInfo")->Fill();
352  // Loop on all leaves of this branch to fill Basket buffer.
353  // The function returns the number of bytes committed to the memory basket.
354  // If a write error occurs, the number of bytes returned is -1.
355  // If no data are written, because e.g. the branch is disabled,
356  // the number of bytes returned is 0.
357  // if(flag==-1) {
358  // edm::LogVerbatim("CastorAnalyzer") << " WARNING: Error writing to Branch \"CastorShowerLibInfo\" \n" ;
359  // } else
360  // if(flag==0) {
361  // edm::LogVerbatim("CastorAnalyzer") << " WARNING: No data written to Branch \"CastorShowerLibInfo\" \n" ;
362  // }
363 
364  // Initialize "accounting" variables
365 
366  eventIndex = 0;
367 }
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 707 of file CastorShowerLibraryMaker.cc.

References CastorShowerEvent::Clear(), emInfo, emShower, emSLHolder, hadInfo, hadShower, hadSLHolder, IsSLReady(), SiStripPI::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().

707  {
708  // Fill the tree with the collected objects
709  if (!IsSLReady())
710  SimG4Exception("\n\nShower Library NOT READY.\n\n");
711 
712  unsigned int ibine, ibineta, ibinphi, ievt; // indexes for em shower
713  unsigned int jbine, jbineta, jbinphi, jevt; // indexes for had shower
714 
715  ibine = ibineta = ibinphi = ievt = jbine = jbineta = jbinphi = jevt = 0;
716 
717  int nEvtInTree = 0;
718  int nEMevt = emSLHolder.nEvtPerBinE * emSLHolder.SLEnergyBins.size();
719  int nHadevt = hadSLHolder.nEvtPerBinE * hadSLHolder.SLEnergyBins.size();
720  int maxEvtInTree = std::max(nEMevt, nHadevt);
721 
724 
725  while (nEvtInTree < maxEvtInTree) {
726  if (emShower)
727  emShower->Clear();
728  if (hadShower)
729  hadShower->Clear();
730  while (ibine < emSLHolder.SLEnergyBins.size() && nEMevt > 0) {
731  emShower = &(emSLHolder.SLCollection.at(ibine).at(ibineta).at(ibinphi).at(ievt));
732  ievt++;
733  if (ievt == emSLHolder.nEvtPerBinPhi) {
734  ievt = 0;
735  ibinphi++;
736  }
737  if (ibinphi == emSLHolder.SLPhiBins.size()) {
738  ibinphi = 0;
739  ibineta++;
740  }
741  if (ibineta == emSLHolder.SLEtaBins.size()) {
742  ibineta = 0;
743  ibine++;
744  }
745  break;
746  }
747  while (jbine < hadSLHolder.SLEnergyBins.size() && nHadevt > 0) {
748  hadShower = &(hadSLHolder.SLCollection.at(jbine).at(jbineta).at(jbinphi).at(jevt));
749  jevt++;
750  if (jevt == hadSLHolder.nEvtPerBinPhi) {
751  jevt = 0;
752  jbinphi++;
753  }
754  if (jbinphi == hadSLHolder.SLPhiBins.size()) {
755  jbinphi = 0;
756  jbineta++;
757  }
758  if (jbineta == hadSLHolder.SLEtaBins.size()) {
759  jbineta = 0;
760  jbine++;
761  }
762  break;
763  }
764  theTree->Fill();
765  nEvtInTree++;
766  if (nEvtInTree == 1) {
767  theTree->SetBranchStatus("emShowerLibInfo.", false);
768  theTree->SetBranchStatus("hadShowerLibInfo.", false);
769  }
770  }
771  // check if run is nullptr and exit
772  if (run == nullptr)
773  throw SimG4Exception("\n\nNumber of needed trigger events reached in CastorShowerLibraryMaker\n\n");
774 }
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 370 of file CastorShowerLibraryMaker.cc.

References accept(), emSLHolder, PVValHelper::eta, eventIndex, FindEnergyBin(), FindEtaBin(), FindPhiBin(), GetKinematics(), GetPrimary(), hadSLHolder, mps_fire::i, InsideCastor, IsSLReady(), MapOfSecondaries, PbPb_ZMuSkimMuonDPG_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().

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

559  {
560  // check if the job is done!
561  if ((*evt)()->IsAborted()) {
562  edm::LogVerbatim("HcalSim") << "\n========================================================================"
563  << "\nEndOfEvent: EVENT ABORTED"
564  << "\n========================================================================";
565  return;
566  }
567  //DynamicRangeFlatRandomEGunProducer* pgun = edm::DynamicRangeFlatRandomEGunKernel::get_instance();
568  //edm::LogVerbatim("HcalSim") << pgun->EGunMaxE();
569  /*
570  edm::LogVerbatim("HcalSim") << "Minimum energy in Particle Gun : " << pgun->EGunMinE() << "\nMaximum energy in Particle Gun : " << pgun->EGunMaxE();
571 */
572  if (verbosity)
573  edm::LogVerbatim("HcalSim") << "CastorShowerLibraryMaker: End of Event: " << eventIndex;
574  // Get the pointer to the primary particle
575  if (thePrims.empty()) {
576  edm::LogVerbatim("CastorShowerLibraryMaker") << "No valid primary particle found. Skipping event";
577  return;
578  }
579  // access to the G4 hit collections
580  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
581  int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("CastorFI");
582  CaloG4HitCollection* theCAFI = (CaloG4HitCollection*)allHC->GetHC(CAFIid);
583  if (verbosity)
584  edm::LogVerbatim("CastorShowerLibraryMaker") << " update(*evt) --> accessed all HC ";
585  edm::LogVerbatim("CastorShowerLibraryMaker") << "Found " << theCAFI->entries() << " hits in G4HitCollection";
586  if (theCAFI->entries() == 0) {
587  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Empty G4HitCollection";
588  return;
589  }
590 
591  // Loop over primaries
592  int NEvtAccepted = 0;
593  int NHitInEvent = 0;
594  for (unsigned int i = 0; i < thePrims.size(); i++) {
595  G4PrimaryParticle* thePrim = thePrims.at(i);
596  if (!thePrim) {
597  edm::LogVerbatim("CastorShowerLibraryMaker") << "nullptr Pointer to the primary";
598  continue;
599  }
600  // Check primary particle type
601  int particleType = thePrim->GetPDGcode();
602 
603  // set the pointer to the shower collection
604  std::string SLType("");
605  if (particleType == 11) {
607  SLType = "Electromagnetic";
608  } else {
610  SLType = "Hadronic";
611  }
612  edm::LogVerbatim("CastorShowerLibraryMaker") << "\n Primary (thePrim) trackID is " << thePrim->GetTrackID() << "\n";
613 
614  // Obtain primary particle's initial momentum (pInit)
615  double px = 0., py = 0., pz = 0., pInit = 0., eta = 0., phi = 0.;
616  GetKinematics(particleType, px, py, pz, pInit, eta, phi);
617  // Check if current event falls into any bin
618  // first: energy
619  if (pInit == 0) {
620  edm::LogVerbatim("CastorShowerLibraryMaker") << "Primary did not hit CASTOR";
621  continue;
622  }
623  int ebin = FindEnergyBin(pInit);
624  int etabin = FindEtaBin(eta);
625  int phibin = FindPhiBin(phi);
626  edm::LogVerbatim("HcalSim") << SLType;
628  if (!SLacceptEvent(ebin, etabin, phibin)) {
629  edm::LogVerbatim("CastorShowerLibraryMaker")
630  << "Event not accepted for ebin=" << ebin << ",etabin=" << etabin << ",phibin=" << phibin << "(" << pInit
631  << "," << eta << "," << phi << ")";
632  continue;
633  }
634  //
635  // event passed. Fill the vector accordingly
636  //
637  // Look for the Hit Collection
638  edm::LogVerbatim("CastorShowerLibraryMaker")
639  << "\n CastorShowerLibraryMaker::update(EndOfEvent * evt) - event #" << (*evt)()->GetEventID();
640 
641  /*
642  edm::LogVerbatim("HcalSim") << "Number of collections : " << allHC->GetNumberOfCollections();
643  for(int ii = 0;ii<allHC->GetNumberOfCollections();ii++)
644  edm::LogVerbatim("HcalSim") << "Name of collection " << ii << " : " << allHC->GetHC(ii)->GetName();
645 */
646 
647  CastorShowerEvent* shower = nullptr;
648  int cur_evt_idx = SLShowerptr->nEvtInBinPhi.at(ebin).at(etabin).at(phibin);
649  shower = &(SLShowerptr->SLCollection.at(ebin).at(etabin).at(phibin).at(cur_evt_idx));
650 
651  // Get Hit information
652  if (FillShowerEvent(theCAFI, shower, particleType)) {
653  // Primary particle information
654  /*
655  edm::LogVerbatim("CastorShowerLibraryMaker") << "New SL event: Primary = " << particleType << "; Energy = " << pInit << "; Eta = " << eta << "; Phi = " << phi << "; Nhits = " << shower->getNhit();
656 */
657  shower->setPrimE(pInit);
658  shower->setPrimEta(eta);
659  shower->setPrimPhi(phi);
663  SLnEvtInBinE(ebin)++;
666  NHitInEvent += shower->getNhit();
667  NEvtAccepted++;
668  } else {
669  shower->Clear();
670  }
671  }
672  // Check for unassociated energy
673  int thecafi_entries = theCAFI->entries();
674  if (NEvtAccepted == int(thePrims.size()) && thecafi_entries != NHitInEvent) {
675  edm::LogWarning("HcalSim") << "WARNING: Inconsistent Number of Hits -> Hits in collection: " << theCAFI->entries()
676  << " Hits in the showers: " << NHitInEvent;
677  double miss_energy = 0;
678  double tot_energy = 0;
679  GetMissingEnergy(theCAFI, miss_energy, tot_energy);
680  if (miss_energy > 0) {
681  edm::LogVerbatim("HcalSim") << "Total missing energy: " << miss_energy
682  << " for an incident energy: " << tot_energy;
683  }
684  }
685 
686  /*
687  for (int i=emSLHolder.SLEnergyBins.size()-1;i>0;i--) {
688  if (emSLHolder.nEvtInBinE.at(i)==(int)emSLHolder.nEvtPerBinE) {
689  std::ostringstream out;
690  out << emSLHolder.SLEnergyBins.at(i);
691  edm::LogVerbatim("HcalSim") << "Bin Limit: " << out.str();
692  setenv("CASTOR_SL_PG_MAXE",out.str().c_str(),1);
693  }
694  break;
695  }
696 */
697  //int iEvt = (*evt)()->GetEventID();
698  //double xint;
699  /*
700  if (modf(log10(iEvt),&xint)==0)
701  edm::LogVerbatim("HcalSim") << " CastorShowerLibraryMaker Event " << iEvt;
702 */
703  // edm::LogVerbatim("HcalSim") << "\n===>>> Done writing user histograms ";
704 }
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 456 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().

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

Referenced by CastorShowerLibraryMaker(), and update().

◆ DoEmSL

bool CastorShowerLibraryMaker::DoEmSL
private

Definition at line 133 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and IsSLReady().

◆ DoHadSL

bool CastorShowerLibraryMaker::DoHadSL
private

Definition at line 132 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and IsSLReady().

◆ emInfo

CastorShowerLibraryInfo* CastorShowerLibraryMaker::emInfo
private

Definition at line 139 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ emShower

CastorShowerEvent* CastorShowerLibraryMaker::emShower
private

Definition at line 141 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ emSLHolder

ShowerLib CastorShowerLibraryMaker::emSLHolder
private

◆ eventIndex

int CastorShowerLibraryMaker::eventIndex
private

Definition at line 180 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ eventNtFileName

std::string CastorShowerLibraryMaker::eventNtFileName
private

Definition at line 128 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ hadInfo

CastorShowerLibraryInfo* CastorShowerLibraryMaker::hadInfo
private

Definition at line 140 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ hadShower

CastorShowerEvent* CastorShowerLibraryMaker::hadShower
private

Definition at line 142 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ hadSLHolder

ShowerLib CastorShowerLibraryMaker::hadSLHolder
private

◆ InsideCastor

bool CastorShowerLibraryMaker::InsideCastor
private

Definition at line 134 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 151 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ MaxPhi

double CastorShowerLibraryMaker::MaxPhi
private

Definition at line 152 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and update().

◆ NPGParticle

unsigned int CastorShowerLibraryMaker::NPGParticle
private

Definition at line 130 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and GetPrimary().

◆ PGParticleIDs

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

Definition at line 131 of file CastorShowerLibraryMaker.cc.

Referenced by CastorShowerLibraryMaker(), and GetPrimary().

◆ PrimaryMomentum

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

Definition at line 149 of file CastorShowerLibraryMaker.cc.

Referenced by GetKinematics(), and update().

◆ PrimaryPosition

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

Definition at line 150 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ SLShowerptr

ShowerLib* CastorShowerLibraryMaker::SLShowerptr
private

◆ stepIndex

int CastorShowerLibraryMaker::stepIndex
private

Definition at line 181 of file CastorShowerLibraryMaker.cc.

Referenced by update().

◆ theFile

TFile* CastorShowerLibraryMaker::theFile
private

Definition at line 177 of file CastorShowerLibraryMaker.cc.

Referenced by Finish(), and update().

◆ thePrims

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

Definition at line 136 of file CastorShowerLibraryMaker.cc.

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

◆ theTree

TTree* CastorShowerLibraryMaker::theTree
private

Definition at line 178 of file CastorShowerLibraryMaker.cc.

Referenced by Finish(), and update().

◆ verbosity

int CastorShowerLibraryMaker::verbosity
private

Definition at line 127 of file CastorShowerLibraryMaker.cc.

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