CMS 3D CMS Logo

MTDDigitizerBase.h
Go to the documentation of this file.
1 #ifndef FastTimingSimProducers_FastTimingCommon_MTDDigitizerBase_h
2 #define FastTimingSimProducers_FastTimingCommon_MTDDigitizerBase_h
3 
8 
11 
15 
16 #include "CLHEP/Units/GlobalPhysicalConstants.h"
17 
18 #include <string>
19 
20 namespace CLHEP {
21  class HepRandomEngine;
22 }
23 
24 namespace edm {
25  class Event;
26  class EventSetup;
27 } // namespace edm
28 
30 
32 public:
34  edm::ProducesCollector producesCollector,
36  : inputSimHits_(config.getParameter<edm::InputTag>("inputSimHits")),
37  digiCollection_(config.getParameter<std::string>("digiCollectionTag")),
38  verbosity_(config.getUntrackedParameter<uint32_t>("verbosity", 0)),
39  refSpeed_(0.1 * CLHEP::c_light),
40  premixStage1MinCharge_(config.getParameter<double>("premixStage1MinCharge")),
41  premixStage1MaxCharge_(config.getParameter<double>("premixStage1MaxCharge")),
42  premixStage1_(config.getParameter<bool>("premixStage1")),
43  name_(config.getParameter<std::string>("digitizerName")) {
44  iC.consumes<std::vector<PSimHit> >(inputSimHits_);
45 
46  if (name_ == "BTLTileDigitizer" || name_ == "BTLBarDigitizer") {
47  if (premixStage1_) {
48  producesCollector.produces<PMTDSimAccumulator>(digiCollection_);
49  } else {
50  producesCollector.produces<BTLDigiCollection>(digiCollection_);
51  }
52  } else if (name_ == "ETLDigitizer")
53  if (premixStage1_) {
54  producesCollector.produces<PMTDSimAccumulator>(digiCollection_);
55  } else {
56  producesCollector.produces<ETLDigiCollection>(digiCollection_);
57  }
58  else
59  throw cms::Exception("[MTDDigitizerBase::MTDDigitizerBase]") << name_ << " is an invalid MTD digitizer name";
60  }
61 
62  virtual ~MTDDigitizerBase() {}
63 
67  virtual void accumulate(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre) = 0;
68  virtual void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre) = 0;
69  virtual void accumulate(edm::Handle<edm::PSimHitContainer> const& hits,
70  int bxCrossing,
71  CLHEP::HepRandomEngine* hre) = 0;
72  // for premixing
73  virtual void accumulate(const PMTDSimAccumulator& simAccumulator) = 0;
74 
78  virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c) = 0;
79  virtual void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre) = 0;
80 
84  virtual void beginRun(const edm::EventSetup& es) = 0;
85  virtual void endRun() = 0;
86 
87  const std::string& name() const { return name_; }
88 
89 protected:
90  //input/output names
93 
94  //misc switches
95  const uint32_t verbosity_;
96 
97  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
98  const float refSpeed_;
99 
100  // Minimum charge threshold for premixing stage1
102  // Maximum charge for packing in premixing stage1
104 
105  // flag telling whether we are runing in premixing stage1
106  const bool premixStage1_;
107 
108 private:
110 };
111 
116 
117 #endif
const bool premixStage1_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
virtual ~MTDDigitizerBase()
Definition: config.py:1
const edm::InputTag inputSimHits_
const std::string digiCollection_
const std::string & name() const
const uint32_t verbosity_
const float refSpeed_
MTDDigitizerBase(const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
HLT enums.