Skip to content

Commit 0970a66

Browse files
committed
make AlcaPCCEventProducer a global module
1 parent 1d7ff69 commit 0970a66

File tree

1 file changed

+25
-39
lines changed

1 file changed

+25
-39
lines changed

Calibration/LumiAlCaRecoProducers/plugins/AlcaPCCEventProducer.cc

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,66 @@
11
/**_________________________________________________________________
22
class: AlcaPCCEventProducer.cc
33
4-
5-
64
authors: Sam Higginbotham ([email protected]), Chris Palmer ([email protected]), Attila Radl ([email protected])
7-
85
________________________________________________________________**/
96

107
// C++ standard
118
#include <string>
129

1310
// CMS
14-
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
1511
#include "DataFormats/DetId/interface/DetId.h"
1612
#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"
1914
#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"
2615
#include "FWCore/Framework/interface/ESHandle.h"
16+
#include "FWCore/Framework/interface/Event.h"
2717
#include "FWCore/Framework/interface/EventSetup.h"
18+
#include "FWCore/Framework/interface/Frameworkfwd.h"
2819
#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"
2923
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
24+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
3025
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
26+
#include "FWCore/ServiceRegistry/interface/Service.h"
27+
#include "FWCore/Utilities/interface/EDGetToken.h"
3128
#include "TMath.h"
3229

3330
//The class
34-
class AlcaPCCEventProducer : public edm::stream::EDProducer<> {
31+
class AlcaPCCEventProducer : public edm::global::EDProducer<> {
3532
public:
3633
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;
3836
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
3937

4038
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_;
4242

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;
5546
};
5647

5748
//--------------------------------------------------------------------------------------------------
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_)) {
6153
produces<reco::PixelClusterCountsInEvent, edm::Transition::Event>(trigstring_);
62-
pixelToken = consumes<edmNew::DetSetVector<SiPixelCluster> >(fPixelClusterLabel);
6354
}
6455

6556
//--------------------------------------------------------------------------------------------------
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>();
7359
unsigned int bx = iEvent.bunchCrossing();
7460

7561
//Looping over the clusters and adding the counts up
7662
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > hClusterColl;
77-
iEvent.getByToken(pixelToken, hClusterColl);
63+
iEvent.getByToken(pixelToken_, hClusterColl);
7864

7965
const edmNew::DetSetVector<SiPixelCluster>& clustColl = *(hClusterColl.product());
8066
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)