|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "GaudiKernel/SystemOfUnits.h"
28 ATH_MSG_ERROR (
"useDB requested but neither Run1DSPThresholdsKey nor Run2DSPThresholdsKey initialized.");
29 return StatusCode::FAILURE;
37 const std::string cutmsg =
m_absECutFortQ.value() ?
" fabs(E) < " :
" E < ";
38 ATH_MSG_INFO(
"Energy cut for time and quality computation: " << cutmsg <<
39 " taken from COOL folder "<<
42 return StatusCode::SUCCESS;
46 return StatusCode::SUCCESS;
55 auto outputContainer = std::make_unique<LArRawChannelContainer>();
72 std::unique_ptr<LArDSPThresholdsFlat> run2DSPThresh;
77 run2DSPThresh = std::make_unique<LArDSPThresholdsFlat>(*dspThrshAttr);
81 return StatusCode::FAILURE;
86 run1DSPThresh = dspThresh.
cptr();
90 return StatusCode::FAILURE;
100 const bool connected=(*cabling)->isOnlineConnected(
id);
105 const std::vector<short>& samples=
digit->samples();
115 const size_t nOFC=ofca.size();
119 const size_t nSamples=samples.size()-firstSample;
122 return StatusCode::FAILURE;
127 if (!connected)
continue;
129 <<
" gain " <<
gain);
130 return StatusCode::FAILURE;
134 if (!connected)
continue;
136 <<
" gain " <<
gain);
137 return StatusCode::FAILURE;
148 std::vector<float> samp_no_ped(nOFC,0.0);
149 for (
size_t i=0;
i<nOFC;++
i) {
150 if (samples[
i+firstSample]==4096 || samples[
i+firstSample]==0)
saturated=
true;
151 samp_no_ped[
i]=samples[
i+firstSample]-
p;
153 for (
size_t i=0;
i<nOFC;++
i) {
154 A+=
static_cast<double>(samp_no_ped[
i])*ofca[
i];
158 const float E=adc2mev[0]+
A*adc2mev[1];
171 ecut = run2DSPThresh->
tQThr(
id);
173 else if (run1DSPThresh) {
174 ecut = run1DSPThresh->
tQThr(
id);
178 return StatusCode::FAILURE;
191 for (
size_t i=0;
i<nOFC;++
i) {
192 At+=
static_cast<double>(samp_no_ped[
i])*ofcb[
i];
195 tau=(std::fabs(
A)>0.1) ? At/
A : 0.0;
196 const auto& fullShape=shapes->
Shape(
id,
gain);
200 const size_t nSamples=samples.size();
208 if (!connected)
continue;
210 <<
" gain " <<
gain);
212 return StatusCode::FAILURE;
215 const float* shape=&*fullShape.begin()+firstSample;
220 if (
ATH_UNLIKELY(fullshapeDer.size()<nOFC+firstSample)) {
222 <<
" gain " <<
gain);
223 ATH_MSG_ERROR(
"Got size " << fullshapeDer.size() <<
", expected at least " << nOFC+firstSample);
224 return StatusCode::FAILURE;
227 const float* shapeDer=&*fullshapeDer.begin()+firstSample;
228 for (
size_t i=0;
i<nOFC;++
i) {
229 q +=
std::pow((
A*(shape[
i]-tau*shapeDer[
i])-(samp_no_ped[
i])),2);
234 for (
size_t i=0;
i<nOFC;++
i) {
239 int iqua =
static_cast<int>(
q);
240 if (iqua > 0xFFFF) iqua=0xFFFF;
241 iquaShort =
static_cast<uint16_t>(iqua & 0xFFFF);
247 outputContainer->emplace_back(
id,
static_cast<int>(std::floor(
E+0.5)),
248 static_cast<int>(std::floor(tau+0.5)),
256 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual float pedestal(const HWIdentifier &id, int gain) const =0
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
const LArOnlineID * m_onlineId
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
Gaudi::Property< bool > m_absECutFortQ
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
Gaudi::Property< bool > m_useShapeDer
StatusCode initialize() override
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Gaudi::Property< float > m_eCutFortQ
StatusCode finalize() override
setScaleOne setStatusOne saturated
SG::ReadCondHandleKey< LArDSPThresholdsComplete > m_run1DSPThresholdsKey
virtual float timeOffset(const HWIdentifier &CellID, int gain) const =0
SG::ReadCondHandleKey< ILArShape > m_shapeKey
SG::ReadCondHandleKey< AthenaAttributeList > m_run2DSPThresholdsKey
float tQThr(const HWIdentifier &CellID) const
Liquid Argon digit base class.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< bool > m_useDBFortQ
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
float tQThr(const HWIdentifier chid) const
SG::ReadCondHandleKey< ILArOFC > m_ofcKey
StatusCode initialize(bool used=true)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Gaudi::Property< int > m_firstSample
SG::ReadHandleKey< LArDigitContainer > m_digitKey
virtual OFCRef_t OFC_a(const HWIdentifier &id, int gain, int tbin=0) const =0
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
SG::ReadCondHandleKey< LArADC2MeV > m_adc2MeVKey
bool isHECchannel(const HWIdentifier id) const override final
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
SG::WriteHandleKey< LArRawChannelContainer > m_rawChannelKey
constexpr int pow(int base, int exp) noexcept
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
const_pointer_type cptr()
StatusCode execute(const EventContext &ctx) const override