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::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 PUDumper (const edm::ParameterSet &)
 ctor More...
 
 ~PUDumper () override
 dtor More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 19 of file PUDumper.h.

Constructor & Destructor Documentation

◆ PUDumper()

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

ctor

Definition at line 4 of file PUDumper.cc.

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

4  {
5  pileupSummaryToken_ = consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupSummary"));
6 
7  // create TTree
9  PUTree_ = fs->make<TTree>("pileup", "pileup");
10 
11  PUTree_->Branch("runNumber", &runNumber, "runNumber/I");
12  PUTree_->Branch("eventNumber", &eventNumber, "eventNumber/l");
13  PUTree_->Branch("lumiBlock", &lumiBlock, "lumiBlock/I");
14 
15  PUTree_->Branch("nBX", &nBX, "nBX/I");
16  PUTree_->Branch("BX", BX_, "BX[nBX]/I");
17  PUTree_->Branch("nPUtrue", &nPUtrue_, "nPUtrue/I");
18  PUTree_->Branch("nPUobs", nPUobs_, "nPUobs[nBX]/I");
19 }
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
Int_t nBX
Definition: PUDumper.h:40
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TTree * PUTree_
Definition: PUDumper.h:34
Int_t nPUtrue_
Definition: PUDumper.h:42
Int_t nPUobs_[100]
Definition: PUDumper.h:43
Int_t lumiBlock
lumi section
Definition: PUDumper.h:38
Long64_t eventNumber
Definition: PUDumper.h:37
Int_t BX_[100]
Definition: PUDumper.h:41
Int_t runNumber
Definition: PUDumper.h:36

◆ ~PUDumper()

PUDumper::~PUDumper ( )
override

dtor

Definition at line 24 of file PUDumper.cc.

24 {}

Member Function Documentation

◆ analyze()

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

the actual analyze method

loop over the reco particles and count leptons

Implements edm::one::EDAnalyzerBase.

Definition at line 29 of file PUDumper.cc.

References BX_, gather_cfg::cout, eventNumber, iEvent, lumiBlock, nBX, nPUobs_, nPUtrue_, pileupSummaryToken_, PUTree_, runNumber, and sistrip::runNumber_.

29  {
30  // get the PU collection
32  if (!iEvent.isRealData()) {
33  iEvent.getByToken(pileupSummaryToken_, PupInfo);
34  } else
35  return;
36 
37  runNumber = iEvent.id().run();
38  eventNumber = iEvent.id().event();
39  if (iEvent.isRealData()) {
40  lumiBlock = iEvent.luminosityBlock();
41  } else {
42  lumiBlock = -1;
43  }
44 
45  // loop on BX
46  nBX = 0;
47  std::vector<PileupSummaryInfo>::const_iterator PVI;
48  nPUtrue_ = PupInfo->begin()->getTrueNumInteractions();
49 
50  for (PVI = PupInfo->begin(); PVI != PupInfo->end(); ++PVI) {
51  BX_[nBX] = PVI->getBunchCrossing();
52  nPUobs_[nBX] = PVI->getPU_NumInteractions();
53 #ifdef DEBUG
54  std::cout << "PUDumper::runNumber: " << runNumber_ << " BX[1]: " << BX_[1] << " nPUtrue: " << nPUtrue_
55  << " nPUobs[1]: " << nPUobs_[1] << std::endl;
56 #endif
57  nBX++;
58  }
59  PUTree_->Fill();
60 }
static const char runNumber_[]
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
Int_t nBX
Definition: PUDumper.h:40
TTree * PUTree_
Definition: PUDumper.h:34
Int_t nPUtrue_
Definition: PUDumper.h:42
Int_t nPUobs_[100]
Definition: PUDumper.h:43
Int_t lumiBlock
lumi section
Definition: PUDumper.h:38
int iEvent
Definition: GenABIO.cc:224
Long64_t eventNumber
Definition: PUDumper.h:37
Int_t BX_[100]
Definition: PUDumper.h:41
Int_t runNumber
Definition: PUDumper.h:36

Member Data Documentation

◆ BX_

Int_t PUDumper::BX_[100]
private

Definition at line 41 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ eventNumber

Long64_t PUDumper::eventNumber
private

Definition at line 37 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ lumiBlock

Int_t PUDumper::lumiBlock
private

lumi section

Definition at line 38 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nBX

Int_t PUDumper::nBX
private

Definition at line 40 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nPUobs_

Int_t PUDumper::nPUobs_[100]
private

Definition at line 43 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nPUtrue_

Int_t PUDumper::nPUtrue_
private

Definition at line 42 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ pileupSummaryToken_

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

Definition at line 32 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ PUTree_

TTree* PUDumper::PUTree_
private

Definition at line 34 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ runNumber

Int_t PUDumper::runNumber
private