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++) {
77 m->ecalMask[
i][
j][
k] =
false;
78 m->hcalMask[
i][
j][
k] =
false;
80 for (
int k = 0;
k < 4;
k++) {
81 m->hfMask[
i][
j][
k] =
false;
90 for (
int i = 0;
i < 18;
i++) {
91 for (
int j = 0;
j < 2;
j++) {
92 for (
int k = 0;
k < 28;
k++) {
93 m2->ecalMask[
i][
j][
k] =
false;
94 m2->hcalMask[
i][
j][
k] =
false;
96 for (
int k = 0;
k < 4;
k++) {
97 m2->hfMask[
i][
j][
k] =
false;
101 m2->ecalThreshold = 0.0;
102 m2->hcalThreshold = 0.0;
103 m2->hfThreshold = 0.0;
112 std::cout <<
"Using old-style TPG scales!" << std::endl;
190 for (
unsigned short nCard = 0; nCard <= 6; nCard = nCard + 2) {
201 if (dummyE !=
nullptr)
203 if (dummyH !=
nullptr)
217 int card2 = card + 1;
226 lutFile_ <<
"Emulator-parameter generated lut file, card " << card <<
" key " <<
keyName_ <<
" ";
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;
314 lutFile_ <<
"Emulator-parameter generated EIC lut file, card " << card <<
" key " <<
keyName_ <<
" ";
323 unsigned long data = 0;
329 for (
int etIn7Bits = 0; etIn7Bits < 128; etIn7Bits++) {
348 lutFile_ <<
"Emulator parameter-generated lut file, key " <<
keyName_ <<
" ";
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;
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_
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
const L1RCTParameters * rctParameters_
L1RCTLutWriter(const edm::ParameterSet &)
unsigned short calcTower(unsigned short rct_iphi, unsigned short absIeta) const
unsigned short calcCrate(unsigned short rct_iphi, short ieta) const
void writeRcLutFile(unsigned short card)
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
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
T const * product() 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)
EcalTPGScale::Tokens tokens_
edm::ESGetToken< L1CaloHcalScale, L1CaloHcalScaleRcd > hcalScaleToken_
void setL1CaloEtScale(const L1CaloEtScale *etScale)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::vector< edm::EDGetTokenT< int > > tokens_
unsigned eicIsolationThreshold() const
unsigned jscQuietThresholdBarrel() const
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi) 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)
unsigned jscQuietThresholdEndcap() 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
unsigned int emRank(unsigned short energy) const
void setChannelMask(const L1RCTChannelMask *channelMask)