Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef SimG4CMS_ECalSD_h
0002 #define SimG4CMS_ECalSD_h
0003 ///////////////////////////////////////////////////////////////////////////////
0004 // File: ECalSD.h
0005 // Description: Stores hits of Electromagnetic calorimeters in appropriate
0006 //              container
0007 // Use in your sensitive detector builder:
0008 //    ECalSD* ecalSD = new ECalSD(SDname, new CaloNumberingScheme());
0009 ///////////////////////////////////////////////////////////////////////////////
0010 //#define plotDebug
0011 
0012 #include "SimG4CMS/Calo/interface/CaloSD.h"
0013 #include "SimG4CMS/Calo/interface/EnergyResolutionVsLumi.h"
0014 #include "Geometry/EcalCommonData/interface/EcalNumberingScheme.h"
0015 #include "CondFormats/GeometryObjects/interface/EcalSimulationParameters.h"
0016 #include "DataFormats/DetId/interface/DetId.h"
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 
0021 #ifdef plotDebug
0022 #include <TH2F.h>
0023 #endif
0024 #include <string>
0025 #include <map>
0026 
0027 class EcalBaseNumber;
0028 class G4LogicalVolume;
0029 class EnergyResolutionVsLumi;
0030 
0031 class ECalSD : public CaloSD {
0032 public:
0033   ECalSD(const std::string &,
0034          const EcalSimulationParameters *,
0035          const SensitiveDetectorCatalog &,
0036          edm::ParameterSet const &p,
0037          const SimTrackManager *);
0038   ~ECalSD() override;
0039   uint32_t setDetUnitId(const G4Step *) override;
0040   void setNumberingScheme(EcalNumberingScheme *);
0041 
0042 protected:
0043   double getEnergyDeposit(const G4Step *) override;
0044   int getTrackID(const G4Track *) override;
0045   uint16_t getDepth(const G4Step *) override;
0046   double EnergyCorrected(const G4Step &, const G4Track *) override;
0047 
0048 private:
0049   void initMap();
0050   uint16_t getRadiationLength(const G4StepPoint *hitPoint, const G4LogicalVolume *lv);
0051   uint16_t getLayerIDForTimeSim();
0052   double curve_LY(const G4LogicalVolume *);
0053 
0054   void getBaseNumber(const G4Step *);
0055   double getBirkL3(const G4Step *);
0056   bool isXtal(const G4LogicalVolume *);
0057 
0058   // initialised before run
0059   const EcalSimulationParameters *ecalSimParameters_;
0060   std::unique_ptr<EcalNumberingScheme> numberingScheme_;
0061   bool useWeight, storeTrack, storeRL, storeLayerTimeSim;
0062   bool useBirk, useBirkL3;
0063   double birk1, birk2, birk3, birkSlope, birkCut;
0064   double slopeLY, scaleRL;
0065   std::string crystalMat, depth1Name, depth2Name;
0066   std::map<const G4LogicalVolume *, double> xtalLMap;
0067   std::vector<const G4LogicalVolume *> useDepth1, useDepth2, noWeight;
0068   EcalBaseNumber theBaseNumber;
0069   EnergyResolutionVsLumi ageing;
0070   bool ageingWithSlopeLY;
0071 
0072   // run time cache
0073   G4ThreeVector currentLocalPoint;
0074   double crystalLength;
0075   double crystalDepth;
0076   uint16_t depth;
0077 #ifdef plotDebug
0078   TH2F *g2L_[4];
0079 #endif
0080 };
0081 
0082 #endif  // ECalSD_h