39 keyName_(iConfig.getParameter<
std::
string>(
"key")),
40 useDebugTpgScales_(iConfig.getParameter<
bool>(
"useDebugTpgScales")) {
73 for (
int i = 0;
i < 18;
i++) {
74 for (
int j = 0; j < 2; j++) {
75 for (
int k = 0;
k < 28;
k++) {
79 for (
int k = 0;
k < 4;
k++) {
89 for (
int i = 0;
i < 18;
i++) {
90 for (
int j = 0; j < 2; j++) {
91 for (
int k = 0;
k < 28;
k++) {
95 for (
int k = 0;
k < 4;
k++) {
112 std::cout <<
"Using old-style TPG scales!" << std::endl;
137 ecalScale->
setBin(irank, ieta, 1, etGeVPos);
151 ecalScale->
setBin(irank, ieta, -1, etGeVNeg);
161 hcalScale->
setBin(irank, ieta, 1, etGeV);
162 hcalScale->
setBin(irank, ieta, -1, etGeV);
199 for (
unsigned short nCard = 0; nCard <= 6; nCard = nCard + 2) {
210 if (dummyE !=
nullptr)
212 if (dummyH !=
nullptr)
227 int card2 = card + 1;
228 sprintf(filename,
"RC%i%i-%s.dat", card, card2,
keyName_.c_str());
231 sprintf(filename,
"RC6-%s.dat",
keyName_.c_str());
236 lutFile_ <<
"Emulator-parameter generated lut file, card " << card <<
" key " 241 sprintf(command,
"date >> %s", filename);
245 lutFile_.open(filename, std::ios::app);
247 unsigned long data = 0;
253 for (
unsigned short nLUT = 0; nLUT < 8; nLUT++) {
255 unsigned short iAbsEta = 0;
257 iAbsEta = (card / 2) * 8 + nLUT + 1;
260 iAbsEta = (card / 2) * 8 + nLUT + 1;
262 iAbsEta = (card / 2) * 8 + (3 - (nLUT % 4)) + 1;
276 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
278 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
280 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
284 unsigned short etIn9Bits = (output >> 8) & 511;
285 unsigned short tauActivityBit = (output >> 17) & 1;
286 data = (tauActivityBit << 9) + etIn9Bits;
293 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
295 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
297 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
301 unsigned short etIn7Bits = output & 127;
302 unsigned short heFgVetoBit = (output >> 7) & 1;
303 data = (heFgVetoBit << 7) + etIn7Bits;
320 int card2 = card + 1;
321 sprintf(filename,
"EIC%i%i-%s.dat", card, card2,
keyName_.c_str());
323 sprintf(filename,
"EIC6-%s.dat",
keyName_.c_str());
327 lutFile_ <<
"Emulator-parameter generated EIC lut file, card " << card
331 sprintf(command,
"date >> %s", filename);
335 lutFile_.open(filename, std::ios::app);
337 unsigned long data = 0;
343 for (
int etIn7Bits = 0; etIn7Bits < 128; etIn7Bits++) {
358 sprintf(filename,
"JSC-%s.dat",
keyName_.c_str());
366 sprintf(command,
"date >> %s", filename);
369 lutFile_.open(filename, std::ios::app);
371 unsigned long data = 0;
372 unsigned long data0 = 0;
373 unsigned long data1 = 0;
379 for (
int lutbits = 0; lutbits < 4; lutbits++) {
381 for (
unsigned int phi1et = 0; phi1et < 256; phi1et++) {
383 for (
unsigned int phi0et = 0; phi0et < 256; phi0et++) {
397 data = (data1 << 8) + (data0);
418 unsigned int jscThresholdBarrel,
419 unsigned int jscThresholdEndcap) {
421 std::ofstream thresholdsFile;
423 sprintf(filename,
"Thresholds-%s.dat",
keyName_.c_str());
426 thresholdsFile <<
"key is " <<
keyName_ << std::endl << std::endl;
427 thresholdsFile <<
"eicIsolationThreshold " << eicThreshold << std::endl;
428 thresholdsFile <<
"jscQuietThresholdBarrel " << jscThresholdBarrel
430 thresholdsFile <<
"jscQuietThresholdEndcap " << jscThresholdEndcap
433 thresholdsFile.close();
const L1RCTParameters * rctParameters_
L1RCTLutWriter(const edm::ParameterSet &)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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