|
1 | 1 | /**_________________________________________________________________ |
2 | 2 | class: AlcaPCCEventProducer.cc |
3 | 3 |
|
4 | | -
|
5 | | -
|
6 | 4 | authors: Sam Higginbotham ([email protected]), Chris Palmer ([email protected]), Attila Radl ([email protected]) |
7 | | -
|
8 | 5 | ________________________________________________________________**/ |
9 | 6 |
|
10 | 7 | // C++ standard |
11 | 8 | #include <string> |
12 | 9 |
|
13 | 10 | // CMS |
14 | | -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" |
15 | 11 | #include "DataFormats/DetId/interface/DetId.h" |
16 | 12 | #include "DataFormats/Luminosity/interface/PixelClusterCountsInEvent.h" |
17 | | -#include "FWCore/MessageLogger/interface/MessageLogger.h" |
18 | | -#include "FWCore/Framework/interface/MakerMacros.h" |
| 13 | +#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" |
19 | 14 | #include "FWCore/Framework/interface/ConsumesCollector.h" |
20 | | -#include "FWCore/Framework/interface/Frameworkfwd.h" |
21 | | -#include "FWCore/Framework/interface/stream/EDProducer.h" |
22 | | -#include "FWCore/Framework/interface/Event.h" |
23 | | -#include "FWCore/ParameterSet/interface/ParameterSet.h" |
24 | | -#include "FWCore/Utilities/interface/EDGetToken.h" |
25 | | -#include "FWCore/ServiceRegistry/interface/Service.h" |
26 | 15 | #include "FWCore/Framework/interface/ESHandle.h" |
| 16 | +#include "FWCore/Framework/interface/Event.h" |
27 | 17 | #include "FWCore/Framework/interface/EventSetup.h" |
| 18 | +#include "FWCore/Framework/interface/Frameworkfwd.h" |
28 | 19 | #include "FWCore/Framework/interface/LuminosityBlock.h" |
| 20 | +#include "FWCore/Framework/interface/MakerMacros.h" |
| 21 | +#include "FWCore/Framework/interface/global/EDProducer.h" |
| 22 | +#include "FWCore/MessageLogger/interface/MessageLogger.h" |
29 | 23 | #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" |
| 24 | +#include "FWCore/ParameterSet/interface/ParameterSet.h" |
30 | 25 | #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" |
| 26 | +#include "FWCore/ServiceRegistry/interface/Service.h" |
| 27 | +#include "FWCore/Utilities/interface/EDGetToken.h" |
31 | 28 | #include "TMath.h" |
32 | 29 |
|
33 | 30 | //The class |
34 | | -class AlcaPCCEventProducer : public edm::stream::EDProducer<> { |
| 31 | +class AlcaPCCEventProducer : public edm::global::EDProducer<> { |
35 | 32 | public: |
36 | 33 | explicit AlcaPCCEventProducer(const edm::ParameterSet&); |
37 | | - ~AlcaPCCEventProducer() override; |
| 34 | + ~AlcaPCCEventProducer() override = default; |
| 35 | + void produce(edm::StreamID id, edm::Event& e, edm::EventSetup const& c) const final; |
38 | 36 | static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); |
39 | 37 |
|
40 | 38 | private: |
41 | | - void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; |
| 39 | + const edm::InputTag pixelClusterLabel_; |
| 40 | + const std::string trigstring_; //specifies the trigger Rand or ZeroBias |
| 41 | + const edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken_; |
42 | 42 |
|
43 | | - edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken; |
44 | | - edm::InputTag fPixelClusterLabel; |
45 | | - |
46 | | - std::string trigstring_; //specifies the trigger Rand or ZeroBias |
47 | | - int countEvt_; //counter |
48 | | - int countLumi_; //counter |
49 | | - |
50 | | - const int rowsperroc = 52; |
51 | | - const int colsperroc = 80; |
52 | | - const int nROCcolumns = 8; |
53 | | - |
54 | | - std::unique_ptr<reco::PixelClusterCountsInEvent> thePCCob; |
| 43 | + static constexpr int rowsperroc = 52; |
| 44 | + static constexpr int colsperroc = 80; |
| 45 | + static constexpr int nROCcolumns = 8; |
55 | 46 | }; |
56 | 47 |
|
57 | 48 | //-------------------------------------------------------------------------------------------------- |
58 | | -AlcaPCCEventProducer::AlcaPCCEventProducer(const edm::ParameterSet& iConfig) { |
59 | | - fPixelClusterLabel = iConfig.getParameter<edm::InputTag>("pixelClusterLabel"); |
60 | | - trigstring_ = iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCCEvent"); |
| 49 | +AlcaPCCEventProducer::AlcaPCCEventProducer(const edm::ParameterSet& iConfig) |
| 50 | + : pixelClusterLabel_(iConfig.getParameter<edm::InputTag>("pixelClusterLabel")), |
| 51 | + trigstring_(iConfig.getUntrackedParameter<std::string>("trigstring", "alcaPCCEvent")), |
| 52 | + pixelToken_(consumes<edmNew::DetSetVector<SiPixelCluster> >(pixelClusterLabel_)) { |
61 | 53 | produces<reco::PixelClusterCountsInEvent, edm::Transition::Event>(trigstring_); |
62 | | - pixelToken = consumes<edmNew::DetSetVector<SiPixelCluster> >(fPixelClusterLabel); |
63 | 54 | } |
64 | 55 |
|
65 | 56 | //-------------------------------------------------------------------------------------------------- |
66 | | -AlcaPCCEventProducer::~AlcaPCCEventProducer() {} |
67 | | - |
68 | | -//-------------------------------------------------------------------------------------------------- |
69 | | -void AlcaPCCEventProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { |
70 | | - countEvt_++; |
71 | | - thePCCob = std::make_unique<reco::PixelClusterCountsInEvent>(); |
72 | | - |
| 57 | +void AlcaPCCEventProducer::produce(edm::StreamID id, edm::Event& iEvent, edm::EventSetup const& iSetup) const { |
| 58 | + std::unique_ptr<reco::PixelClusterCountsInEvent> thePCCob = std::make_unique<reco::PixelClusterCountsInEvent>(); |
73 | 59 | unsigned int bx = iEvent.bunchCrossing(); |
74 | 60 |
|
75 | 61 | //Looping over the clusters and adding the counts up |
76 | 62 | edm::Handle<edmNew::DetSetVector<SiPixelCluster> > hClusterColl; |
77 | | - iEvent.getByToken(pixelToken, hClusterColl); |
| 63 | + iEvent.getByToken(pixelToken_, hClusterColl); |
78 | 64 |
|
79 | 65 | const edmNew::DetSetVector<SiPixelCluster>& clustColl = *(hClusterColl.product()); |
80 | 66 | // ---------------------------------------------------------------------- |
|
0 commit comments