CMS 3D CMS Logo

FTLDigiProducer.cc
Go to the documentation of this file.
9 
10 //
14  std::vector<std::string> psetNames;
15 
16  pset.getParameterSetNames(psetNames);
17 
18  for(const auto& psname : psetNames) {
19  const auto& ps = pset.getParameterSet(psname);
20  const std::string& digitizerName = ps.getParameter<std::string>("digitizerName");
21  auto temp = FTLDigitizerFactory::get()->create(digitizerName,ps,iC,mixMod);
22  theDigitizers_.emplace_back(temp);
23  }
24 }
25 
26 //
28 {
29 }
30 
31 //
33 {
34  for( auto& digitizer : theDigitizers_ ) {
35  digitizer->initializeEvent(event, es);
36  }
37 }
38 
39 //
41 {
42  for( auto& digitizer : theDigitizers_ ) {
43  digitizer->finalizeEvent(event, es, randomEngine(event.streamID()));
44  }
45 }
46 
47 //
49 {
50  for( auto& digitizer : theDigitizers_ ) {
51  digitizer->accumulate(event, es, randomEngine(event.streamID()));
52  }
53 }
54 
56 {
57  for( auto& digitizer : theDigitizers_ ) {
58  digitizer->accumulate(event, es, randomEngine(streamID));
59  }
60 }
61 
62 //
64 {
65  for( auto& digitizer : theDigitizers_ ) {
66  digitizer->beginRun(es);
67  }
68 }
69 
70 //
72 {
73  for( auto& digitizer : theDigitizers_ ) {
74  digitizer->endRun();
75  }
76 }
77 
78 CLHEP::HepRandomEngine* FTLDigiProducer::randomEngine(edm::StreamID const& streamID) {
79  unsigned int index = streamID.value();
80  if(index >= randomEngines_.size()) {
81  randomEngines_.resize(index + 1, nullptr);
82  }
83  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
84  if(!ptr) {
86  ptr = &rng->getEngine(streamID);
87  randomEngines_[index] = ptr;
88  }
89  return ptr;
90 }
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
virtual void initializeEvent(edm::Event const &, edm::EventSetup const &) override
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::vector< CLHEP::HepRandomEngine * > randomEngines_
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
unsigned int value() const
Definition: StreamID.h:46
virtual void finalizeEvent(edm::Event &, edm::EventSetup const &) override
ParameterSet const & getParameterSet(std::string const &) const
FTLDigiProducer(edm::ParameterSet const &pset, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
std::vector< std::unique_ptr< FTLDigitizerBase > > theDigitizers_
StreamID streamID() const
Definition: Event.h:81
virtual void accumulate(edm::Event const &, edm::EventSetup const &) override
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
T get(const Candidate &c)
Definition: component.h:55
Definition: event.py:1
Definition: Run.h:42
virtual void endRun(edm::Run const &, edm::EventSetup const &) override