CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CaloTPTableProducer Class Reference

#include <PhysicsTools/NanoAOD/plugins/CaloTPTableProducer.cc>

Inheritance diagram for CaloTPTableProducer:
edm::stream::EDProducer<>

Public Member Functions

 CaloTPTableProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecorddecoderToken_
 
const double ecalLSB_
 
const std::string ecalTPsName_
 
const edm::EDGetTokenT< EcalTrigPrimDigiCollectionecalTPsToken_
 
const std::string hcalTPsName_
 
const edm::EDGetTokenT< HcalTrigPrimDigiCollectionhcalTPsToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file CaloTPTableProducer.cc.

Constructor & Destructor Documentation

◆ CaloTPTableProducer()

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

Definition at line 73 of file CaloTPTableProducer.cc.

74  : ecalLSB_(iConfig.getUntrackedParameter<double>("ecalLSB", 0.5)),
75  ecalTPsToken_(consumes<EcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("ecalTPsSrc"))),
76  ecalTPsName_(iConfig.getParameter<std::string>("ecalTPsName")),
77  hcalTPsToken_(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalTPsSrc"))),
78  hcalTPsName_(iConfig.getParameter<std::string>("hcalTPsName")),
79  decoderToken_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>()) {
80  produces<nanoaod::FlatTable>("EcalTP");
81  produces<nanoaod::FlatTable>("HcalTP");
82 
83  //now do what ever other initialization is needed
84 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string hcalTPsName_
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPsToken_
T getUntrackedParameter(std::string const &, T const &) const
const std::string ecalTPsName_
const edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderToken_
const edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPsToken_

Member Function Documentation

◆ beginStream()

void CaloTPTableProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 183 of file CaloTPTableProducer.cc.

183  {
184  // please remove this method if not needed
185 }

◆ endStream()

void CaloTPTableProducer::endStream ( )
overrideprivate

Definition at line 188 of file CaloTPTableProducer.cc.

188  {
189  // please remove this method if not needed
190 }

◆ fillDescriptions()

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

Definition at line 193 of file CaloTPTableProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

193  {
195 
196  desc.add<std::string>("name", "l1calotowerflattableproducer");
197  desc.addUntracked<double>("ecalLSB", 0.5);
198  desc.add<edm::InputTag>("ecalTPsSrc", edm::InputTag{"ecalDigis", "EcalTriggerPrimitives"});
199  desc.add<string>("ecalTPsName", "EcalUnpackedTPs");
200  desc.add<edm::InputTag>("hcalTPsSrc", edm::InputTag{"hcalDigis"});
201  desc.add<string>("hcalTPsName", "HcalUnpackedTPs");
202 
203  descriptions.addWithDefaultLabel(desc);
204 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void CaloTPTableProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 91 of file CaloTPTableProducer.cc.

References funct::abs(), decoderToken_, ecalLSB_, ecalTPsName_, ecalTPsToken_, l1tnanotables_cff::et, edm::EventSetup::getHandle(), hcalTPsName_, hcalTPsToken_, hcalRecHitTable_cff::ieta, iEvent, hcalRecHitTable_cff::iphi, edm::HandleBase::isValid(), eostools::move(), and edm::Handle< T >::product().

91  {
92  using namespace edm;
93 
95  decoder = iSetup.getHandle(decoderToken_);
96 
98  iEvent.getByToken(ecalTPsToken_, ecalTPs);
99 
101  iEvent.getByToken(hcalTPsToken_, hcalTPs);
102 
103  vector<int> ecalTPieta;
104  vector<int> ecalTPCaliphi;
105  vector<int> ecalTPiphi;
106  vector<float> ecalTPet;
107  vector<int> ecalTPcompEt;
108  vector<int> ecalTPfineGrain;
109  int nECALTP(0);
110  if (ecalTPs.isValid()) {
111  for (const auto& itr : *(ecalTPs.product())) {
112  short ieta = (short)itr.id().ieta();
113 
114  unsigned short cal_iphi = (unsigned short)itr.id().iphi();
115  unsigned short iphi = (72 + 18 - cal_iphi) % 72;
116  unsigned short compEt = itr.compressedEt();
117  double et = ecalLSB_ * compEt;
118  unsigned short fineGrain = (unsigned short)itr.fineGrain();
119 
120  if (compEt > 0) {
121  ecalTPieta.push_back(ieta);
122  ecalTPCaliphi.push_back(cal_iphi);
123  ecalTPiphi.push_back(iphi);
124  ecalTPet.push_back(et);
125  ecalTPcompEt.push_back(compEt);
126  ecalTPfineGrain.push_back(fineGrain);
127  nECALTP++;
128  }
129  }
130  }
131  auto ecalTPTable = std::make_unique<nanoaod::FlatTable>(nECALTP, ecalTPsName_, false);
132  ecalTPTable->addColumn<int16_t>("ieta", ecalTPieta, "");
133  ecalTPTable->addColumn<int16_t>("Caliphi", ecalTPCaliphi, "");
134  ecalTPTable->addColumn<int16_t>("iphi", ecalTPiphi, "");
135  ecalTPTable->addColumn<float>("et", ecalTPet, "", 12);
136  ecalTPTable->addColumn<int16_t>("compEt", ecalTPcompEt, "");
137  ecalTPTable->addColumn<int16_t>("fineGrain", ecalTPfineGrain, "");
138 
139  vector<int> hcalTPieta;
140  vector<int> hcalTPCaliphi;
141  vector<int> hcalTPiphi;
142  vector<float> hcalTPet;
143  vector<int> hcalTPcompEt;
144  vector<int> hcalTPfineGrain;
145  int nHCALTP(0);
146  if (hcalTPs.isValid()) {
147  for (auto itr : (*hcalTPs.product())) {
148  int ver = itr.id().version();
149  short ieta = (short)itr.id().ieta();
150  unsigned short absIeta = (unsigned short)abs(ieta);
151  unsigned short cal_iphi = (unsigned short)itr.id().iphi();
152  unsigned short iphi = (72 + 18 - cal_iphi) % 72;
153 
154  unsigned short compEt = itr.SOI_compressedEt();
155  double et = decoder->hcaletValue(itr.id(), itr.t0());
156  unsigned short fineGrain = (unsigned short)itr.SOI_fineGrain();
157 
158  if (compEt > 0 && (absIeta < 29 || ver == 1)) {
159  hcalTPieta.push_back(ieta);
160  hcalTPCaliphi.push_back(cal_iphi);
161  hcalTPiphi.push_back(iphi);
162  hcalTPet.push_back(et);
163  hcalTPcompEt.push_back(compEt);
164  hcalTPfineGrain.push_back(fineGrain);
165  nHCALTP++;
166  }
167  }
168  }
169 
170  auto hcalTPTable = std::make_unique<nanoaod::FlatTable>(nHCALTP, hcalTPsName_, false);
171  hcalTPTable->addColumn<int16_t>("ieta", hcalTPieta, "");
172  hcalTPTable->addColumn<int16_t>("Caliphi", hcalTPCaliphi, "");
173  hcalTPTable->addColumn<int16_t>("iphi", hcalTPiphi, "");
174  hcalTPTable->addColumn<float>("et", hcalTPet, "", 12);
175  hcalTPTable->addColumn<int16_t>("compEt", hcalTPcompEt, "");
176  hcalTPTable->addColumn<int16_t>("fineGrain", hcalTPfineGrain, "");
177 
178  iEvent.put(std::move(ecalTPTable), "HcalTP");
179  iEvent.put(std::move(hcalTPTable), "EcalTP");
180 }
T const * product() const
Definition: Handle.h:70
const std::string hcalTPsName_
const edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPsToken_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const std::string ecalTPsName_
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
const edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderToken_
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalTPsToken_

Member Data Documentation

◆ decoderToken_

const edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> CaloTPTableProducer::decoderToken_
private

Definition at line 70 of file CaloTPTableProducer.cc.

Referenced by produce().

◆ ecalLSB_

const double CaloTPTableProducer::ecalLSB_
private

Definition at line 62 of file CaloTPTableProducer.cc.

Referenced by produce().

◆ ecalTPsName_

const std::string CaloTPTableProducer::ecalTPsName_
private

Definition at line 65 of file CaloTPTableProducer.cc.

Referenced by produce().

◆ ecalTPsToken_

const edm::EDGetTokenT<EcalTrigPrimDigiCollection> CaloTPTableProducer::ecalTPsToken_
private

Definition at line 64 of file CaloTPTableProducer.cc.

Referenced by produce().

◆ hcalTPsName_

const std::string CaloTPTableProducer::hcalTPsName_
private

Definition at line 68 of file CaloTPTableProducer.cc.

Referenced by produce().

◆ hcalTPsToken_

const edm::EDGetTokenT<HcalTrigPrimDigiCollection> CaloTPTableProducer::hcalTPsToken_
private

Definition at line 67 of file CaloTPTableProducer.cc.

Referenced by produce().