CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
PrescaleWeightProvider_weightprov
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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())
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.
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.

References _weightprov.

104 {
105 
106  // do anything here that needs to be done at desctruction time
107  // (e.g. close files, deallocate resources etc.)
108 
109  delete _weightprov;
110 
111 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 120 of file AnotherPrimaryVertexAnalyzer.cc.

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

121 {
122 
123  // compute event weigth
124 
125  double weight = 1.;
126 
127  if(_weightprov) weight = _weightprov->prescaleWeight(iEvent,iSetup);
128 
129  // get PV
130 
132  iEvent.getByToken(_recoVertexCollectionToken,pvcoll);
133 
134  if(_firstOnly) {
135  reco::VertexCollection firstpv;
136  if(pvcoll->size()) firstpv.push_back((*pvcoll)[0]);
137  _vhm.fill(iEvent,firstpv,weight);
138  }
139  else {
140  _vhm.fill(iEvent,*pvcoll,weight);
141  }
142 }
int prescaleWeight(const edm::Event &event, const edm::EventSetup &setup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
void fill(const edm::Event &iEvent, const reco::VertexCollection &vertices, const double weight=1.)
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
int weight
Definition: histoStyle.py:50
void AnotherPrimaryVertexAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file AnotherPrimaryVertexAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file AnotherPrimaryVertexAnalyzer.cc.

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

151  {
152 
153  _vhm.beginRun(iRun);
154 
155  if(_weightprov) _weightprov->initRun(iRun,iSetup);
156 
157 }
void initRun(const edm::Run &run, const edm::EventSetup &setup)
void beginRun(const edm::Run &iRun)
void AnotherPrimaryVertexAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file AnotherPrimaryVertexAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file AnotherPrimaryVertexAnalyzer.cc.

160  {
161 
162 }

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().

PrescaleWeightProvider* AnotherPrimaryVertexAnalyzer::_weightprov
private