39 keyName_(iConfig.getParameter<
std::
string>(
"key")),
40 useDebugTpgScales_(iConfig.getParameter<
bool>(
"useDebugTpgScales")) {
70 for (
int i = 0;
i < 18;
i++) {
71 for (
int j = 0;
j < 2;
j++) {
72 for (
int k = 0;
k < 28;
k++) {
76 for (
int k = 0;
k < 4;
k++) {
86 for (
int i = 0;
i < 18;
i++) {
87 for (
int j = 0;
j < 2;
j++) {
88 for (
int k = 0;
k < 28;
k++) {
92 for (
int k = 0;
k < 4;
k++) {
108 std::cout <<
"Using old-style TPG scales!" << std::endl;
192 for (
unsigned short nCard = 0; nCard <= 6; nCard = nCard + 2) {
203 if (dummyE !=
nullptr)
205 if (dummyH !=
nullptr)
219 int card2 = card + 1;
220 sprintf(filename,
"RC%i%i-%s.dat", card, card2,
keyName_.c_str());
223 sprintf(filename,
"RC6-%s.dat",
keyName_.c_str());
228 lutFile_ <<
"Emulator-parameter generated lut file, card " << card <<
" key " <<
keyName_ <<
" ";
232 sprintf(command,
"date >> %s", filename);
236 lutFile_.open(filename, std::ios::app);
238 unsigned long data = 0;
244 for (
unsigned short nLUT = 0; nLUT < 8; nLUT++) {
246 unsigned short iAbsEta = 0;
248 iAbsEta = (card / 2) * 8 + nLUT + 1;
251 iAbsEta = (card / 2) * 8 + nLUT + 1;
253 iAbsEta = (card / 2) * 8 + (3 - (nLUT % 4)) + 1;
267 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
269 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
271 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
274 unsigned short etIn9Bits = (output >> 8) & 511;
275 unsigned short tauActivityBit = (output >> 17) & 1;
276 data = (tauActivityBit << 9) + etIn9Bits;
283 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
285 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
287 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
290 unsigned short etIn7Bits = output & 127;
291 unsigned short heFgVetoBit = (output >> 7) & 1;
292 data = (heFgVetoBit << 7) + etIn7Bits;
309 int card2 = card + 1;
310 sprintf(filename,
"EIC%i%i-%s.dat", card, card2,
keyName_.c_str());
312 sprintf(filename,
"EIC6-%s.dat",
keyName_.c_str());
316 lutFile_ <<
"Emulator-parameter generated EIC lut file, card " << card <<
" key " <<
keyName_ <<
" ";
319 sprintf(command,
"date >> %s", filename);
323 lutFile_.open(filename, std::ios::app);
325 unsigned long data = 0;
331 for (
int etIn7Bits = 0; etIn7Bits < 128; etIn7Bits++) {
346 sprintf(filename,
"JSC-%s.dat",
keyName_.c_str());
350 lutFile_ <<
"Emulator parameter-generated lut file, key " <<
keyName_ <<
" ";
353 sprintf(command,
"date >> %s", filename);
356 lutFile_.open(filename, std::ios::app);
358 unsigned long data = 0;
359 unsigned long data0 = 0;
360 unsigned long data1 = 0;
366 for (
int lutbits = 0; lutbits < 4; lutbits++) {
368 for (
unsigned int phi1et = 0; phi1et < 256; phi1et++) {
370 for (
unsigned int phi0et = 0; phi0et < 256; phi0et++) {
384 data = (data1 << 8) + (data0);
405 unsigned int jscThresholdBarrel,
406 unsigned int jscThresholdEndcap) {
408 std::ofstream thresholdsFile;
410 sprintf(filename,
"Thresholds-%s.dat",
keyName_.c_str());
413 thresholdsFile <<
"key is " <<
keyName_ << std::endl << std::endl;
414 thresholdsFile <<
"eicIsolationThreshold " << eicThreshold << std::endl;
415 thresholdsFile <<
"jscQuietThresholdBarrel " << jscThresholdBarrel << std::endl;
416 thresholdsFile <<
"jscQuietThresholdEndcap " << jscThresholdEndcap << std::endl;
418 thresholdsFile.close();
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const L1RCTParameters * rctParameters_
L1RCTLutWriter(const edm::ParameterSet &)
void setEventSetup(const edm::EventSetup &evtSetup)
void writeRcLutFile(unsigned short card)
unsigned eicIsolationThreshold() const
void analyze(const edm::Event &, const edm::EventSetup &) override
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
L1RCTLookupTables * lookupTable_
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
unsigned jscQuietThresholdEndcap() const
unsigned short calcTower(unsigned short rct_iphi, unsigned short absIeta) const
void setHcalScale(const L1CaloHcalScale *hcalScale)
static const unsigned short nBinRank
void writeThresholdsFile(unsigned int eicThreshold, unsigned int jscThresholdBarrel, unsigned int jscThresholdEndcap)
unsigned int emRank(unsigned short energy) const
void setL1CaloEtScale(const L1CaloEtScale *etScale)
void setEcalScale(const L1CaloEcalScale *ecalScale)
void setRCTParameters(const L1RCTParameters *rctParameters)
char data[epos_bytes_allocation]
static const unsigned short nBinRank
void setNoisyChannelMask(const L1RCTNoisyChannelMask *channelMask)
static const unsigned short nBinEta
static const unsigned short nBinEta
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
void writeEicLutFile(unsigned short card)
~L1RCTLutWriter() override
T const * product() const
void setChannelMask(const L1RCTChannelMask *channelMask)
unsigned short calcCrate(unsigned short rct_iphi, short ieta) const
unsigned jscQuietThresholdBarrel() const
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const