CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TZDCProducer Class Reference
Inheritance diagram for L1TZDCProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1TZDCProducer (const edm::ParameterSet &ps)
 
 ~L1TZDCProducer () override=default
 
- 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 beginRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int bxFirst_
 
int bxLast_
 
edm::EDPutTokenT< EtSumBxCollectionetToken_
 
edm::EDGetTokenT< HcalTrigPrimDigiCollectionhcalTPSource
 

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

Definition at line 59 of file L1TZDCProducer.cc.

Constructor & Destructor Documentation

◆ L1TZDCProducer()

L1TZDCProducer::L1TZDCProducer ( const edm::ParameterSet ps)
explicit

Definition at line 85 of file L1TZDCProducer.cc.

References bxFirst_, bxLast_, etToken_, and edm::ParameterSet::getParameter().

86  : hcalTPSource(consumes<HcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("hcalTPDigis"))) {
87  // register what you produce
88  etToken_ = produces<EtSumBxCollection>();
89 
90  bxFirst_ = ps.getParameter<int>("bxFirst");
91  bxLast_ = ps.getParameter<int>("bxLast");
92 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< EtSumBxCollection > etToken_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource

◆ ~L1TZDCProducer()

L1TZDCProducer::~L1TZDCProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

void L1TZDCProducer::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 161 of file L1TZDCProducer.cc.

161 {}

◆ fillDescriptions()

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

Definition at line 164 of file L1TZDCProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

164  {
166  desc.add<edm::InputTag>("hcalTPDigis", edm::InputTag("simHcalTriggerPrimitiveDigis"));
167  desc.add<int>("bxFirst", -2);
168  desc.add<int>("bxLast", 2);
169  descriptions.add("l1tZDCProducer", desc);
170 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 95 of file L1TZDCProducer.cc.

References funct::abs(), bxFirst_, bxLast_, HcalTriggerPrimitiveSample::compressedEt(), etToken_, hcalTPSource, hcalRecHitTable_cff::ieta, iEvent, hcalRecHitTable_cff::iphi, edm::HandleBase::isValid(), L1Analysis::kZDCM, L1Analysis::kZDCP, LogDebug, eostools::move(), PresampleTask_cfi::nSamples, BXVector< T >::push_back(), l1t::L1Candidate::setHwEta(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), and l1t::EtSum::setType().

95  {
96  using namespace edm;
97  using namespace l1t;
98 
99  LogDebug("L1TZDCProducer") << "L1TZDCProducer::produce function called..." << std::endl;
100 
101  // reduced collection to be emplaced in output
102  EtSumBxCollection etsumsReduced(0, bxFirst_, bxLast_);
103 
105  iEvent.getByToken(hcalTPSource, hcalTPs);
106 
107  //Check if the hcal tokens are valid
108  if (hcalTPs.isValid()) {
109  //If valid, process
110  for (const auto& hcalTp : *hcalTPs) {
111  int ieta = hcalTp.id().ieta();
112  uint32_t absIEta = std::abs(ieta);
113 
114  //absIEta position 42 is used for the ZDC; -42 for ZDCM, +42 for ZDCP
115  if (absIEta != 42)
116  continue;
117 
118  int iphi = hcalTp.id().iphi();
119  //iphi position 99 is used for the etSums
120  if (iphi != 99)
121  continue;
122 
123  //Get number of samples and number of presamples; bx 0 is nPresamples
124  int nSamples = hcalTp.size();
125  int nPresamples = hcalTp.presamples();
126 
127  for (int ibx = 0; ibx < nSamples; ibx++) {
128  if (ibx >= nPresamples + bxFirst_ && ibx <= nPresamples + bxLast_) {
129  HcalTriggerPrimitiveSample hcalTpSample = hcalTp.sample(ibx);
130  int ietIn = hcalTpSample.compressedEt();
131 
132  l1t::EtSum tempEt = l1t::EtSum();
133  tempEt.setHwPt(ietIn);
134  tempEt.setHwPhi(0.);
135 
136  //ieta < 0 is ZDCMinus; > 0 is ZDCPlus
137  if (ieta < 0) {
138  tempEt.setHwEta(-1.);
140  } else {
141  tempEt.setHwEta(1.);
143  }
144 
145  //By construction, nPresamples is 0 bx (since presamples span 0 to nPresamples-1)
146  etsumsReduced.push_back(ibx - nPresamples, CaloTools::etSumP4Demux(tempEt));
147  }
148  }
149  }
150  } else {
151  // If the collection is not valid issue a warning before putting an empty collection
152  edm::LogWarning("L1TZDCProducer") << "hcalTps not valid; return empty ZDC Et Sum BXCollection" << std::endl;
153  }
154 
155  // Emplace even if !hcalTps.isValid()
156  // Output in this case will be an empty collection
157  iEvent.emplace(etToken_, std::move(etsumsReduced));
158 }
int compressedEt() const
get the encoded/compressed Et
delete x;
Definition: CaloConfig.h:22
void setType(EtSumType type)
Definition: EtSum.cc:11
edm::EDPutTokenT< EtSumBxCollection > etToken_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setHwPhi(int phi)
Definition: L1Candidate.h:30
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
void setHwPt(int pt)
Definition: L1Candidate.h:28
void setHwEta(int eta)
Definition: L1Candidate.h:29
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalTPSource
#define LogDebug(id)

Member Data Documentation

◆ bxFirst_

int L1TZDCProducer::bxFirst_
private

Definition at line 78 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ bxLast_

int L1TZDCProducer::bxLast_
private

Definition at line 79 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ etToken_

edm::EDPutTokenT<EtSumBxCollection> L1TZDCProducer::etToken_
private

Definition at line 82 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ hcalTPSource

edm::EDGetTokenT<HcalTrigPrimDigiCollection> L1TZDCProducer::hcalTPSource
private

Definition at line 75 of file L1TZDCProducer.cc.

Referenced by produce().