CMS 3D CMS Logo

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 () override
 dtor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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 ( )
override

dtor

Definition at line 29 of file PUDumper.cc.

30 {}

Member Function Documentation

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

the actual analyze method

loop over the reco particles and count leptons

Definition at line 37 of file PUDumper.cc.

References begin, BX_, gather_cfg::cout, DEFINE_FWK_MODULE, 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:579
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:32

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