CMS 3D CMS Logo

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

#include <L1RCTTPGProvider.h>

Inheritance diagram for L1RCTTPGProvider:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1RCTTPGProvider (const edm::ParameterSet &)
 
 ~L1RCTTPGProvider () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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)
 

Private Member Functions

void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag ecalTPG_
 
int hbShift
 
edm::InputTag hcalTPG_
 
int hfShift
 
int postSamples
 
int preSamples
 
bool useEcalCosmicTiming
 
bool useHcalCosmicTiming
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
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

L1Trigger/L1RCTTPGProvider/src/L1RCTTPGProvider.cc

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 35 of file L1RCTTPGProvider.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file L1RCTTPGProvider.cc.

References mps_fire::i, postSamples, and preSamples.

6  : ecalTPG_(iConfig.getParameter<edm::InputTag>("ecalTPGs")),
7  hcalTPG_(iConfig.getParameter<edm::InputTag>("hcalTPGs")),
8  useHcalCosmicTiming(iConfig.getParameter<bool>("useHCALCosmicTiming")),
9  useEcalCosmicTiming(iConfig.getParameter<bool>("useECALCosmicTiming")),
10  preSamples(iConfig.getParameter<int>("preSamples")),
11  postSamples(iConfig.getParameter<int>("postSamples")),
12  hfShift(iConfig.getParameter<int>("HFShift")),
13  hbShift(iConfig.getParameter<int>("HBShift")) {
14 
15  // Output :The new manipulated TPGs
16  // make it smart - to name the collections
17  // correctly
18  char ecal_label[200];
19  char hcal_label[200];
20 
21  for (int i = preSamples; i > 0; --i) {
22  sprintf(ecal_label, "ECALBxminus%d", i);
23  sprintf(hcal_label, "HCALBxminus%d", i);
24  produces<EcalTrigPrimDigiCollection>(ecal_label);
25  produces<HcalTrigPrimDigiCollection>(hcal_label);
26  }
27 
28  produces<EcalTrigPrimDigiCollection>("ECALBx0");
29  produces<HcalTrigPrimDigiCollection>("HCALBx0");
30 
31  for (int i = 0; i < postSamples; ++i) {
32  sprintf(ecal_label, "ECALBxplus%d", i + 1);
33  sprintf(hcal_label, "HCALBxplus%d", i + 1);
34  produces<EcalTrigPrimDigiCollection>(ecal_label);
35  produces<HcalTrigPrimDigiCollection>(hcal_label);
36  }
37 }
T getParameter(std::string const &) const
edm::InputTag ecalTPG_
edm::InputTag hcalTPG_
L1RCTTPGProvider::~L1RCTTPGProvider ( )
override

Definition at line 39 of file L1RCTTPGProvider.cc.

39  {
40  // do anything here that needs to be done at desctruction time
41  // (e.g. close files, deallocate resources etc.)
42 }

Member Function Documentation

void L1RCTTPGProvider::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 360 of file L1RCTTPGProvider.cc.

360 {}
void L1RCTTPGProvider::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 49 of file L1RCTTPGProvider.cc.

References edm::SortedCollection< T, SORT >::begin(), digitizers_cfi::ecal, ecalTPG_, EcalTriggerTower, edm::SortedCollection< T, SORT >::end(), edm::Event::getByLabel(), hbShift, digitizers_cfi::hcal, hcalTPG_, hfShift, mps_fire::i, edm::HandleBase::isValid(), eostools::move(), hgc_digi::nSamples, postSamples, preSamples, edm::Event::put(), simplePhotonAnalyzer_cfi::sample, HcalTriggerPrimitiveDigi::setPresamples(), EcalTriggerPrimitiveDigi::setSample(), HcalTriggerPrimitiveDigi::setSample(), HcalTriggerPrimitiveDigi::setSize(), EcalTriggerPrimitiveDigi::setSize(), useEcalCosmicTiming, useHcalCosmicTiming, and ecaldqm::zside().

