39 keyName_(iConfig.getParameter<std::
string>(
"key")),
45 useDebugTpgScales_(iConfig.getParameter<bool>(
"useDebugTpgScales")),
74 for (
int i = 0;
i < 18;
i++) {
75 for (
int j = 0;
j < 2;
j++) {
76 for (
int k = 0;
k < 28;
k++) {
80 for (
int k = 0;
k < 4;
k++) {
90 for (
int i = 0;
i < 18;
i++) {
91 for (
int j = 0;
j < 2;
j++) {
92 for (
int k = 0;
k < 28;
k++) {
96 for (
int k = 0;
k < 4;
k++) {
112 std::cout <<
"Using old-style TPG scales!" << std::endl;
135 ecalScale->
setBin(irank, ieta, 1, etGeVPos);
148 ecalScale->
setBin(irank, ieta, -1, etGeVNeg);
157 hcalScale->
setBin(irank, ieta, 1, etGeV);
158 hcalScale->
setBin(irank, ieta, -1, etGeV);
190 for (
unsigned short nCard = 0; nCard <= 6; nCard = nCard + 2) {
201 if (dummyE !=
nullptr)
203 if (dummyH !=
nullptr)
217 int card2 = card + 1;
218 sprintf(filename,
"RC%i%i-%s.dat", card, card2,
keyName_.c_str());
221 sprintf(filename,
"RC6-%s.dat",
keyName_.c_str());
226 lutFile_ <<
"Emulator-parameter generated lut file, card " << card <<
" key " <<
keyName_ <<
" ";
230 sprintf(command,
"date >> %s", filename);
234 lutFile_.open(filename, std::ios::app);
236 unsigned long data = 0;
242 for (
unsigned short nLUT = 0; nLUT < 8; nLUT++) {
244 unsigned short iAbsEta = 0;
246 iAbsEta = (card / 2) * 8 + nLUT + 1;
249 iAbsEta = (card / 2) * 8 + nLUT + 1;
251 iAbsEta = (card / 2) * 8 + (3 - (nLUT % 4)) + 1;
265 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
267 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
269 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
272 unsigned short etIn9Bits = (output >> 8) & 511;
273 unsigned short tauActivityBit = (output >> 17) & 1;
274 data = (tauActivityBit << 9) + etIn9Bits;
281 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++) {
283 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++) {
285 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++) {
288 unsigned short etIn7Bits = output & 127;
289 unsigned short heFgVetoBit = (output >> 7) & 1;
290 data = (heFgVetoBit << 7) + etIn7Bits;
307 int card2 = card + 1;
308 sprintf(filename,
"EIC%i%i-%s.dat", card, card2,
keyName_.c_str());
310 sprintf(filename,
"EIC6-%s.dat",
keyName_.c_str());
314 lutFile_ <<
"Emulator-parameter generated EIC lut file, card " << card <<
" key " <<
keyName_ <<
" ";
317 sprintf(command,
"date >> %s", filename);
321 lutFile_.open(filename, std::ios::app);
323 unsigned long data = 0;
329 for (
int etIn7Bits = 0; etIn7Bits < 128; etIn7Bits++) {
344 sprintf(filename,
"JSC-%s.dat",
keyName_.c_str());
348 lutFile_ <<
"Emulator parameter-generated lut file, key " <<
keyName_ <<
" ";
351 sprintf(command,
"date >> %s", filename);
354 lutFile_.open(filename, std::ios::app);
356 unsigned long data = 0;
357 unsigned long data0 = 0;
358 unsigned long data1 = 0;
364 for (
int lutbits = 0; lutbits < 4; lutbits++) {
366 for (
unsigned int phi1et = 0; phi1et < 256; phi1et++) {
368 for (
unsigned int phi0et = 0; phi0et < 256; phi0et++) {
382 data = (data1 << 8) + (data0);
403 unsigned int jscThresholdBarrel,
404 unsigned int jscThresholdEndcap) {
406 std::ofstream thresholdsFile;
408 sprintf(filename,
"Thresholds-%s.dat",
keyName_.c_str());
411 thresholdsFile <<
"key is " <<
keyName_ << std::endl << std::endl;
412 thresholdsFile <<
"eicIsolationThreshold " << eicThreshold << std::endl;
413 thresholdsFile <<
"jscQuietThresholdBarrel " << jscThresholdBarrel << std::endl;
414 thresholdsFile <<
"jscQuietThresholdEndcap " << jscThresholdEndcap << std::endl;
416 thresholdsFile.close();
edm::ESGetToken< L1RCTParameters, L1RCTParametersRcd > rctParametersToken_
const L1RCTParameters * rctParameters_
L1RCTLutWriter(const edm::ParameterSet &)
void writeRcLutFile(unsigned short card)
unsigned eicIsolationThreshold() const
edm::ESGetToken< L1CaloEcalScale, L1CaloEcalScaleRcd > ecalScaleToken_
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
unsigned jscQuietThresholdEndcap() const
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
unsigned short calcTower(unsigned short rct_iphi, unsigned short absIeta) const
void setHcalScale(const L1CaloHcalScale *hcalScale)
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > transcoderToken_
static const unsigned short nBinRank
void writeThresholdsFile(unsigned int eicThreshold, unsigned int jscThresholdBarrel, unsigned int jscThresholdEndcap)
unsigned int emRank(unsigned short energy) const
EcalTPGScale::Tokens tokens_
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_
void setL1CaloEtScale(const L1CaloEtScale *etScale)
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) const
std::vector< edm::EDGetTokenT< int > > tokens_
T const * product() const
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
void writeEicLutFile(unsigned short card)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
~L1RCTLutWriter() override
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
virtual double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const =0
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