CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1GTNTupleProducer Class Reference
Inheritance diagram for L1GTNTupleProducer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void fillData (const l1t::P2GTCandidateCollection &collection, const std::string &instanceName)
 

Private Attributes

const edm::EDGetTokenT< P2GTCandidateCollectioncl2ElectronToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectioncl2EtSumToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectioncl2HtSumToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectioncl2JetToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectioncl2PhotonToken_
 
std::unordered_map< std::string, std::vector< int > > data_
 
const edm::Service< TFileServicefs_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongmtSaDisplacedMuonToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongmtSaPromptMuonToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongmtTkMuonToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongttDisplacedJetToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongttPrimaryVertexToken_
 
const edm::EDGetTokenT< P2GTCandidateCollectiongttPromptJetToken_
 
const unsigned maxNTuples_
 
const std::string producerName_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

Definition at line 21 of file L1GTNTupleProducer.cc.

Constructor & Destructor Documentation

◆ L1GTNTupleProducer()

L1GTNTupleProducer::L1GTNTupleProducer ( const edm::ParameterSet config)
explicit

Definition at line 71 of file L1GTNTupleProducer.cc.

References data_, Skims_PA_cff::name, NTUPLE_VARIABLES, AlCaHLTBitMon_QueryRunRegistry::string, tree_, trigObjTnPSource_cfi::var, and hcalRecHitTable_cff::variables.

72  : producerName_(config.getParameter<std::string>("producerName")),
73  maxNTuples_(config.getParameter<unsigned>("maxNTuples")),
74  gttPromptJetToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GTTPromptJets"))),
75  gttDisplacedJetToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GTTDisplacedJets"))),
76  gttPrimaryVertexToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GTTPrimaryVert"))),
77  gmtSaPromptMuonToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GMTSaPromptMuons"))),
78  gmtSaDisplacedMuonToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GMTSaDisplacedMuons"))),
79  gmtTkMuonToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "GMTTkMuons"))),
80  cl2JetToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "CL2Jets"))),
81  cl2PhotonToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "CL2Photons"))),
82  cl2ElectronToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "CL2Electrons"))),
83  cl2EtSumToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "CL2EtSum"))),
84  cl2HtSumToken_(consumes<P2GTCandidateCollection>(edm::InputTag(producerName_, "CL2HtSum"))),
85  tree_(fs_->make<TTree>("L1PhaseIITree", "L1PhaseIITree")) {
86  for (const auto& [collec, variables] : NTUPLE_VARIABLES) {
87  for (const std::string& var : variables) {
88  std::string name = collec + var;
89  tree_->Branch(name.c_str(), &data_[name], 8000, 1);
90  }
91  }
92 }
const edm::EDGetTokenT< P2GTCandidateCollection > gttPromptJetToken_
Definition: config.py:1
const edm::EDGetTokenT< P2GTCandidateCollection > cl2ElectronToken_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2HtSumToken_
const edm::Service< TFileService > fs_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtSaDisplacedMuonToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gttPrimaryVertexToken_
const std::string producerName_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2PhotonToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gttDisplacedJetToken_
std::unordered_map< std::string, std::vector< int > > data_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2EtSumToken_
const unsigned maxNTuples_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtSaPromptMuonToken_
static const std::map< std::string, std::vector< std::string > > NTUPLE_VARIABLES
const edm::EDGetTokenT< P2GTCandidateCollection > cl2JetToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtTkMuonToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64

Member Function Documentation

◆ analyze()

void L1GTNTupleProducer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 122 of file L1GTNTupleProducer.cc.

References cl2ElectronToken_, cl2EtSumToken_, cl2HtSumToken_, cl2JetToken_, cl2PhotonToken_, data_, fillData(), gmtSaDisplacedMuonToken_, gmtSaPromptMuonToken_, gmtTkMuonToken_, gttDisplacedJetToken_, gttPrimaryVertexToken_, gttPromptJetToken_, crabWrapper::key, tree_, and trackerHitRTTI::vector.

