CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1RecoTreeProducer Class Reference

#include <L1Trigger/L1TNtuples/src/L1RecoTreeProducer.cc>

Inheritance diagram for L1RecoTreeProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

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

Public Attributes

L1Analysis::L1AnalysisRecoVertexDataFormatvtxData_
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void endJob ()
 

Private Attributes

edm::Service< TFileServicefs_
 
unsigned int maxVtx_
 
TTree * tree_
 
edm::EDGetTokenT
< reco::VertexCollection
vtxToken_
 

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: Produces tree containing reco quantities

Definition at line 43 of file L1RecoTreeProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file L1RecoTreeProducer.cc.

References fs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::make(), maxVtx_, tree_, vtxData_, and vtxToken_.

75 {
76 
77  vtxToken_ = consumes<reco::VertexCollection>(iConfig.getUntrackedParameter("vtxToken",edm::InputTag("offlinePrimaryVertices")));
78 
79  maxVtx_ = iConfig.getParameter<unsigned int>("maxVtx");
80 
82 
83  // set up output
84  tree_=fs_->make<TTree>("RecoTree", "RecoTree");
85  tree_->Branch("Vertex", "L1Analysis::L1AnalysisRecoVertexDataFormat", &vtxData_, 32000, 3);
86 
87 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
L1Analysis::L1AnalysisRecoVertexDataFormat * vtxData_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
edm::Service< TFileService > fs_
L1RecoTreeProducer::~L1RecoTreeProducer ( )

Definition at line 90 of file L1RecoTreeProducer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 104 of file L1RecoTreeProducer.cc.

References edm::Event::getByToken(), edm::HandleBase::isValid(), maxVtx_, L1Analysis::L1AnalysisRecoVertexDataFormat::NDoF, L1Analysis::L1AnalysisRecoVertexDataFormat::nVtx, L1Analysis::L1AnalysisRecoVertexDataFormat::Rho, HLT_FULL_cff::vertices, vtxData_, vtxToken_, and L1Analysis::L1AnalysisRecoVertexDataFormat::Z.

105 {
106 
107  vtxData_->nVtx = 0;
108 
109  // get vertices
111  iEvent.getByToken(vtxToken_, vertices);
112 
113  if (vertices.isValid()) {
114 
115  for(reco::VertexCollection::const_iterator it=vertices->begin();
116  it!=vertices->end() && vtxData_->nVtx < maxVtx_;
117  ++it) {
118 
119  if (!it->isFake()) {
120  vtxData_->NDoF.push_back(it->ndof());
121  vtxData_->Z.push_back(it->z());
122  vtxData_->Rho.push_back(it->position().rho());
123  vtxData_->nVtx++;
124  }
125 
126  }
127 
128  }
129 
130 }
L1Analysis::L1AnalysisRecoVertexDataFormat * vtxData_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
void L1RecoTreeProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 135 of file L1RecoTreeProducer.cc.

136 {
137 }
void L1RecoTreeProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file L1RecoTreeProducer.cc.

141  {
142 }

Member Data Documentation

edm::Service<TFileService> L1RecoTreeProducer::fs_
private

Definition at line 60 of file L1RecoTreeProducer.cc.

Referenced by L1RecoTreeProducer().

unsigned int L1RecoTreeProducer::maxVtx_
private

Definition at line 68 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

TTree* L1RecoTreeProducer::tree_
private

Definition at line 63 of file L1RecoTreeProducer.cc.

Referenced by L1RecoTreeProducer().

L1Analysis::L1AnalysisRecoVertexDataFormat* L1RecoTreeProducer::vtxData_

Definition at line 55 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

edm::EDGetTokenT<reco::VertexCollection> L1RecoTreeProducer::vtxToken_
private

Definition at line 66 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().