39 keyName_(iConfig.getParameter<std::
string>(
"key")),
40 useDebugTpgScales_(iConfig.getParameter<bool>(
"useDebugTpgScales"))
78 for (
int i = 0;
i < 18;
i++)
80 for (
int j = 0;
j < 2;
j++)
82 for (
int k = 0;
k < 28;
k++)
87 for (
int k = 0;
k < 4;
k++)
99 for (
int i = 0;
i < 18;
i++)
101 for (
int j = 0;
j < 2;
j++)
103 for (
int k = 0;
k < 28;
k++)
108 for (
int k = 0;
k < 4;
k++)
128 std::cout <<
"Using old-style TPG scales!" << std::endl;
156 ecalScale->
setBin( irank, ieta, 1, etGeVPos ) ;
173 ecalScale->
setBin( irank, ieta, -1, etGeVNeg ) ;
184 hcalScale->
setBin( irank, ieta, 1, etGeV ) ;
185 hcalScale->
setBin( irank, ieta, -1, etGeV ) ;
225 for (
unsigned short nCard = 0; nCard <= 6; nCard = nCard + 2)
237 if (dummyE != 0)
delete dummyE;
238 if (dummyH != 0)
delete dummyH;
261 int card2 = card + 1;
262 sprintf(filename,
"RC%i%i-%s.dat",card,card2,
keyName_.c_str() );
267 sprintf(filename,
"RC6-%s.dat",
keyName_.c_str() );
272 lutFile_ <<
"Emulator-parameter generated lut file, card "
273 << card <<
" key " <<
keyName_ <<
" ";
277 sprintf(command,
"date >> %s", filename);
281 lutFile_.open(filename, std::ios::app);
283 unsigned long data = 0;
289 for (
unsigned short nLUT = 0; nLUT < 8; nLUT++)
292 unsigned short iAbsEta = 0;
295 iAbsEta = (card/2)*8 + nLUT + 1;
301 iAbsEta = (card/2)*8 + nLUT + 1;
305 iAbsEta = (card/2)*8 + (3 - (nLUT%4) ) + 1;
319 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++)
322 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++)
325 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++)
329 lookup(ecalEt, hcalEt, ecalfg, crate, card, tower);
330 unsigned short etIn9Bits = (output>>8)&511;
331 unsigned short tauActivityBit = (output>>17)&1;
332 data = (tauActivityBit<<9)+etIn9Bits;
333 lutFile_ << std::hex << data << std::dec << std::endl;
339 for (
unsigned int hcalEt = 0; hcalEt < 256; hcalEt++)
342 for (
unsigned short ecalfg = 0; ecalfg < 2; ecalfg++)
345 for (
unsigned int ecalEt = 0; ecalEt < 256; ecalEt++)
349 lookup(ecalEt, hcalEt, ecalfg, crate, card, tower);
350 unsigned short etIn7Bits = output&127;
351 unsigned short heFgVetoBit = (output>>7)&1;
352 data = (heFgVetoBit<<7)+etIn7Bits;
353 lutFile_ << std::hex << data << std::dec << std::endl;
373 int card2 = card + 1;
374 sprintf(filename,
"EIC%i%i-%s.dat", card, card2,
keyName_.c_str() );
378 sprintf(filename,
"EIC6-%s.dat",
keyName_.c_str() );
382 lutFile_ <<
"Emulator-parameter generated EIC lut file, card "
383 << card <<
" key " <<
keyName_ <<
" ";
386 sprintf(command,
"date >> %s", filename);
390 lutFile_.open(filename, std::ios::app);
392 unsigned long data = 0;
398 for (
int etIn7Bits = 0; etIn7Bits < 128; etIn7Bits++)
405 lutFile_ << std::hex << data << std::dec << std::endl;
417 sprintf(filename,
"JSC-%s.dat",
keyName_.c_str() );
425 sprintf(command,
"date >> %s", filename);
428 lutFile_.open(filename, std::ios::app);
430 unsigned long data = 0;
431 unsigned long data0 = 0;
432 unsigned long data1 = 0;
438 for (
int lutbits = 0; lutbits < 4; lutbits++)
441 for (
unsigned int phi1et = 0; phi1et < 256; phi1et++)
444 for (
unsigned int phi0et = 0; phi0et < 256; phi0et++)
461 data = (data1<<8) + (data0);
462 lutFile_ << std::hex << data << std::dec << std::endl;
483 unsigned int jscThresholdBarrel,
484 unsigned int jscThresholdEndcap)
487 std::ofstream thresholdsFile;
489 sprintf(filename,
"Thresholds-%s.dat",
keyName_.c_str() );
492 thresholdsFile <<
"key is " <<
keyName_ << std::endl << std::endl;
493 thresholdsFile <<
"eicIsolationThreshold " << eicThreshold << std::endl;
494 thresholdsFile <<
"jscQuietThresholdBarrel " << jscThresholdBarrel << std::endl;
495 thresholdsFile <<
"jscQuietThresholdEndcap " << jscThresholdEndcap << std::endl;
497 thresholdsFile.close();
const L1RCTParameters * rctParameters_
L1RCTLutWriter(const edm::ParameterSet &)
void setEventSetup(const edm::EventSetup &evtSetup)
void writeRcLutFile(unsigned short card)
unsigned eicIsolationThreshold() const
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)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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)
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
virtual double hcaletValue(const int &ieta, const int &compET) const =0