CMS 3D CMS Logo

CaloTrkProcessingBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimG4CMS/Calo
4 // Class : CaloTrkProcessingBuilder
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Sunanda Banerjee
10 // Created: Tue, 12 Jul 2021 23:18:17 GMT
11 //
12 
13 // system include files
14 #include <string>
15 #include <vector>
16 
17 // user include files
21 
25 
32 
34 public:
37  bool dd4hep = p.getParameter<bool>("g4GeometryDD4hepSource");
38  addlevel_ = dd4hep ? 1 : 0;
39  edm::ParameterSet csps = p.getParameter<edm::ParameterSet>("CaloTrkProcessing");
40  testBeam_ = csps.getParameter<bool>("TestBeam");
41  eMin_ = csps.getParameter<double>("EminTrack") * CLHEP::MeV;
42  putHistory_ = csps.getParameter<bool>("PutHistory");
43  doFineCalo_ = csps.getParameter<bool>("DoFineCalo");
44  eMinFine_ = csps.getParameter<double>("EminFineTrack") * CLHEP::MeV;
45  fineNames_ = csps.getParameter<std::vector<std::string> >("FineCaloNames");
46  fineLevels_ = csps.getParameter<std::vector<int> >("FineCaloLevels");
47  useFines_ = csps.getParameter<std::vector<int> >("UseFineCalo");
48  for (auto& level : fineLevels_)
49  level += addlevel_;
50  }
51 
52  void beginRun(const edm::EventSetup& es) final { caloSimPar_ = &es.getData(cspsToken_); }
53 
54  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
55  const SensitiveDetectorCatalog& clg,
56  const edm::ParameterSet& p,
57  const SimTrackManager* man,
58  SimActivityRegistry& reg) const final {
59  auto sd = std::make_unique<CaloTrkProcessing>(iname,
60  *caloSimPar_,
61  clg,
62  testBeam_,
63  eMin_,
66  eMinFine_,
67  addlevel_,
68  fineNames_,
70  useFines_,
71  man);
73  return sd;
74  }
75 
76 private:
79  bool testBeam_;
80  double eMin_;
83  double eMinFine_;
84  int addlevel_;
85  std::vector<std::string> fineNames_;
86  std::vector<int> fineLevels_;
87  std::vector<int> useFines_;
88 };
89 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > fineNames_
CaloTrkProcessingBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
const edm::ESGetToken< CaloSimulationParameters, HcalParametersRcd > cspsToken_
static void enroll(SimActivityRegistry &iReg, T *iObj)
const CaloSimulationParameters * caloSimPar_
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
void beginRun(const edm::EventSetup &es) final