CMS 3D CMS Logo

PreMixingPhase2TrackerWorker.cc
Go to the documentation of this file.
11 
14 
17 
18 #include "Phase2TrackerDigitizer.h"
20 
22 public:
24  ~PreMixingPhase2TrackerWorker() override = default;
25 
26  void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& es) override;
27 
28  void initializeEvent(edm::Event const& e, edm::EventSetup const& es) override;
29  void addSignals(edm::Event const& e, edm::EventSetup const& es) override;
30  void addPileups(PileUpEventPrincipal const& pep, edm::EventSetup const& es) override;
31  void put(edm::Event& e, edm::EventSetup const& iSetup, std::vector<PileupSummaryInfo> const& ps, int bs) override;
32 
33 private:
34  void accumulate(const edm::DetSetVector<PixelDigi>& digis, const float electronsPerADC);
35 
37 
44 
45  // Maybe map of maps is not that bad for this add once, update once,
46  // read once workflow?
47  using SignalMap = std::map<uint32_t, std::map<int, float>>; // (channel, charge)
49 };
50 
52  edm::ProducesCollector producesCollector,
54  : digitizer_(ps, producesCollector, iC),
55  pixelSignalToken_(iC.consumes<edm::DetSetVector<PixelDigi>>(ps.getParameter<edm::InputTag>("pixelLabelSig"))),
56  trackerSignalToken_(iC.consumes<edm::DetSetVector<PixelDigi>>(ps.getParameter<edm::InputTag>("trackerLabelSig"))),
57  pixelPileupLabel_(ps.getParameter<edm::InputTag>("pixelPileInputTag")),
58  trackerPileupLabel_(ps.getParameter<edm::InputTag>("trackerPileInputTag")),
59  pixelElectronPerAdc_(ps.getParameter<double>("pixelPmxStage1ElectronPerAdc")),
60  trackerElectronPerAdc_(ps.getParameter<double>("trackerPmxStage1ElectronPerAdc")) {}
61 
64 }
65 
68 }
69 
72  e.getByToken(pixelSignalToken_, hdigis);
74 
75  e.getByToken(trackerSignalToken_, hdigis);
77 }
78 
81  pep.getByLabel(pixelPileupLabel_, hdigis);
83 
84  pep.getByLabel(trackerPileupLabel_, hdigis);
86 }
87 
88 void PreMixingPhase2TrackerWorker::accumulate(const edm::DetSetVector<PixelDigi>& digis, const float electronPerADC) {
89  for (const auto& detset : digis) {
90  auto& accDet = accumulator_[detset.detId()];
91  for (const auto& digi : detset) {
92  // note: according to C++ standard operator[] does
93  // value-initializiation, which for float means initial value of 0
94  auto& acc = accDet[digi.channel()];
95  acc += digi.adc() * electronPerADC;
96  }
97  }
98 }
99 
101  edm::EventSetup const& iSetup,
102  std::vector<PileupSummaryInfo> const& ps,
103  int bs) {
105  digitizer_.finalizeEvent(e, iSetup);
106  decltype(accumulator_){}.swap(accumulator_); // release memory
107 }
108 
edm::DetSetVector
Definition: DetSetVector.h:61
Handle.h
PreMixingPhase2TrackerWorker::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &es) override
Definition: PreMixingPhase2TrackerWorker.cc:66
MessageLogger.h
ESHandle.h
Phase2TrackerDigitizer.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
RandomNumberGenerator.h
PreMixingPhase2TrackerWorker::pixelPileupLabel_
edm::InputTag pixelPileupLabel_
Definition: PreMixingPhase2TrackerWorker.cc:40
PreMixingPhase2TrackerWorker
Definition: PreMixingPhase2TrackerWorker.cc:21
PixelDigi
Definition: PixelDigi.h:14
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
Phase2TrackerDigitizerAlgorithm.h
PreMixingPhase2TrackerWorker::trackerSignalToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > trackerSignalToken_
Definition: PreMixingPhase2TrackerWorker.cc:39
cms::Phase2TrackerDigitizer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
Definition: Phase2TrackerDigitizer.cc:218
edm::Handle
Definition: AssociativeIterator.h:50
PreMixingPhase2TrackerWorker::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &es) override
Definition: PreMixingPhase2TrackerWorker.cc:62
ProducesCollector.h
PreMixingPhase2TrackerWorker::put
void put(edm::Event &e, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bs) override
Definition: PreMixingPhase2TrackerWorker.cc:100
cms::cuda::bs
bs
Definition: HistoContainer.h:127
cms::Phase2TrackerDigitizer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
Definition: Phase2TrackerDigitizer.cc:153
PreMixingPhase2TrackerWorker::digitizer_
cms::Phase2TrackerDigitizer digitizer_
Definition: PreMixingPhase2TrackerWorker.cc:36
PreMixingPhase2TrackerWorker::PreMixingPhase2TrackerWorker
PreMixingPhase2TrackerWorker(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &&iC)
Definition: PreMixingPhase2TrackerWorker.cc:51
PreMixingWorker.h
Service.h
PreMixingPhase2TrackerWorker::addPileups
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &es) override
Definition: PreMixingPhase2TrackerWorker.cc:79
PreMixingPhase2TrackerWorker::accumulate
void accumulate(const edm::DetSetVector< PixelDigi > &digis, const float electronsPerADC)
Definition: PreMixingPhase2TrackerWorker.cc:88
PileUpEventPrincipal.h
PreMixingPhase2TrackerWorker::SignalMap
std::map< uint32_t, std::map< int, float > > SignalMap
Definition: PreMixingPhase2TrackerWorker.cc:47
cms::Phase2TrackerDigitizer::loadAccumulator
void loadAccumulator(const std::map< uint32_t, std::map< int, float > > &accumulator)
Definition: Phase2TrackerDigitizer.cc:210
PreMixingPhase2TrackerWorker::trackerElectronPerAdc_
float trackerElectronPerAdc_
Definition: PreMixingPhase2TrackerWorker.cc:43
PreMixingPhase2TrackerWorker::pixelSignalToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > pixelSignalToken_
Definition: PreMixingPhase2TrackerWorker.cc:38
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
PreMixingPhase2TrackerWorker::~PreMixingPhase2TrackerWorker
~PreMixingPhase2TrackerWorker() override=default
Event.h
PreMixingPhase2TrackerWorker::pixelElectronPerAdc_
float pixelElectronPerAdc_
Definition: PreMixingPhase2TrackerWorker.cc:42
cms::Phase2TrackerDigitizer::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &iSetup) override
Definition: Phase2TrackerDigitizer.cc:100
PreMixingPhase2TrackerWorker::addSignals
void addSignals(edm::Event const &e, edm::EventSetup const &es) override
Definition: PreMixingPhase2TrackerWorker.cc:70
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
PreMixingWorkerFactory.h
edm::ProducesCollector
Definition: ProducesCollector.h:43
cms::Phase2TrackerDigitizer
Definition: Phase2TrackerDigitizer.h:49
DEFINE_PREMIXING_WORKER
#define DEFINE_PREMIXING_WORKER(TYPE)
Definition: PreMixingWorkerFactory.h:16
PreMixingWorker
Definition: PreMixingWorker.h:14
DetSet.h
ConsumesCollector.h
ParameterSet.h
PileUpEventPrincipal::getByLabel
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
Definition: PileUpEventPrincipal.h:33
edm::Event
Definition: Event.h:73
PreMixingPhase2TrackerWorker::accumulator_
SignalMap accumulator_
Definition: PreMixingPhase2TrackerWorker.cc:48
lumi
Definition: LumiSectionData.h:20
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
PreMixingPhase2TrackerWorker::trackerPileupLabel_
edm::InputTag trackerPileupLabel_
Definition: PreMixingPhase2TrackerWorker.cc:41
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37