CMS 3D CMS Logo

PUDumper.cc
Go to the documentation of this file.
2 
5  // MCPileupTag_ = iConfig.getParameter<edm::InputTag>("MCPileupTag");
6  pileupSummaryToken_ = consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummary"));
7 
8  // create TTree
10  PUTree_ = fs->make<TTree>("pileup", "pileup");
11 
12  PUTree_->Branch("runNumber", &runNumber, "runNumber/I");
13  PUTree_->Branch("eventNumber", &eventNumber, "eventNumber/l");
14  PUTree_->Branch("lumiBlock", &lumiBlock, "lumiBlock/I");
15 
16  PUTree_->Branch("nBX", &nBX, "nBX/I");
17  PUTree_->Branch("BX", BX_, "BX[nBX]/I");
18  PUTree_->Branch("nPUtrue", &nPUtrue_, "nPUtrue/I");
19  PUTree_->Branch("nPUobs", nPUobs_, "nPUobs[nBX]/I");
20 }
21 
22 // ----------------------------------------------------------------
23 
26 
27 // ----------------------------------------------------------------
28 
30 void PUDumper::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
31  // get the PU collection
33  if (!iEvent.isRealData()) {
34  iEvent.getByToken(pileupSummaryToken_, PupInfo);
35  } else
36  return;
37 
38  runNumber = iEvent.id().run();
39  eventNumber = iEvent.id().event();
40  if (iEvent.isRealData()) {
41  lumiBlock = iEvent.luminosityBlock();
42  } else {
43  lumiBlock = -1;
44  }
45 
46  // loop on BX
47  nBX = 0;
48  std::vector<PileupSummaryInfo>::const_iterator PVI;
49  nPUtrue_ = PupInfo->begin()->getTrueNumInteractions();
50 
51  for (PVI = PupInfo->begin(); PVI != PupInfo->end(); ++PVI) {
52  BX_[nBX] = PVI->getBunchCrossing();
53  nPUobs_[nBX] = PVI->getPU_NumInteractions();
54 #ifdef DEBUG
55  std::cout << "PUDumper::runNumber: " << runNumber_ << " BX[1]: " << BX_[1] << " nPUtrue: " << nPUtrue_
56  << " nPUobs[1]: " << nPUobs_[1] << std::endl;
57 #endif
58  nBX++;
59  }
60  PUTree_->Fill();
61 }
62 
PUDumper.h
PUDumper::nPUtrue_
Int_t nPUtrue_
Definition: PUDumper.h:45
PUDumper::~PUDumper
~PUDumper() override
dtor
Definition: PUDumper.cc:25
PUDumper::nPUobs_
Int_t nPUobs_[100]
Definition: PUDumper.h:46
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::Handle
Definition: AssociativeIterator.h:50
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PUDumper::PUTree_
TTree * PUTree_
Definition: PUDumper.h:36
edm::ParameterSet
Definition: ParameterSet.h:36
PUDumper::pileupSummaryToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
PUDumper::BX_
Int_t BX_[100]
Definition: PUDumper.h:44
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
PUDumper::PUDumper
PUDumper(const edm::ParameterSet &)
ctor
Definition: PUDumper.cc:4
PUDumper::eventNumber
Long64_t eventNumber
Definition: PUDumper.h:39
PUDumper
Definition: PUDumper.h:19
PUDumper::lumiBlock
Int_t lumiBlock
lumi section
Definition: PUDumper.h:40
PUDumper::runNumber
Int_t runNumber
Definition: PUDumper.h:38
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
sistrip::runNumber_
static const char runNumber_[]
Definition: ConstantsForDqm.h:33
PUDumper::nBX
Int_t nBX
Definition: PUDumper.h:43
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
PUDumper::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
the actual analyze method
Definition: PUDumper.cc:30