diff --git a/Detector/Calo/include/Detector/Calo/CellParam.h b/Detector/Calo/include/Detector/Calo/CellParam.h index 7f13b5b26bdc6062a9cd96c628b7e21f657200c2..d73adeb47cd0e36eb95fcb82f4f49aeeb16f805a 100644 --- a/Detector/Calo/include/Detector/Calo/CellParam.h +++ b/Detector/Calo/include/Detector/Calo/CellParam.h @@ -82,6 +82,7 @@ namespace LHCb::Detector::Calo { double pileUpOffsetSPD() const { return m_offsetSPD; } double pileUpOffsetRMS() const { return m_eoffset; } double pileUpOffsetSPDRMS() const { return m_eoffsetSPD; } + double Gamma() const { return m_gamma; } const std::vector& pins() const { return m_pins; } const std::vector& leds() const { return m_leds; } @@ -142,6 +143,7 @@ namespace LHCb::Detector::Calo { m_offsetSPD = off; m_eoffsetSPD = eoff; } + void setGamma( double gamma ) { m_gamma = gamma; } std::string cellStatus() { if ( (CellQuality::Flag)m_quality == CellQuality::OK ) return CellQuality::qName( CellQuality::OK ); @@ -188,6 +190,7 @@ namespace LHCb::Detector::Calo { double m_eoffset{ 0.0 }; double m_offsetSPD{ 0.0 }; double m_eoffsetSPD{ 0.0 }; + double m_gamma{ 0.0 }; }; } // namespace LHCb::Detector::Calo diff --git a/Detector/Calo/include/Detector/Calo/DeCalorimeter.h b/Detector/Calo/include/Detector/Calo/DeCalorimeter.h index 2c5bfb5b75244c9a2485f3c1bf5860f06226101c..9700914fa749bc7ff4d2ef9bd764d9ae0c53894e 100644 --- a/Detector/Calo/include/Detector/Calo/DeCalorimeter.h +++ b/Detector/Calo/include/Detector/Calo/DeCalorimeter.h @@ -240,6 +240,7 @@ namespace LHCb::Detector::Calo { double gainError() const { return this->access()->gainError; } double getCalibration( const CellID& ID ) const { return this->access()->cells[ID].calibration(); } + double getGamma( const CellID& ID ) const { return this->access()->cells[ID].Gamma(); } // for simulation only int zSupMethod() const { return this->access()->zSupMethod; } diff --git a/Detector/Calo/src/DeCalorimeter.cpp b/Detector/Calo/src/DeCalorimeter.cpp index d48128bbed35df8cb5148281d20564f6a6be325b..6b015f070aa259359a2993b19d78e98f5195a74e 100644 --- a/Detector/Calo/src/DeCalorimeter.cpp +++ b/Detector/Calo/src/DeCalorimeter.cpp @@ -683,6 +683,41 @@ detail::DeCaloObject::DeCaloObject( dd4hep::DetElement const& de, dd4hep::cond:: dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Pileup offset added for %d channel(s)", countPU ); } + //---------------------------------------------- + // ** Gamma for ECAL energy + //---------------------------------------------- + if ( isEcal ) { + auto condgammas = ctxt.condition( hash_key( de, "Gammas" ), false ); + if ( !condgammas.isValid() ) { + dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Condition 'Gammas' is not defined, assuming 0.0" ); + } else { + const auto& gammas = condgammas.get(); + if ( gammas.is_null() ) { + dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Condition 'Gammas' is null, assuming 0.0" ); + } else { + auto cellsGammas = gammas["data"].get>>(); + dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Gammas for ECAL energy" ); + int countGammas = 0; + for ( auto& cellGammas : cellsGammas ) { + double cell = cellGammas[0]; + double gamma = cellGammas[1]; + LHCb::Detector::Calo::CellID id = LHCb::Detector::Calo::CellID( (int)cell ); + id.setCalo( index ); + if ( cells[id].valid() ) { + cells[id].setGamma( gamma ); + dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Added gamma for channel %s : gamma = %f", + id.asString().c_str(), gamma ); + } else { + dd4hep::printout( dd4hep::WARNING, "DeCalorimeter", "Trying to add gamma on non-valid channel : %s", + id.asString().c_str() ); + } + countGammas++; + } + dd4hep::printout( dd4hep::DEBUG, "DeCalorimeter", "Gamma added for %d channel(s)", countGammas ); + } + } + } + bool nominal = false; int countGain = 0; // Nominal Gain parameters diff --git a/compact/components/ECAL/2024-v00.00/conditions.xml b/compact/components/ECAL/2024-v00.00/conditions.xml index e1fb242e9c1ee5aa960332ea99e9096b29a58007..5a0f2677349af685d0dce9335537bf825d263a33 100644 --- a/compact/components/ECAL/2024-v00.00/conditions.xml +++ b/compact/components/ECAL/2024-v00.00/conditions.xml @@ -18,6 +18,7 @@ + diff --git a/compact/components/ECAL/trunk/conditions.xml b/compact/components/ECAL/trunk/conditions.xml index e1fb242e9c1ee5aa960332ea99e9096b29a58007..5a0f2677349af685d0dce9335537bf825d263a33 100644 --- a/compact/components/ECAL/trunk/conditions.xml +++ b/compact/components/ECAL/trunk/conditions.xml @@ -18,6 +18,7 @@ + diff --git a/tests/ConditionsIOV/.schema.json b/tests/ConditionsIOV/.schema.json index bc6ed3ac935663cfdd7135edf93a109ce858b3f7..461400c57bfe5b94d222ad0b1133587492b9199b 100644 --- a/tests/ConditionsIOV/.schema.json +++ b/tests/ConditionsIOV/.schema.json @@ -9,7 +9,8 @@ "LEDReference", "PileUpOffset", "Quality", - "Reco" + "Reco", + "Gammas" ], "Conditions/Ecal/ReadoutConf.yml": [ "Hardware", diff --git a/tests/ConditionsIOV/Conditions/Ecal/Calibration.yml/0 b/tests/ConditionsIOV/Conditions/Ecal/Calibration.yml/0 index bb1ed13181cfcff6a3c5fa058825e294ef899218..f947db7a65627c0cff8da8a7d70333b694532225 100644 --- a/tests/ConditionsIOV/Conditions/Ecal/Calibration.yml/0 +++ b/tests/ConditionsIOV/Conditions/Ecal/Calibration.yml/0 @@ -12083,3 +12083,6 @@ Quality: size: 2 Reco: ZShowerMax: -282.0 +Gammas: + data: [] + size: 2