CMS 3D CMS Logo

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

#include <L1RCTInputProducer.h>

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

Public Member Functions

 L1RCTInputProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~L1RCTInputProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ESGetToken< L1RCTChannelMask, L1RCTChannelMaskRcdchannelMaskToken
 
edm::InputTag ecalDigisLabel
 
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcdecalScaleToken
 
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcdemScaleToken
 
edm::InputTag hcalDigisLabel
 
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcdhcalScaleToken
 
L1RCTrct
 
L1RCTLookupTablesrctLookupTables
 
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcdrctParametersToken
 
bool useEcal
 
bool useHcal
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 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<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 30 of file L1RCTInputProducer.h.

Constructor & Destructor Documentation

◆ L1RCTInputProducer()

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

Definition at line 16 of file L1RCTInputProducer.cc.

19  useEcal(conf.getParameter<bool>("useEcal")),
20  useHcal(conf.getParameter<bool>("useHcal")),
21  ecalDigisLabel(conf.getParameter<edm::InputTag>("ecalDigisLabel")),
22  hcalDigisLabel(conf.getParameter<edm::InputTag>("hcalDigisLabel")),
23  rctParametersToken(esConsumes<L1RCTParameters, L1RCTParametersRcd>()),
24  channelMaskToken(esConsumes<L1RCTChannelMask, L1RCTChannelMaskRcd>()),
25  ecalScaleToken(esConsumes<L1CaloEcalScale, L1CaloEcalScaleRcd>()),
26  hcalScaleToken(esConsumes<L1CaloHcalScale, L1CaloHcalScaleRcd>()),
27  emScaleToken(esConsumes<L1CaloEtScale, L1EmEtScaleRcd>()) {
28  produces<std::vector<unsigned short>>("rctCrate");
29  produces<std::vector<unsigned short>>("rctCard");
30  produces<std::vector<unsigned short>>("rctTower");
31  produces<std::vector<unsigned int>>("rctEGammaET");
32  produces<std::vector<bool>>("rctHoEFGVetoBit");
33  produces<std::vector<unsigned int>>("rctJetMETET");
34  produces<std::vector<bool>>("rctTowerActivityBit");
35  produces<std::vector<bool>>("rctTowerMIPBit");
36  produces<std::vector<unsigned short>>("rctHFCrate");
37  produces<std::vector<unsigned short>>("rctHFRegion");
38  produces<std::vector<unsigned int>>("rctHFET");
39  produces<std::vector<bool>>("rctHFFG");
40 }
edm::InputTag ecalDigisLabel
edm::ESGetToken< L1RCTChannelMask, L1RCTChannelMaskRcd > channelMaskToken
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken
edm::InputTag hcalDigisLabel
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken
L1RCTLookupTables * rctLookupTables
Definition: L1RCT.h:20
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcd > rctParametersToken
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken

◆ ~L1RCTInputProducer()

L1RCTInputProducer::~L1RCTInputProducer ( )
override

Definition at line 42 of file L1RCTInputProducer.cc.

References rct, and rctLookupTables.

42  {
43  if (rct != nullptr)
44  delete rct;
45  if (rctLookupTables != nullptr)
46  delete rctLookupTables;
47 }
L1RCTLookupTables * rctLookupTables

Member Function Documentation

◆ produce()

void L1RCTInputProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 49 of file L1RCTInputProducer.cc.

References c, channelMaskToken, L1RCT::digiInput(), MillePedeFileConverter_cfg::e, bsc_activity_cfg::ecal, L1RCT::ecalCompressedET(), ecalDigisLabel, L1RCT::ecalFineGrainBit(), ecalScaleToken, emScaleToken, options_cfi::eventSetup, h, hltEgammaHLTExtra_cfi::hcal, L1RCT::hcalCompressedET(), hcalDigisLabel, hcalScaleToken, L1RCT::hfCompressedET(), L1RCTLookupTables::lookup(), eostools::move(), edm::ESHandle< T >::product(), alignCSCRings::r, rct, rctLookupTables, rctParametersToken, alignCSCRings::s, L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), L1RCTLookupTables::setRCTParameters(), hgcalTowerProducer_cfi::tower, useEcal, and useHcal.

