40 return StatusCode::SUCCESS;
51 << writeHandle.
fullKey() <<
" is already valid.");
52 return StatusCode::SUCCESS;
60 larOnlineID = scidhelper;
64 larOnlineID = idhelper;
71 larOnOffIdMapping = *larOnOffIdMappingHdl;
72 if (larOnOffIdMapping ==
nullptr) {
90 larADC2MeV = *ADC2MeVHdl;
91 if (larADC2MeV ==
nullptr) {
93 return StatusCode::FAILURE;
108 larNoise = *NoiseHdl;
112 larPedestal = *PedestalHdl;
117 larfSampl = *fSamplHdl;
121 larMinBias = *MinBiasHdl;
125 ATH_MSG_INFO(
"IOV found from intersection for AutoCorrTotal object: "
131 std::unique_ptr<LArAutoCorrTotal> larAutoCorrTotal =
132 std::make_unique<LArAutoCorrTotal>(larOnlineID, larOnOffIdMapping,
m_nGains);
146 for (
size_t igain = 0; igain <
m_nGains; igain++) {
148 const int nsamples_shape =
static_cast<int>(Shape.size());
153 if (AC.size() == 0) {
159 int nsamples_AC_OFC = AC.size() + 1;
166 unsigned int ihecshift = 0;
167 if (larOnlineID->
isHECchannel(chid) && nsamples_AC_OFC == 4 &&
183 SigmaNoise = larNoise->
noise(chid, igain);
185 float RMSpedestal = larPedestal->
pedestalRMS(chid, igain);
187 SigmaNoise = RMSpedestal;
191 float fSampl = larfSampl->
FSAMPL(chid);
192 float MinBiasRMS = larMinBias->
minBiasRMS(chid);
194 MinBiasRMS /= fSampl;
195 const auto polynom_adc2mev =
196 larADC2MeV->
ADC2MEV(hid, igain);
198 if (polynom_adc2mev.size() > 0) {
199 Adc2MeV = (polynom_adc2mev)[1];
201 if (SigmaNoise != 0 && Adc2MeV != 0)
202 fSigma2 = pow(MinBiasRMS / (SigmaNoise * Adc2MeV), 2);
204 if (fSampl == 0 || SigmaNoise == 0 || Adc2MeV == 0) {
208 <<
"fSampl (" << fSampl <<
"), SigmaNoise ("
209 << SigmaNoise <<
") or Adc2MeV (" << Adc2MeV
211 <<
"=> AutoCorrTotal = only AutoCorr elect. part ");
216 <<
") fSampl (" << fSampl <<
") "
217 <<
") SigmaNoise (" << SigmaNoise <<
") "
218 <<
") Adc2MeV (" << Adc2MeV <<
") "
230 int nsize_tot = (nsamples_AC_OFC - 1) * (nsamples_AC_OFC) / 2;
233 <<
") fSigma2 (" << fSigma2 <<
") "
234 <<
") nsamples_AC_OFC ( " << nsamples_AC_OFC);
235 std::vector<float> vTerms;
237 vTerms.resize(2 * nsize_tot + nsamples_AC_OFC, 0.);
240 for (
int j1 = 0; j1 < nsamples_AC_OFC - 1; j1++) {
241 for (
int j2 = j1 + 1; j2 < nsamples_AC_OFC; j2++) {
242 int l = abs(j2 - j1) - 1;
244 j1 * nsamples_AC_OFC - j1 * (j1 + 1) / 2 + j2 - (j1 + 1);
245 vTerms[
index] = AC[l];
250 <<
") vTerms[1] (" << vTerms[1] <<
") ");
252 for (
int j1 = 0; j1 < nsamples_AC_OFC - 1; ++j1) {
253 for (
int j2 = j1 + 1; j2 < nsamples_AC_OFC; j2++) {
255 j1 * nsamples_AC_OFC - j1 * (j1 + 1) / 2 + j2 - (j1 + 1);
257 for (
int k = 0; k < nsamples_shape; ++k) {
258 if ((j2 - j1 + k) >= 0 && (j2 - j1 + k) < nsamples_shape) {
262 Rij += Shape[k] * Shape[j2 - j1 + k] * ibunch;
265 vTerms[nsize_tot +
index] = fSigma2 * Rij;
269 <<
") vTerms[mid] (" << vTerms[vTerms.size()/2] <<
") ");
272 for (
int j1 = 0; j1 < nsamples_AC_OFC; j1++) {
274 for (
int k = 0; k < nsamples_shape; ++k) {
278 Rms2i += pow(Shape[k], 2) * ibunch;
280 vTerms[2 * nsize_tot + j1] = fSigma2 * Rms2i;
283 <<
") vTerms[last] (" << vTerms[vTerms.size()-1] <<
") ");
287 larAutoCorrTotal->set(hid, igain, vTerms);
292 for (
unsigned int igain = 0; igain <
m_nGains; igain++) {
294 std::vector<float>
empty(nsize_tot, 0.);
295 larAutoCorrTotal->set(hid, igain,
empty);
300 ATH_MSG_INFO(
"LArAutoCorrTotal Ncell * Ngain " << count3);
308 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
static const Attributes_t empty
const ServiceHandle< StoreGateSvc > & detStore() const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
This class defines the interface for accessing AutoCorrelation parameters for each channel @stereotyp...
LArVectorProxy AutoCorrRef_t
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const =0
virtual const float & minBiasRMS(const HWIdentifier &id) const =0
access to RMS of E in minimum bias events index by Identifier
virtual const float & noise(const HWIdentifier &id, int gain) const =0
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
virtual const float & FSAMPL(const HWIdentifier &id) const =0
This is a "hash" representation of an Identifier.
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
SG::WriteCondHandleKey< LArAutoCorrTotal > m_LArAutoCorrTotalObjKey
Gaudi::Property< unsigned > m_nGains
SG::ReadCondHandleKey< LArOnOffIdMapping > m_LArOnOffIdMappingObjKey
SG::ReadCondHandleKey< ILArShape > m_LArShapeObjKey
SG::ReadCondHandleKey< ILArPedestal > m_LArPedestalObjKey
SG::ReadCondHandleKey< ILArMinBias > m_LArMinBiasObjKey
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadCondHandleKey< ILArAutoCorr > m_LArAutoCorrObjKey
virtual ~LArAutoCorrTotalCondAlg() override
Gaudi::Property< bool > m_isMC
Gaudi::Property< int > m_deltaBunch
SG::ReadCondHandleKey< LArADC2MeV > m_LArADC2MeVObjKey
SG::ReadCondHandleKey< ILArNoise > m_LArNoiseObjKey
SG::ReadCondHandleKey< ILArfSampl > m_LArfSamplObjKey
Gaudi::Property< unsigned int > m_firstSample
Gaudi::Property< bool > m_isSuperCell
Gaudi::Property< bool > m_NoPile
virtual StatusCode initialize() override
Gaudi::Property< int > m_Nsamples
Identifier cnvToIdentifier(const HWIdentifier &sid) const
create an Identifier from a HWIdentifier (inline)
bool isOnlineConnected(const HWIdentifier &sid) const
Test whether a HWIdentifier is connected of not (inline) .
Helper for the Liquid Argon Calorimeter cell identifiers.
id_range channel_range() const
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
virtual bool isHECchannel(const HWIdentifier id) const =0
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string