50  {
51  using namespace edm;
52  // Declare handles
55 
56  // Declare vector of collection to send for output !
57 
58  std::vector<EcalTrigPrimDigiCollection> ecalColl(preSamples + 1 +
59  postSamples);
60  std::vector<HcalTrigPrimDigiCollection> hcalColl(preSamples + 1 +
61  postSamples);
62 
63  unsigned nSamples = preSamples + postSamples + 1;
64 
65  if (iEvent.getByLabel(ecalTPG_, ecal))
66  if (ecal.isValid()) {
67  // loop through all ecal digis
69  ecal_it != ecal->end(); ecal_it++) {
70  short zside = ecal_it->id().zside();
71  unsigned short ietaAbs = ecal_it->id().ietaAbs();
72  short iphi = ecal_it->id().iphi();
73  unsigned short digiSize = ecal_it->size();
74  unsigned short nSOI = (unsigned short)(ecal_it->sampleOfInterest());
75  if (digiSize < nSamples || nSOI < preSamples ||
76  ((int)(digiSize - nSOI) < (int)(nSamples - preSamples))) {
77  unsigned short preLoopsZero = (unsigned short)(preSamples)-nSOI;
78 
79  // fill extra bx's at beginning with zeros
80  for (int sample = 0; sample < preLoopsZero; sample++) {
81  // fill first few with zeros
83  (int)zside, EcalTriggerTower, (int)ietaAbs, (int)iphi));
84  ecalDigi.setSize(1);
85  ecalDigi.setSample(0, EcalTriggerPrimitiveSample(0, false, 0));
86  ecalColl[sample].push_back(ecalDigi);
87  }
88 
89  // loop through existing data
90  for (int sample = preLoopsZero; sample < (preLoopsZero + digiSize);
91  sample++) {
92  // go through data
94  (int)zside, EcalTriggerTower, (int)ietaAbs, (int)iphi));
95  ecalDigi.setSize(1);
96  if (useEcalCosmicTiming && iphi >= 1 && iphi <= 36) {
97  if (nSOI < (preSamples + 1)) {
98  edm::LogWarning("TooLittleData")
99  << "ECAL data needs at least one presample "
100  << "more than the number requested "
101  << "to use ecal cosmic timing mod! "
102  << "reverting to useEcalCosmicTiming = false "
103  << "for rest of job.";
104  useEcalCosmicTiming = false;
105  } else {
106  ecalDigi.setSample(
107  0,
109  ecal_it->sample(nSOI + sample - preSamples - 1).raw()));
110  }
111  }
112  // else
113  if ((!useEcalCosmicTiming) || (iphi >= 37 && iphi <= 72)) {
114  ecalDigi.setSample(
116  ecal_it->sample(nSOI + sample - preSamples).raw()));
117  }
118  ecalColl[sample].push_back(ecalDigi);
119  }
120 
121  // fill extra bx's at end with zeros
122  for (unsigned int sample = (preLoopsZero + digiSize);
123  sample < nSamples; sample++) {
124  // fill zeros!
126  (int)zside, EcalTriggerTower, (int)ietaAbs, (int)iphi));
127  ecalDigi.setSize(1);
128  ecalDigi.setSample(0, EcalTriggerPrimitiveSample(0, false, 0));
129  ecalColl[sample].push_back(ecalDigi);
130  }
131  } else {
132  for (unsigned short sample = 0; sample < nSamples; sample++) {
133  // put each time sample into its own digi
134  short zside = ecal_it->id().zside();
135  unsigned short ietaAbs = ecal_it->id().ietaAbs();
136  short iphi = ecal_it->id().iphi();
138  (int)zside, EcalTriggerTower, (int)ietaAbs, (int)iphi));
139  ecalDigi.setSize(1);
140 
141  if (useEcalCosmicTiming && iphi >= 1 && iphi <= 36) {
142  if (nSOI < (preSamples + 1)) {
143  edm::LogWarning("TooLittleData")
144  << "ECAL data needs at least one presample "
145  << "more than the number requested "
146  << "to use ecal cosmic timing mod! "
147  << "reverting to useEcalCosmicTiming = false "
148  << "for rest of job.";
149  useEcalCosmicTiming = false;
150  } else {
151  ecalDigi.setSample(
153  ecal_it
154  ->sample(ecal_it->sampleOfInterest() + sample -
155  preSamples - 1)
156  .raw()));
157  }
158  }
159  // else
160  if ((!useEcalCosmicTiming) || (iphi >= 37 && iphi <= 72)) {
161  ecalDigi.setSample(0,
163  ecal_it
164  ->sample(ecal_it->sampleOfInterest() +
165  sample - preSamples)
166  .raw()));
167  }
168  // push back each digi into correct "time sample" of coll
169  ecalColl[sample].push_back(ecalDigi);
170  }
171  }
172  }
173  }
174 
175  if (iEvent.getByLabel(hcalTPG_, hcal))
176  if (hcal.isValid()) {
177  // loop through all hcal digis
178  for (HcalTrigPrimDigiCollection::const_iterator hcal_it = hcal->begin();
179  hcal_it != hcal->end(); hcal_it++) {
180  short ieta = hcal_it->id().ieta();
181  short iphi = hcal_it->id().iphi();
182  // loop through time samples for each digi
183  unsigned short digiSize = hcal_it->size();
184  // (size of each digi must be no less than nSamples)
185  unsigned short nSOI = (unsigned short)(hcal_it->presamples());
186  if (digiSize < nSamples || nSOI < preSamples ||
187  ((int)(digiSize - nSOI) < (int)(nSamples - preSamples))) {
188  unsigned short preLoopsZero = (unsigned short)(preSamples)-nSOI;
189  // fill extra bx's at beginning with zeros
190  for (int sample = 0; sample < preLoopsZero; sample++) {
191  // fill first few with zeros
192  HcalTriggerPrimitiveDigi hcalDigi(
193  HcalTrigTowerDetId((int)ieta, (int)iphi));
194  hcalDigi.setSize(1);
195  hcalDigi.setPresamples(0);
196  hcalDigi.setSample(0, HcalTriggerPrimitiveSample(0, false, 0, 0));
197  hcalColl[sample].push_back(hcalDigi);
198  }
199 
200  // loop through existing data
201  for (int sample = preLoopsZero; sample < (preLoopsZero + digiSize);
202  sample++) {
203  // go through data
204  HcalTriggerPrimitiveDigi hcalDigi(
205  HcalTrigTowerDetId((int)ieta, (int)iphi));
206  hcalDigi.setSize(1);
207  hcalDigi.setPresamples(0);
208 
209  if (useHcalCosmicTiming && iphi >= 1 && iphi <= 36) {
210  if (nSOI < (preSamples + 1)) {
211  edm::LogWarning("TooLittleData")
212  << "HCAL data needs at least one presample "
213  << "more than the number requested "
214  << "to use hcal cosmic timing mod! "
215  << "reverting to useHcalCosmicTiming = false "
216  << "for rest of job.";
217  useHcalCosmicTiming = false;
218  } else {
219  hcalDigi.setSample(0, HcalTriggerPrimitiveSample(
220  hcal_it
221  ->sample(hcal_it->presamples() +
222  sample - preSamples - 1)
223  .raw()));
224  }
225  }
226  // else
227  if ((!useHcalCosmicTiming) || (iphi >= 37 && iphi <= 72)) {
228 
229  hcalDigi.setSample(0, HcalTriggerPrimitiveSample(
230  hcal_it
231  ->sample(hcal_it->presamples() +
232  sample - preSamples)
233  .raw()));
234  }
235  hcalColl[sample].push_back(hcalDigi);
236  }
237 
238  // fill extra bx's at end with zeros
239  for (unsigned int sample = (preLoopsZero + digiSize);
240  sample < nSamples; sample++) {
241  // fill zeros!
242  HcalTriggerPrimitiveDigi hcalDigi(
243  HcalTrigTowerDetId((int)ieta, (int)iphi));
244  hcalDigi.setSize(1);
245  hcalDigi.setPresamples(0);
246  hcalDigi.setSample(0, HcalTriggerPrimitiveSample(0, false, 0, 0));
247  hcalColl[sample].push_back(hcalDigi);
248  }
249  } else {
250  for (unsigned short sample = 0; sample < nSamples; sample++) {
251  // put each (relevant) time sample into its own digi
252  HcalTriggerPrimitiveDigi hcalDigi(
253  HcalTrigTowerDetId((int)ieta, (int)iphi));
254  hcalDigi.setSize(1);
255  hcalDigi.setPresamples(0);
256 
257  if (useHcalCosmicTiming && iphi >= 1 && iphi <= 36) {
258  if (nSOI < (preSamples + 1)) {
259  edm::LogWarning("TooLittleData")
260  << "HCAL data needs at least one presample "
261  << "more than the number requested "
262  << "to use hcal cosmic timing mod! "
263  << "reverting to useHcalCosmicTiming = false "
264  << "for rest of job.";
265  useHcalCosmicTiming = false;
266  } else {
267  hcalDigi.setSample(0, HcalTriggerPrimitiveSample(
268  hcal_it
269  ->sample(hcal_it->presamples() +
270  sample - preSamples - 1)
271  .raw()));
272  }
273  }
274  // else
275  if ((!useHcalCosmicTiming) || (iphi >= 37 && iphi <= 72)) {
276  if (ieta > -29 && ieta < 29)
277  hcalDigi.setSample(
279  hcal_it
280  ->sample(hcal_it->presamples() + sample -
282  .raw()));
283  if (ieta <= -29 || ieta >= 29)
284  hcalDigi.setSample(
286  hcal_it
287  ->sample(hcal_it->presamples() + sample -
289  .raw()));
290  }
291  hcalColl[sample].push_back(hcalDigi);
292  }
293  }
294  }
295  }
296 
297  // Now put the events back to file
298 
299  for (int i = 0; i < preSamples; ++i) {
300  char ecal_label[200];
301  char hcal_label[200];
302 
303  sprintf(ecal_label, "ECALBxminus%d", preSamples - i);
304  sprintf(hcal_label, "HCALBxminus%d", preSamples - i);
305 
306  std::unique_ptr<EcalTrigPrimDigiCollection> ecalIn(
308  std::unique_ptr<HcalTrigPrimDigiCollection> hcalIn(
310  for (unsigned int j = 0; j < ecalColl[i].size(); ++j) {
311  ecalIn->push_back((ecalColl[i])[j]);
312  }
313  for (unsigned int j = 0; j < hcalColl[i].size(); ++j)
314  hcalIn->push_back((hcalColl[i])[j]);
315 
316  iEvent.put(std::move(ecalIn), ecal_label);
317  iEvent.put(std::move(hcalIn), hcal_label);
318  }
319 
320  std::unique_ptr<EcalTrigPrimDigiCollection> ecal0(
322  std::unique_ptr<HcalTrigPrimDigiCollection> hcal0(
324  for (unsigned int j = 0; j < ecalColl[preSamples].size(); ++j)
325  ecal0->push_back((ecalColl[preSamples])[j]);
326  for (unsigned int j = 0; j < hcalColl[preSamples].size(); ++j)
327  hcal0->push_back((hcalColl[preSamples])[j]);
328 
329  iEvent.put(std::move(ecal0), "ECALBx0");
330  iEvent.put(std::move(hcal0), "HCALBx0");
331 
332  for (int i = preSamples + 1; i < preSamples + postSamples + 1; ++i) {
333  char ecal_label[200];
334  char hcal_label[200];
335 
336  sprintf(ecal_label, "ECALBxplus%d", i - preSamples);
337  sprintf(hcal_label, "HCALBxplus%d", i - preSamples);
338 
339  std::unique_ptr<EcalTrigPrimDigiCollection> ecalIn2(
341  std::unique_ptr<HcalTrigPrimDigiCollection> hcalIn2(
343 
344  for (unsigned int j = 0; j < ecalColl[i].size(); ++j)
345  ecalIn2->push_back((ecalColl[i])[j]);
346 
347  for (unsigned int j = 0; j < hcalColl[i].size(); ++j)
348  hcalIn2->push_back((hcalColl[i])[j]);
349 
350  iEvent.put(std::move(ecalIn2), ecal_label);
351  iEvent.put(std::move(hcalIn2), hcal_label);
352  }
353 }
edm::InputTag ecalTPG_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
std::vector< T >::const_iterator const_iterator
int zside(DetId const &)
bool isValid() const
Definition: HandleBase.h:74
constexpr size_t nSamples
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
edm::InputTag hcalTPG_
const_iterator end() const
HLT enums.
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const

Member Data Documentation

edm::InputTag L1RCTTPGProvider::ecalTPG_
private

Definition at line 45 of file L1RCTTPGProvider.h.

Referenced by produce().

int L1RCTTPGProvider::hbShift
private

Definition at line 52 of file L1RCTTPGProvider.h.

Referenced by produce().

edm::InputTag L1RCTTPGProvider::hcalTPG_
private

Definition at line 46 of file L1RCTTPGProvider.h.

Referenced by produce().

int L1RCTTPGProvider::hfShift
private

Definition at line 51 of file L1RCTTPGProvider.h.

Referenced by produce().

int L1RCTTPGProvider::postSamples
private

Definition at line 50 of file L1RCTTPGProvider.h.

Referenced by L1RCTTPGProvider(), and produce().

int L1RCTTPGProvider::preSamples
private

Definition at line 49 of file L1RCTTPGProvider.h.

Referenced by L1RCTTPGProvider(), and produce().

bool L1RCTTPGProvider::useEcalCosmicTiming
private

Definition at line 48 of file L1RCTTPGProvider.h.

Referenced by produce().

bool L1RCTTPGProvider::useHcalCosmicTiming
private

Definition at line 47 of file L1RCTTPGProvider.h.

Referenced by produce().