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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 

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 &)
 
- 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 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 52 of file AnotherPrimaryVertexAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file AnotherPrimaryVertexAnalyzer.cc.

References _vhm, and VertexHistogramMaker::book().

86  : _vhm(iConfig.getParameter<edm::ParameterSet>("vHistogramMakerPSet"), consumesCollector())
87  , _recoVertexCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pvCollection")))
88  , _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly",false))
89  , _weightprov(iConfig.getParameter<bool>("usePrescaleWeight")
90  ? new PrescaleWeightProvider(iConfig.getParameter<edm::ParameterSet>("prescaleWeightProviderPSet"), consumesCollector(), *this)
91  : 0
92  )
93 {
94  //now do what ever initialization is needed
95 
96  //
97 
98  _vhm.book();
99 
100 }
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 ( )

Definition at line 103 of file AnotherPrimaryVertexAnalyzer.cc.

104 {
105 }

Member Function Documentation

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

Definition at line 114 of file AnotherPrimaryVertexAnalyzer.cc.

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

115 {
116 
117  // compute event weigth
118 
119  double weight = 1.;
120 
121  if(_weightprov) weight = _weightprov->prescaleWeight(iEvent,iSetup);
122 
123  // get PV
124 
126  iEvent.getByToken(_recoVertexCollectionToken,pvcoll);
127 
128  if(_firstOnly) {
129  reco::VertexCollection firstpv;
130  if(pvcoll->size()) firstpv.push_back((*pvcoll)[0]);
131  _vhm.fill(iEvent,firstpv,weight);
132  }
133  else {
134  _vhm.fill(iEvent,*pvcoll,weight);
135  }
136 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file AnotherPrimaryVertexAnalyzer.cc.

142 { }
void AnotherPrimaryVertexAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 145 of file AnotherPrimaryVertexAnalyzer.cc.

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

145  {
146 
147  _vhm.beginRun(iRun);
148 
149  if(_weightprov) _weightprov->initRun(iRun,iSetup);
150 
151 }
std::unique_ptr< PrescaleWeightProvider > _weightprov
void beginRun(const edm::Run &iRun)
void AnotherPrimaryVertexAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file AnotherPrimaryVertexAnalyzer.cc.

References DEFINE_FWK_MODULE.

159  {
160 }
void AnotherPrimaryVertexAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 154 of file AnotherPrimaryVertexAnalyzer.cc.

154  {
155 
156 }

Member Data Documentation

bool AnotherPrimaryVertexAnalyzer::_firstOnly
private

Definition at line 69 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

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

Definition at line 68 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

VertexHistogramMaker AnotherPrimaryVertexAnalyzer::_vhm
private

Definition at line 67 of file AnotherPrimaryVertexAnalyzer.cc.

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

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

Definition at line 71 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze(), and beginRun().