CMS 3D CMS Logo

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

#include <L1RCTSaveInput.h>

Inheritance diagram for L1RCTSaveInput:
edm::EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Attributes

edm::InputTag ecalDigisLabel
 
std::string fileName
 
edm::InputTag hcalDigisLabel
 
std::ofstream ofs
 
L1RCTrct
 
L1RCTLookupTablesrctLookupTables
 
bool useDebugTpgScales
 
bool useEcal
 
bool useHcal
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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 39 of file L1RCTSaveInput.h.

Constructor & Destructor Documentation

◆ L1RCTSaveInput()

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

Definition at line 45 of file L1RCTSaveInput.cc.

46  : fileName(conf.getUntrackedParameter<std::string>("rctTestInputFile")),
49  useEcal(conf.getParameter<bool>("useEcal")),
50  useHcal(conf.getParameter<bool>("useHcal")),
51  ecalDigisLabel(conf.getParameter<edm::InputTag>("ecalDigisLabel")),
52  hcalDigisLabel(conf.getParameter<edm::InputTag>("hcalDigisLabel")),
53  useDebugTpgScales(conf.getParameter<bool>("useDebugTpgScales")) {
54  ofs.open(fileName.c_str(), std::ios::app);
55  if (!ofs) {
56  std::cerr << "Could not create " << fileName << std::endl;
57  exit(1);
58  }
59 }

References beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), fileName, and ofs.

◆ ~L1RCTSaveInput()

L1RCTSaveInput::~L1RCTSaveInput ( )
override

Definition at line 61 of file L1RCTSaveInput.cc.

61  {
62  if (rct != nullptr)
63  delete rct;
64  if (rctLookupTables != nullptr)
65  delete rctLookupTables;
66 }

References rct, and rctLookupTables.

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 68 of file L1RCTSaveInput.cc.

