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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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::InputTag _pvcollection
 
VertexHistogramMaker _vhm
 
PrescaleWeightProvider_weightprov
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 53 of file AnotherPrimaryVertexAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 86 of file AnotherPrimaryVertexAnalyzer.cc.

References _vhm, and VertexHistogramMaker::book().

86  :
87  _vhm(iConfig.getParameter<edm::ParameterSet>("vHistogramMakerPSet")),
88  _pvcollection(iConfig.getParameter<edm::InputTag>("pvCollection")),
89  _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly",false)),
90  _weightprov(iConfig.getParameter<bool>("usePrescaleWeight") ?
91  new PrescaleWeightProvider(iConfig.getParameter<edm::ParameterSet>("prescaleWeightProviderPSet")) : 0)
92 {
93  //now do what ever initialization is needed
94 
95  //
96 
97  _vhm.book();
98 
99 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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 102 of file AnotherPrimaryVertexAnalyzer.cc.

References _weightprov.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 119 of file AnotherPrimaryVertexAnalyzer.cc.

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

120 {
121  using namespace edm;
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.getByLabel(_pvcollection,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)
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.)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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 70 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

edm::InputTag AnotherPrimaryVertexAnalyzer::_pvcollection
private

Definition at line 69 of file AnotherPrimaryVertexAnalyzer.cc.

Referenced by analyze().

VertexHistogramMaker AnotherPrimaryVertexAnalyzer::_vhm
private

Definition at line 68 of file AnotherPrimaryVertexAnalyzer.cc.

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

PrescaleWeightProvider* AnotherPrimaryVertexAnalyzer::_weightprov
private