ATLAS Offline Software
Loading...
Searching...
No Matches
LArStripsCrossTalkCorrector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5//Dear emacs, this is -*-c++-*-
6#ifndef LARSTRIPSCROSSTALKCORRECTOR_H
7#define LARSTRIPSCROSSTALKCORRECTOR_H
8
10
18
19#include <vector>
20#include <string>
21#include <bitset>
22#include <array>
23
24class LArEM_ID;
25class LArOnlineID;
27
28//Poor man's histogramming class to monitor difference introduced by xtalk corr
30public:
31 XtalkCorrHisto(const unsigned nBins, const float maxbin);
32 void add(const LArAccumulatedCalibDigit* dig, const float reldiff);
33 void print(MsgStream& stream, const LArOnlineID* onlId, MSG::Level lvl=MSG::INFO);
34
35private:
36 struct maxlistitem {
37 public:
38 maxlistitem(HWIdentifier chidin, int dacin , int delayin ,float reldiffin) :
39 chid(chidin), dac(dacin), delay(delayin), reldiff(reldiffin) {}
41 int dac;
42 int delay;
43 float reldiff;
44 };
45
46 const unsigned m_nBins;
47 const float m_binwidth;
48 std::vector<unsigned> m_diffs;
49
50 std::vector<maxlistitem> m_maxlist;
51};
52
53
54
55
56//===================================================================================
57
59{
60 public:
62
63 //standard algorithm methods
64 virtual StatusCode initialize() override final;
65 virtual StatusCode execute() override final;
66 virtual StatusCode finalize() override final;
67
68
69 private:
70
71 SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey {this, "BadChanKey", "LArBadChannel", "SG key for LArBadChan object"};
72 SG::ReadCondHandleKey<LArBadFebCont> m_BFKey {this, "MissingFEBKey", "LArBadFeb", "SG key for miffing FEB object"};
73 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
74
75
76 Gaudi::Property<std::vector<std::string> > m_dontUseForCorr{this,"DontUseForXtalkCorr",{}, "Types of bad channel should not be taken into accout for xtalk correction of their neighbor"};
77
78
80 Gaudi::Property<std::vector<std::string> > m_dontCorr{this,"NoXtalkCorr",{}, "Types of bad channel should be ignored and not x-talk corrected"};
82
83
84
85 const LArOnlineID* m_onlineHelper{nullptr};
86 const LArEM_ID* m_emId{nullptr};
87 unsigned int m_event_counter=0;
88 //Ranges for eta and phi indices for barrel(0) and endcap(1)
89 static constexpr auto m_MAXeta=std::to_array<unsigned>({448,208});
90 static constexpr auto m_MINeta=std::to_array<unsigned>({1,0});
91 const unsigned int m_MAXphi=64;
92 int m_nStrips=-1;
93 //Algorithm-Properties:
94 Gaudi::Property<std::vector<std::string> > m_keylist{this,"KeyList",{},"List of input keys ('HIGH','MEDIUM','LOW')"};
95 Gaudi::Property<unsigned int> m_ADCsatur {this,"ADCsaturation",0,"Cutoff value to ignore saturated digits"};
96 Gaudi::Property<float> m_acceptableDifference{this,"AcceptableDifference",20, "For sanity check: By how much the corrected value may differ from the original one (in %)"};
97
98
99 SG::ReadCondHandleKey<ILArPedestal> m_pedKey{this,"PedestalKey","Pedestal","Key of Pedestal object"};
100
101 uint16_t m_fatalFebErrorPattern{0xffff};
102
103 const size_t m_noIdx{9999999};
104
105 //2D Eta-phi array of strip cells. A/C side is accomodated by duplicating the number of phi-bins
106 //One such array for barrel, one for endcap
107 //Idexing: Barrel/EC, eta-index, phi-index
108 std::array<std::vector < std::vector < const LArAccumulatedCalibDigit* > >,2> m_stripsLookUp;
109
110 std::array<std::vector < std::bitset< 128 > >,2> m_knownMissingFebs;
111
113
114 std::set<HWIdentifier> m_uncorrectedIds;
115
117 int dist{};
119 double ped{};
120 double weight{};
121 };
122
123
125
126 static std::string printMaxSample(const LArAccumulatedCalibDigit* thisDig);
127 StatusCode initKnownMissingFebs();
128
129 size_t getEtaIndex(const Identifier) const;
130 size_t getPhiIndex(const Identifier) const;
131
132 void correctSamples(std::vector<double>& dest, const neighbour_t& neighbor) const;
133
134
135};
136
137
138inline void LArStripsCrossTalkCorrector::correctSamples(std::vector<double>& dest, const LArStripsCrossTalkCorrector::neighbour_t& nb) const {
139 const size_t nSamples=std::min(dest.size(),nb.dig->sampleSum().size());
140 const double pedTimesTrig=nb.ped*(double)nb.dig->nTriggers();
141 for (size_t i=0;i<nSamples;++i) {
142 dest[i]+=nb.weight*(nb.dig->sampleSum()[i]-pedTimesTrig);
143 }
144 return;
145}
146
148 if (m_emId->sampling(id)!=1) return m_noIdx; //Deal only with layer 1
149 const int region = m_emId->region(id);
150 const int keta = m_emId->eta(id);
151 if (abs(m_emId->barrel_ec(id))== 1) { // Barrel case
152 if (region==0)
153 return keta;
154 else
155 return m_noIdx;
156 }// end if barrel
157 else if (abs(m_emId->barrel_ec(id))== 2) { //Endcap case
158 switch (region) {
159 case 2:
160 return keta;
161 break;
162 case 3:
163 return keta+96;
164 break;
165 case 4:
166 return keta+144;
167 break;
168 default:
169 return m_noIdx;
170 break;
171 }
172 }// end if endcap
173 return m_noIdx; //endcap OW or unknown region
174}
175
177 const int kphi = m_emId->phi(id);
178 const int kside=m_emId->barrel_ec(id)>0;
179 return kphi+kside*m_MAXphi;
180 }
181
182
183
184#endif
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Data class for calibration ADC samples preprocessed by the DSP.
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
void correctSamples(std::vector< double > &dest, const neighbour_t &neighbor) const
SG::ReadCondHandleKey< ILArPedestal > m_pedKey
std::set< HWIdentifier > m_uncorrectedIds
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
virtual StatusCode finalize() override final
std::array< std::vector< std::bitset< 128 > >, 2 > m_knownMissingFebs
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
size_t getEtaIndex(const Identifier) const
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
Gaudi::Property< std::vector< std::string > > m_dontUseForCorr
Gaudi::Property< float > m_acceptableDifference
virtual StatusCode execute() override final
size_t getPhiIndex(const Identifier) const
std::array< std::vector< std::vector< const LArAccumulatedCalibDigit * > >, 2 > m_stripsLookUp
Gaudi::Property< std::vector< std::string > > m_keylist
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Property< std::vector< std::string > > m_dontCorr
Gaudi::Property< unsigned int > m_ADCsatur
void add(const LArAccumulatedCalibDigit *dig, const float reldiff)
std::vector< unsigned > m_diffs
void print(MsgStream &stream, const LArOnlineID *onlId, MSG::Level lvl=MSG::INFO)
std::vector< maxlistitem > m_maxlist
XtalkCorrHisto(const unsigned nBins, const float maxbin)
void initialize()
maxlistitem(HWIdentifier chidin, int dacin, int delayin, float reldiffin)