68  {
69  edm::ESHandle<L1RCTParameters> rctParameters;
70  eventSetup.get<L1RCTParametersRcd>().get(rctParameters);
71  const L1RCTParameters *r = rctParameters.product();
73  eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
74  const L1RCTChannelMask *c = channelMask.product();
76  eventSetup.get<L1EmEtScaleRcd>().get(emScale);
77  const L1CaloEtScale *s = emScale.product();
78 
82 
83  if (useDebugTpgScales) {
84  // use old-style scales
86  eventSetup.get<CaloTPGRecord>().get(transcoder);
87  const CaloTPGTranscoder *h_tpg = transcoder.product();
88 
89  EcalTPGScale *e_tpg = new EcalTPGScale();
90  e_tpg->setEventSetup(eventSetup);
91 
92  L1CaloEcalScale *ecalScale = new L1CaloEcalScale();
93  L1CaloHcalScale *hcalScale = new L1CaloHcalScale();
94 
95  // create input scales, werner's code
96  // ECAL
97  std::cout << "ECAL Pos " << L1CaloEcalScale::nBinRank << std::endl;
98  for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
99  for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
100  std::cout << ieta << " " << irank;
101  EcalSubdetector subdet = (ieta <= 17) ? EcalBarrel : EcalEndcap;
102  double etGeVPos = e_tpg->getTPGInGeV(irank,
103  EcalTrigTowerDetId(1, // +ve eta
104  subdet,
105  ieta,
106  1)); // dummy phi value
107  ecalScale->setBin(irank, ieta, 1, etGeVPos);
108  std::cout << etGeVPos << ", ";
109  }
110  std::cout << std::endl;
111  }
112  std::cout << std::endl;
113 
114  std::cout << "ECAL Neg" << std::endl;
115  for (unsigned short ieta = 1; ieta <= L1CaloEcalScale::nBinEta; ++ieta) {
116  for (unsigned short irank = 0; irank < L1CaloEcalScale::nBinRank; ++irank) {
117  EcalSubdetector subdet = (ieta <= 17) ? EcalBarrel : EcalEndcap;
118 
119  std::cout << ieta << " " << irank;
120  double etGeVNeg = e_tpg->getTPGInGeV(irank,
121  EcalTrigTowerDetId(-1, // -ve eta
122  subdet,
123  ieta,
124  2)); // dummy phi value
125  ecalScale->setBin(irank, ieta, -1, etGeVNeg);
126  std::cout << etGeVNeg << ", ";
127  }
128  std::cout << std::endl;
129  }
130  std::cout << std::endl;
131 
132  // HCAL
133  std::cout << "HCAL" << std::endl;
134  for (unsigned short ieta = 1; ieta <= L1CaloHcalScale::nBinEta; ++ieta) {
135  for (unsigned short irank = 0; irank < L1CaloHcalScale::nBinRank; ++irank) {
136  double etGeV = h_tpg->hcaletValue(ieta, irank);
137 
138  hcalScale->setBin(irank, ieta, 1, etGeV);
139  hcalScale->setBin(irank, ieta, -1, etGeV);
140  std::cout << etGeV << ", ";
141  std::cout << std::endl;
142  }
143  std::cout << std::endl;
144  }
145 
146  // set the input scales
147  rctLookupTables->setEcalScale(ecalScale);
148  rctLookupTables->setHcalScale(hcalScale);
149 
150  delete e_tpg;
151 
152  } else {
154  eventSetup.get<L1CaloHcalScaleRcd>().get(hcalScale);
155  const L1CaloHcalScale *h = hcalScale.product();
157  eventSetup.get<L1CaloEcalScaleRcd>().get(ecalScale);
158  const L1CaloEcalScale *e = ecalScale.product();
159 
162  }
163 
166  event.getByLabel(ecalDigisLabel, ecal);
167  event.getByLabel(hcalDigisLabel, hcal);
170  if (ecal.isValid()) {
171  ecalColl = *ecal;
172  }
173  if (hcal.isValid()) {
174  hcalColl = *hcal;
175  }
176  rct->digiInput(ecalColl, hcalColl);
177  static int nEvents = 0;
178  if (nEvents == 0) {
179  ofs << "Crate = 0-17" << std::endl
180  << "Card = 0-7 within the crate" << std::endl
181  << "Tower = 0-31 covers 4 x 8 covered by the card" << std::endl
182  << "EMAddr(0:8) = EMFGBit(0:0)+CompressedEMET(1:8)" << std::endl
183  << "HDAddr(0:8) = HDFGBit(0:0)+CompressedHDET(1:8) - note: "
184  "HDFGBit(0:0) is not part of the hardware LUT address"
185  << std::endl
186  << "LutOut(0:17)= "
187  "LinearEMET(0:6)+HoEFGVetoBit(7:7)+LinearJetET(8:16)+ActivityBit(17:"
188  "17)"
189  << std::endl
190  << "Event"
191  << "\t"
192  << "Crate"
193  << "\t"
194  << "Card"
195  << "\t"
196  << "Tower"
197  << "\t"
198  << "EMAddr"
199  << "\t"
200  << "HDAddr"
201  << "\t"
202  << "LUTOut" << std::endl;
203  }
204  if (nEvents < 64) {
205  for (unsigned short iCrate = 0; iCrate < 18; iCrate++) {
206  for (unsigned short iCard = 0; iCard < 7; iCard++) {
207  // tower numbered from 0-31
208  for (unsigned short iTower = 0; iTower < 32; iTower++) {
209  unsigned short ecal = rct->ecalCompressedET(iCrate, iCard, iTower);
210  unsigned short hcal = rct->hcalCompressedET(iCrate, iCard, iTower);
211  unsigned short fgbit = rct->ecalFineGrainBit(iCrate, iCard, iTower);
212  unsigned short mubit = rct->hcalFineGrainBit(iCrate, iCard, iTower);
213  unsigned long lutOutput = rctLookupTables->lookup(ecal, hcal, fgbit, iCrate, iCard, iTower);
214  ofs << std::hex << nEvents << "\t" << iCrate << "\t" << iCard << "\t" << iTower << "\t" << ecal * 2 + fgbit
215  << "\t" << hcal * 2 + mubit << "\t" << lutOutput << std::dec << std::endl;
216  }
217  }
218  }
219  }
220  nEvents++;
221 }

