37#include "GaudiKernel/IIncidentSvc.h"
43#include "CLHEP/Random/RandGaussZiggurat.h"
44#include "CLHEP/Random/Randomize.h"
45#include "CLHEP/Random/RandomEngine.h"
54#include <unordered_map>
61 template <
typename MSG,
typename T>
62 void printVec(
MSG&
msg,
const std::vector<T>& v) {
66 template <
typename MSG,
typename T, std::
size_t N>
67 void printVec(
MSG&
msg,
const std::array<T, N>& v) {
71 constexpr static int ADCMAX = 1023;
72 constexpr static int SATURATIONVALUE = 255;
75 static const xAOD::TriggerTower::Decorator<int> firDecorator(
"fir");
85 m_bstowertool(
"LVL1BS__TrigT1CaloDataAccessV2/TrigT1CaloDataAccessV2", this),
132 for(
unsigned int i = 0; i < 25; i++) {
144 m_sinThetaHash[ (
unsigned int)(32 + (0.5*0.425)*10.) ] = 1.0/cosh(3.2 + 0.5*0.425);
145 m_sinThetaHash[ (
unsigned int)(32 + (1.5*0.425)*10.) ] = 1.0/cosh(3.2 + 1.5*0.425);
146 m_sinThetaHash[ (
unsigned int)(32 + (2.5*0.425)*10.) ] = 1.0/cosh(3.2 + 2.5*0.425);
147 m_sinThetaHash[ (
unsigned int)(32 + (3.5*0.425)*10.) ] = 1.0/cosh(3.2 + 3.5*0.425);
165 return StatusCode::FAILURE;
171 incSvc->addListener(
this,
"BeginRun");
207 return StatusCode::SUCCESS;
214 if(inc.type() !=
"BeginRun")
return;
221 }
catch(
const std::out_of_range&) {
222 ATH_MSG_DEBUG(
"No Legacy triggers in menu, using default scales");
238 throw std::runtime_error(
"Overlay no longer supported in Run2TriggerTowerMaker");
265 if(
detStore()->retrieve(tileInfo,
"TileInfo").isFailure()) {
277 if(
evtStore()->retrieve(evtinfo)!=StatusCode::SUCCESS) {
278 ATH_MSG_WARNING(
"Could not determine if input file is data or simulation. Will assume simulation.");
284 ATH_MSG_INFO(
"Detected data reprocessing. Will take pedestal correction values from input trigger towers.");
293 ATH_MSG_INFO(
"L1Calo overlay job - setting m_isDataReprocessing to false");
301 return StatusCode::SUCCESS;
325 auto*
defaults = pprChanDefaults->pprChanDefaults(0);
327 ATH_MSG_ERROR(
"Could not retrieve channel 0 PprChanDefaults folder. Aborting ...");
328 throw std::runtime_error(
"Run2TriggerTowerMaker: channel 0 of PprChanDefaults not accesible");
351 ATH_MSG_ERROR(
"Unsupported Cell Type!!!!!!");
return StatusCode::FAILURE;
358 const float mu = muDecor(0);
369 return StatusCode::SUCCESS;
375 if (!db)
return false;
376 if (db->errorCode() > 0 || db->noiseCut() > 0)
return true;
382 if (!db)
return false;
383 if (db->disabledBits() > 0)
return true;
391 if (!isDead && !isDisabled)
return true;
400 overlayDataTTs->setStore( &overlayDataTTsAux );
404 std::unordered_map<uint32_t,xAOD::TriggerTower*> overlayMap;
405 typedef std::unordered_map<uint32_t,xAOD::TriggerTower*>::iterator Itr;
408 char decor_ttNotUsedInOverlay = 0;
409 char decor_ttUsedInOverlay = 1;
411 for (
auto tt:*overlayDataTTs) {
414 decor(*tt) = decor_ttNotUsedInOverlay;
415 overlayMap.insert( std::make_pair( tt->coolId() , tt ) );
420 bool findSizeOfPrimaryLUT(
true);
421 unsigned int sizeOfPrimaryLUT(0);
422 uint8_t peakOfPrimary(0);
428 if (findSizeOfPrimaryLUT) {
429 findSizeOfPrimaryLUT =
false;
430 sizeOfPrimaryLUT = tt->lut_cp().size();
431 peakOfPrimary = tt->peak();
435 Itr
match = overlayMap.find( tt->coolId() );
436 if (
match != overlayMap.end()) {
441 decor(*
match->second) = decor_ttUsedInOverlay;
447 for (Itr i=overlayMap.begin();i!=overlayMap.end();++i) {
449 if (decor(*tt) == decor_ttNotUsedInOverlay) {
451 std::vector<uint8_t> overlay_lut_cp(sizeOfPrimaryLUT,0.);
452 std::vector<uint8_t> overlay_lut_jep(sizeOfPrimaryLUT,0.);
455 overlay_lut_cp.at(peakOfPrimary) = tt->cpET();
456 overlay_lut_jep.at(peakOfPrimary) = tt->jepET();
459 tt->setPeak( peakOfPrimary );
460 tt->setLut_cp( overlay_lut_cp );
461 tt->setLut_jep( overlay_lut_jep );
469 return StatusCode::SUCCESS;
480 ATH_MSG_ERROR(
"Cannot find signal DB for tower 0x"<<std::hex<<sigTT->
coolId()<<std::dec<<
" Aborting...");
481 return StatusCode::FAILURE;
485 ATH_MSG_ERROR(
"Cannot find overlay DB for tower 0x"<<std::hex<<ovTT->
coolId()<<std::dec<<
" Aborting...");
486 return StatusCode::FAILURE;
491 std::vector<int> sigDigits( std::begin(sigTT->
adc()) , std::end(sigTT->
adc()) );
492 std::vector<int> ovDigits( std::begin(ovTT->
adc()) , std::end(ovTT->
adc()) );
493 std::vector<int> normOverlayDigits;
497 std::vector<int> sigLutIn,ovLutIn;
502 std::vector<int> lutOut_cp,lutOut_jep;
508 std::size_t peak = lutOut_jep.size()/2;
509 std::vector<uint_least8_t> etResultVectorCp { uint8_t(lutOut_cp[peak]) };
510 std::vector<uint_least8_t> etResultVectorJep { uint8_t(lutOut_jep[peak]) };
512 sigTT->
setLut_cp(std::move(etResultVectorCp));
513 sigTT->
setLut_jep(std::move(etResultVectorJep));
515 return StatusCode::SUCCESS;
521 ATH_MSG_ERROR(
"Cannot process calcLutOutCP as lutCpStrategy > 2");
522 return StatusCode::FAILURE;
526 double sigSlope = sigScale * sigDB->
lutCpSlope();
527 double sigOffset = sigScale * sigDB->
lutCpOffset();
530 double ovSlope = ovScale * ovDB->
lutCpSlope();
534 calcCombinedLUT(sigLutIn,sigSlope,sigOffset,ovLutIn,ovSlope,ovOffset,ovNoiseCut,output);
536 return StatusCode::SUCCESS;
542 ATH_MSG_ERROR(
"Cannot process calcLutOutJEP as lutJepStrategy > 2");
543 return StatusCode::FAILURE;
555 calcCombinedLUT(sigLutIn,sigSlope,sigOffset,ovLutIn,ovSlope,ovOffset,ovNoiseCut,output);
557 return StatusCode::SUCCESS;
561 const std::vector<int>& ovIN,
const int ovSlope,
const int ovOffset,
const int ovNoiseCut,std::vector<int>& output)
571 output.reserve(sigIN.size());
573 for (
unsigned int i=0;i<sigIN.size();++i) {
575 int signal = sigIN[i];
578 int outSig = signal*sigSlope - sigOffset;
579 int outOv =
overlay*ovSlope - ovOffset;
580 int outTmp = outSig + outOv;
583 if (outTmp >= ovNoiseCut) {
584 out = (outSig + outOv + 2048)>>12;
588 if (out < 0) out = 0;
589 if (out > 255) out = 255;
591 output.push_back( out );
600 std::vector<int> fir;
602 {db->firCoeff5(),db->firCoeff4(),db->firCoeff3(),db->firCoeff2(),db->firCoeff1()},
606 int pedCorrectionStrategy = db->lutCpStrategy();
607 std::vector<int16_t> correction;
610 if (pedCorrectionStrategy == 1) {
614 int firPed = (db->firCoeff5() + db->firCoeff4() + db->firCoeff3() +
615 db->firCoeff2() + db->firCoeff1()) * int(db->pedMean() + 0.5);
626 if (pedCorrectionStrategy == 2) {
631 std::size_t offset = (fir.size() - tower->
correction().size())/2;
633 for(std::size_t i = offset, e = fir.size() - offset; i != e; ++i) {
634 correction.push_back(tower->
correction()[i-offset]);
640 m_TTtool->dropBits(fir, db->firStartBit(), output);
642 return StatusCode::SUCCESS;
654 if (sigDigits.size() == ovDigits.size()) {
655 for (
auto x:ovDigits) normDigits.push_back(
x );
659 if (sigDigits.size() > ovDigits.size()) {
660 unsigned int pad = (sigDigits.size() - ovDigits.size()) / 2;
661 for (
unsigned int x=0;
x<pad;++
x) normDigits.push_back( 32 );
662 for (
auto x:ovDigits) normDigits.push_back(
x );
663 for (
unsigned int x=0;
x<pad;++
x) normDigits.push_back( 32 );
668 if (sigDigits.size() < ovDigits.size()) {
669 unsigned int offset = (ovDigits.size() - sigDigits.size()) / 2;
670 for (
unsigned int x=0;
x<sigDigits.size();++
x) {
671 unsigned int pos =
x + offset;
672 normDigits.push_back( ovDigits[pos] );
687 return StatusCode::SUCCESS;
696 ATH_MSG_ERROR(
"Tower with coolId 0x"<<std::hex<<tower->
coolId()<<std::dec<<
" Not in database! Aborting ...");
697 return StatusCode::FAILURE;
701 int pedCorrectionStrategy(0);
712 std::vector<int> digits(std::begin(tower->
adc()), std::end(tower->
adc()));
715 std::vector<int> fir;
722 std::vector<int16_t> correction;
732 if (pedCorrectionStrategy == 1) {
748 if (pedCorrectionStrategy == 2) {
753 std::size_t offset = (fir.size() - tower->
correction().size())/2;
755 for(std::size_t i = offset, e = fir.size() - offset; i != e; ++i) {
756 correction.push_back(tower->
correction()[i-offset]);
760 printVec(this->
msg(MSG::VERBOSE), correction);
766 std::vector<int> lutIn;
770 std::vector<int> lutOut_cp;
789 printVec(this->
msg(MSG::VERBOSE), lutOut_cp);
793 std::vector<int> lutOut_jep;
812 printVec(this->
msg(MSG::VERBOSE), lutOut_jep);
816 std::vector<int> BCIDOut;
828 printVec(this->
msg(MSG::VERBOSE), BCIDOut);
831 std::size_t peak = lutOut_jep.size()/2;
832 std::vector<uint_least8_t> etResultVectorCp { uint8_t(lutOut_cp[peak]) };
834 printVec(this->
msg(MSG::VERBOSE), etResultVectorCp);
835 std::vector<uint_least8_t> etResultVectorJep { uint8_t(lutOut_jep[peak]) };
837 printVec(this->
msg(MSG::VERBOSE), etResultVectorJep);
849 std::array<int, 3> bcidDecision {
853 printVec(this->
msg(MSG::VERBOSE), bcidDecision);
855 std::array<int, 3> satOverride {
859 printVec(this->
msg(MSG::VERBOSE), satOverride);
861 if((bcidDecision[range]) & (0x1 << (BCIDOut[BCIDOut.size()/2]))) {
862 if((satOverride[range]) & 0x1) {
864 etResultVectorCp[0] = SATURATIONVALUE;
865 etResultVectorJep[0] = SATURATIONVALUE;
869 etResultVectorCp[0] = 0;
870 etResultVectorJep[0] = 0;
876 tower->
setLut_cp(std::move(etResultVectorCp));
877 tower->
setLut_jep(std::move(etResultVectorJep));
878 tower->
setBcidVec({uint8_t(BCIDOut[BCIDOut.size()/2])});
880 printVec(this->
msg(MSG::VERBOSE), tower->
bcidVec());
886 tower->
setBcidExt(std::vector<uint8_t>(tower->
adc().size(), 0u));
893 correction[correction.size()/2]));
900 return StatusCode::SUCCESS;
915 return tt->cpET() == 0 && tt->jepET() == 0;
931 return StatusCode::SUCCESS;
942 ATH_MSG_INFO(
"Found " << inputTTs->size() <<
" input TriggerTowers");
957 [
this](
const xAOD::TriggerTower* tt){return !IsGoodTower(tt,m_deadChannelsContainer,m_disabledTowersContainer);}),
960 return StatusCode::SUCCESS;
967 StatusCode sc1 = StatusCode::SUCCESS;
971 sc1 = StatusCode::FAILURE;
974 StatusCode sc2 = StatusCode::SUCCESS;
978 sc2 = StatusCode::FAILURE;
982 StatusCode sc3 = StatusCode::SUCCESS;
986 sc3 = StatusCode::FAILURE;
990 (sc2==StatusCode::FAILURE) ||
991 (sc3==StatusCode::FAILURE))) {
993 <<
"Found Em LArTTL1 : "<<sc1 <<
endmsg
994 <<
"Found Had LArTTL1 : "<<sc2 <<
endmsg
995 <<
"Found TileTTL1 : "<<sc3<<
endmsg
997 return StatusCode::FAILURE;
1001 if(sc1 == StatusCode::SUCCESS) {
1004 if(sc2 == StatusCode::SUCCESS) {
1007 if(sc3 == StatusCode::SUCCESS) {
1019 [
this](
const xAOD::TriggerTower* tt){return !IsGoodTower(tt,m_deadChannelsContainer,m_disabledTowersContainer);}),
1022 return StatusCode::SUCCESS;
1029 for(
const LArTTL1* tower : *towers){
1030 ATH_MSG_VERBOSE(
"Looking at retrieved tower number "<<towerNumber++<<
" ***********");
1036 int layer = int(
m_caloId->sampling(
id) != 0);
1040 int nsamples = tower->nsamples();
1041 std::vector<float> tower_amps = tower->samples();
1053 if(j >= 0 && j < nsamples) {
1054 amps[i] = tower_amps[j];
1064 t->setCoolId(coolId.
id());
1075 for(
const TileTTL1* tower : *towers) {
1076 ATH_MSG_VERBOSE(
"Looking at retrieved tower number "<<towerNumber++<<
" ***********");
1089 unsigned Ieta = unsigned(fabs(tower_eta)*10.0);
1091 ATH_MSG_WARNING(
"TileTTL1 with invalid index for m_sinThetaHash: Ieta = " << Ieta);
1096 int nsamples = tower->nsamples();
1097 std::vector<float> tower_amps = tower->fsamples();
1106 for(
int i = 0; i < 7; i++) {
1108 if(j >= 0 && j < nsamples) {
1122 t->setCoolId(
channelId(tower_eta, tower_phi, 1).
id());
1123 t->setEta(tower_eta);
1124 t->setPhi(tower_phi);
1135 CLHEP::HepRandomEngine* rndmADCs =
m_rndmADCs->getEngine (ctx);
1142 tower->setAdc(std::vector<uint16_t>(std::begin(digits), std::end(digits)));
1143 tower->setAdcPeak(digits.size()/2);
1151 if(!chanCalib) {
ATH_MSG_WARNING(
"No database entry for tower " << channel.id());
return {}; }
1152 double ped = chanCalib->pedMean();
1155 double adcCal = (
m_gainCorr > 0.) ? CLHEP::RandGaussZiggurat::shoot(rndmADCs, 1.,
m_gainCorr) : 1.;
1157 std::vector<int> digits;
1158 const int nSamples = amps.size();
1159 digits.reserve(nSamples);
1160 for(
int i = 0; i < nSamples; ++i) {
1162 double adcNoise = (
m_adcVar > 0.) ? CLHEP::RandGaussZiggurat::shoot(rndmADCs,0.,
m_adcVar) : 0.;
1164 int digit = int((amps[i]*adcCal/
m_adcStep) + ped + adcNoise);
1165 if(digit > ADCMAX) digit = ADCMAX;
1166 if(digit < 0) digit = 0;
1167 digits.push_back(digit);
1174 if(
et < bcidEnergyRangeLow)
return 0;
1175 if(
et < bcidEnergyRangeHigh)
return 1;
1181 int region = l1id->
region(
id);
1182 int ieta = l1id->
eta(
id);
1185 double gran[4] = {0.1, 0.2, 0.1, 0.425};
1186 double offset[4] = {0., 2.5, 3.1, 3.2};
1189 if(region>=0 && region<=3) {
1190 eta =
sign* (((ieta+0.5) * gran[region]) + offset[region]);
1204 double phiMax = l1id->
phi_max(regId);
1205 int iphi = l1id->
phi(
id);
1206 double phi = (iphi+0.5)*2*
M_PI/(phiMax+1);
1217 int crate, module, channel;
1219 int slot =
module + 5;
1220 int pin = channel % 16;
1221 int asic = channel / 16;
1227 constexpr static int NELEMENTS = 33;
1229 float shiftedEta = feta + 4.9;
1231 if(fabs(shiftedEta*10.0 - (
uint)(
eta+1)) < 0.01)
eta++;
1232 if(fabs(shiftedEta) < 0.01)
eta = 0;
1234 constexpr int nBins = 16;
1235 constexpr uint map[nBins] = {2,6,10,14,17,19,21,23,75,77,79,80,83,87,91,95};
1237 if(
eta > 23 &&
eta < 74) {
1240 for(
int i = 0; i < nBins; i++) {
1242 if(i < 8) element = i;
1243 else element = i + 50;
1248 if (layer == 1 && (element == 0 || element == 64)) element = 1;
1249 else if (layer == 1 && (element == 1 || element == 65)) element = 0;
1250 else if (layer == 1 && (element == 2 || element == 62)) element = 3;
1251 else if (layer == 1 && (element == 3 || element == 63)) element = 2;
1252 else if (element > 32) element = 65-element;
1255 element = NELEMENTS-element-1;
1268 double nll_slope = 0.001 * scale;
1269 double nll_offset = 0.001 * par1;
1270 double nll_ampl = 0.001 * par2;
1271 double nll_expo = 0.;
1273 nll_expo = -1. / (4096 * 0.001*par3);
1277 double nll_noise = 0.001 * par4;
1280 if (lutin * slope < offset + nll_noise * noiseCut) {
1285 int output = int((((
int)(2048 + nll_slope * (lutin * slope - offset)))>>12) + nll_offset + nll_ampl * std::exp(nll_expo * (lutin * slope - offset)));
1286 if(output >= 255)
return 255;
1287 if(output < 0)
return 0;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Helper class to provide type-safe access to aux data.
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
TileContainer< TileTTL1 > TileTTL1Container
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
Helper class for offline TT identifiers.
int phi_max(const Identifier regId) const
min value of phi index (-999 == failure)
Identifier region_id(int pos_neg_z, int sampling, int region) const
build a region (of towers) identifier
int region(const Identifier id) const
return region according to :
int pos_neg_z(const Identifier id) const
return pos_neg_z according to :
int eta(const Identifier id) const
return eta according to :
int phi(const Identifier id) const
return phi according to :
Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Conditions/DisabledTowers .
const L1CaloPpmDeadChannels * ppmDeadChannels(unsigned int channelId) const
Folder <-> Object mapping for /TRIGGER/L1Calo/V1/Calibration/PpmDeadChannels .
Folder <-> Object mapping for /TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib .
unsigned short lutJepStrategy() const
unsigned short lutCpSlope() const
unsigned short satBcidLevel() const
unsigned short lutCpScale() const
unsigned short lutJepNoiseCut() const
unsigned short lutJepSlope() const
unsigned short lutCpStrategy() const
unsigned int pedFirSum() const
unsigned short satBcidThreshLow() const
unsigned short firStartBit() const
unsigned short lutCpOffset() const
unsigned short lutJepScale() const
unsigned short bcidEnergyRangeLow() const
unsigned short satBcidThreshHigh() const
unsigned short lutCpNoiseCut() const
unsigned short bcidEnergyRangeHigh() const
unsigned short lutJepOffset() const
Container class for LArTTL1.
Liquid Argon TT L1 sum class.
std::string m_chanCalibKeyoverlay
void processLArTowers(const LArTTL1Container *)
extract amplitudes from TTL1
SG::ReadCondHandleKey< L1CaloPpmDeadChannelsContainer > m_deadChannelsKey
bool m_isDataReprocessing
int EtRange(int et, unsigned short bcidEnergyRangeLow, unsigned short bcidEnergyRangeHigh) const
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_inputTTLocation
L1CaloDisabledTowersContainer * m_disabledTowersContaineroverlay
std::vector< std::vector< double > > m_xaodTowersAmps
SG::ReadHandleKey< TileTTL1Container > m_TileTTL1ContainerName
SG::ReadCondHandleKey< L1CaloPprChanCalibContainer > m_chanCalibKey
ATHRNG::RNGWrapper * m_rndmADCs
L1CaloPpmDeadChannelsContainer * m_deadChannelsContaineroverlay
bool IsGoodTower(const xAOD::TriggerTower *tt, const L1CaloPpmDeadChannelsContainer *dead, const L1CaloDisabledTowersContainer *disabled) const
StatusCode execute(const EventContext &ctx)
Checks that the Cell Type is supported (terminates with errors if not) and calls relevant routine to ...
bool IsDeadChannel(const L1CaloPpmDeadChannels *db) const
Database helper functions for dead and disabled towers.
std::unique_ptr< xAOD::TriggerTowerContainer > m_xaodTowers
SG::WriteHandleKey< xAOD::TriggerTowerContainer > m_outputLocationRerun
ToolHandle< IL1TriggerTowerTool > m_TTtool
void calcCombinedLUT(const std::vector< int > &sigIN, const int sigSlope, const int sigOffset, const std::vector< int > &ovIN, const int ovSlope, const int ovOffset, const int ovNoiseCut, std::vector< int > &output)
int non_linear_lut(int lutin, unsigned short offset, unsigned short slope, unsigned short noiseCut, unsigned short scale, short par1, short par2, short par3, short par4)
bool IsDisabledChannel(const L1CaloDisabledTowers *db) const
double IDphi(const Identifier &id, const CaloLVL1_ID *caloId)
L1CaloPprChanDefaults m_chanDefaults
ToolHandle< IL1CaloMappingTool > m_mappingTool
ServiceHandle< IAthRNGSvc > m_rngSvc
void normaliseDigits(const std::vector< int > &sigDigits, const std::vector< int > &ovDigits, std::vector< int > &normDigits)
normalise the number of ADC digits for overlay
L1CaloPprChanCalibContainer * m_chanCalibContaineroverlay
StatusCode preProcessTower(int bcid, float mu, xAOD::TriggerTower *tower)
int etaToElement(float feta, int layer) const
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
SG::ReadHandleKey< xAOD::EventInfo > m_xaodevtKey
virtual StatusCode addOverlay(int bcid, float mu)
Add overlay data.
const L1CaloPpmDeadChannelsContainer * m_deadChannelsContainer
StatusCode getTriggerTowers()
gets collection of input TriggerTowers for reprocessing
StatusCode getCaloTowers()
fetch Calorimeter Towers
double IDeta(const Identifier &id, const CaloLVL1_ID *caloId)
functions to extract eta, phi coordinates from calo tower identifiers
L1CaloCoolChannelId channelId(double eta, double phi, int layer)
Compute L1CaloCoolChannelId (including support for old geometries).
StatusCode calcLutOutCP(const std::vector< int > &sigLutIn, const L1CaloPprChanCalib *sigDB, const std::vector< int > &ovLutIn, const L1CaloPprChanCalib *ovDB, std::vector< int > &output)
calculate LUT out
Run2TriggerTowerMaker(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< LArTTL1Container > m_EmTTL1ContainerName
ToolHandle< LVL1BS::ITrigT1CaloDataAccessV2 > m_bstowertool
static constexpr unsigned int m_maxIetaBins
static constexpr int s_FIRLENGTH
std::string m_disabledTowersKeyoverlay
const L1CaloPprChanCalibContainer * m_chanCalibContainer
StatusCode preProcessTower_getLutIn(int bcid, float mu, xAOD::TriggerTower *tower, const L1CaloPprChanCalib *db, const std::vector< int > &digits, std::vector< int > &output)
PreProcess up to LUT in.
void digitize(const EventContext &ctx)
Convert analogue pulses to digits.
StatusCode calcLutOutJEP(const std::vector< int > &sigLutIn, const L1CaloPprChanCalib *sigDB, const std::vector< int > &ovLutIn, const L1CaloPprChanCalib *ovDB, std::vector< int > &output)
SG::ReadDecorHandleKey< xAOD::EventInfo > m_actMuKey
SG::ReadHandleKey< LArTTL1Container > m_HadTTL1ContainerName
SG::ReadCondHandleKey< L1CaloDisabledTowersContainer > m_disabledTowersKey
std::unique_ptr< xAOD::TriggerTowerAuxContainer > m_xaodTowersAux
const CaloLVL1_ID * m_caloId
StatusCode preProcess(int bcid, float mu)
Simulate PreProcessing on analogue amplitudes.
static constexpr int s_MEV
std::string m_chanDefaultsKeyoverlay
std::array< double, m_maxIetaBins > m_sinThetaHash
instead of calculating the expression: double theta =2.
std::string m_deadChannelsKeyoverlay
void processTileTowers(const TileTTL1Container *)
StatusCode store()
Stores Trigger Towers in the TES, at a location defined in m_outputLocation.
std::vector< int > ADC(CLHEP::HepRandomEngine *rndmADCs, L1CaloCoolChannelId channel, const std::vector< double > &s) const
Functions to simulate processing of tower signals.
const L1CaloDisabledTowersContainer * m_disabledTowersContainer
SG::ReadCondHandleKey< L1CaloPprChanDefaultsContainer > m_chanDefaultsKey
virtual ~Run2TriggerTowerMaker()
SG::WriteHandleKey< xAOD::TriggerTowerContainer > m_outputLocation
void handle(const Incident &)
Best if initialisation which uses COOL-derived values is done here rather than in initialize().
static const std::string xAODTriggerTowerLocation
static const std::string xAODTriggerTowerRerunLocation
Handle class for reading a decoration on an object.
bool isPresent() const
Is the referenced container present in SG?
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
double TTL1Calib(const Identifier &) const
Returns the factor which converts amplitude in pCb to mV in TTL1.
double TTL1Ped(const Identifier &) const
Returns the pedestal (in mV) for TTL1 adcs.
uint32_t eventTypeBitmask() const
The event type bitmask.
@ IS_SIMULATION
true: simulation, false: data
void setPeak(uint8_t)
set peak
void setBcidVec(const std::vector< uint8_t > &)
set bcidVec
uint32_t coolId() const
Tower identifiers.
void setCorrectionEnabled(const std::vector< uint8_t > &)
set correctionEnabled
void setCorrection(const std::vector< int16_t > &)
set correction
const std::vector< uint8_t > & correctionEnabled() const
get correctionEnabled
void setLut_cp(const std::vector< uint8_t > &)
set lut_cp
virtual double eta() const final
The pseudorapidity ( ) of the particle.
void setBcidExt(const std::vector< uint8_t > &)
set bcidExt
void setLut_jep(const std::vector< uint8_t > &)
set lut_jep
const std::vector< uint16_t > & adc() const
get adc
int layer() const
get layer ( 0 = EM, 1 = Had, 2 = FCAL23) - to be confirmed
const std::vector< int16_t > & correction() const
get correction
const std::vector< uint8_t > & lut_cp() const
get lut_cp
const std::vector< uint8_t > & bcidVec() const
get bcidVec
bool match(std::string s1, std::string s2)
match the individual directories of two strings
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
TriggerTowerAuxContainer_v2 TriggerTowerAuxContainer
Define the latest version of the TriggerTower auxiliary container.
Extra patterns decribing particle interation process.