49  {
50  // Refresh configuration information every event
51  // Hopefully, this does not take too much time
52  // There should be a call back function in future to
53  // handle changes in configuration
54 
56  const L1RCTParameters *r = rctParameters.product();
58  const L1RCTChannelMask *c = channelMask.product();
60  const L1CaloEcalScale *e = ecalScale.product();
62  const L1CaloHcalScale *h = hcalScale.product();
64  const L1CaloEtScale *s = emScale.product();
65 
71 
74 
75  if (useEcal) {
76  event.getByLabel(ecalDigisLabel, ecal);
77  }
78  if (useHcal) {
79  event.getByLabel(hcalDigisLabel, hcal);
80  }
81 
84  if (ecal.isValid()) {
85  ecalColl = *ecal;
86  }
87  if (hcal.isValid()) {
88  hcalColl = *hcal;
89  }
90 
91  rct->digiInput(ecalColl, hcalColl);
92 
93  // Stuff to create
94 
95  std::unique_ptr<std::vector<unsigned short>> rctCrate(new std::vector<unsigned short>);
96  std::unique_ptr<std::vector<unsigned short>> rctCard(new std::vector<unsigned short>);
97  std::unique_ptr<std::vector<unsigned short>> rctTower(new std::vector<unsigned short>);
98  std::unique_ptr<std::vector<unsigned int>> rctEGammaET(new std::vector<unsigned int>);
99  std::unique_ptr<std::vector<bool>> rctHoEFGVetoBit(new std::vector<bool>);
100  std::unique_ptr<std::vector<unsigned int>> rctJetMETET(new std::vector<unsigned int>);
101  std::unique_ptr<std::vector<bool>> rctTowerActivityBit(new std::vector<bool>);
102  std::unique_ptr<std::vector<bool>> rctTowerMIPBit(new std::vector<bool>);
103 
104  for (int crate = 0; crate < 18; crate++) {
105  for (int card = 0; card < 7; card++) {
106  for (int tower = 0; tower < 32; tower++) {
107  unsigned short ecalCompressedET = rct->ecalCompressedET(crate, card, tower);
108  unsigned short ecalFineGrainBit = rct->ecalFineGrainBit(crate, card, tower);
109  unsigned short hcalCompressedET = rct->hcalCompressedET(crate, card, tower);
110  unsigned int lutBits =
111  rctLookupTables->lookup(ecalCompressedET, hcalCompressedET, ecalFineGrainBit, crate, card, tower);
112  unsigned int eGammaETCode = lutBits & 0x0000007F;
113  bool hOeFGVetoBit = (lutBits >> 7) & 0x00000001;
114  unsigned int jetMETETCode = (lutBits >> 8) & 0x000001FF;
115  bool activityBit = (lutBits >> 17) & 0x00000001;
116  if (eGammaETCode > 0 || jetMETETCode > 0 || hOeFGVetoBit || activityBit) {
117  rctCrate->push_back(crate);
118  rctCard->push_back(card);
119  rctTower->push_back(tower);
120  rctEGammaET->push_back(eGammaETCode);
121  rctHoEFGVetoBit->push_back(hOeFGVetoBit);
122  rctJetMETET->push_back(jetMETETCode);
123  rctTowerActivityBit->push_back(activityBit);
124  rctTowerMIPBit->push_back(false); // FIXME: MIP bit is not yet defined
125  }
126  }
127  }
128  }
129 
130  std::unique_ptr<std::vector<unsigned short>> rctHFCrate(new std::vector<unsigned short>);
131  std::unique_ptr<std::vector<unsigned short>> rctHFRegion(new std::vector<unsigned short>);
132  std::unique_ptr<std::vector<unsigned int>> rctHFET(new std::vector<unsigned int>);
133  std::unique_ptr<std::vector<bool>> rctHFFG(new std::vector<bool>);
134  for (int crate = 0; crate < 18; crate++) {
135  for (int hfRegion = 0; hfRegion < 8; hfRegion++) {
136  unsigned short hfCompressedET = rct->hfCompressedET(crate, hfRegion);
137  unsigned int hfETCode = rctLookupTables->lookup(hfCompressedET, crate, 999, hfRegion);
138  if (hfETCode > 0) {
139  rctHFCrate->push_back(crate);
140  rctHFRegion->push_back(hfRegion);
141  rctHFET->push_back(hfETCode);
142  rctHFFG->push_back(false); // FIXME: HF FG is not yet defined
143  }
144  }
145  }
146 
147  // putting stuff back into event
148  event.put(std::move(rctCrate), "rctCrate");
149  event.put(std::move(rctCard), "rctCard");
150  event.put(std::move(rctTower), "rctTower");
151  event.put(std::move(rctEGammaET), "rctEGammaET");
152  event.put(std::move(rctHoEFGVetoBit), "rctHoEFGVetoBit");
153  event.put(std::move(rctJetMETET), "rctJetMETET");
154  event.put(std::move(rctTowerActivityBit), "rctTowerActivityBit");
155  event.put(std::move(rctTowerMIPBit), "rctTowerMIPBit");
156  event.put(std::move(rctHFCrate), "rctHFCrate");
157  event.put(std::move(rctHFRegion), "rctHFRegion");
158  event.put(std::move(rctHFET), "rctHFET");
159  event.put(std::move(rctHFFG), "rctHFFG");
160 }
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
unsigned short hcalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:65
unsigned short hfCompressedET(int crate, int tower)
Definition: L1RCT.h:71
edm::InputTag ecalDigisLabel
edm::ESGetToken< L1RCTChannelMask, L1RCTChannelMaskRcd > channelMaskToken
T const * product() const
Definition: ESHandle.h:86
void setHcalScale(const L1CaloHcalScale *hcalScale)
unsigned short ecalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:64
unsigned short ecalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:63
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken
void setL1CaloEtScale(const L1CaloEtScale *etScale)
edm::InputTag hcalDigisLabel
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken
void setEcalScale(const L1CaloEcalScale *ecalScale)
void setRCTParameters(const L1RCTParameters *rctParameters)
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:109
L1RCTLookupTables * rctLookupTables
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcd > rctParametersToken
def move(src, dest)
Definition: eostools.py:511
void setChannelMask(const L1RCTChannelMask *channelMask)
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken

