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 &&)=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
 
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 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

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

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

Definition at line 50 of file AnotherPrimaryVertexAnalyzer.cc.

Constructor & Destructor Documentation

◆ AnotherPrimaryVertexAnalyzer()

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

Definition at line 82 of file AnotherPrimaryVertexAnalyzer.cc.

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 }

References _vhm, and VertexHistogramMaker::book().

◆ ~AnotherPrimaryVertexAnalyzer()

AnotherPrimaryVertexAnalyzer::~AnotherPrimaryVertexAnalyzer ( )
override

Definition at line 98 of file AnotherPrimaryVertexAnalyzer.cc.

98 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 105 of file AnotherPrimaryVertexAnalyzer.cc.

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 }

References _firstOnly, _recoVertexCollectionToken, _vhm, _weightprov, VertexHistogramMaker::fill(), and iEvent.

◆ beginJob()

void AnotherPrimaryVertexAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file AnotherPrimaryVertexAnalyzer.cc.

129 {}

◆ beginRun()

void AnotherPrimaryVertexAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file AnotherPrimaryVertexAnalyzer.cc.

131  {
132  _vhm.beginRun(iRun);
133 
134  if (_weightprov)
135  _weightprov->initRun(iRun, iSetup);
136 }

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

◆ endJob()

void AnotherPrimaryVertexAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file AnotherPrimaryVertexAnalyzer.cc.

140 {}

◆ endRun()

void AnotherPrimaryVertexAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 138 of file AnotherPrimaryVertexAnalyzer.cc.

138 {}

Member Data Documentation

◆ _firstOnly

bool AnotherPrimaryVertexAnalyzer::_firstOnly
private

Definition at line 66 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

◆ _recoVertexCollectionToken

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

Definition at line 65 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

◆ _vhm

VertexHistogramMaker AnotherPrimaryVertexAnalyzer::_vhm
private

Definition at line 64 of file AnotherPrimaryVertexAnalyzer.cc.

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

◆ _weightprov

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

Definition at line 68 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze(), and beginRun().

AnotherPrimaryVertexAnalyzer::_recoVertexCollectionToken
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
Definition: AnotherPrimaryVertexAnalyzer.cc:65
VertexHistogramMaker::fill
void fill(const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
Definition: VertexHistogramMaker.cc:440
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle< reco::VertexCollection >
PrescaleWeightProvider
This class takes a vector of HLT paths and returns a weight based on their HLT and L1 prescales....
Definition: PrescaleWeightProvider.h:47
AnotherPrimaryVertexAnalyzer::_firstOnly
bool _firstOnly
Definition: AnotherPrimaryVertexAnalyzer.cc:66
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
VertexHistogramMaker::beginRun
void beginRun(const edm::Run &iRun)
Definition: VertexHistogramMaker.cc:257
AnotherPrimaryVertexAnalyzer::_vhm
VertexHistogramMaker _vhm
Definition: AnotherPrimaryVertexAnalyzer.cc:64
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AnotherPrimaryVertexAnalyzer::_weightprov
std::unique_ptr< PrescaleWeightProvider > _weightprov
Definition: AnotherPrimaryVertexAnalyzer.cc:68
VertexHistogramMaker::book
void book(const std::string dirname="")
Definition: VertexHistogramMaker.cc:48
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1