test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PUDumper Class Reference

#include <PUDumper.h>

Inheritance diagram for PUDumper:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PUDumper (const edm::ParameterSet &)
 ctor More...
 
 ~PUDumper ()
 dtor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 the actual analyze method More...
 

Private Attributes

Int_t BX_ [100]
 
Long64_t eventNumber
 
Int_t lumiBlock
 lumi section More...
 
Int_t nBX
 
Int_t nPUobs_ [100]
 
Int_t nPUtrue_
 
edm::EDGetTokenT< std::vector
< PileupSummaryInfo > > 
pileupSummaryToken_
 
TTree * PUTree_
 
Int_t runNumber
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 20 of file PUDumper.h.

Constructor & Destructor Documentation

PUDumper::PUDumper ( const edm::ParameterSet iConfig)
explicit

ctor

Definition at line 5 of file PUDumper.cc.

References BX_, eventNumber, edm::ParameterSet::getParameter(), lumiBlock, nBX, nPUobs_, nPUtrue_, pileupSummaryToken_, PUTree_, and runNumber.

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 }
T getParameter(std::string const &) const
Int_t nBX
Definition: PUDumper.h:52
TTree * PUTree_
Definition: PUDumper.h:45
Int_t nPUtrue_
Definition: PUDumper.h:54
Int_t nPUobs_[100]
Definition: PUDumper.h:55
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:41
Int_t lumiBlock
lumi section
Definition: PUDumper.h:49
Long64_t eventNumber
Definition: PUDumper.h:48
Int_t BX_[100]
Definition: PUDumper.h:53
Int_t runNumber
Definition: PUDumper.h:47
PUDumper::~PUDumper ( )

dtor

Definition at line 29 of file PUDumper.cc.

30 {}

Member Function Documentation

void PUDumper::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

the actual analyze method

loop over the reco particles and count leptons

Implements edm::EDAnalyzer.

Definition at line 37 of file PUDumper.cc.

References begin, BX_, gather_cfg::cout, edm::EventID::event(), eventNumber, HcalObjRepresent::Fill(), edm::Event::getByToken(), edm::EventBase::id(), edm::EventBase::isRealData(), lumiBlock, edm::EventBase::luminosityBlock(), nBX, nPUobs_, nPUtrue_, pileupSummaryToken_, PUTree_, edm::EventID::run(), runNumber, and sistrip::runNumber_.

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 }
RunNumber_t run() const
Definition: EventID.h:39
static const char runNumber_[]
EventNumber_t event() const
Definition: EventID.h:41
Int_t nBX
Definition: PUDumper.h:52
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
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
Int_t lumiBlock
lumi section
Definition: PUDumper.h:49
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
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

Member Data Documentation

Int_t PUDumper::BX_[100]
private

Definition at line 53 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Long64_t PUDumper::eventNumber
private
Int_t PUDumper::lumiBlock
private

lumi section

Definition at line 49 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nBX
private

Definition at line 52 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nPUobs_[100]
private

Definition at line 55 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nPUtrue_
private

Definition at line 54 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

edm::EDGetTokenT< std::vector<PileupSummaryInfo> > PUDumper::pileupSummaryToken_
private

Definition at line 41 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

TTree* PUDumper::PUTree_
private

Definition at line 45 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::runNumber
private

Definition at line 47 of file PUDumper.h.

Referenced by analyze(), and PUDumper().