From d7b4117f88b9e79274f04111dbf9f729d67596d4 Mon Sep 17 00:00:00 2001 From: Joao Gentil Mendes Saraiva <joao.gentil.saraiva@cern.ch> Date: Mon, 26 Oct 2020 10:27:16 +0000 Subject: [PATCH] Including TMDB container filling for RUN3 In RUN3 the TMDB container filling will use a single threshold for cell D5, D6 and D5+D6 and code extended for this end. RUN2 container filling is still in place and interchangeable from Athena job options for tile cabling. --- .../TileSimAlgs/TileMuonReceiverDecision.h | 19 +- .../share/TileMuonReceiver_jobOptions.py | 21 ++- .../src/TileMuonReceiverDecision.cxx | 178 +++++++++++------- 3 files changed, 136 insertions(+), 82 deletions(-) diff --git a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h index f3fac3668a1..64baf270f8a 100644 --- a/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h +++ b/TileCalorimeter/TileSimAlgs/TileSimAlgs/TileMuonReceiverDecision.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -13,10 +13,13 @@ // // Properties (JobOption Parameters): // -// MuonReceiverEneThreshCellD6Low "Setting the lowest trigger threshold for cell D6 in MeV (Def=500 MeV)" -// MuonReceiverEneThreshCellD6andD5Low "Setting the lowest trigger threshold for cell D5+D6 in MeV (Def=500 MeV)" -// MuonReceiverEneThreshCellD6High "Setting the highest trigger threshold for cell D6 in MeV (Def=600 MeV)" -// MuonReceiverEneThreshCellD6andD5High "Setting the highest trigger threshold for cell D5+D6 in MeV (Def=600 MeV)" +// MuonReceiverEneThreshCellD6Low "(RUN2) Setting the lowest trigger threshold for cell D6 in MeV (Def=500 MeV)" +// MuonReceiverEneThreshCellD6andD5Low "(RUN2) Setting the lowest trigger threshold for cell D5+D6 in MeV (Def=500 MeV)" +// MuonReceiverEneThreshCellD6High "(RUN2) Setting the highest trigger threshold for cell D6 in MeV (Def=600 MeV)" +// MuonReceiverEneThreshCellD6andD5High "(RUN2) Setting the highest trigger threshold for cell D5+D6 in MeV (Def=600 MeV)" +// MuonReceiverEneThreshCellD5 "(RUN3) Setting the single trigger threshold for cell D5 in MeV (Def=500 MeV)" +// MuonReceiverEneThreshCellD6 "(RUN3) Setting the single trigger threshold for cell D6 in MeV (Def=500 MeV)" +// MuonReceiverEneThreshCellD5andD6 "(RUN3) Setting the single trigger threshold for cell d5+D6 in MeV (Def=500 MeV)" // SelectionCutForMatchedFilterQf "Selection cut for the quality factor of the matched filters (NOT implemented)" // TileMuonReceiverContainer "Tile Calorimeter decision to TGC Sector Logic" // @@ -88,6 +91,9 @@ class TileMuonReceiverDecision: public AthAlgorithm { float m_threshold_d6_hi; float m_threshold_d5d6_lo; float m_threshold_d5d6_hi; + float m_threshold_d5; + float m_threshold_d6; + float m_threshold_d5d6; float m_selCutQf; ToolHandle<TileCondToolEmscale> m_tileToolEmscale{this, @@ -98,9 +104,8 @@ class TileMuonReceiverDecision: public AthAlgorithm { */ ServiceHandle<TileCablingSvc> m_cablingSvc{ this, "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"}; + int m_runPeriod; - - bool m_run2; }; #endif diff --git a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py index 74e380ace93..62e4852da07 100644 --- a/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py +++ b/TileCalorimeter/TileSimAlgs/share/TileMuonReceiver_jobOptions.py @@ -47,7 +47,6 @@ topSequence = AlgSequence() # Set up TilePulseForTileMuonReceiver from TileConditions.TileConditionsConf import TileCondToolNoiseSample topSequence += CfgMgr.TilePulseForTileMuonReceiver('TilePulseForTileMuonReceiver' -# , OutputLevel = VERBOSE , IntegerDigits = not jobproperties.Digitization.PileUpPremixing() , UseCoolPedestal = False , UseCoolPulseShapes = True @@ -58,12 +57,22 @@ if jobproperties.Digitization.PileUpPremixing and 'OverlayMT' in jobproperties.D from OverlayCommonAlgs.OverlayFlags import overlayFlags topSequence.TilePulseForTileMuonReceiver.MuonReceiverDigitsContainer = overlayFlags.bkgPrefix() + "MuRcvDigitsCnt" +# +# Thresholds +# + topSequence += CfgMgr.TileMuonReceiverDecision('TileMuonReceiverDecision' -# , OutputLevel = VERBOSE - , MuonReceiverEneThreshCellD6Low = 500 - , MuonReceiverEneThreshCellD6andD5Low = 500 - , MuonReceiverEneThreshCellD6High = 600 - , MuonReceiverEneThreshCellD6andD5High = 600) +# run 2 thresholds + , MuonReceiverEneThreshCellD6Low = 500 + , MuonReceiverEneThreshCellD6andD5Low = 500 + , MuonReceiverEneThreshCellD6High = 600 + , MuonReceiverEneThreshCellD6andD5High = 600 +# run 3 thresholds + , MuonReceiverEneThreshCellD5 = 500 + , MuonReceiverEneThreshCellD6 = 500 + , MuonReceiverEneThreshCellD5andD6 = 500) + + if jobproperties.Digitization.PileUpPremixing and 'OverlayMT' in jobproperties.Digitization.experimentalDigi(): from OverlayCommonAlgs.OverlayFlags import overlayFlags topSequence.TileMuonReceiverDecision.TileMuonReceiverContainer = overlayFlags.bkgPrefix() + "TileMuRcvCnt" diff --git a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx index d9aa54b142f..61b69fc66f7 100644 --- a/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx +++ b/TileCalorimeter/TileSimAlgs/src/TileMuonReceiverDecision.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //**************************************************************************** @@ -43,15 +43,18 @@ TileMuonReceiverDecision::TileMuonReceiverDecision(std::string name, ISvcLocator m_tileHWID(nullptr), m_cablingService(nullptr), m_tileInfo(nullptr), - m_run2(true) + m_runPeriod(0) { // declare properties... - declareProperty( "MuonReceiverEneThreshCellD6Low" , m_threshold_d6_lo = 500. , "Setting the lowest trigger threshold for cell D6 in MeV (Def=500 MeV)"); - declareProperty( "MuonReceiverEneThreshCellD6andD5Low" , m_threshold_d5d6_lo = 500. , "Setting the lowest trigger threshold for cell D5+D6 in MeV (Def=500 MeV)"); - declareProperty( "MuonReceiverEneThreshCellD6High" , m_threshold_d6_hi = 600. , "Setting the highest trigger threshold for cell D6 in MeV (Def=600 MeV)"); - declareProperty( "MuonReceiverEneThreshCellD6andD5High" , m_threshold_d5d6_hi = 600. , "Setting the highest trigger threshold for cell D5+D6 in MeV (Def=600 MeV)"); - declareProperty( "SelectionCutForMatchedFilterQf" , m_selCutQf=0. , "Selection cut for the quality factor of the matched filters"); - declareProperty( "TileInfoName" , m_infoName = "TileInfo" ); + declareProperty( "MuonReceiverEneThreshCellD6Low" , m_threshold_d6_lo = 500. , "(RUN2) Setting the lowest trigger threshold for cell D6 in MeV (Def=500 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD6andD5Low" , m_threshold_d5d6_lo = 500. , "(RUN2) Setting the lowest trigger threshold for cell D5+D6 in MeV (Def=500 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD6High" , m_threshold_d6_hi = 600. , "(RUN2) Setting the highest trigger threshold for cell D6 in MeV (Def=600 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD6andD5High" , m_threshold_d5d6_hi = 600. , "(RUN2) Setting the highest trigger threshold for cell D5+D6 in MeV (Def=600 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD5" , m_threshold_d5 = 500. , "(RUN3) Setting the single threshold for cell D5 during Run 3 in MeV (Def=500 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD6" , m_threshold_d6 = 500. , "(RUN3) Setting the single threshold for cell D6 during Run 3 in MeV (Def=500 MeV)"); + declareProperty( "MuonReceiverEneThreshCellD5andD6" , m_threshold_d5d6 = 500. , "(RUN3) Setting the single threshold for cell D5+D6 during Run 3 in MeV (Def=500 MeV)"); + declareProperty( "SelectionCutForMatchedFilterQf" , m_selCutQf = 0. , "n cut for the quality factor of the matched filters"); + declareProperty( "TileInfoName" , m_infoName = "TileInfo" ); } TileMuonReceiverDecision::~TileMuonReceiverDecision() @@ -62,10 +65,10 @@ StatusCode TileMuonReceiverDecision::initialize() { ATH_CHECK( m_cablingSvc.retrieve() ); m_cablingService = m_cablingSvc->cablingService(); + m_runPeriod = m_cablingService->runPeriod(); - if (! m_cablingService->isRun2Cabling() ) { - ATH_MSG_INFO("TileMuonReceiverDecision should not be used for RUN1 simulations"); - m_run2 = false; + if (m_runPeriod == 0) { + ATH_MSG_INFO("Stopping ... TileMuonReceiverDecision should not be used for RUN1 simulations"); return StatusCode::SUCCESS; } else { ATH_MSG_INFO("Initializing TileMuonReceiverDecision"); @@ -78,22 +81,38 @@ StatusCode TileMuonReceiverDecision::initialize() { CHECK(m_tileToolEmscale.retrieve()); - ATH_CHECK( m_rawChannelContainerKey.initialize(m_run2)); - ATH_CHECK( m_muonReceiverContainerKey.initialize(m_run2)); + ATH_CHECK( m_rawChannelContainerKey.initialize(true)); + ATH_CHECK( m_muonReceiverContainerKey.initialize(true)); ATH_MSG_INFO("TileMuonReceiverDecision initialization completed" ); return StatusCode::SUCCESS; } StatusCode TileMuonReceiverDecision::execute() { - - if (m_run2) { - ATH_MSG_VERBOSE( "ATT: RUN2 settings TileMuonReceiverDecsionTool will run now" ); - ATH_MSG_DEBUG( "Executing TileMuonReceiverDecision" ); - } else { + + std::vector<float> thresholds; + + if ( m_runPeriod == 0 ) { ATH_MSG_VERBOSE( "ATT: RUN1 settings TileMuonReceiverDecision will end now" ); return StatusCode::SUCCESS; } + if ( m_runPeriod == 2 ) { + ATH_MSG_VERBOSE( "ATT: RUN2 settings TileMuonReceiverDecsionTool will run now" ); + ATH_MSG_DEBUG( "Executing TileMuonReceiverDecision" ); + + thresholds.push_back(m_threshold_d5d6_hi); + thresholds.push_back(m_threshold_d5d6_lo); + thresholds.push_back(m_threshold_d6_hi); + thresholds.push_back(m_threshold_d6_lo); + } + if ( m_runPeriod == 3 ) { + ATH_MSG_VERBOSE( "ATT: RUN3 settings TileMuonReceiverDecsionTool will run now" ); + ATH_MSG_DEBUG( "Executing TileMuonReceiverDecision" ); + + thresholds.push_back(m_threshold_d5); + thresholds.push_back(m_threshold_d6); + thresholds.push_back(m_threshold_d5d6); + } // Get the container with the matched filter reconstructed raw channels in MeV // @@ -105,12 +124,6 @@ StatusCode TileMuonReceiverDecision::execute() { std::vector<bool> tile2SL(4,false); std::vector<float> ene(2,0.0); std::vector<float> time(2,0.0); - std::vector<float> thresholds; - - thresholds.push_back(m_threshold_d5d6_hi); - thresholds.push_back(m_threshold_d5d6_lo); - thresholds.push_back(m_threshold_d6_hi); - thresholds.push_back(m_threshold_d6_lo); // Create the container to store the decision from the algorithm // @@ -141,28 +154,31 @@ StatusCode TileMuonReceiverDecision::execute() { if (rawChannelCollection->empty()) continue; - int frag_id = rawChannelCollection->identify(); - int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(frag_id); - int ros = frag_id>>8; - bool eb_ros = ((ros == TileHWID::EXTBAR_POS) || (ros == TileHWID::EXTBAR_NEG)); - int upperLim = (eb_ros) ? nEBchan : nLBchan; - - if (msgLvl(MSG::VERBOSE)) { - int drawer = (frag_id&0xFF); - memset(energy_HLX,0,sizeof(energy_HLX)); - memset(time_HLX,0,sizeof(time_HLX)); - ATH_MSG_VERBOSE( "(E.0.0) Frag_id: 0x"<< MSG::hex << frag_id << MSG::dec <<" ros: "<< ros <<" drawer: "<< drawer ); - } - + float energy_d5 = 0.0; float energy_d6 = 0.0; float energy_d5d6 = 0.0; + float time_d5 = 0.0; float time_d6 = 0.0; float time_d5d6 = 0.0; - + int ich = 0; + int jch5 = 0; int jch6 = 0; int jch56 = 0; + int frag_id = rawChannelCollection->identify(); + int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(frag_id); + int ros = frag_id>>8; + bool eb_ros = ((ros == TileHWID::EXTBAR_POS) || (ros == TileHWID::EXTBAR_NEG)); + int upperLim = (eb_ros) ? nEBchan : nLBchan; + + if (msgLvl(MSG::VERBOSE)) { + int drawer = (frag_id&0xFF); + memset(energy_HLX,0,sizeof(energy_HLX)); + memset(time_HLX,0,sizeof(time_HLX)); + ATH_MSG_VERBOSE( "(E.0.0) Frag_id: 0x"<< MSG::hex << frag_id << MSG::dec <<" ros: "<< ros <<" drawer: "<< drawer ); + } + for (const TileRawChannel* rawChannel : *rawChannelCollection) { ++ich; @@ -199,6 +215,12 @@ StatusCode TileMuonReceiverDecision::execute() { time_d6 += time; ++jch6; } + if ( TMDBchan==0 || TMDBchan==1 ) { /* choose d5 cell */ + energy_d5 += energy; + time_d5 += time; + ++jch5; + } + } if (msgLvl(MSG::VERBOSE)) { energy_HLX[EBIdCell[TMDBchan]] += energy; @@ -213,7 +235,7 @@ StatusCode TileMuonReceiverDecision::execute() { } if (msgLvl(MSG::VERBOSE)) { - ATH_MSG_VERBOSE( "(X.0.0) Summary of the exteded results for HL-LHC: " ); + ATH_MSG_VERBOSE( "(X.0.0) Summary of the extended results for HL-LHC: " ); if ( eb_ros ) { ATH_MSG_VERBOSE( "(X.1.0) Energy D-5 "<<energy_HLX[0]<<" D-6 "<<energy_HLX[1]<<" D-4 "<<energy_HLX[2] ); ATH_MSG_VERBOSE( "(X.2.0) Time D-5 "<<time_HLX[0]/2.<<" D-6 "<<time_HLX[1]/2.<<" D-4 "<<time_HLX[2]/2. ); @@ -222,64 +244,82 @@ StatusCode TileMuonReceiverDecision::execute() { ATH_MSG_VERBOSE( "(X.2.0) Time D-0 "<<time_HLX[0]<<" D-1 "<<time_HLX[1]/2.<<" D-2 "<<time_HLX[2]/2.<<" D-3 "<<time_HLX[3]/2.<<" BC-8 "<<time_HLX[4]/2. ); } } - - if (jch56 == 0) { // neigher D5 nor D6 found - nothing to do + + if (jch56 == 0) { // neither D5 nor D6 found - nothing to do ATH_MSG_VERBOSE( "== NO trigger for this drawer " ); continue; } - + if (jch56>1) { time_d5d6 /= jch56; if (jch6>1) time_d6 /= jch6; + if (jch5>1) time_d5 /= jch5; } - - // A. Above threshold (hi and lo) d5+d6 + + // A. Above threshold(s) + // run2 dual (hi and lo) d5+d6 + // run3 single d5+d6 // bool pass_d5d6_hi = (energy_d5d6>m_threshold_d5d6_hi); bool pass_d5d6_lo = (energy_d5d6>m_threshold_d5d6_lo); - - // (hi and lo) d6 - // + bool pass_d5d6 = (energy_d5d6>m_threshold_d5d6); + // run2 dual (hi and lo) d6 + // run3 single d5 and d6 bool pass_d6_hi = (energy_d6>m_threshold_d6_hi); bool pass_d6_lo = (energy_d6>m_threshold_d6_lo); - - // B. Fill a vector with size 4 reproducing the 4-bit word with the structure HLHL:[d5+d6][d6] - // vector at 0 (d56hi) is the most significant digit in the 4 bits output - // vector at 3 (d6lo) is the least significant digit in the 4 bits output + bool pass_d5 = (energy_d5>m_threshold_d5); + bool pass_d6 = (energy_d6>m_threshold_d6); + + // B. + // (RUN2) Fill a vector with size 4 reproducing the 4-bit word with the structure HLHL:[d5+d6][d6][d5+d6][d6] + // vector at 0 (d56hi) is the most significant digit in the 4 bits output + // (...) + // vector at 3 (d6lo) is the least significant digit in the 4 bits output + // (RUN3) Fill a vector with size 4 reproducing the 4-bit word with the structure 0HHH:0[d5+d6][d6][d5] + // vector at 0 set to 0 + // vector at 1 [d5+d6] result + // vector at 2 [d6] result + // vector at 3 [d5] result + + // query for RUN2; if false it must be RUN3 // - tile2SL[0] = pass_d5d6_hi; - tile2SL[1] = (!pass_d5d6_hi && pass_d5d6_lo); - tile2SL[2] = pass_d6_hi; - tile2SL[3] = (!pass_d6_hi && pass_d6_lo); + if ( m_runPeriod == 2 ) tile2SL = { pass_d5d6_hi, (!pass_d5d6_hi && pass_d5d6_lo), pass_d6_hi, !pass_d6_hi && pass_d6_lo}; + if ( m_runPeriod == 3 ) tile2SL = { 0, pass_d5d6, pass_d6, pass_d5}; + + // tile2SL[0] = m_run2? pass_d5d6_hi : 0; + // tile2SL[1] = m_run2? (!pass_d5d6_hi && pass_d5d6_lo) : pass_d5d6; + // tile2SL[2] = m_run2? (pass_d6_hi) : pass_d6; + // tile2SL[3] = m_run2? (!pass_d6_hi && pass_d6_lo) : pass_d5; if (msgLvl(MSG::VERBOSE)) { - ATH_MSG_VERBOSE( "(E.2.0) Summary: e(d5+d6)= " << energy_d5d6 << " e(d6)= " << energy_d6 ); - ATH_MSG_VERBOSE( "(E.3.0) Thresholds: " << m_threshold_d5d6_lo << " " << m_threshold_d5d6_hi << " " << m_threshold_d6_lo << " " << m_threshold_d6_hi ); - ATH_MSG_VERBOSE( "(E.4.0) Checking which tresholds have been passed: d56 high " << pass_d5d6_hi << " d56 low " << pass_d5d6_lo << " d6 high " << pass_d6_hi << " d6 low " << pass_d6_lo ); - ATH_MSG_VERBOSE( "(E.5.0) Output to SL: " << tile2SL[0] << tile2SL[1] << tile2SL[2] << tile2SL[3] ); + if ( m_runPeriod == 2 ) { + ATH_MSG_VERBOSE( "(E.2.0) Summary: e(d5+d6)= " << energy_d5d6 << " e(d6)= " << energy_d6 ); + ATH_MSG_VERBOSE( "(E.3.0) Thresholds: " << m_threshold_d5d6_lo << " " << m_threshold_d5d6_hi << " " << m_threshold_d6_lo << " " << m_threshold_d6_hi ); + ATH_MSG_VERBOSE( "(E.4.0) Check which thresholds were passed: d56 high " << pass_d5d6_hi << " d56 low " << pass_d5d6_lo << " d6 high " << pass_d6_hi << " d6 low " << pass_d6_lo ); + ATH_MSG_VERBOSE( "(E.5.0) Output to SL: " << tile2SL[0] << tile2SL[1] << tile2SL[2] << tile2SL[3] ); + } + if ( m_runPeriod == 3 ) { + ATH_MSG_VERBOSE( "(E.2.0) Summary: e(d5+d6)= " << energy_d5d6 << " e(d6)= " << energy_d6 << " e(d5)= " << energy_d5 ); + ATH_MSG_VERBOSE( "(E.3.0) Thresholds: " << m_threshold_d5d6 << " " << m_threshold_d6 << " " << m_threshold_d5 ); + ATH_MSG_VERBOSE( "(E.4.0) Check which thresholds were passed: d56 " << pass_d5d6 << " d6 " << pass_d6 << " d5 " << pass_d5 ); + ATH_MSG_VERBOSE( "(E.5.0) Output to SL: " << tile2SL[0] << tile2SL[1] << tile2SL[2] << tile2SL[3] ); + } } - if (tile2SL[0] || tile2SL[1] || tile2SL[2] || tile2SL[3]) { - - ene[0] = energy_d5d6; - ene[1] = energy_d6; - time[0] = time_d5d6; - time[1] = time_d6; - + ene[0] = energy_d5d6; ene[1] = energy_d6; + time[0] = time_d5d6 ; time[1] = time_d6; std::unique_ptr<TileMuonReceiverObj> tileMuRcvObj = std::make_unique<TileMuonReceiverObj>(frag_id,ene,time,tile2SL); decisionContainer->push_back(tileMuRcvObj.release()); - } else { ATH_MSG_VERBOSE( "== NULL trigger not include in container " ); } - } + } // end loop over collection if (msgLvl(MSG::DEBUG)) { ATH_MSG_DEBUG( "== Print TileD decision container output to SL" ); decisionContainer->print(); } - ATH_MSG_DEBUG("TileMuonReceiverDecision execution completed" ); return StatusCode::SUCCESS; } -- GitLab