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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

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

◆ ~PUDumper()

PUDumper::~PUDumper ( )
override

dtor

Definition at line 25 of file PUDumper.cc.

25 {}

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::EDAnalyzer.

Definition at line 30 of file PUDumper.cc.

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 }

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

Member Data Documentation

◆ BX_

Int_t PUDumper::BX_[100]
private

Definition at line 44 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ eventNumber

Long64_t PUDumper::eventNumber
private

Definition at line 39 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ lumiBlock

Int_t PUDumper::lumiBlock
private

lumi section

Definition at line 40 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nBX

Int_t PUDumper::nBX
private

Definition at line 43 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nPUobs_

Int_t PUDumper::nPUobs_[100]
private

Definition at line 46 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ nPUtrue_

Int_t PUDumper::nPUtrue_
private

Definition at line 45 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 36 of file PUDumper.h.

Referenced by analyze(), and PUDumper().

◆ runNumber

Int_t PUDumper::runNumber
private
PUDumper::nPUtrue_
Int_t nPUtrue_
Definition: PUDumper.h:45
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
PUDumper::PUTree_
TTree * PUTree_
Definition: PUDumper.h:36
PUDumper::pileupSummaryToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryToken_
Definition: PUDumper.h:32
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
PUDumper::BX_
Int_t BX_[100]
Definition: PUDumper.h:44
PUDumper::eventNumber
Long64_t eventNumber
Definition: PUDumper.h:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PUDumper::lumiBlock
Int_t lumiBlock
lumi section
Definition: PUDumper.h:40
PUDumper::runNumber
Int_t runNumber
Definition: PUDumper.h:38
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