References HltBtagPostValidation_cff::c, gather_cfg::cout, TauDecayModes::dec, L1RCT::digiInput(), MillePedeFileConverter_cfg::e, bsc_activity_cfg::ecal, EcalBarrel, L1RCT::ecalCompressedET(), ecalDigisLabel, EcalEndcap, L1RCT::ecalFineGrainBit(), options_cfi::eventSetup, get, EcalTPGScale::getTPGInGeV(), patCandidatesForDimuonsSequences_cff::hcal, L1RCT::hcalCompressedET(), hcalDigisLabel, CaloTPGTranscoder::hcaletValue(), L1RCT::hcalFineGrainBit(), LEDCalibrationChannels::ieta, L1RCTLookupTables::lookup(), L1CaloEcalScale::nBinEta, L1CaloHcalScale::nBinEta, L1CaloEcalScale::nBinRank, L1CaloHcalScale::nBinRank, nEvents, ofs, edm::ESHandle< T >::product(), alignCSCRings::r, rct, rctLookupTables, alignCSCRings::s, L1CaloEcalScale::setBin(), L1CaloHcalScale::setBin(), L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), EcalTPGScale::setEventSetup(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), L1RCTLookupTables::setRCTParameters(), and useDebugTpgScales.

Member Data Documentation

◆ ecalDigisLabel

edm::InputTag L1RCTSaveInput::ecalDigisLabel
private

Definition at line 51 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ fileName

std::string L1RCTSaveInput::fileName
private

Definition at line 46 of file L1RCTSaveInput.h.

Referenced by L1RCTSaveInput().

◆ hcalDigisLabel

edm::InputTag L1RCTSaveInput::hcalDigisLabel
private

Definition at line 52 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ ofs

std::ofstream L1RCTSaveInput::ofs
private

Definition at line 54 of file L1RCTSaveInput.h.

Referenced by analyze(), and L1RCTSaveInput().

◆ rct

L1RCT* L1RCTSaveInput::rct
private

Definition at line 48 of file L1RCTSaveInput.h.

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

◆ rctLookupTables

L1RCTLookupTables* L1RCTSaveInput::rctLookupTables
private

Definition at line 47 of file L1RCTSaveInput.h.

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

◆ useDebugTpgScales

bool L1RCTSaveInput::useDebugTpgScales
private

Definition at line 53 of file L1RCTSaveInput.h.

Referenced by analyze().

◆ useEcal

bool L1RCTSaveInput::useEcal
private

Definition at line 49 of file L1RCTSaveInput.h.

◆ useHcal

bool L1RCTSaveInput::useHcal
private

Definition at line 50 of file L1RCTSaveInput.h.

