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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 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 19 of file PUDumper.h.

Constructor & Destructor Documentation

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

ctor

Definition at line 4 of file PUDumper.cc.

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

4  {
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 }
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
T getParameter(std::string const &) const
Int_t nBX
Definition: PUDumper.h:43
TTree * PUTree_
Definition: PUDumper.h:36
Int_t nPUtrue_
Definition: PUDumper.h:45
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
Int_t nPUobs_[100]
Definition: PUDumper.h:46
Int_t lumiBlock
lumi section
Definition: PUDumper.h:40
Long64_t eventNumber
Definition: PUDumper.h:39
Int_t BX_[100]
Definition: PUDumper.h:44
Int_t runNumber
Definition: PUDumper.h:38
PUDumper::~PUDumper ( )
override

dtor

Definition at line 25 of file PUDumper.cc.

25 {}

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 30 of file PUDumper.cc.

References BX_, gather_cfg::cout, DEFINE_FWK_MODULE, edm::EventID::event(), eventNumber, 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_.

30  {
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 }
RunNumber_t run() const
Definition: EventID.h:38
static const char runNumber_[]
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
EventNumber_t event() const
Definition: EventID.h:40
Int_t nBX
Definition: PUDumper.h:43
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
TTree * PUTree_
Definition: PUDumper.h:36
Int_t nPUtrue_
Definition: PUDumper.h:45
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
Int_t nPUobs_[100]
Definition: PUDumper.h:46
bool isRealData() const
Definition: EventBase.h:62
Int_t lumiBlock
lumi section
Definition: PUDumper.h:40
Long64_t eventNumber
Definition: PUDumper.h:39
Int_t BX_[100]
Definition: PUDumper.h:44
Int_t runNumber
Definition: PUDumper.h:38
edm::EventID id() const
Definition: EventBase.h:59

Member Data Documentation

Int_t PUDumper::BX_[100]
private

Definition at line 44 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

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

lumi section

Definition at line 40 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nBX
private

Definition at line 43 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nPUobs_[100]
private

Definition at line 46 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::nPUtrue_
private

Definition at line 45 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

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

Definition at line 32 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

TTree* PUDumper::PUTree_
private

Definition at line 36 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

Int_t PUDumper::runNumber
private