CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
AnotherPrimaryVertexAnalyzer Class Reference

#include <Validation/RecoVertex/plugins/AnotherPrimaryVertexAnalyzer.cc>

Inheritance diagram for AnotherPrimaryVertexAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AnotherPrimaryVertexAnalyzer (const edm::ParameterSet &)
 
 ~AnotherPrimaryVertexAnalyzer () override
 
- 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
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

bool _firstOnly
 
edm::EDGetTokenT< reco::VertexCollection_recoVertexCollectionToken
 
VertexHistogramMaker _vhm
 
std::unique_ptr< PrescaleWeightProvider_weightprov
 

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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file AnotherPrimaryVertexAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file AnotherPrimaryVertexAnalyzer.cc.

References _vhm, and VertexHistogramMaker::book().

83  : _vhm(iConfig.getParameter<edm::ParameterSet>("vHistogramMakerPSet"), consumesCollector()),
84  _recoVertexCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pvCollection"))),
85  _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly", false)),
87  iConfig.getParameter<bool>("usePrescaleWeight")
89  iConfig.getParameter<edm::ParameterSet>("prescaleWeightProviderPSet"), consumesCollector(), *this)
90  : nullptr) {
91  //now do what ever initialization is needed
92 
93  //
94 
95  _vhm.book();
96 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< PrescaleWeightProvider > _weightprov
void book(const std::string dirname="")
This class takes a vector of HLT paths and returns a weight based on their HLT and L1 prescales...
AnotherPrimaryVertexAnalyzer::~AnotherPrimaryVertexAnalyzer ( )
override

Definition at line 98 of file AnotherPrimaryVertexAnalyzer.cc.

98 {}

Member Function Documentation

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

Definition at line 105 of file AnotherPrimaryVertexAnalyzer.cc.

References _firstOnly, _recoVertexCollectionToken, _vhm, _weightprov, VertexHistogramMaker::fill(), and edm::Event::getByToken().

105  {
106  // compute event weigth
107 
108  double weight = 1.;
109 
110  if (_weightprov)
111  weight = _weightprov->prescaleWeight(iEvent, iSetup);
112 
113  // get PV
114 
116  iEvent.getByToken(_recoVertexCollectionToken, pvcoll);
117 
118  if (_firstOnly) {
119  reco::VertexCollection firstpv;
120  if (!pvcoll->empty())
121  firstpv.push_back((*pvcoll)[0]);
122  _vhm.fill(iEvent, firstpv, weight);
123  } else {
124  _vhm.fill(iEvent, *pvcoll, weight);
125  }
126 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
Definition: weight.py:1
void fill(const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
std::unique_ptr< PrescaleWeightProvider > _weightprov
void AnotherPrimaryVertexAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file AnotherPrimaryVertexAnalyzer.cc.

129 {}
void AnotherPrimaryVertexAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 131 of file AnotherPrimaryVertexAnalyzer.cc.

References _vhm, _weightprov, and VertexHistogramMaker::beginRun().

131  {
132  _vhm.beginRun(iRun);
133 
134  if (_weightprov)
135  _weightprov->initRun(iRun, iSetup);
136 }
std::unique_ptr< PrescaleWeightProvider > _weightprov
void beginRun(const edm::Run &iRun)
void AnotherPrimaryVertexAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file AnotherPrimaryVertexAnalyzer.cc.

References DEFINE_FWK_MODULE.

140 {}
void AnotherPrimaryVertexAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 138 of file AnotherPrimaryVertexAnalyzer.cc.

138 {}

Member Data Documentation

bool AnotherPrimaryVertexAnalyzer::_firstOnly
private

Definition at line 66 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::VertexCollection> AnotherPrimaryVertexAnalyzer::_recoVertexCollectionToken
private

Definition at line 65 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

VertexHistogramMaker AnotherPrimaryVertexAnalyzer::_vhm
private

Definition at line 64 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze(), AnotherPrimaryVertexAnalyzer(), and beginRun().

std::unique_ptr<PrescaleWeightProvider> AnotherPrimaryVertexAnalyzer::_weightprov
private

Definition at line 68 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze(), and beginRun().