CMS 3D CMS Logo

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

#include <L1RCTSaveInput.h>

Inheritance diagram for L1RCTSaveInput:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 L1RCTSaveInput (const edm::ParameterSet &)
 
 ~L1RCTSaveInput () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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::EDGetTokenT< EcalTrigPrimDigiCollectionecalDigisToken_
 
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcdecalScaleToken_
 
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcdemScaleToken_
 
std::string fileName
 
edm::EDGetTokenT< HcalTrigPrimDigiCollectionhcalDigisToken_
 
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcdhcalScaleToken_
 
std::ofstream ofs
 
L1RCTrct
 
L1RCTLookupTablesrctLookupTables
 
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcdrctParametersToken_
 
EcalTPGScale::Tokens tokens_
 
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecordtranscoderToken_
 
bool useDebugTpgScales
 
bool useEcal
 
bool useHcal
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

src/L1RCTSaveInput/src/L1RCTSaveInput.cc

Description: Saves the input event from TPGs for loading simulated events in hardware

Implementation: Kind of kludgy – should think of a better way in future

Definition at line 55 of file L1RCTSaveInput.h.

Constructor & Destructor Documentation

◆ L1RCTSaveInput()

L1RCTSaveInput::L1RCTSaveInput ( const edm::ParameterSet conf)
explicit

Definition at line 26 of file L1RCTSaveInput.cc.

References Exception, fileName, and ofs.

27  : fileName(conf.getUntrackedParameter<std::string>("rctTestInputFile")),
30  useEcal(conf.getParameter<bool>("useEcal")),
31  useHcal(conf.getParameter<bool>("useHcal")),
32  ecalDigisToken_(consumes(conf.getParameter<edm::InputTag>("ecalDigisLabel"))),
33  hcalDigisToken_(consumes(conf.getParameter<edm::InputTag>("hcalDigisLabel"))),
34  rctParametersToken_(esConsumes<L1RCTParameters, L1RCTParametersRcd>()),
35  channelMaskToken_(esConsumes<L1RCTChannelMask, L1RCTChannelMaskRcd>()),
36  emScaleToken_(esConsumes<L1CaloEtScale, L1EmEtScaleRcd>()),
37  transcoderToken_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>()),
38  hcalScaleToken_(esConsumes<L1CaloHcalScale, L1CaloHcalScaleRcd>()),
39  ecalScaleToken_(esConsumes<L1CaloEcalScale, L1CaloEcalScaleRcd>()),
40  useDebugTpgScales(conf.getParameter<bool>("useDebugTpgScales")),
42  ofs.open(fileName.c_str(), std::ios::app);
43  if (!ofs) {
44  throw cms::Exception("FailedFileOpen") << "Could not create " << fileName << std::endl;
45  }
46 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalTPGScale::Tokens tokens_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalDigisToken_
L1RCTLookupTables * rctLookupTables
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalDigisToken_
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > transcoderToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::string fileName
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken_
edm::ESGetToken< L1RCTChannelMask, L1RCTChannelMaskRcd > channelMaskToken_
std::ofstream ofs
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcd > rctParametersToken_
Definition: L1RCT.h:20

◆ ~L1RCTSaveInput()

L1RCTSaveInput::~L1RCTSaveInput ( )
override

Definition at line 48 of file L1RCTSaveInput.cc.

References rct, and rctLookupTables.

48  {
49  if (rct != nullptr)
50  delete rct;
51  if (rctLookupTables != nullptr)
52  delete rctLookupTables;
53 }
L1RCTLookupTables * rctLookupTables

Member Function Documentation

◆ analyze()

void L1RCTSaveInput::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 55 of file L1RCTSaveInput.cc.

References HltBtagPostValidation_cff::c, channelMaskToken_, gather_cfg::cout, TauDecayModes::dec, L1RCT::digiInput(), MillePedeFileConverter_cfg::e, bsc_activity_cfg::ecal, EcalBarrel, L1RCT::ecalCompressedET(), ecalDigisToken_, EcalEndcap, L1RCT::ecalFineGrainBit(), ecalScaleToken_, emScaleToken_, options_cfi::eventSetup, EcalTPGScale::getTPGInGeV(), h, hltEgammaHLTExtra_cfi::hcal, L1RCT::hcalCompressedET(), hcalDigisToken_, CaloTPGTranscoder::hcaletValue(), L1RCT::hcalFineGrainBit(), hcalScaleToken_, LEDCalibrationChannels::ieta, L1RCTLookupTables::lookup(), L1CaloEcalScale::nBinEta, L1CaloHcalScale::nBinEta, L1CaloEcalScale::nBinRank, L1CaloHcalScale::nBinRank, createIOVlist::nEvents, ofs, edm::ESHandle< T >::product(), alignCSCRings::r, rct, rctLookupTables, rctParametersToken_, alignCSCRings::s, L1CaloHcalScale::setBin(), L1CaloEcalScale::setBin(), L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), L1RCTLookupTables::setRCTParameters(), tokens_, transcoderToken_, and useDebugTpgScales.

