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
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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< reco::VertexCollection
primaryVerticesToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 
- 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

Definition at line 16 of file EventVtxInfoNtupleDumper.cc.

Constructor & Destructor Documentation

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

Definition at line 26 of file EventVtxInfoNtupleDumper.cc.

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

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 41 of file EventVtxInfoNtupleDumper.cc.

References reco::Vertex::chi2(), edm::Event::getByToken(), reco::Vertex::isFake(), reco::Vertex::ndof(), reco::Vertex::position(), HLT_FULL_cff::primaryVertices, primaryVerticesToken_, edm::Event::put(), MetAnalyzer::pv(), reco::Vertex::tracksSize(), and reco::Vertex::z().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

41  {
42 
43  Handle<reco::VertexCollection> primaryVertices; // Collection of primary Vertices
44  evt.getByToken(primaryVerticesToken_, primaryVertices);
45  auto_ptr<int> nVtxs( new int );
46  auto_ptr<int> nTrkVtx( new int );
47  auto_ptr<float> chi2Vtx( new float );
48  auto_ptr<float> ndofVtx( new float );
49  auto_ptr<float> zVtx( new float );
50  auto_ptr<float> rhoVtx( new float );
51  // auto_ptr< vector< unsigned int > > nTrkVtx( new vector< unsigned int > );
52  // auto_ptr< vector< float > > chi2Vtx( new vector< float > );
53  // auto_ptr< vector< float > > ndofVtx( new vector< float > );
54 
55  const reco::Vertex &pv = (*primaryVertices)[0];
56 
57  *nVtxs = -1;
58  *nTrkVtx = -1;
59  *chi2Vtx = -1.0;
60  *ndofVtx = -1.0;
61  *zVtx = -1000;
62  *rhoVtx = -1000;
63  if( !(pv.isFake()) ) {
64  *nVtxs = primaryVertices->size();
65  *nTrkVtx = pv.tracksSize();
66  *chi2Vtx = pv.chi2();
67  *ndofVtx = pv.ndof();
68  *zVtx = pv.z();
69  *rhoVtx = pv.position().Rho();
70  }
71  // nTrkVtx->push_back(pv.tracksSize());
72  // chi2Vtx->push_back(pv.chi2());
73  // ndofVtx->push_back(pv.ndof());
74  evt.put( nVtxs, "numPV" );
75  evt.put( nTrkVtx, "nTrkPV" );
76  evt.put( chi2Vtx, "chi2PV" );
77  evt.put( ndofVtx, "ndofPV" );
78  evt.put( zVtx, "zPV" );
79  evt.put( rhoVtx, "rhoPV" );
80 
81 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
tuple primaryVertices
const Point & position() const
position
Definition: Vertex.h:99
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< reco::VertexCollection > primaryVerticesToken_
double chi2() const
chi-squares
Definition: Vertex.h:88
double z() const
y coordinate
Definition: Vertex.h:105
double ndof() const
Definition: Vertex.h:95
bool isFake() const
Definition: Vertex.h:64
size_t tracksSize() const
number of tracks
Definition: Vertex.cc:34

Member Data Documentation

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

Definition at line 22 of file EventVtxInfoNtupleDumper.cc.

Referenced by produce().