EcalTPGScale::getTPGInGeV
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
Definition: EcalTPGScale.cc:18
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CaloTPGTranscoder
Definition: CaloTPGTranscoder.h:24
EcalTPGScale
Definition: EcalTPGScale.h:8
L1CaloHcalScale
Definition: L1CaloHcalScale.h:28
L1CaloEcalScale
Definition: L1CaloEcalScale.h:28
L1RCTSaveInput::hcalDigisLabel
edm::InputTag hcalDigisLabel
Definition: L1RCTSaveInput.h:52
L1RCTLookupTables::lookup
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
Definition: L1RCTLookupTables.cc:22
hcal
Definition: ConfigurationDatabase.cc:13
L1CaloEcalScaleRcd
Definition: L1CaloEcalScaleRcd.h:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1RCTParametersRcd
Definition: L1RCTParametersRcd.h:12
L1CaloHcalScale::nBinRank
static const unsigned short nBinRank
Definition: L1CaloHcalScale.h:31
edm::SortedCollection
Definition: SortedCollection.h:49
L1RCT::hcalFineGrainBit
unsigned short hcalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:68
L1RCTChannelMask
Definition: L1RCTChannelMask.h:7
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
EcalTPGScale::setEventSetup
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalTPGScale.cc:16
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
L1RCTSaveInput::ecalDigisLabel
edm::InputTag ecalDigisLabel
Definition: L1RCTSaveInput.h:51
L1RCTSaveInput::useDebugTpgScales
bool useDebugTpgScales
Definition: L1RCTSaveInput.h:53
L1RCTSaveInput::rctLookupTables
L1RCTLookupTables * rctLookupTables
Definition: L1RCTSaveInput.h:47
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
L1CaloEcalScale::nBinRank
static const unsigned short nBinRank
Definition: L1CaloEcalScale.h:31
L1RCT::ecalCompressedET
unsigned short ecalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:63
patCandidatesForDimuonsSequences_cff.hcal
hcal
Definition: patCandidatesForDimuonsSequences_cff.py:37
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1RCTLookupTables::setHcalScale
void setHcalScale(const L1CaloHcalScale *hcalScale)
Definition: L1RCTLookupTables.h:27
L1RCT
Definition: L1RCT.h:20
edm::ESHandle
Definition: DTSurvey.h:22
L1RCTSaveInput::useEcal
bool useEcal
Definition: L1RCTSaveInput.h:49
h
L1RCTSaveInput::fileName
std::string fileName
Definition: L1RCTSaveInput.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
L1RCT::ecalFineGrainBit
unsigned short ecalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:64
L1CaloHcalScale::nBinEta
static const unsigned short nBinEta
Definition: L1CaloHcalScale.h:32
L1RCTLookupTables
Definition: L1RCTLookupTables.h:11
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
L1RCTSaveInput::ofs
std::ofstream ofs
Definition: L1RCTSaveInput.h:54
CaloTPGRecord
Definition: CaloTPGRecord.h:26
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
L1RCTChannelMaskRcd
Definition: L1RCTChannelMaskRcd.h:12
L1CaloEtScale
Definition: L1CaloEtScale.h:29
L1RCTLookupTables::setL1CaloEtScale
void setL1CaloEtScale(const L1CaloEtScale *etScale)
Definition: L1RCTLookupTables.h:29
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
alignCSCRings.r
r
Definition: alignCSCRings.py:93
L1CaloHcalScale::setBin
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
Definition: L1CaloHcalScale.cc:33
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
L1CaloEcalScale::setBin
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
Definition: L1CaloEcalScale.cc:33
L1RCTLookupTables::setEcalScale
void setEcalScale(const L1CaloEcalScale *ecalScale)
Definition: L1RCTLookupTables.h:31
L1EmEtScaleRcd
Definition: L1EmEtScaleRcd.h:30
options_cfi.eventSetup
eventSetup
Definition: options_cfi.py:12
L1RCTLookupTables::setRCTParameters
void setRCTParameters(const L1RCTParameters *rctParameters)
Definition: L1RCTLookupTables.h:21
L1RCTSaveInput::rct
L1RCT * rct
Definition: L1RCTSaveInput.h:48
L1RCTParameters
Definition: L1RCTParameters.h:27
bsc_activity_cfg.ecal
ecal
Definition: bsc_activity_cfg.py:25
CaloTPGTranscoder::hcaletValue
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
L1RCTLookupTables::setChannelMask
void setChannelMask(const L1RCTChannelMask *channelMask)
Definition: L1RCTLookupTables.h:23
L1CaloEcalScale::nBinEta
static const unsigned short nBinEta
Definition: L1CaloEcalScale.h:32
nEvents
UInt_t nEvents
Definition: hcalCalib.cc:41
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
L1RCTSaveInput::useHcal
bool useHcal
Definition: L1RCTSaveInput.h:50
L1RCT::digiInput
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:109
L1RCT::hcalCompressedET
unsigned short hcalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:65
L1CaloHcalScaleRcd
Definition: L1CaloHcalScaleRcd.h:13
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37