55  {
57  const L1RCTParameters *r = rctParameters.product();
59  const L1RCTChannelMask *c = channelMask.product();
61  const L1CaloEtScale *s = emScale.product();
62 
66 
67  if (useDebugTpgScales) {
68  // use old-style scales
70  const CaloTPGTranscoder *h_tpg = transcoder.product();
71 
73 
74  L1CaloEcalScale *ecalScale = new L1CaloEcalScale();
75  L1CaloHcalScale *hcalScale = new L1CaloHcalScale();
76 
77  // create input scales, werner's code
78  // ECAL
79  std::cout << "ECAL Pos " << L1CaloEcalScale::nBinRank << std::endl;
80  for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
81  for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
82  std::cout << ieta << " " << irank;
83  EcalSubdetector subdet = (ieta <= 17) ? EcalBarrel : EcalEndcap;
84  double etGeVPos = e_tpg.getTPGInGeV(irank,
85  EcalTrigTowerDetId(1, // +ve eta
86  subdet,
87  ieta,
88  1)); // dummy phi value
89  ecalScale->setBin(irank, ieta, 1, etGeVPos);
90  std::cout << etGeVPos << ", ";
91  }
92  std::cout << std::endl;
93  }
94  std::cout << std::endl;
95 
96  std::cout << "ECAL Neg" << std::endl;
97  for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
98  for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
99  EcalSubdetector subdet = (ieta <= 17) ? EcalBarrel : EcalEndcap;
100 
101  std::cout << ieta << " " << irank;
102  double etGeVNeg = e_tpg.getTPGInGeV(irank,
103  EcalTrigTowerDetId(-1, // -ve eta
104  subdet,
105  ieta,
106  2)); // dummy phi value
107  ecalScale->setBin(irank, ieta, -1, etGeVNeg);
108  std::cout << etGeVNeg << ", ";
109  }
110  std::cout << std::endl;
111  }
112  std::cout << std::endl;
113 
114  // HCAL
115  std::cout << "HCAL" << std::endl;
116  for (unsigned short ieta = 1; ieta <= L1CaloHcalScale::nBinEta; ++ieta) {
117  for (unsigned short irank = 0; irank < L1CaloHcalScale::nBinRank; ++irank) {
118  double etGeV = h_tpg->hcaletValue(ieta, irank);
119 
120  hcalScale->setBin(irank, ieta, 1, etGeV);
121  hcalScale->setBin(irank, ieta, -1, etGeV);
122  std::cout << etGeV << ", ";
123  std::cout << std::endl;
124  }
125  std::cout << std::endl;
126  }
127 
128  // set the input scales
129  rctLookupTables->setEcalScale(ecalScale);
130  rctLookupTables->setHcalScale(hcalScale);
131 
132  } else {
134  const L1CaloHcalScale *h = hcalScale.product();
136  const L1CaloEcalScale *e = ecalScale.product();
137 
140  }
141 
146  if (ecal.isValid()) {
147  ecalColl = *ecal;
148  }
149  if (hcal.isValid()) {
150  hcalColl = *hcal;
151  }
152  rct->digiInput(ecalColl, hcalColl);
153  static int nEvents = 0;
154  if (nEvents == 0) {
155  ofs << "Crate = 0-17" << std::endl
156  << "Card = 0-7 within the crate" << std::endl
157  << "Tower = 0-31 covers 4 x 8 covered by the card" << std::endl
158  << "EMAddr(0:8) = EMFGBit(0:0)+CompressedEMET(1:8)" << std::endl
159  << "HDAddr(0:8) = HDFGBit(0:0)+CompressedHDET(1:8) - note: "
160  "HDFGBit(0:0) is not part of the hardware LUT address"
161  << std::endl
162  << "LutOut(0:17)= "
163  "LinearEMET(0:6)+HoEFGVetoBit(7:7)+LinearJetET(8:16)+ActivityBit(17:"
164  "17)"
165  << std::endl
166  << "Event"
167  << "\t"
168  << "Crate"
169  << "\t"
170  << "Card"
171  << "\t"
172  << "Tower"
173  << "\t"
174  << "EMAddr"
175  << "\t"
176  << "HDAddr"
177  << "\t"
178  << "LUTOut" << std::endl;
179  }
180  if (nEvents < 64) {
181  for (unsigned short iCrate = 0; iCrate < 18; iCrate++) {
182  for (unsigned short iCard = 0; iCard < 7; iCard++) {
183  // tower numbered from 0-31
184  for (unsigned short iTower = 0; iTower < 32; iTower++) {
185  unsigned short ecal = rct->ecalCompressedET(iCrate, iCard, iTower);
186  unsigned short hcal = rct->hcalCompressedET(iCrate, iCard, iTower);
187  unsigned short fgbit = rct->ecalFineGrainBit(iCrate, iCard, iTower);
188  unsigned short mubit = rct->hcalFineGrainBit(iCrate, iCard, iTower);
189  unsigned long lutOutput = rctLookupTables->lookup(ecal, hcal, fgbit, iCrate, iCard, iTower);
190  ofs << std::hex << nEvents << "\t" << iCrate << "\t" << iCard << "\t" << iTower << "\t" << ecal * 2 + fgbit
191  << "\t" << hcal * 2 + mubit << "\t" << lutOutput << std::dec << std::endl;
192  }
193  }
194  }
195  }
196  nEvents++;
197 }
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
EcalTPGScale::Tokens tokens_
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hcalDigisToken_
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
L1RCTLookupTables * rctLookupTables
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
unsigned short hcalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:68
edm::EDGetTokenT< EcalTrigPrimDigiCollection > ecalDigisToken_
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > transcoderToken_
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
static const unsigned short nBinRank
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken_
edm::ESGetToken< L1RCTChannelMask, L1RCTChannelMaskRcd > channelMaskToken_
void setL1CaloEtScale(const L1CaloEtScale *etScale)
std::ofstream ofs
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
void setEcalScale(const L1CaloEcalScale *ecalScale)
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcd > rctParametersToken_
void setRCTParameters(const L1RCTParameters *rctParameters)
static const unsigned short nBinRank
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:109
static const unsigned short nBinEta
static const unsigned short nBinEta
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
EcalSubdetector
void setChannelMask(const L1RCTChannelMask *channelMask)