122  {
123  const l1t::P2GTCandidateCollection& gttPromptJets = event.get(gttPromptJetToken_);
124  fillData(gttPromptJets, "GTTPromptJet");
125 
126  const l1t::P2GTCandidateCollection& gttDisplacedJets = event.get(gttDisplacedJetToken_);
127  fillData(gttDisplacedJets, "GTTDisplacedJet");
128 
129  const l1t::P2GTCandidateCollection& gttPrimaryVertices = event.get(gttPrimaryVertexToken_);
130  fillData(gttPrimaryVertices, "GTTPrimaryVertex");
131 
132  const l1t::P2GTCandidateCollection& gmtSaPromptMuons = event.get(gmtSaPromptMuonToken_);
133  fillData(gmtSaPromptMuons, "GMTSaPromptMuon");
134 
135  const l1t::P2GTCandidateCollection& gmtSaDisplacedMuons = event.get(gmtSaDisplacedMuonToken_);
136  fillData(gmtSaDisplacedMuons, "GMTSaDisplacedMuon");
137 
138  const l1t::P2GTCandidateCollection& gmtTkMuons = event.get(gmtTkMuonToken_);
139  fillData(gmtTkMuons, "GMTTkMuon");
140 
141  const l1t::P2GTCandidateCollection& cl2Jets = event.get(cl2JetToken_);
142  fillData(cl2Jets, "CL2Jet");
143 
144  const l1t::P2GTCandidateCollection& cl2Photons = event.get(cl2PhotonToken_);
145  fillData(cl2Photons, "CL2Photon");
146 
147  const l1t::P2GTCandidateCollection& cl2Electrons = event.get(cl2ElectronToken_);
148  fillData(cl2Electrons, "CL2Electron");
149 
150  const l1t::P2GTCandidateCollection& cl2EtSum = event.get(cl2EtSumToken_);
151  fillData(cl2EtSum, "CL2EtSum");
152 
153  const l1t::P2GTCandidateCollection& cl2HtSum = event.get(cl2HtSumToken_);
154  fillData(cl2HtSum, "CL2HtSum");
155 
156  tree_->Fill();
157 
158  for (auto& [key, vector] : data_) {
159  vector.clear();
160  }
161 }
std::vector< P2GTCandidate > P2GTCandidateCollection
Definition: P2GTCandidate.h:16
const edm::EDGetTokenT< P2GTCandidateCollection > gttPromptJetToken_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2ElectronToken_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2HtSumToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtSaDisplacedMuonToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gttPrimaryVertexToken_
void fillData(const l1t::P2GTCandidateCollection &collection, const std::string &instanceName)
const edm::EDGetTokenT< P2GTCandidateCollection > cl2PhotonToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gttDisplacedJetToken_
std::unordered_map< std::string, std::vector< int > > data_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2EtSumToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtSaPromptMuonToken_
const edm::EDGetTokenT< P2GTCandidateCollection > cl2JetToken_
const edm::EDGetTokenT< P2GTCandidateCollection > gmtTkMuonToken_

◆ fillData()

void L1GTNTupleProducer::fillData ( const l1t::P2GTCandidateCollection collection,
const std::string &  instanceName 
)
private

Definition at line 102 of file L1GTNTupleProducer.cc.

References universalConfigTemplate::collection, data_, l1trig_cff::hwEta, l1trig_cff::hwPhi, Skims_PA_cff::name, NTUPLE_VARIABLES, AlCaHLTBitMon_QueryRunRegistry::string, and trigObjTnPSource_cfi::var.

Referenced by analyze().

102  {
103  for (const P2GTCandidate& object : collection) {
104  for (const std::string& var : NTUPLE_VARIABLES.at(instanceName)) {
105  std::string name = instanceName + var;
106  if (var == "Pt")
107  data_.at(name).push_back(object.hwPT());
108  else if (var == "Eta")
109  data_.at(name).push_back(object.hwEta());
110  else if (var == "Phi")
111  data_.at(name).push_back(object.hwPhi());
112  else if (var == "Z0")
113  data_.at(name).push_back(object.hwZ0());
114  else if (var == "D0")
115  data_.at(name).push_back(object.hwD0());
116  else if (var == "ScaSumPt")
117  data_.at(name).push_back(object.hwSca_sum());
118  }
119  }
120 }
std::unordered_map< std::string, std::vector< int > > data_
static const std::map< std::string, std::vector< std::string > > NTUPLE_VARIABLES

◆ fillDescriptions()

void L1GTNTupleProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Member Data Documentation

◆ cl2ElectronToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::cl2ElectronToken_
private

Definition at line 48 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ cl2EtSumToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::cl2EtSumToken_
private

Definition at line 49 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ cl2HtSumToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::cl2HtSumToken_
private

Definition at line 50 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ cl2JetToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::cl2JetToken_
private

Definition at line 46 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ cl2PhotonToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::cl2PhotonToken_
private

Definition at line 47 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ data_

std::unordered_map<std::string, std::vector<int> > L1GTNTupleProducer::data_
private

Definition at line 55 of file L1GTNTupleProducer.cc.

Referenced by analyze(), fillData(), and L1GTNTupleProducer().

◆ fs_

const edm::Service<TFileService> L1GTNTupleProducer::fs_
private

Definition at line 52 of file L1GTNTupleProducer.cc.

◆ gmtSaDisplacedMuonToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gmtSaDisplacedMuonToken_
private

Definition at line 43 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ gmtSaPromptMuonToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gmtSaPromptMuonToken_
private

Definition at line 42 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ gmtTkMuonToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gmtTkMuonToken_
private

Definition at line 44 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ gttDisplacedJetToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gttDisplacedJetToken_
private

Definition at line 39 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ gttPrimaryVertexToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gttPrimaryVertexToken_
private

Definition at line 40 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ gttPromptJetToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTNTupleProducer::gttPromptJetToken_
private

Definition at line 38 of file L1GTNTupleProducer.cc.

Referenced by analyze().

◆ maxNTuples_

const unsigned L1GTNTupleProducer::maxNTuples_
private

Definition at line 36 of file L1GTNTupleProducer.cc.

◆ producerName_

const std::string L1GTNTupleProducer::producerName_
private

Definition at line 35 of file L1GTNTupleProducer.cc.

◆ tree_

TTree* L1GTNTupleProducer::tree_
private

Definition at line 53 of file L1GTNTupleProducer.cc.

Referenced by analyze(), and L1GTNTupleProducer().