CMS 3D CMS Logo

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

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

Inheritance diagram for BSvsPVAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 BSvsPVAnalyzer (const edm::ParameterSet &)
 
 ~BSvsPVAnalyzer ()
 
- 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
 
 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

BSvsPVHistogramMaker _bspvhm
 
bool _firstOnly
 
edm::EDGetTokenT< reco::BeamSpot_recoBeamSpotToken
 
edm::EDGetTokenT< reco::VertexCollection_recoVertexCollectionToken
 

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 50 of file BSvsPVAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 83 of file BSvsPVAnalyzer.cc.

References _bspvhm, and BSvsPVHistogramMaker::book().

84  : _bspvhm(iConfig.getParameter<edm::ParameterSet>("bspvHistogramMakerPSet"), consumesCollector())
85  , _recoVertexCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pvCollection")))
86  , _recoBeamSpotToken(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("bsCollection")))
87  , _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly",false))
88 {
89  //now do what ever initialization is needed
90 
91  //
92 
93  _bspvhm.book();
94 
95 }
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.
edm::EDGetTokenT< reco::BeamSpot > _recoBeamSpotToken
void book(const std::string dirname="")
BSvsPVHistogramMaker _bspvhm
BSvsPVAnalyzer::~BSvsPVAnalyzer ( )

Definition at line 98 of file BSvsPVAnalyzer.cc.

99 {
100 
101  // do anything here that needs to be done at desctruction time
102  // (e.g. close files, deallocate resources etc.)
103 
104 }

Member Function Documentation

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

Definition at line 113 of file BSvsPVAnalyzer.cc.

References _bspvhm, _firstOnly, _recoBeamSpotToken, _recoVertexCollectionToken, BSvsPVHistogramMaker::fill(), and edm::Event::getByToken().

114 {
115 
116  // get BS
117 
119  iEvent.getByToken(_recoBeamSpotToken,bs);
120 
121  // get PV
122 
124  iEvent.getByToken(_recoVertexCollectionToken,pvcoll);
125 
126  if(_firstOnly) {
127  reco::VertexCollection firstpv;
128  if(pvcoll->size()) firstpv.push_back((*pvcoll)[0]);
129  _bspvhm.fill(iEvent,firstpv,*bs);
130  }
131  else {
132  _bspvhm.fill(iEvent,*pvcoll,*bs);
133  }
134 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::BeamSpot > _recoBeamSpotToken
BSvsPVHistogramMaker _bspvhm
void fill(const unsigned int orbit, const int bx, const reco::VertexCollection &vertices, const reco::BeamSpot &bs)
void BSvsPVAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 139 of file BSvsPVAnalyzer.cc.

140 { }
void BSvsPVAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 143 of file BSvsPVAnalyzer.cc.

References _bspvhm, BSvsPVHistogramMaker::beginRun(), and edm::RunBase::run().

143  {
144 
145  _bspvhm.beginRun(iRun.run());
146 
147 }
RunNumber_t run() const
Definition: RunBase.h:40
BSvsPVHistogramMaker _bspvhm
void beginRun(const unsigned int nrun)
void BSvsPVAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 155 of file BSvsPVAnalyzer.cc.

References DEFINE_FWK_MODULE.

155  {
156 }
void BSvsPVAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Definition at line 150 of file BSvsPVAnalyzer.cc.

150  {
151 
152 }

Member Data Documentation

BSvsPVHistogramMaker BSvsPVAnalyzer::_bspvhm
private

Definition at line 65 of file BSvsPVAnalyzer.cc.

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

bool BSvsPVAnalyzer::_firstOnly
private

Definition at line 68 of file BSvsPVAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::BeamSpot> BSvsPVAnalyzer::_recoBeamSpotToken
private

Definition at line 67 of file BSvsPVAnalyzer.cc.

Referenced by analyze().

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

Definition at line 66 of file BSvsPVAnalyzer.cc.

Referenced by analyze().