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

Merge branch 'LArRODMT_bugfix' into 'master'

Fix/improvments of the MT-safe LArRawChannelBuilderAlg

See merge request atlas/athena!9819
parents 51237d40 d254288e
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ StatusCode LArBadFebCondAlg::execute() { ...@@ -45,7 +45,7 @@ StatusCode LArBadFebCondAlg::execute() {
if (writeHandle.isValid()) { if (writeHandle.isValid()) {
writeHandle.updateStore(); //???? writeHandle.updateStore(); //????
msg(MSG::WARNING) << "Found valid write handle" << endmsg; msg(MSG::DEBUG) << "Found valid write handle" << endmsg;
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "LArRawConditions/LArADC2MeV.h" #include "LArRawConditions/LArADC2MeV.h"
#include "LArElecCalib/ILArOFC.h" #include "LArElecCalib/ILArOFC.h"
#include "LArElecCalib/ILArShape.h" #include "LArElecCalib/ILArShape.h"
#include "LArCabling/LArOnOffIdMapping.h"
//Event classes //Event classes
class LArDigitContainer; class LArDigitContainer;
...@@ -47,6 +48,9 @@ class LArRawChannelBuilderAlg : public AthReentrantAlgorithm { ...@@ -47,6 +48,9 @@ class LArRawChannelBuilderAlg : public AthReentrantAlgorithm {
SG::ReadCondHandleKey<ILArOFC> m_ofcKey{this,"OFCKey","LArOFC","SG Key of OFC conditions object"}; SG::ReadCondHandleKey<ILArOFC> m_ofcKey{this,"OFCKey","LArOFC","SG Key of OFC conditions object"};
SG::ReadCondHandleKey<ILArShape> m_shapeKey{this,"ShapeKey","LArShape","SG Key of Shape conditions object"}; SG::ReadCondHandleKey<ILArShape> m_shapeKey{this,"ShapeKey","LArShape","SG Key of Shape conditions object"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
//Other jobOptions: //Other jobOptions:
Gaudi::Property<float> m_eCutForQ{this,"ECutForQ",250.0,"Q will be computed only for channels with E above this value"}; Gaudi::Property<float> m_eCutForQ{this,"ECutForQ",250.0,"Q will be computed only for channels with E above this value"};
Gaudi::Property<bool> m_useShapeDer{this,"useShapeDer",true,"Use shape derivative in Q-factor computation"}; Gaudi::Property<bool> m_useShapeDer{this,"useShapeDer",true,"Use shape derivative in Q-factor computation"};
......
...@@ -19,6 +19,7 @@ StatusCode LArRawChannelBuilderAlg::initialize() { ...@@ -19,6 +19,7 @@ StatusCode LArRawChannelBuilderAlg::initialize() {
ATH_CHECK(m_adc2MeVKey.initialize()); ATH_CHECK(m_adc2MeVKey.initialize());
ATH_CHECK(m_ofcKey.initialize()); ATH_CHECK(m_ofcKey.initialize());
ATH_CHECK(m_shapeKey.initialize()); ATH_CHECK(m_shapeKey.initialize());
ATH_CHECK( m_cablingKey.initialize() );
ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID")); ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID"));
...@@ -78,6 +79,21 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { ...@@ -78,6 +79,21 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const {
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
if(ATH_UNLIKELY(adc2mev.size()<2)) {
//Apparently we got digits for a disconnected channel.
//Check if it is really disconncted
SG::ReadCondHandle<LArOnOffIdMapping> cabling(m_cablingKey,ctx);
if ((*cabling)->isOnlineConnected(id)) {
ATH_MSG_ERROR("No valid ADC2MeV for connected channel " << m_onlineId->channel_name(id)
<< " gain " << gain);
return StatusCode::FAILURE;
}
else {
//as expected, a disconnected channel
continue; //simply skip over this channl
}
}
//Apply OFCs to get amplitude and time //Apply OFCs to get amplitude and time
float A=0; float A=0;
...@@ -89,7 +105,7 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { ...@@ -89,7 +105,7 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const {
if (samples[i]==4096 || samples[i]==0) saturated=true; if (samples[i]==4096 || samples[i]==0) saturated=true;
} }
const float tau=At/A; const float tau=(std::fabs(A)>1.0) ? At/A : 0.0;
//Apply Ramp //Apply Ramp
const float E=adc2mev[0]+A*adc2mev[1]; const float E=adc2mev[0]+A*adc2mev[1];
...@@ -141,7 +157,9 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { ...@@ -141,7 +157,9 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const {
const float time=(tau-timeOffset)*(Gaudi::Units::nanosecond/ const float time=(tau-timeOffset)*(Gaudi::Units::nanosecond/
Gaudi::Units::picosecond); //Convert time to ps Gaudi::Units::picosecond); //Convert time to ps
outputContainer->emplace_back(id,(int)(floor(E+0.5)),(int)floor(time+0.5),iquaShort,prov,(CaloGain::CaloGain)gain); outputContainer->emplace_back(id,static_cast<int>(std::floor(E+0.5)),
static_cast<int>(std::floor(time+0.5)),
iquaShort,prov,(CaloGain::CaloGain)gain);
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
......
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