CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PUDumper.cc
Go to the documentation of this file.
2 
3 
6 {
7  // MCPileupTag_ = iConfig.getParameter<edm::InputTag>("MCPileupTag");
8  pileupSummaryToken_ = consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummary"));
9 
10  // create TTree
12  PUTree_ = fs -> make<TTree>("pileup","pileup");
13 
14  PUTree_ -> Branch("runNumber", &runNumber, "runNumber/I");
15  PUTree_ -> Branch("eventNumber", &eventNumber, "eventNumber/l");
16  PUTree_ -> Branch("lumiBlock", &lumiBlock, "lumiBlock/I");
17 
18  PUTree_ -> Branch("nBX", &nBX, "nBX/I");
19  PUTree_ -> Branch("BX", BX_, "BX[nBX]/I");
20  PUTree_ -> Branch("nPUtrue", &nPUtrue_, "nPUtrue/I");
21  PUTree_ -> Branch("nPUobs", nPUobs_, "nPUobs[nBX]/I");
22 }
23 
24 // ----------------------------------------------------------------
25 
26 
27 
30 {}
31 
32 // ----------------------------------------------------------------
33 
34 
35 
38 {
39  // get the PU collection
41  if( !iEvent.isRealData() ){
42  iEvent.getByToken(pileupSummaryToken_, PupInfo);
43  } else return;
44 
45 
46  runNumber = iEvent.id().run();
47  eventNumber = iEvent.id().event();
48  if( iEvent.isRealData() ) {
49  lumiBlock = iEvent.luminosityBlock();
50  } else {
51  lumiBlock = -1;
52  }
53 
54  // loop on BX
55  nBX=0;
56  std::vector<PileupSummaryInfo>::const_iterator PVI;
57  nPUtrue_ = PupInfo -> begin()->getTrueNumInteractions();
58 
59  for(PVI = PupInfo->begin(); PVI != PupInfo->end(); ++PVI){
60  BX_[nBX] = PVI -> getBunchCrossing();
61  nPUobs_[nBX] = PVI -> getPU_NumInteractions();
62 #ifdef DEBUG
63  std::cout << "PUDumper::runNumber: " << runNumber_
64  << " BX[1]: " << BX_[1]
65  << " nPUtrue: " << nPUtrue_
66  << " nPUobs[1]: " << nPUobs_[1]
67  << std::endl;
68 #endif
69  nBX++;
70  }
71  PUTree_ -> Fill();
72 }
73 
RunNumber_t run() const
Definition: EventID.h:39
static const char runNumber_[]
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
virtual void analyze(const edm::Event &, const edm::EventSetup &)
the actual analyze method
Definition: PUDumper.cc:37
Int_t nBX
Definition: PUDumper.h:52
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TTree * PUTree_
Definition: PUDumper.h:45
Int_t nPUtrue_
Definition: PUDumper.h:54
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
Int_t nPUobs_[100]
Definition: PUDumper.h:55
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:41
bool isRealData() const
Definition: EventBase.h:64
PUDumper(const edm::ParameterSet &)
ctor
Definition: PUDumper.cc:5
Int_t lumiBlock
lumi section
Definition: PUDumper.h:49
int iEvent
Definition: GenABIO.cc:230
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
~PUDumper()
dtor
Definition: PUDumper.cc:29
Long64_t eventNumber
Definition: PUDumper.h:48
Int_t BX_[100]
Definition: PUDumper.h:53
Int_t runNumber
Definition: PUDumper.h:47
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121