diff --git a/LArCalorimeter/LArBadChannelTool/src/LArBadFebCondAlg.cxx b/LArCalorimeter/LArBadChannelTool/src/LArBadFebCondAlg.cxx index f121fd62ba4e03098644e93e5252e74c2010f26b..e0faa796787c52371d46c4819ab4895a6ca7a606 100644 --- a/LArCalorimeter/LArBadChannelTool/src/LArBadFebCondAlg.cxx +++ b/LArCalorimeter/LArBadChannelTool/src/LArBadFebCondAlg.cxx @@ -45,7 +45,7 @@ StatusCode LArBadFebCondAlg::execute() { if (writeHandle.isValid()) { writeHandle.updateStore(); //???? - msg(MSG::WARNING) << "Found valid write handle" << endmsg; + msg(MSG::DEBUG) << "Found valid write handle" << endmsg; return StatusCode::SUCCESS; } diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderAlg.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderAlg.h index d2220e7661022b4b27c5730110414aba8021d7a0..c184ea79e15800210deebdf5b0f0bd35023d4b47 100644 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderAlg.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderAlg.h @@ -16,6 +16,7 @@ #include "LArRawConditions/LArADC2MeV.h" #include "LArElecCalib/ILArOFC.h" #include "LArElecCalib/ILArShape.h" +#include "LArCabling/LArOnOffIdMapping.h" //Event classes class LArDigitContainer; @@ -47,6 +48,9 @@ class LArRawChannelBuilderAlg : public AthReentrantAlgorithm { 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<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; + //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<bool> m_useShapeDer{this,"useShapeDer",true,"Use shape derivative in Q-factor computation"}; diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx index 8a6837914a59d36376029e6c5a413a4ea3b01151..5589d49613d793960f984da3b2bff2b476fad34c 100644 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx @@ -19,6 +19,7 @@ StatusCode LArRawChannelBuilderAlg::initialize() { ATH_CHECK(m_adc2MeVKey.initialize()); ATH_CHECK(m_ofcKey.initialize()); ATH_CHECK(m_shapeKey.initialize()); + ATH_CHECK( m_cablingKey.initialize() ); ATH_CHECK(detStore()->retrieve(m_onlineId,"LArOnlineID")); @@ -78,6 +79,21 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { 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 float A=0; @@ -89,7 +105,7 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { 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 const float E=adc2mev[0]+A*adc2mev[1]; @@ -141,7 +157,9 @@ StatusCode LArRawChannelBuilderAlg::execute_r(const EventContext& ctx) const { const float time=(tau-timeOffset)*(Gaudi::Units::nanosecond/ 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;