CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EventVtxInfoNtupleDumper Class Reference
Inheritance diagram for EventVtxInfoNtupleDumper:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EventVtxInfoNtupleDumper (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< reco::VertexCollectionprimaryVerticesToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file EventVtxInfoNtupleDumper.cc.

Constructor & Destructor Documentation

◆ EventVtxInfoNtupleDumper()

EventVtxInfoNtupleDumper::EventVtxInfoNtupleDumper ( const edm::ParameterSet cfg)

Definition at line 24 of file EventVtxInfoNtupleDumper.cc.

25  : primaryVerticesToken_(consumes<reco::VertexCollection>(cfg.getParameter<InputTag>("primaryVertices"))) {
26  produces<int>("numPV").setBranchAlias("numPV");
27  produces<int>("nTrkPV").setBranchAlias("nTrkPV");
28  produces<float>("chi2PV").setBranchAlias("chi2PV");
29  produces<float>("ndofPV").setBranchAlias("ndofPV");
30  produces<float>("zPV").setBranchAlias("zPV");
31  produces<float>("rhoPV").setBranchAlias("rhoPV");
32  // produces<std::vector< unsigned int > >( "nTrkPV" ).setBranchAlias( "nTrkPV" );
33  // produces<std::vector< float > >( "chi2PV" ).setBranchAlias( "chi2PV" );
34  // produces<std::vector< float > >( "ndofPV" ).setBranchAlias( "ndofPV" );
35 }

Member Function Documentation

◆ produce()

void EventVtxInfoNtupleDumper::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 37 of file EventVtxInfoNtupleDumper.cc.

37  {
38  Handle<reco::VertexCollection> primaryVertices; // Collection of primary Vertices
40  unique_ptr<int> nVtxs(new int);
41  unique_ptr<int> nTrkVtx(new int);
42  unique_ptr<float> chi2Vtx(new float);
43  unique_ptr<float> ndofVtx(new float);
44  unique_ptr<float> zVtx(new float);
45  unique_ptr<float> rhoVtx(new float);
46  // unique_ptr< vector< unsigned int > > nTrkVtx( new vector< unsigned int > );
47  // unique_ptr< vector< float > > chi2Vtx( new vector< float > );
48  // unique_ptr< vector< float > > ndofVtx( new vector< float > );
49 
50  const reco::Vertex &pv = (*primaryVertices)[0];
51 
52  *nVtxs = -1;
53  *nTrkVtx = -1;
54  *chi2Vtx = -1.0;
55  *ndofVtx = -1.0;
56  *zVtx = -1000;
57  *rhoVtx = -1000;
58  if (!(pv.isFake())) {
59  *nVtxs = primaryVertices->size();
60  *nTrkVtx = pv.tracksSize();
61  *chi2Vtx = pv.chi2();
62  *ndofVtx = pv.ndof();
63  *zVtx = pv.z();
64  *rhoVtx = pv.position().Rho();
65  }
66  // nTrkVtx->push_back(pv.tracksSize());
67  // chi2Vtx->push_back(pv.chi2());
68  // ndofVtx->push_back(pv.ndof());
69  evt.put(std::move(nVtxs), "numPV");
70  evt.put(std::move(nTrkVtx), "nTrkPV");
71  evt.put(std::move(chi2Vtx), "chi2PV");
72  evt.put(std::move(ndofVtx), "ndofPV");
73  evt.put(std::move(zVtx), "zPV");
74  evt.put(std::move(rhoVtx), "rhoPV");
75 }

References edm::Event::getByToken(), eostools::move(), zMuMuMuonUserData::primaryVertices, primaryVerticesToken_, edm::Event::put(), MetAnalyzer::pv(), and TrackCollections2monitor_cff::rhoVtx.

Member Data Documentation

◆ primaryVerticesToken_

edm::EDGetTokenT<reco::VertexCollection> EventVtxInfoNtupleDumper::primaryVerticesToken_
private

Definition at line 21 of file EventVtxInfoNtupleDumper.cc.

Referenced by produce().

EventVtxInfoNtupleDumper::primaryVerticesToken_
edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
Definition: EventVtxInfoNtupleDumper.cc:21
edm::Handle< reco::VertexCollection >
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
zMuMuMuonUserData.primaryVertices
primaryVertices
Definition: zMuMuMuonUserData.py:12
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
TrackCollections2monitor_cff.rhoVtx
rhoVtx
Definition: TrackCollections2monitor_cff.py:263
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35