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
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 
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
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
~AlcaPCCIntegrator() override
edm::EDGetTokenT< reco::PixelClusterCountsInEvent > pccToken_
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override
T const * product() const
Definition: Handle.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) override