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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 41 of file L1RecoTreeProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 67 of file L1RecoTreeProducer.cc.

References fs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), 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  // set up output
76  tree_ = fs_->make<TTree>("RecoTree", "RecoTree");
77  tree_->Branch("Vertex", "L1Analysis::L1AnalysisRecoVertexDataFormat", &vtxData_, 32000, 3);
78 }
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 ( )
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

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

Definition at line 90 of file L1RecoTreeProducer.cc.

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

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 }
L1Analysis::L1AnalysisRecoVertexDataFormat * vtxData_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
void L1RecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 113 of file L1RecoTreeProducer.cc.

113 {}
void L1RecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file L1RecoTreeProducer.cc.

References DEFINE_FWK_MODULE.

116 {}

Member Data Documentation

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

Definition at line 56 of file L1RecoTreeProducer.cc.

Referenced by L1RecoTreeProducer().

unsigned int L1RecoTreeProducer::maxVtx_
private

Definition at line 64 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

TTree* L1RecoTreeProducer::tree_
private

Definition at line 59 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

L1Analysis::L1AnalysisRecoVertexDataFormat* L1RecoTreeProducer::vtxData_

Definition at line 52 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().

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

Definition at line 62 of file L1RecoTreeProducer.cc.

Referenced by analyze(), and L1RecoTreeProducer().