CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
std::vector< ESProxyIndex > 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::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)
 

Public Attributes

L1Analysis::L1AnalysisRecoVertexDataFormatvtxData_
 

Private Member Functions

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

Private Attributes

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

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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

Description: Produces tree containing reco quantities

Definition at line 41 of file L1RecoTreeProducer.cc.

Constructor & Destructor Documentation

◆ L1RecoTreeProducer()

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

Definition at line 67 of file L1RecoTreeProducer.cc.

67  {
68  vtxToken_ = consumes<reco::VertexCollection>(
69  iConfig.getUntrackedParameter("vtxToken", edm::InputTag("offlinePrimaryVertices")));
70 
71  maxVtx_ = iConfig.getParameter<unsigned int>("maxVtx");
72 
74 
75  // set up output
76  tree_ = fs_->make<TTree>("RecoTree", "RecoTree");
77  tree_->Branch("Vertex", "L1Analysis::L1AnalysisRecoVertexDataFormat", &vtxData_, 32000, 3);
78 }

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

◆ ~L1RecoTreeProducer()

L1RecoTreeProducer::~L1RecoTreeProducer ( )
override

Definition at line 80 of file L1RecoTreeProducer.cc.

80  {
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 90 of file L1RecoTreeProducer.cc.

90  {
91  vtxData_->Reset();
92 
93  // get vertices
95  iEvent.getByToken(vtxToken_, vertices);
96 
97  if (vertices.isValid()) {
98  for (reco::VertexCollection::const_iterator it = vertices->begin();
99  it != vertices->end() && vtxData_->nVtx < maxVtx_;
100  ++it) {
101  if (!it->isFake()) {
102  vtxData_->NDoF.push_back(it->ndof());
103  vtxData_->Z.push_back(it->z());
104  vtxData_->Rho.push_back(it->position().rho());
105  vtxData_->nVtx++;
106  }
107  }
108  tree_->Fill();
109  }
110 }

References iEvent, maxVtx_, L1Analysis::L1AnalysisRecoVertexDataFormat::NDoF, L1Analysis::L1AnalysisRecoVertexDataFormat::nVtx, L1Analysis::L1AnalysisRecoVertexDataFormat::Reset(), L1Analysis::L1AnalysisRecoVertexDataFormat::Rho, tree_, pwdgSkimBPark_cfi::vertices, vtxData_, vtxToken_, and L1Analysis::L1AnalysisRecoVertexDataFormat::Z.

◆ beginJob()

void L1RecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 113 of file L1RecoTreeProducer.cc.

113 {}

◆ endJob()

void L1RecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file L1RecoTreeProducer.cc.

116 {}

Member Data Documentation

◆ fs_

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

Definition at line 56 of file L1RecoTreeProducer.cc.

Referenced by L1RecoTreeProducer().

◆ maxVtx_

unsigned int L1RecoTreeProducer::maxVtx_
private

Definition at line 64 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

◆ tree_

TTree* L1RecoTreeProducer::tree_
private

Definition at line 59 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

◆ vtxData_

L1Analysis::L1AnalysisRecoVertexDataFormat* L1RecoTreeProducer::vtxData_

Definition at line 52 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

◆ vtxToken_

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

Definition at line 62 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

L1Analysis::L1AnalysisRecoVertexDataFormat::Reset
void Reset()
Definition: L1AnalysisRecoVertexDataFormat.h:18
L1Analysis::L1AnalysisRecoVertexDataFormat
Definition: L1AnalysisRecoVertexDataFormat.h:14
L1RecoTreeProducer::vtxToken_
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: L1RecoTreeProducer.cc:62
L1RecoTreeProducer::maxVtx_
unsigned int maxVtx_
Definition: L1RecoTreeProducer.cc:64
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle< reco::VertexCollection >
L1RecoTreeProducer::tree_
TTree * tree_
Definition: L1RecoTreeProducer.cc:59
L1RecoTreeProducer::vtxData_
L1Analysis::L1AnalysisRecoVertexDataFormat * vtxData_
Definition: L1RecoTreeProducer.cc:52
L1Analysis::L1AnalysisRecoVertexDataFormat::nVtx
unsigned nVtx
Definition: L1AnalysisRecoVertexDataFormat.h:25
L1Analysis::L1AnalysisRecoVertexDataFormat::Z
std::vector< double > Z
Definition: L1AnalysisRecoVertexDataFormat.h:27
L1Analysis::L1AnalysisRecoVertexDataFormat::Rho
std::vector< double > Rho
Definition: L1AnalysisRecoVertexDataFormat.h:28
L1Analysis::L1AnalysisRecoVertexDataFormat::NDoF
std::vector< unsigned int > NDoF
Definition: L1AnalysisRecoVertexDataFormat.h:26
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
L1RecoTreeProducer::fs_
edm::Service< TFileService > fs_
Definition: L1RecoTreeProducer.cc:56
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7