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::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 BSvsPVAnalyzer (const edm::ParameterSet &)
 
 ~BSvsPVAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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

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

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

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

Definition at line 49 of file BSvsPVAnalyzer.cc.

Constructor & Destructor Documentation

◆ BSvsPVAnalyzer()

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

Definition at line 80 of file BSvsPVAnalyzer.cc.

References _bspvhm, BSvsPVHistogramMaker::book(), and TFileService::kSharedResource.

81  : _bspvhm(iConfig.getParameter<edm::ParameterSet>("bspvHistogramMakerPSet"), consumesCollector()),
82  _recoVertexCollectionToken(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pvCollection"))),
83  _recoBeamSpotToken(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("bsCollection"))),
84  _firstOnly(iConfig.getUntrackedParameter<bool>("firstOnly", false)) {
85  //now do what ever initialization is needed
86  usesResource(TFileService::kSharedResource);
87  //
88 
89  _bspvhm.book();
90 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
T getUntrackedParameter(std::string const &, T const &) const
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::~BSvsPVAnalyzer ( )
override

Definition at line 92 of file BSvsPVAnalyzer.cc.

92  {
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 102 of file BSvsPVAnalyzer.cc.

References _bspvhm, _firstOnly, _recoBeamSpotToken, _recoVertexCollectionToken, cms::cuda::bs, BSvsPVHistogramMaker::fill(), and iEvent.

102  {
103  // get BS
104 
106  iEvent.getByToken(_recoBeamSpotToken, bs);
107 
108  // get PV
109 
111  iEvent.getByToken(_recoVertexCollectionToken, pvcoll);
112 
113  if (_firstOnly) {
114  reco::VertexCollection firstpv;
115  if (!pvcoll->empty())
116  firstpv.push_back((*pvcoll)[0]);
117  _bspvhm.fill(iEvent, firstpv, *bs);
118  } else {
119  _bspvhm.fill(iEvent, *pvcoll, *bs);
120  }
121 }
edm::EDGetTokenT< reco::VertexCollection > _recoVertexCollectionToken
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::BeamSpot > _recoBeamSpotToken
BSvsPVHistogramMaker _bspvhm
void fill(const unsigned int orbit, const int bx, const reco::VertexCollection &vertices, const reco::BeamSpot &bs)

◆ beginJob()

void BSvsPVAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 124 of file BSvsPVAnalyzer.cc.

124 {}

◆ beginRun()

void BSvsPVAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 126 of file BSvsPVAnalyzer.cc.

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

126 { _bspvhm.beginRun(iRun.run()); }
RunNumber_t run() const
Definition: RunBase.h:40
BSvsPVHistogramMaker _bspvhm
void beginRun(const unsigned int nrun)

◆ endJob()

void BSvsPVAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 130 of file BSvsPVAnalyzer.cc.

130 {}

◆ endRun()

void BSvsPVAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 128 of file BSvsPVAnalyzer.cc.

128 {}

Member Data Documentation

◆ _bspvhm

BSvsPVHistogramMaker BSvsPVAnalyzer::_bspvhm
private

Definition at line 63 of file BSvsPVAnalyzer.cc.

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

◆ _firstOnly

bool BSvsPVAnalyzer::_firstOnly
private

Definition at line 66 of file BSvsPVAnalyzer.cc.

Referenced by analyze().

◆ _recoBeamSpotToken

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

Definition at line 65 of file BSvsPVAnalyzer.cc.

Referenced by analyze().

◆ _recoVertexCollectionToken

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

Definition at line 64 of file BSvsPVAnalyzer.cc.

Referenced by analyze().