Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:59

0001 #ifndef SimG4CMS_CastorShowerLibrary_h
0002 #define SimG4CMS_CastorShowerLibrary_h
0003 ///////////////////////////////////////////////////////////////////////////////
0004 // File: CastorShowerLibrary.h
0005 // Description: Gets information from a shower library
0006 //              Adapted from HFShowerLibrary class
0007 //
0008 //              Wagner Carvalho (wcarvalh@cern.ch)
0009 //
0010 ///////////////////////////////////////////////////////////////////////////////
0011 
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h"
0015 #include "SimDataFormats/CaloHit/interface/CastorShowerEvent.h"
0016 
0017 #include "G4ParticleTable.hh"
0018 #include "G4ThreeVector.hh"
0019 
0020 #include <string>
0021 #include <memory>
0022 
0023 class G4Step;
0024 class TFile;
0025 class TBranch;
0026 
0027 class CastorShowerLibrary {
0028 public:
0029   //Constructor and Destructor
0030   CastorShowerLibrary(const std::string &name, edm::ParameterSet const &p);
0031   ~CastorShowerLibrary();
0032 
0033 public:
0034   CastorShowerEvent getShowerHits(const G4Step *, bool &);
0035   int FindEnergyBin(double);
0036   int FindEtaBin(double);
0037   int FindPhiBin(double);
0038 
0039 protected:
0040   void initFile(edm::ParameterSet const &);
0041   CastorShowerEvent getRecord(int, int);
0042   void loadEventInfo(TBranch *);
0043   // if eta or phi is not given, take into account only the binning in energy
0044   CastorShowerEvent select(int, double, double = 0, double = 9);
0045 
0046 private:
0047   TFile *hf;
0048   TBranch *emBranch, *hadBranch;  // pointer to CastorShowerEvent-type branch
0049 
0050   bool verbose;
0051   unsigned int nMomBin, totEvents, evtPerBin;
0052 
0053   std::vector<double> pmom;
0054 
0055   // new variables (bins in eta and phi)
0056   unsigned int nBinsE, nBinsEta, nBinsPhi;
0057   unsigned int nEvtPerBinE, nEvtPerBinEta, nEvtPerBinPhi;
0058   std::vector<double> SLenergies;
0059   std::vector<double> SLetas;
0060   std::vector<double> SLphis;
0061 };
0062 #endif