Skip to content
Snippets Groups Projects
Commit c0569065 authored by Pavol Strizenec's avatar Pavol Strizenec
Browse files

fixing LArCellRec

parent 5d356df7
No related branches found
No related tags found
No related merge requests found
......@@ -361,8 +361,11 @@ CaloNoiseToolDB::updateCache()
}
if (m_cached==ICalorimeterNoiseTool::TOTALNOISE) {
float hvcorr=1.0;
ATH_MSG_DEBUG("hvcorr before " << hvcorr);
if (m_rescaleForHV && !isTile) hvcorr=m_larHVCellCorrTool->getCorrection(m_calo_id->cell_id(i));
ATH_MSG_DEBUG("hvcorr after " << hvcorr);
float noise = this->getDBNoise(i,caloGain,lumi,hvcorr);
ATH_MSG_DEBUG("noise " << igain << " " << i << " " << noise);
m_noise[igain][i] = noise;
if (i==0 && m_cacheUpdateCounter==0) {
ATH_MSG_INFO( " NoiseDB parameters for first cell at gain " << igain );
......
......@@ -51,6 +51,8 @@ StatusCode LArCellHVCorr::initialize() {
ATH_CHECK( m_hvCorrTool.retrieve() );
ATH_CHECK( m_cablingKey.initialize() );
// if (m_undoHVonline) {
// sc = detStore()->regHandle(m_dd_HVScaleCorr,m_keyHVScaleCorr);
// if (sc.isFailure()) {
......@@ -87,10 +89,17 @@ float LArCellHVCorr::getCorrection(const Identifier id)
float LArCellHVCorr::getCorrection(const Identifier id) const
{
float hvcorr = m_hvCorrTool->Scale(id);
// this is highly ineffective, but this tool will be soon decommissioned, so could live with this for some time...
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
const LArOnOffIdMapping* cabling{*cablingHdl};
if(!cabling){
ATH_MSG_WARNING("Do not have mapping object " << m_cablingKey.key() << " returning 1.");
return 1.;
}
float hvcorr = m_hvCorrTool->Scale(cabling->createSignalChannelID(id));
if (m_undoHVonline) {
float hvonline = m_dd_HVScaleCorr->HVScaleCorr(id);
float hvonline = m_dd_HVScaleCorr->HVScaleCorr(cabling->createSignalChannelID(id));
if (hvonline>0. && hvonline<100.) hvcorr = hvcorr/hvonline;
}
......@@ -110,7 +119,8 @@ float LArCellHVCorr::getCorrection(const Identifier id) const
void LArCellHVCorr::MakeCorrection (CaloCell* theCell,
const EventContext& /*ctx*/) const
{
const float hvcorr=getCorrection(theCell->ID());
const Identifier id=theCell->ID();
const float hvcorr=getCorrection(id);
theCell->setEnergy(theCell->energy()*hvcorr);
}
......
......@@ -14,6 +14,8 @@
#include "LArElecCalib/ILArHVScaleCorr.h"
#include "LArElecCalib/ILArCellHVCorrTool.h"
#include "StoreGate/DataHandle.h"
#include "LArCabling/LArOnOffIdMapping.h"
#include "StoreGate/ReadCondHandleKey.h"
class CaloCell;
......@@ -50,7 +52,9 @@ public:
virtual bool updateOnLastCallback() override {return m_updateOnLastCallback;}
private:
float getCorrection(const Identifier id) const;
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
float getCorrection(const Identifier id) const;
ToolHandle<ILArHVCorrTool> m_hvCorrTool;
std::string m_keyHVScaleCorr;
......
......@@ -22,6 +22,7 @@ LArCellHVCorrAlg::~LArCellHVCorrAlg() {}
StatusCode LArCellHVCorrAlg::initialize() {
ATH_CHECK(m_offlineHVScaleCorrKey.initialize());
ATH_CHECK( m_cablingKey.initialize() );
return StatusCode::SUCCESS;
}
......@@ -66,7 +67,13 @@ void LArCellHVCorrAlg::MakeCorrection (CaloCell* theCell,
ATH_MSG_ERROR("Do not have ofline HV corr. conditions object !!!!");
return;
}
float hvcorr = oflHVCorr->HVScaleCorr(theCell->ID());
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
const LArOnOffIdMapping* cabling{*cablingHdl};
if(!cabling){
ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key() );
return;
}
float hvcorr = oflHVCorr->HVScaleCorr(cabling->createSignalChannelID((theCell->ID())));
if (hvcorr<0.9 ) {
if (hvcorr<0.4) {
......@@ -85,9 +92,9 @@ void LArCellHVCorrAlg::MakeCorrection (CaloCell* theCell,
}
void LArCellHVCorrAlg::MakeCorrection (CaloCell* theCell,
const EventContext& /*ctx*/, const ILArHVScaleCorr* oflHVCorr ) const
const EventContext& /*ctx*/, const ILArHVScaleCorr* oflHVCorr, const LArOnOffIdMapping* cabling ) const
{
float hvcorr = oflHVCorr->HVScaleCorr(theCell->ID());
float hvcorr = oflHVCorr->HVScaleCorr(cabling->createSignalChannelID(theCell->ID()));
if (hvcorr<0.9 ) {
if (hvcorr<0.4) {
......
......@@ -10,6 +10,7 @@
#include "GaudiKernel/ToolHandle.h"
#include "LArElecCalib/ILArHVScaleCorr.h"
#include "LArElecCalib/ILArCellHVCorrTool.h"
#include "LArCabling/LArOnOffIdMapping.h"
#include "StoreGate/ReadCondHandleKey.h"
class CaloCell;
......@@ -31,13 +32,14 @@ public:
//Implements the CaloCellCorrection interface
virtual void MakeCorrection (CaloCell* /*theCell*/, const EventContext& /*ctx*/) const override final;
void MakeCorrection (CaloCell* theCell,
const EventContext& ctx, const ILArHVScaleCorr* ofl=nullptr) const;
const EventContext& ctx, const ILArHVScaleCorr* ofl=nullptr, const LArOnOffIdMapping* cabling=nullptr) const;
private:
SG::ReadCondHandleKey<ILArHVScaleCorr> m_offlineHVScaleCorrKey{this, "keyOfflineHVCorr", "LArHVScaleCorrRecomputed","Key for LArHVScaleCorr"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
};
......
......@@ -59,7 +59,7 @@ if 'LArDigitKey' in dir() :
if jobproperties.Beam.beamType() == 'cosmics':
if larESDMon and not athenaCommonFlags.isOnline():
if LArMonFlags.doLArAffectedRegions():
include ("LArRecUtils/LArAffectedRegion_read.py")
include ("LArRecUtils/LArAffectedRegion.py")
include ("LArMonTools/LArAffectedRegions_jobOptions.py")
if larRawMon:
if jobproperties.Global.DataSource.get_Value() == 'data':
......@@ -89,7 +89,7 @@ if jobproperties.Beam.beamType() == 'cosmics':
elif jobproperties.Beam.beamType() == 'singlebeam':
if larESDMon and not athenaCommonFlags.isOnline():
if LArMonFlags.doLArAffectedRegions():
include ("LArRecUtils/LArAffectedRegion_read.py")
include ("LArRecUtils/LArAffectedRegion.py")
include ("LArMonTools/LArAffectedRegions_jobOptions.py")
if larRawMon:
if jobproperties.Global.DataSource.get_Value() == 'data':
......@@ -115,7 +115,7 @@ elif jobproperties.Beam.beamType() == 'singlebeam':
else: # should be jobproperties.Beam.beamType() =='collisions'
if larESDMon and not athenaCommonFlags.isOnline():
if LArMonFlags.doLArAffectedRegions():
include ("LArRecUtils/LArAffectedRegion_read.py")
include ("LArRecUtils/LArAffectedRegion.py")
include ("LArMonTools/LArAffectedRegions_jobOptions.py")
if larRawMon:
if jobproperties.Global.DataSource.get_Value() == 'data':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment