CMS 3D CMS Logo

AlcaPCCIntegrator.cc
Go to the documentation of this file.
1 /*_________________________________________________________________
2 class: AlcaPCCIntegrator.cc
3 
4 
5 
6 authors: Sam Higginbotham (shigginb@cern.ch), Chris Palmer (capalmer@cern.ch), Attila Radl (attila.radl@cern.ch)
7 
8 ________________________________________________________________**/
9 
10 // C++ standard
11 #include <string>
12 // CMS
25 //The class
26 class AlcaPCCIntegrator : public edm::global::EDProducer<edm::LuminosityBlockSummaryCache<reco::PixelClusterCounts>,
27  edm::StreamCache<reco::PixelClusterCounts>,
28  edm::EndLuminosityBlockProducer,
29  edm::Accumulator> {
30 public:
31  explicit AlcaPCCIntegrator(const edm::ParameterSet&);
32  ~AlcaPCCIntegrator() override = default;
33 
34  std::unique_ptr<reco::PixelClusterCounts> beginStream(edm::StreamID) const override;
35  std::shared_ptr<reco::PixelClusterCounts> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
36  edm::EventSetup const&) const override;
37  void accumulate(edm::StreamID iID, const edm::Event& iEvent, const edm::EventSetup&) const override;
39  edm::LuminosityBlock const&,
40  edm::EventSetup const&,
41  reco::PixelClusterCounts*) const override;
43  edm::EventSetup const&,
44  reco::PixelClusterCounts* iCounts) const override;
46  edm::EventSetup const&,
47  reco::PixelClusterCounts const* iCounts) const override;
48 
49 private:
52 };
53 
55  : lumiPutToken_(produces<reco::PixelClusterCounts, edm::Transition::EndLuminosityBlock>(
56  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters").getParameter<std::string>("ProdInst"))),
57  pccToken_(consumes<reco::PixelClusterCountsInEvent>(
58  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters")
59  .getParameter<edm::InputTag>("inputPccLabel"))) {}
60 
61 std::unique_ptr<reco::PixelClusterCounts> AlcaPCCIntegrator::beginStream(edm::StreamID StreamID) const {
62  return std::make_unique<reco::PixelClusterCounts>();
63 }
64 
65 std::shared_ptr<reco::PixelClusterCounts> AlcaPCCIntegrator::globalBeginLuminosityBlockSummary(
66  edm::LuminosityBlock const&, edm::EventSetup const&) const {
67  return std::make_shared<reco::PixelClusterCounts>();
68 }
69 
71  edm::EventSetup const&,
72  reco::PixelClusterCounts*) const {}
73 
76  iEvent.getByToken(pccToken_, pccHandle);
77 
78  if (!pccHandle.isValid()) {
79  // do not resolve a not existing product!
80  return;
81  }
82 
83  const reco::PixelClusterCountsInEvent inputPcc = *pccHandle;
84  unsigned int bx = iEvent.bunchCrossing();
85  // add the BXID of the event to the stream cache
86  streamCache(iID)->eventCounter(bx);
87  // add the PCCs from the event to the stream cache
88  streamCache(iID)->add(inputPcc);
89 }
90 
92  edm::LuminosityBlock const&,
93  edm::EventSetup const&,
94  reco::PixelClusterCounts* iCounts) const {
95  iCounts->merge(*streamCache(iID));
96  // now clear in order to be ready for the next LuminosityBlock
97  streamCache(iID)->reset();
98 }
99 
101  edm::EventSetup const&,
102  reco::PixelClusterCounts const* iCounts) const {
103  // save the PCC object
104  iLumi.emplace(lumiPutToken_, *iCounts);
105 }
std::unique_ptr< reco::PixelClusterCounts > beginStream(edm::StreamID) const override
void globalEndLuminosityBlockProduce(edm::LuminosityBlock &iLumi, edm::EventSetup const &, reco::PixelClusterCounts const *iCounts) const override
AlcaPCCIntegrator(const edm::ParameterSet &)
~AlcaPCCIntegrator() override=default
const edm::EDGetTokenT< reco::PixelClusterCountsInEvent > pccToken_
int iEvent
Definition: GenABIO.cc:224
void merge(reco::PixelClusterCounts const &pcc)
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, reco::PixelClusterCounts *iCounts) const override
void emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
bool isValid() const
Definition: HandleBase.h:70
void accumulate(edm::StreamID iID, const edm::Event &iEvent, const edm::EventSetup &) const override
fixed size matrix
void streamEndLuminosityBlockSummary(edm::StreamID, edm::LuminosityBlock const &, edm::EventSetup const &, reco::PixelClusterCounts *) const override
HLT enums.
std::shared_ptr< reco::PixelClusterCounts > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &) const override
const edm::EDPutTokenT< reco::PixelClusterCounts > lumiPutToken_