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 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 83 of file L1TZDCProducer.cc.

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

84  : hcalTPSource(consumes<HcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("hcalTPDigis"))) {
85  // register what you produce
86  etToken_ = produces<EtSumBxCollection>();
87 
88  bxFirst_ = ps.getParameter<int>("bxFirst");
89  bxLast_ = ps.getParameter<int>("bxLast");
90 }
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

◆ fillDescriptions()

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

Definition at line 159 of file L1TZDCProducer.cc.

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

159  {
161  desc.add<edm::InputTag>("hcalTPDigis", edm::InputTag("simHcalTriggerPrimitiveDigis"));
162  desc.add<int>("bxFirst", -2);
163  desc.add<int>("bxLast", 2);
164  descriptions.add("l1tZDCProducer", desc);
165 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 93 of file L1TZDCProducer.cc.

References funct::abs(), bxFirst_, bxLast_, 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(), HcalTriggerPrimitiveSample::raw(), l1t::L1Candidate::setHwEta(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), and l1t::EtSum::setType().

93  {
94  using namespace edm;
95  using namespace l1t;
96 
97  LogDebug("L1TZDCProducer") << "L1TZDCProducer::produce function called..." << std::endl;
98 
99  // reduced collection to be emplaced in output
100  EtSumBxCollection etsumsReduced(0, bxFirst_, bxLast_);
101 
103  iEvent.getByToken(hcalTPSource, hcalTPs);
104 
105  //Check if the hcal tokens are valid
106  if (hcalTPs.isValid()) {
107  //If valid, process
108  for (const auto& hcalTp : *hcalTPs) {
109  int ieta = hcalTp.id().ieta();
110  uint32_t absIEta = std::abs(ieta);
111 
112  //absIEta position 42 is used for the ZDC; -42 for ZDCM, +42 for ZDCP
113  if (absIEta != 42)
114  continue;
115 
116  int iphi = hcalTp.id().iphi();
117  //iphi position 99 is used for the etSums
118  if (iphi != 99)
119  continue;
120 
121  //Get number of samples and number of presamples; bx 0 is nPresamples
122  int nSamples = hcalTp.size();
123  int nPresamples = hcalTp.presamples();
124 
125  for (int ibx = 0; ibx < nSamples; ibx++) {
126  if (ibx >= nPresamples + bxFirst_ && ibx <= nPresamples + bxLast_) {
127  HcalTriggerPrimitiveSample hcalTpSample = hcalTp.sample(ibx);
128  int ietIn = hcalTpSample.raw();
129 
130  l1t::EtSum tempEt = l1t::EtSum();
131  tempEt.setHwPt(ietIn);
132  tempEt.setHwPhi(0.);
133 
134  //ieta < 0 is ZDCMinus; > 0 is ZDCPlus
135  if (ieta < 0) {
136  tempEt.setHwEta(-1.);
138  } else {
139  tempEt.setHwEta(1.);
141  }
142 
143  //By construction, nPresamples is 0 bx (since presamples span 0 to nPresamples-1)
144  etsumsReduced.push_back(ibx - nPresamples, CaloTools::etSumP4Demux(tempEt));
145  }
146  }
147  }
148  } else {
149  // If the collection is not valid issue a warning before putting an empty collection
150  edm::LogWarning("L1TZDCProducer") << "hcalTps not valid; return empty ZDC Et Sum BXCollection" << std::endl;
151  }
152 
153  // Emplace even if !hcalTps.isValid()
154  // Output in this case will be an empty collection
155  iEvent.emplace(etToken_, std::move(etsumsReduced));
156 }
delete x;
Definition: CaloConfig.h:22
void setType(EtSumType type)
Definition: EtSum.cc:11
edm::EDPutTokenT< EtSumBxCollection > etToken_
uint16_t raw() const
get the raw word
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 76 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ bxLast_

int L1TZDCProducer::bxLast_
private

Definition at line 77 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ etToken_

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

Definition at line 80 of file L1TZDCProducer.cc.

Referenced by L1TZDCProducer(), and produce().

◆ hcalTPSource

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

Definition at line 73 of file L1TZDCProducer.cc.

Referenced by produce().