Member Data Documentation

◆ channelMaskToken

edm::ESGetToken<L1RCTChannelMask, L1RCTChannelMaskRcd> L1RCTInputProducer::channelMaskToken
private

Definition at line 44 of file L1RCTInputProducer.h.

Referenced by produce().

◆ ecalDigisLabel

edm::InputTag L1RCTInputProducer::ecalDigisLabel
private

Definition at line 41 of file L1RCTInputProducer.h.

Referenced by produce().

◆ ecalScaleToken

edm::ESGetToken<L1CaloEcalScale, L1CaloEcalScaleRcd> L1RCTInputProducer::ecalScaleToken
private

Definition at line 45 of file L1RCTInputProducer.h.

Referenced by produce().

◆ emScaleToken

edm::ESGetToken<L1CaloEtScale, L1EmEtScaleRcd> L1RCTInputProducer::emScaleToken
private

Definition at line 47 of file L1RCTInputProducer.h.

Referenced by produce().

◆ hcalDigisLabel

edm::InputTag L1RCTInputProducer::hcalDigisLabel
private

Definition at line 42 of file L1RCTInputProducer.h.

Referenced by produce().

◆ hcalScaleToken

edm::ESGetToken<L1CaloHcalScale, L1CaloHcalScaleRcd> L1RCTInputProducer::hcalScaleToken
private

Definition at line 46 of file L1RCTInputProducer.h.

Referenced by produce().

◆ rct

L1RCT* L1RCTInputProducer::rct
private

Definition at line 38 of file L1RCTInputProducer.h.

Referenced by produce(), and ~L1RCTInputProducer().

◆ rctLookupTables

L1RCTLookupTables* L1RCTInputProducer::rctLookupTables
private

Definition at line 37 of file L1RCTInputProducer.h.

Referenced by produce(), and ~L1RCTInputProducer().

◆ rctParametersToken

edm::ESGetToken<L1RCTParameters, L1RCTParametersRcd> L1RCTInputProducer::rctParametersToken
private

Definition at line 43 of file L1RCTInputProducer.h.

Referenced by produce().

◆ useEcal

bool L1RCTInputProducer::useEcal
private

Definition at line 39 of file L1RCTInputProducer.h.

Referenced by produce().

◆ useHcal

bool L1RCTInputProducer::useHcal
private

Definition at line 40 of file L1RCTInputProducer.h.

Referenced by produce().