CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
27  : public edm::one::EDProducer<edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks> {
28 public:
29  explicit AlcaPCCIntegrator(const edm::ParameterSet&);
30  ~AlcaPCCIntegrator() override = default;
31 
32 private:
33  void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
34  void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, const edm::EventSetup& iSetup) override;
35  void endLuminosityBlockProduce(edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) override;
36  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
37 
40 
41  std::string trigstring_; //specifies the input trigger Rand or ZeroBias
42  std::string prodInst_; //file product instance
43  int countEvt_; //counter
44  int countLumi_; //counter
45 
46  std::unique_ptr<reco::PixelClusterCounts> thePCCob;
47 };
48 
49 //--------------------------------------------------------------------------------------------------
51  pccSource_ =
52  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters").getParameter<std::string>("inputPccLabel");
53  auto trigstring_ = iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters")
54  .getUntrackedParameter<std::string>("trigstring", "alcaPCC");
55  prodInst_ =
56  iConfig.getParameter<edm::ParameterSet>("AlcaPCCIntegratorParameters").getParameter<std::string>("ProdInst");
57 
58  edm::InputTag PCCInputTag_(pccSource_, trigstring_);
59 
60  countLumi_ = 0;
61 
62  produces<reco::PixelClusterCounts, edm::Transition::EndLuminosityBlock>(prodInst_);
63  pccToken_ = consumes<reco::PixelClusterCountsInEvent>(PCCInputTag_);
64 }
65 
66 //--------------------------------------------------------------------------------------------------
68  countEvt_++;
69 
70  unsigned int bx = iEvent.bunchCrossing();
71  //std::cout<<"The Bunch Crossing Int"<<bx<<std::endl;
72 
73  thePCCob->eventCounter(bx);
74 
75  //Looping over the clusters and adding the counts up
77  iEvent.getByToken(pccToken_, pccHandle);
78 
79  if (!pccHandle.isValid()) {
80  // do not resolve a not existing product!
81  return;
82  }
83 
84  const reco::PixelClusterCountsInEvent inputPcc = *pccHandle;
85  thePCCob->add(inputPcc);
86 }
87 
88 //--------------------------------------------------------------------------------------------------
90  //PCC object at the beginning of each lumi section
91  thePCCob = std::make_unique<reco::PixelClusterCounts>();
92  countLumi_++;
93 }
94 
95 //--------------------------------------------------------------------------------------------------
97 
98 //--------------------------------------------------------------------------------------------------
100  //Saving the PCC object
102 }
103 
AlcaPCCIntegrator(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
int bunchCrossing() const
Definition: EventBase.h:64
~AlcaPCCIntegrator() override=default
std::unique_ptr< reco::PixelClusterCounts > thePCCob
int iEvent
Definition: GenABIO.cc:224
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
void put(std::unique_ptr< PROD > product)
Put a new product.
def move
Definition: eostools.py:511
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::PixelClusterCountsInEvent > pccToken_
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) override