Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-06 04:01:05

0001 #ifndef SimG4CMS_HFShowerLibrary_h
0002 #define SimG4CMS_HFShowerLibrary_h 1
0003 ///////////////////////////////////////////////////////////////////////////////
0004 // File: HFShowerLibrary.h
0005 // Description: Gets information from a shower library
0006 ///////////////////////////////////////////////////////////////////////////////
0007 
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h"
0011 #include "CondFormats/GeometryObjects/interface/HcalSimulationParameters.h"
0012 #include "SimG4CMS/Calo/interface/HFFibre.h"
0013 #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h"
0014 
0015 #include "G4ThreeVector.hh"
0016 
0017 //ROOT
0018 #include "TROOT.h"
0019 #include "TFile.h"
0020 #include "TTree.h"
0021 
0022 #include <string>
0023 #include <memory>
0024 
0025 class G4Step;
0026 class G4ParticleTable;
0027 
0028 class HFShowerLibrary {
0029 public:
0030   //Constructor and Destructor
0031   HFShowerLibrary(const std::string &name,
0032                   const HcalDDDSimConstants *hcons,
0033                   const HcalSimulationParameters *hps,
0034                   edm::ParameterSet const &p);
0035   ~HFShowerLibrary();
0036 
0037 public:
0038   struct Hit {
0039     Hit() {}
0040     G4ThreeVector position;
0041     int depth;
0042     double time;
0043   };
0044 
0045   std::vector<Hit> getHits(const G4Step *aStep, bool &ok, double weight, bool onlyLong = false);
0046   std::vector<Hit> fillHits(const G4ThreeVector &p,
0047                             const G4ThreeVector &v,
0048                             int parCode,
0049                             double parEnergy,
0050                             bool &ok,
0051                             double weight,
0052                             double time,
0053                             bool onlyLong = false);
0054 
0055 protected:
0056   bool rInside(double r);
0057   void getRecord(int, int);
0058   void loadEventInfo(TBranch *);
0059   void interpolate(int, double);
0060   void extrapolate(int, double);
0061   void storePhoton(int j);
0062 
0063 private:
0064   const HcalDDDSimConstants *hcalConstant_;
0065   std::unique_ptr<HFFibre> fibre_;
0066   TFile *hf;
0067   TBranch *emBranch, *hadBranch;
0068 
0069   bool verbose, applyFidCut, newForm, v3version;
0070   int nMomBin, totEvents, evtPerBin;
0071   float libVers, listVersion;
0072   std::vector<double> pmom;
0073 
0074   int fileVersion_;
0075   bool equalizeTimeShift_;
0076   double probMax, backProb;
0077   double dphi, rMin, rMax;
0078   std::vector<double> gpar;
0079 
0080   int npe;
0081   HFShowerPhotonCollection pe;
0082   std::unique_ptr<HFShowerPhotonCollection> photo;
0083   HFShowerPhotonCollection photon;
0084 };
0085 #endif