Member Data Documentation

◆ channelMaskToken_

edm::ESGetToken<L1RCTChannelMask, L1RCTChannelMaskRcd> L1RCTSaveInput::channelMaskToken_
private

Definition at line 70 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ ecalDigisToken_

edm::EDGetTokenT<EcalTrigPrimDigiCollection> L1RCTSaveInput::ecalDigisToken_
private

Definition at line 67 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ ecalScaleToken_

edm::ESGetToken<L1CaloEcalScale, L1CaloEcalScaleRcd> L1RCTSaveInput::ecalScaleToken_
private

Definition at line 74 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ emScaleToken_

edm::ESGetToken<L1CaloEtScale, L1EmEtScaleRcd> L1RCTSaveInput::emScaleToken_
private

Definition at line 71 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ fileName

std::string L1RCTSaveInput::fileName
private

Definition at line 62 of file L1RCTSaveInput.h.

Referenced by L1RCTSaveInput().

◆ hcalDigisToken_

edm::EDGetTokenT<HcalTrigPrimDigiCollection> L1RCTSaveInput::hcalDigisToken_
private

Definition at line 68 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ hcalScaleToken_

edm::ESGetToken<L1CaloHcalScale, L1CaloHcalScaleRcd> L1RCTSaveInput::hcalScaleToken_
private

Definition at line 73 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ ofs

std::ofstream L1RCTSaveInput::ofs
private

Definition at line 76 of file L1RCTSaveInput.h.

Referenced by analyze(), and L1RCTSaveInput().

◆ rct

L1RCT* L1RCTSaveInput::rct
private

Definition at line 64 of file L1RCTSaveInput.h.

Referenced by analyze(), and ~L1RCTSaveInput().

◆ rctLookupTables

L1RCTLookupTables* L1RCTSaveInput::rctLookupTables
private

Definition at line 63 of file L1RCTSaveInput.h.

Referenced by analyze(), and ~L1RCTSaveInput().

◆ rctParametersToken_

edm::ESGetToken<L1RCTParameters, L1RCTParametersRcd> L1RCTSaveInput::rctParametersToken_
private

Definition at line 69 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ tokens_

EcalTPGScale::Tokens L1RCTSaveInput::tokens_
private

Definition at line 77 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ transcoderToken_

edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> L1RCTSaveInput::transcoderToken_
private

Definition at line 72 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ useDebugTpgScales

bool L1RCTSaveInput::useDebugTpgScales
private

Definition at line 75 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ useEcal

bool L1RCTSaveInput::useEcal
private

Definition at line 65 of file L1RCTSaveInput.h.

◆ useHcal

bool L1RCTSaveInput::useHcal
private

Definition at line 66 of file L1RCTSaveInput.h.