Skip to content
Snippets Groups Projects
Commit 20a2c0c0 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'scottHvscaleFixResolved' into 'master'

Resolve conflicting changes of LArHVScaleCorrCondAlg

See merge request atlas/athena!15854
parents 88eecfc6 fd78960e
No related branches found
No related tags found
No related merge requests found
...@@ -538,11 +538,11 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, ...@@ -538,11 +538,11 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx,
ncell++; ncell++;
} }
} //end of loop over all cells } //end of loop over all cells
if (m_calculateLArHVFraction) {
const auto hvFrac=m_larHVFraction->getLArHVFrac(theCluster->getCellLinks(),ctx); const auto hvFrac=m_larHVFraction->getLArHVFrac(theCluster->getCellLinks(),ctx);
eBadLArHV= hvFrac.first; eBadLArHV= hvFrac.first;
nBadLArHV=hvFrac.second; nBadLArHV=hvFrac.second;
}
if ( w > 0 ) { if ( w > 0 ) {
mass = w*w - mx*mx - my*my - mz*mz; mass = w*w - mx*mx - my*my - mz*mz;
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "LArHVScaleCorrCondAlg.h" #include "LArHVScaleCorrCondAlg.h"
#include "AthenaKernel/errorcheck.h" #include "AthenaKernel/errorcheck.h"
#include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/ThreadLocalContext.h"
#include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloDetDescr/CaloDetDescrElement.h"
#include "xAODEventInfo/EventInfo.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h" #include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h" #include "AthenaPoolUtilities/AthenaAttributeList.h"
...@@ -104,7 +104,6 @@ StatusCode LArHVScaleCorrCondAlg::initialize() { ...@@ -104,7 +104,6 @@ StatusCode LArHVScaleCorrCondAlg::initialize() {
ATH_CHECK(m_cablingKey.initialize()); ATH_CHECK(m_cablingKey.initialize());
ATH_CHECK(m_hvKey.initialize()); ATH_CHECK(m_hvKey.initialize());
if(!m_updateIfChanged) ATH_CHECK(m_eventInfoKey.initialize());
if(m_undoOnlineHVCorr) ATH_CHECK(m_onlineHVScaleCorrKey.initialize()); if(m_undoOnlineHVCorr) ATH_CHECK(m_onlineHVScaleCorrKey.initialize());
ATH_CHECK(m_outputHVScaleCorrKey.initialize()); ATH_CHECK(m_outputHVScaleCorrKey.initialize());
...@@ -118,21 +117,22 @@ StatusCode LArHVScaleCorrCondAlg::initialize() { ...@@ -118,21 +117,22 @@ StatusCode LArHVScaleCorrCondAlg::initialize() {
StatusCode LArHVScaleCorrCondAlg::execute() { StatusCode LArHVScaleCorrCondAlg::execute() {
const EventContext& ctx = Gaudi::Hive::currentContext();
// test validity of write handle // test validity of write handle
SG::WriteCondHandle<ILArHVScaleCorr> writeHandle(m_outputHVScaleCorrKey); SG::WriteCondHandle<ILArHVScaleCorr> writeHandle(m_outputHVScaleCorrKey, ctx);
if (writeHandle.isValid()) { if (writeHandle.isValid()) {
ATH_MSG_DEBUG( "Found valid " << writeHandle.fullKey() << " handle."); ATH_MSG_DEBUG( "Found valid " << writeHandle.fullKey() << " handle.");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
// get DCS HVData // get DCS HVData
SG::ReadCondHandle<LArHVData> hvDataHdl(m_hvKey); SG::ReadCondHandle<LArHVData> hvDataHdl(m_hvKey, ctx);
const LArHVData *hvdata = *hvDataHdl; const LArHVData *hvdata = *hvDataHdl;
// Online HVScaleCorr (if needed to subtract) // Online HVScaleCorr (if needed to subtract)
const ILArHVScaleCorr *onlHVCorr = nullptr; const ILArHVScaleCorr *onlHVCorr = nullptr;
if(m_undoOnlineHVCorr) { if(m_undoOnlineHVCorr) {
SG::ReadCondHandle<ILArHVScaleCorr> onlHVCorrHdl(m_onlineHVScaleCorrKey); SG::ReadCondHandle<ILArHVScaleCorr> onlHVCorrHdl(m_onlineHVScaleCorrKey, ctx);
// onlHVCorr = dynamic_cast<const LArHVScaleCorrFlat*>(*onlHVCorrHdl); // onlHVCorr = dynamic_cast<const LArHVScaleCorrFlat*>(*onlHVCorrHdl);
onlHVCorr = *onlHVCorrHdl; onlHVCorr = *onlHVCorrHdl;
if(!onlHVCorr) { if(!onlHVCorr) {
...@@ -142,7 +142,7 @@ StatusCode LArHVScaleCorrCondAlg::execute() { ...@@ -142,7 +142,7 @@ StatusCode LArHVScaleCorrCondAlg::execute() {
} }
SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl(m_cablingKey); SG::ReadCondHandle<LArOnOffIdMapping> larCablingHdl(m_cablingKey, ctx);
const LArOnOffIdMapping* cabling=*larCablingHdl; const LArOnOffIdMapping* cabling=*larCablingHdl;
if(!cabling) { if(!cabling) {
ATH_MSG_ERROR("Could not get LArOnOffIdMapping !!"); ATH_MSG_ERROR("Could not get LArOnOffIdMapping !!");
...@@ -177,18 +177,14 @@ StatusCode LArHVScaleCorrCondAlg::execute() { ...@@ -177,18 +177,14 @@ StatusCode LArHVScaleCorrCondAlg::execute() {
} }
}//end if updateIfChanges }//end if updateIfChanges
else { else {
// FIXME: statics are not MT-safe!!!
static unsigned int timestamp_old = 0; static unsigned int timestamp_old = 0;
static unsigned int lumiblock_old = 0; static unsigned int lumiblock_old = 0;
static unsigned int run_old = 0; static unsigned int run_old = 0;
SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey);
if (not eventInfo.isValid()) { const unsigned int lumiblock = ctx.eventID().lumi_block();
ATH_MSG_WARNING(" Cannot access to event info, will recompute on every event"); const unsigned int run = ctx.eventID().run_number();
m_updateIfChanged = true; const unsigned int timestamp = ctx.eventID().time_stamp();
return StatusCode::SUCCESS;
}
const unsigned int lumiblock = eventInfo->lumiBlock();
const unsigned int run = eventInfo->runNumber();
const unsigned int timestamp = eventInfo->timeStamp();
ATH_MSG_DEBUG("run|lbn|timestamp [CURRENT][CACHED] --> [ " ATH_MSG_DEBUG("run|lbn|timestamp [CURRENT][CACHED] --> [ "
<< run << " | " << lumiblock << " | " << timestamp << " ] [ " << run << " | " << lumiblock << " | " << timestamp << " ] [ "
...@@ -254,7 +250,11 @@ StatusCode LArHVScaleCorrCondAlg::finalize() ...@@ -254,7 +250,11 @@ StatusCode LArHVScaleCorrCondAlg::finalize()
// *** compute global ADC2MeV factor from subfactors *** // *** compute global ADC2MeV factor from subfactors ***
StatusCode LArHVScaleCorrCondAlg::getScale(const HASHRANGEVEC& hashranges, std::vector<float> &vScale, const LArHVData *hvdata, const ILArHVScaleCorr *onlHVCorr, const LArOnOffIdMapping* cabling) const {
StatusCode LArHVScaleCorrCondAlg::getScale(const HASHRANGEVEC& hashranges,
std::vector<float> &vScale, const LArHVData *hvdata,
const ILArHVScaleCorr *onlHVCorr, const LArOnOffIdMapping* cabling) const {
unsigned nChannelsUpdates=0; unsigned nChannelsUpdates=0;
...@@ -437,8 +437,7 @@ StatusCode LArHVScaleCorrCondAlg::getScale(const HASHRANGEVEC& hashranges, std:: ...@@ -437,8 +437,7 @@ StatusCode LArHVScaleCorrCondAlg::getScale(const HASHRANGEVEC& hashranges, std::
++nChannelsUpdates; ++nChannelsUpdates;
if(onlHVCorr) { // undo the online one if(onlHVCorr) { // undo the online one
float hvonline = onlHVCorr->HVScaleCorr(cabling->createSignalChannelID(offid)); float hvonline = onlHVCorr->HVScaleCorr(cabling->createSignalChannelID(offid));
if (hvonline>0. && hvonline<100.) mycorr = mycorr/hvonline; if (hvonline>0. && hvonline<100.) mycorr = mycorr/hvonline;
} }
vScale[idx]=mycorr; vScale[idx]=mycorr;
}// end loop over cells }// end loop over cells
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include "LArCOOLConditions/LArHVScaleCorrFlat.h" #include "LArCOOLConditions/LArHVScaleCorrFlat.h"
#include "LArRecConditions/LArHVCorr.h" #include "LArRecConditions/LArHVCorr.h"
#include "xAODEventInfo/EventInfo.h"
class StoreGateSvc; class StoreGateSvc;
class LArElectrodeID; class LArElectrodeID;
...@@ -60,7 +58,6 @@ class LArHVScaleCorrCondAlg: public AthAlgorithm ...@@ -60,7 +58,6 @@ class LArHVScaleCorrCondAlg: public AthAlgorithm
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey {this,"keyCabling", "LArOnOffIdMap", "Input key for Id mapping"} ; SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey {this,"keyCabling", "LArOnOffIdMap", "Input key for Id mapping"} ;
SG::ReadCondHandleKey<LArHVData> m_hvKey {this, "keyHVdata", "LArHVData", "Input key for HV data from DCS"}; SG::ReadCondHandleKey<LArHVData> m_hvKey {this, "keyHVdata", "LArHVData", "Input key for HV data from DCS"};
SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "eventInfoKey", "EventInfo", "Key for EventInfo object"};
SG::ReadCondHandleKey<ILArHVScaleCorr> m_onlineHVScaleCorrKey{this, "keyOnlineHVCorr", "LArHVScaleCorr","Input key for HVScaleCorr from conditions database (used online)"}; SG::ReadCondHandleKey<ILArHVScaleCorr> m_onlineHVScaleCorrKey{this, "keyOnlineHVCorr", "LArHVScaleCorr","Input key for HVScaleCorr from conditions database (used online)"};
SG::WriteCondHandleKey<ILArHVScaleCorr> m_outputHVScaleCorrKey{this, "keyOutputCorr", "LArHVScaleCorrRecomputed","Output key for LArHVScaleCorr"}; SG::WriteCondHandleKey<ILArHVScaleCorr> m_outputHVScaleCorrKey{this, "keyOutputCorr", "LArHVScaleCorrRecomputed","Output key for LArHVScaleCorr"};
...@@ -121,7 +118,10 @@ class LArHVScaleCorrCondAlg: public AthAlgorithm ...@@ -121,7 +118,10 @@ class LArHVScaleCorrCondAlg: public AthAlgorithm
HASHRANGEVEC m_hashRanges[2];//x2 for the side HASHRANGEVEC m_hashRanges[2];//x2 for the side
HASHRANGEVEC m_completeRange; HASHRANGEVEC m_completeRange;
HASHRANGEVEC cellsIDsToPartition(const std::set<Identifier>& cellsIDvec) const; HASHRANGEVEC cellsIDsToPartition(const std::set<Identifier>& cellsIDvec) const;
StatusCode getScale(const HASHRANGEVEC& hashranges, std::vector<float> &vScale, const LArHVData* hvdata, const ILArHVScaleCorr *onlHVCorr, const LArOnOffIdMapping* cabling) const; StatusCode getScale(const HASHRANGEVEC& hashranges,
std::vector<float> &vScale, const LArHVData* hvdata, const ILArHVScaleCorr *onlHVCorr,
const LArOnOffIdMapping* cabling) const;
}; };
#endif #endif
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