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
15 
28 #include "TMath.h"
29 //The class
31  : public edm::one::EDProducer<edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks> {
32 public:
33  explicit AlcaPCCIntegrator(const edm::ParameterSet&);
34  ~AlcaPCCIntegrator() override;
35 
36 private:
37  void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
38  void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
39  void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) override;
40  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
41 
44 
45  std::string trigstring_; //specifies the input trigger Rand or ZeroBias
46  std::string prodInst_; //file product instance
47  int countEvt_; //counter
48  int countLumi_; //counter
49 
50  std::unique_ptr<reco::PixelClusterCounts> thePCCob;
51 };
52 
53 //--------------------------------------------------------------------------------------------------
55  pccSource_ =
56  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters").getParameter<std::string>("inputPccLabel");
57  auto trigstring_ = iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters")
58  .getUntrackedParameter<std::string>("trigstring", "alcaPCC");
59  prodInst_ =
60  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters").getParameter<std::string>("ProdInst");
61 
62  edm::InputTag PCCInputTag_(pccSource_, trigstring_);
63 
64  countLumi_ = 0;
65 
66  produces<reco::PixelClusterCounts, edm::Transition::EndLuminosityBlock>(prodInst_);
67  pccToken_ = consumes<reco::PixelClusterCountsInEvent>(PCCInputTag_);
68 }
69 
70 //--------------------------------------------------------------------------------------------------
72 
73 //--------------------------------------------------------------------------------------------------
75  countEvt_++;
76 
77  unsigned int bx = iEvent.bunchCrossing();
78  //std::cout<<"The Bunch Crossing Int"<<bx<<std::endl;
79 
80  thePCCob->eventCounter(bx);
81 
82  //Looping over the clusters and adding the counts up
84  iEvent.getByToken(pccToken_, pccHandle);
85 
86  const reco::PixelClusterCountsInEvent inputPcc = *(pccHandle.product());
87  thePCCob->add(inputPcc);
88 }
89 
90 //--------------------------------------------------------------------------------------------------
92  //PCC object at the beginning of each lumi section
93  thePCCob = std::make_unique<reco::PixelClusterCounts>();
94  countLumi_++;
95 }
96 
97 //--------------------------------------------------------------------------------------------------
99 
100 //--------------------------------------------------------------------------------------------------
102  //Saving the PCC object
104 }
105 
reco::PixelClusterCountsInEvent
Definition: PixelClusterCountsInEvent.h:15
AlcaPCCIntegrator::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: AlcaPCCIntegrator.cc:74
EDProducer.h
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
PixelClusterCountsInEvent.h
ESHandle.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::EDGetTokenT< reco::PixelClusterCountsInEvent >
LuminosityBlock.h
AlcaPCCIntegrator::thePCCob
std::unique_ptr< reco::PixelClusterCounts > thePCCob
Definition: AlcaPCCIntegrator.cc:50
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
AlcaPCCIntegrator::AlcaPCCIntegrator
AlcaPCCIntegrator(const edm::ParameterSet &)
Definition: AlcaPCCIntegrator.cc:54
edm::one::EDProducer
Definition: EDProducer.h:30
edm::Handle
Definition: AssociativeIterator.h:50
AlcaPCCIntegrator
Definition: AlcaPCCIntegrator.cc:30
PixelClusterCounts.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
AlcaPCCIntegrator::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCIntegrator.cc:98
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
AlcaPCCIntegrator::~AlcaPCCIntegrator
~AlcaPCCIntegrator() override
Definition: AlcaPCCIntegrator.cc:71
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
AlcaPCCIntegrator::countEvt_
int countEvt_
Definition: AlcaPCCIntegrator.cc:47
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
AlcaPCCIntegrator::trigstring_
std::string trigstring_
Definition: AlcaPCCIntegrator.cc:45
AlcaPCCIntegrator::prodInst_
std::string prodInst_
Definition: AlcaPCCIntegrator.cc:46
edm::LuminosityBlock::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: LuminosityBlock.h:116
AlcaPCCIntegrator::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCIntegrator.cc:91
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlcaPCCIntegrator::pccToken_
edm::EDGetTokenT< reco::PixelClusterCountsInEvent > pccToken_
Definition: AlcaPCCIntegrator.cc:42
AlcaPCCIntegrator::countLumi_
int countLumi_
Definition: AlcaPCCIntegrator.cc:48
Frameworkfwd.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ConsumesCollector.h
AlcaPCCIntegrator::endLuminosityBlockProduce
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) override
Definition: AlcaPCCIntegrator.cc:101
ParameterSet.h
edm::Event
Definition: Event.h:73
AlcaPCCIntegrator::pccSource_
std::string pccSource_
Definition: AlcaPCCIntegrator.cc:43
edm::InputTag
Definition: InputTag.h:15