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

Public Member Functions

 L1RecoTreeProducer (const edm::ParameterSet &)
 
 ~L1RecoTreeProducer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< 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)
 

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::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: 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.

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

67  {
68  vtxToken_ = consumes<reco::VertexCollection>(
69  iConfig.getUntrackedParameter("vtxToken", edm::InputTag("offlinePrimaryVertices")));
70 
71  maxVtx_ = iConfig.getParameter<unsigned int>("maxVtx");
72 
74 
75  usesResource(TFileService::kSharedResource);
76  // set up output
77  tree_ = fs_->make<TTree>("RecoTree", "RecoTree");
78  tree_->Branch("Vertex", "L1Analysis::L1AnalysisRecoVertexDataFormat", &vtxData_, 32000, 3);
79 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1Analysis::L1AnalysisRecoVertexDataFormat * vtxData_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
edm::Service< TFileService > fs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64

◆ ~L1RecoTreeProducer()

L1RecoTreeProducer::~L1RecoTreeProducer ( )
override

Definition at line 81 of file L1RecoTreeProducer.cc.

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

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 91 of file L1RecoTreeProducer.cc.

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

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

◆ beginJob()

void L1RecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 114 of file L1RecoTreeProducer.cc.

114 {}

◆ endJob()

void L1RecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 117 of file L1RecoTreeProducer.cc.

117 {}

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().