ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawCorrelatedNoise Class Reference

#include <TileRawCorrelatedNoise.h>

Inheritance diagram for TileRawCorrelatedNoise:
Collaboration diagram for TileRawCorrelatedNoise:

Classes

struct  AlphaMatrix

Public Member Functions

 TileRawCorrelatedNoise (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TileRawCorrelatedNoise ()
virtual StatusCode initialize ()
virtual StatusCode execute (const EventContext &ctx)
 Execute method.
virtual StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< TileDigitsContainerm_inputDigitsContainerKey
SG::WriteHandleKey< TileDigitsContainerm_outputDigitsContainerKey
float m_nRMS_threshold
std::string m_alphaMatrixFilePrefix
std::string m_sample3RMSFilePrefix
std::string m_meanFilePrefix
std::unique_ptr< AlphaMatrixm_alphaMatrix
float m_meanSamples [4][64][48][7] {}
float m_sample3RMS [4][64][48] {}
bool m_useMeanFiles
bool m_pmtOrder
ToolHandle< TileCondToolNoiseSamplem_tileToolNoiseSample
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 32 of file TileRawCorrelatedNoise.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileRawCorrelatedNoise()

TileRawCorrelatedNoise::TileRawCorrelatedNoise ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 23 of file TileRawCorrelatedNoise.cxx.

24 : AthAlgorithm(name, pSvcLocator)
25{
26// #############################################################################
27
28 declareProperty("nRMSThreshold", m_nRMS_threshold = 2.);
29 declareProperty("AlphaMatrixFilePrefix", m_alphaMatrixFilePrefix = "AlphaMatrix");
30 declareProperty("MeanFilePrefix", m_meanFilePrefix = "Mean");
31 declareProperty("Sample3RMSFilePrefix", m_sample3RMSFilePrefix = "RMS");
32 declareProperty("UseMeanFiles", m_useMeanFiles = true);
33 declareProperty("PMTOrder", m_pmtOrder = false);
34}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~TileRawCorrelatedNoise()

TileRawCorrelatedNoise::~TileRawCorrelatedNoise ( )
virtual

Definition at line 37 of file TileRawCorrelatedNoise.cxx.

37 {
38// #############################################################################
39
40}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileRawCorrelatedNoise::execute ( const EventContext & ctx)
virtual

Execute method.

Implements AthAlgorithm.

Definition at line 294 of file TileRawCorrelatedNoise.cxx.

294 {
295// #############################################################################
296
297 // get named TileDigitsContaner from TES
298 SG::ReadHandle<TileDigitsContainer> inputDigitsContainer(m_inputDigitsContainerKey, ctx);
299
300 ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_inputDigitsContainerKey.key() << "'" );
301
302 const TileHWID* tileHWID;
303 CHECK( detStore()->retrieve(tileHWID, "TileHWID") );
304 //coverity[STACK_USE]
305 const TileDigits* OriginalDigits[4][64][48];
306
307 // go through ALL TileDigits in container
308 SelectAllObject<TileDigitsContainer> selAll(inputDigitsContainer.cptr());
309 SelectAllObject<TileDigitsContainer>::const_iterator digItr = selAll.begin();
310 SelectAllObject<TileDigitsContainer>::const_iterator lastDig = selAll.end();
311
312 // read digits
313 for (; digItr != lastDig; ++digItr) {
314 const HWIdentifier adc_HWID = (*digItr)->adc_HWID();
315 int Ros = tileHWID->ros(adc_HWID);
316 int Drawer = tileHWID->drawer(adc_HWID);
317 int Channel = tileHWID->channel(adc_HWID);
318 OriginalDigits[Ros - 1][Drawer][Channel] = (*digItr);
319
320 if (!m_useMeanFiles) {
321 // read pedestal value and use it as mean
322 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(Ros, Drawer);
323 int adc = tileHWID->adc(adc_HWID);
324 double ped = m_tileToolNoiseSample->getPed(drawerIdx, Channel, adc, TileRawChannelUnit::ADCcounts, ctx);
325 int nSamples = 7;
326 for (int Sample = 0; Sample < nSamples; ++Sample) {
327 m_meanSamples[Ros - 1][Drawer][Channel][Sample] = ped;
328 }
329 }
330 }
331
332 // prepare new samples
333 const int nSamples = 7;
334 struct Arrays {
335 float NewSamples[4][64][48][nSamples];
336 };
337 auto a = std::make_unique<Arrays>();
338 for (int Ros = 1; Ros < 5; ++Ros) {
339 for (int Drawer = 0; Drawer < 64; ++Drawer) {
340 for (int Channel = 0; Channel < 48; ++Channel) {
341 for (int Sample = 0; Sample < nSamples; ++Sample) {
342 a->NewSamples[Ros - 1][Drawer][Channel][Sample] =
343 ((OriginalDigits[Ros - 1][Drawer][Channel])->samples())[Sample];
344 }
345 }
346 }
347 }
348
349 // apply method
350 for (int Ros = 1; Ros < 5; ++Ros) {
351 for (int Drawer = 0; Drawer < 64; ++Drawer) {
352 for (int Channel = 0; Channel < 48; ++Channel) {
353 if (OriginalDigits[Ros - 1][Drawer][Channel]) {
354 int nSamples = (OriginalDigits[Ros - 1][Drawer][Channel])->nsamples();
355 std::vector<float> digits(nSamples);
356 for (int jCh = 0; jCh < 48; ++jCh) {
357 if (OriginalDigits[Ros - 1][Drawer][jCh]) {
358 if (Channel != jCh
359 && fabs(((OriginalDigits[Ros - 1][Drawer][jCh])->samples())[3]
360 - m_meanSamples[Ros - 1][Drawer][jCh][3])
361 < m_nRMS_threshold * m_sample3RMS[Ros - 1][Drawer][jCh]) {
362
363 for (int Sample = 0; Sample < nSamples; ++Sample)
364 a->NewSamples[Ros - 1][Drawer][Channel][Sample] =
365 a->NewSamples[Ros - 1][Drawer][Channel][Sample]
366 - m_alphaMatrix->m[Ros - 1][Drawer][Channel][jCh]
367 * (((OriginalDigits[Ros - 1][Drawer][jCh])->samples())[Sample]
368 - m_meanSamples[Ros - 1][Drawer][jCh][Sample]);
369 }
370 }
371 }
372 }
373 }
374 }
375 }
376
377 // create new container
378
379 auto outputDigitsContainer = std::make_unique<TileMutableDigitsContainer>();
380 ATH_CHECK( outputDigitsContainer->status() );
381
382 // fill new container
383 for (int Ros = 1; Ros < 5; ++Ros) {
384 for (int Drawer = 0; Drawer < 64; ++Drawer) {
385 for (int Channel = 0; Channel < 48; ++Channel) {
386 if (OriginalDigits[Ros - 1][Drawer][Channel]) {
387 int nSamples = (OriginalDigits[Ros - 1][Drawer][Channel])->nsamples();
388 std::vector<float> digits(nSamples);
389 for (int Sample = 0; Sample < nSamples; ++Sample) {
390 digits[Sample] = a->NewSamples[Ros - 1][Drawer][Channel][Sample];
391 }
392 TileDigits* NewDigits = new TileDigits(
393 (OriginalDigits[Ros - 1][Drawer][Channel])->adc_HWID(), digits);
394 ATH_CHECK( outputDigitsContainer->push_back(NewDigits) );
395 }
396 }
397 }
398 }
399
400 SG::WriteHandle<TileDigitsContainer> outputDigitsCnt(m_outputDigitsContainerKey, ctx);
401 ATH_CHECK( outputDigitsCnt.record(std::move(outputDigitsContainer)) );
402
403
404 ATH_MSG_DEBUG( "execute completed successfully" );
405
406 return StatusCode::SUCCESS;
407}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t a
SelectAllObjectMT< DCC, OBJECT > SelectAllObject
const ServiceHandle< StoreGateSvc > & detStore() const
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition TileHWID.h:189
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
Definition TileHWID.h:193
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
Definition TileHWID.h:171
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
Definition TileHWID.h:167
SG::WriteHandleKey< TileDigitsContainer > m_outputDigitsContainerKey
float m_meanSamples[4][64][48][7]
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
SG::ReadHandleKey< TileDigitsContainer > m_inputDigitsContainerKey
std::unique_ptr< AlphaMatrix > m_alphaMatrix
Identifier32::value_type Channel

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode TileRawCorrelatedNoise::finalize ( )
virtual

Definition at line 410 of file TileRawCorrelatedNoise.cxx.

410 {
411// #############################################################################
412
413 ATH_MSG_INFO( " finalize completed successfully" );
414
415 return StatusCode::SUCCESS;
416}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode TileRawCorrelatedNoise::initialize ( )
virtual

Definition at line 43 of file TileRawCorrelatedNoise.cxx.

43 {
44// #############################################################################
45
46 static constexpr int PmtToChannelBarrel[48] = {
47 1, 2, 3, 4, 5, 6, 7, 8,
48 9, 10, 11, 12, 13, 14, 15, 16,
49 17, 18, 19, 20, 21, 22, 23, 24,
50 27, 26, 25, 30, 29, 28, 33, 32,
51 31, 36, 35, 34, 39, 38, 37, 42,
52 41, 40, 45, 44, 43, 48, 47, 46 };
53
54 static constexpr int PmtToChannelExtendedBarrel[48] = {
55 1, 2, 3, 4, 5, 6, 7, 8,
56 9, 10, 11, 12, 13, 14, 15, 16,
57 17, 18, 19, 20, 21, 22, 23, 24,
58 27, 26, 25, 31, 32, 28, 33, 29,
59 30, 36, 35, 34, 44, 38, 37, 43,
60 42, 41, 45, 39, 40, 48, 47, 46 };
61
62 m_alphaMatrix = std::make_unique<AlphaMatrix>();
63
64 // read alpha matrix
65 FILE* AlphaMatrixFile[4][64]{};
66 char Rosstr[10];
67 char buff[1000];
68 // Cycle over 4 partitions and 64 modules
69 for (int Ros = 1; Ros < 5; ++Ros) {
70 for (int Drawer = 0; Drawer < 64; ++Drawer) {
71 // open file which corresponds to AlphaMatrix[Ros][Drawer]
72 if (Ros == 1) sprintf(Rosstr, "LBA");
73 else if (Ros == 2) sprintf(Rosstr, "LBC");
74 else if (Ros == 3) sprintf(Rosstr, "EBA");
75 else sprintf(Rosstr, "EBC");
76
77 sprintf(buff, "%s%s%02d.txt", m_alphaMatrixFilePrefix.c_str(), Rosstr, Drawer + 1);
78 std::string filestr(buff);
79 std::string file = PathResolver::find_file(buff, "DATAPATH");
80// ATH_MSG_INFO( " buff=" << buff
81// << " filestr=" << filestr.c_str()
82// << " file=" << file.c_str() );
83 if (file.size() == 0) {
84 ATH_MSG_WARNING( "Could not find input file " << buff );
85 } else {
86 ATH_MSG_INFO( "Reading file " << file );
87 AlphaMatrixFile[Ros - 1][Drawer] = fopen(file.c_str(), "r");
88 }
89 if (AlphaMatrixFile[Ros - 1][Drawer] == NULL) {
90 ATH_MSG_ERROR( "Can't read input Alpha Matrix files." );
91 return StatusCode::FAILURE;
92 }
93 ATH_MSG_DEBUG( " **** Start of Alpha Matrix Read Out" );
94 FILE* alpha_file = AlphaMatrixFile[Ros - 1][Drawer];
95// if(fgets(buff, sizeof(buff), alpha_file) != NULL) {
96// ATH_MSG_DEBUG( "Matrix is being loaded: " << buff );
97// }
98 // load tokens to be searched for in a string
99 const char* TOKENS = { " \t\n" };
100 // read Matrix
101 int dima = 48;
102 char* saveptr = nullptr;
103 for (int line = 0; line < dima; line++) {
104 if (fgets(buff, sizeof(buff), alpha_file) != NULL) {
105 ATH_MSG_DEBUG( "line " << line << " is " << buff );
106 for (int column = 0; column < dima; column++) {
107 // Check for comment lines
108 if (*buff == '!' || *buff == '*') continue;
109 // read value
110 double pippo = 0;
111 if (const char* word = strtok_r(column==0 ? buff : nullptr, TOKENS, &saveptr))
112 {
113 pippo = atof(word);
114 }
115
116 ATH_MSG_VERBOSE ( "elem " << column << " is " << pippo );
117 int chline = line;
118 int chcolumn = column;
119 // read alpha matrix in pmt order but save it in channel order if m_pmtOrder is true
120 if (m_pmtOrder) {
121 if (Ros < 3) {
122 chline = PmtToChannelBarrel[line] - 1;
123 chcolumn = PmtToChannelBarrel[column] - 1;
124 } else {
125 chline = PmtToChannelExtendedBarrel[line] - 1;
126 chcolumn = PmtToChannelExtendedBarrel[column] - 1;
127 }
128 }
129 m_alphaMatrix->m[Ros - 1][Drawer][chline][chcolumn] = pippo;
130 }
131 }
132 }
133 fclose(alpha_file);
134 }
135 }
136
137 if (m_useMeanFiles) {
138 // read mean
139 int nSamples = 7;
140 FILE* MeanFile[4][64];
141 // cicle over 4 partitions and 64 modules
142 for (int Ros = 1; Ros < 5; ++Ros) {
143 for (int Drawer = 0; Drawer < 64; ++Drawer) {
144 // open file which corresponds to Mean[Ros][Drawer]
145 if (Ros == 1)
146 sprintf(Rosstr, "LBA");
147 else if (Ros == 2)
148 sprintf(Rosstr, "LBC");
149 else if (Ros == 3)
150 sprintf(Rosstr, "EBA");
151 else
152 sprintf(Rosstr, "EBC");
153 sprintf(buff, "%s%s%02d.txt", m_meanFilePrefix.c_str(), Rosstr, Drawer + 1);
154 std::string filestr(buff);
155 std::string file = PathResolver::find_file(buff, "DATAPATH");
156 if (file.size() == 0) {
157 ATH_MSG_VERBOSE ( "Could not find input file " << buff );
158 } else {
159 ATH_MSG_INFO( "Reading file " << file );
160 MeanFile[Ros - 1][Drawer] = fopen(file.c_str(), "r");
161 }
162 if (MeanFile[Ros - 1][Drawer] == NULL) {
163 ATH_MSG_ERROR( "Can't read input Mean files." );
164 return StatusCode::FAILURE;
165 }
166
167 ATH_MSG_DEBUG( " **** Start of Means Read Out" );
168 FILE* mean_file = MeanFile[Ros - 1][Drawer];
169 //if(fgets(buff, sizeof(buff), mean_file) != NULL) {
170 // if (lDebug)
171 // log << MSG::DEBUG << "Vector is being loaded: "<< buff << endmsg;
172 //}
173 // load tokens to be searched for in a string
174 const char* TOKENS = { " \t\n" };
175 // read Vector
176 int dima = 48;
177 char* saveptr = nullptr;
178 for (int line = 0; line < dima; line++) {
179 if (fgets(buff, sizeof(buff), mean_file) != NULL) {
180 ATH_MSG_DEBUG( "line " << line << " is " << buff );
181 for (int Sample = 0; Sample < nSamples; Sample++) {
182 // Check for comment lines
183 if (*buff == '!' || *buff == '*') continue;
184 // read value
185 double pippo = 0;
186 if (const char* word = strtok_r(Sample==0 ? buff : nullptr, TOKENS, &saveptr))
187 {
188 pippo = atof(word);
189 }
190
191 ATH_MSG_VERBOSE ( "elem " << Sample << " is " << pippo );
192 int chline = line;
193 // read lines of mean matrix in pmt order but save it in channel order if m_pmtOrder is true
194 if (m_pmtOrder) {
195 if (Ros < 3) chline = PmtToChannelBarrel[line] - 1;
196 else chline = PmtToChannelExtendedBarrel[line] - 1;
197 }
198 m_meanSamples[Ros - 1][Drawer][chline][Sample] = pippo;
199 }
200 }
201 }
202 fclose(mean_file);
203 }
204 }
205 } else {
206 // Initialize mean
207 int nSamples = 7;
208 for (int Ros = 1; Ros < 5; ++Ros) {
209 for (int Drawer = 0; Drawer < 64; ++Drawer) {
210 for (int Channel = 0; Channel < 48; ++Channel) {
211 for (int Sample = 0; Sample < nSamples; ++Sample) {
212 //MeanSamples[Ros-1][Drawer][Channel][Sample]=50.;
213 m_meanSamples[Ros - 1][Drawer][Channel][Sample] = -1.;
214 }
215 }
216 }
217 }
218 }
219
220 // read sample 3 RMS
221 FILE* Sample3RMSFile[4][64];
222 // cicle over 4 partitions and 64 modules
223 for (int Ros = 1; Ros < 5; ++Ros) {
224 for (int Drawer = 0; Drawer < 64; ++Drawer) {
225 // open file which corresponds to Sample3RMS[Ros][Drawer]
226 if (Ros == 1) sprintf(Rosstr, "LBA");
227 else if (Ros == 2) sprintf(Rosstr, "LBC");
228 else if (Ros == 3) sprintf(Rosstr, "EBA");
229 else sprintf(Rosstr, "EBC");
230
231 sprintf(buff, "%s%s%02d.txt", m_sample3RMSFilePrefix.c_str(), Rosstr, Drawer + 1);
232 std::string filestr(buff);
233 std::string file = PathResolver::find_file(buff, "DATAPATH");
234 if (file.size() == 0) {
235 ATH_MSG_VERBOSE ( "Could not find input file " << buff );
236 } else {
237 ATH_MSG_INFO( "Reading file " << file );
238 Sample3RMSFile[Ros - 1][Drawer] = fopen(file.c_str(), "r");
239 }
240 if (Sample3RMSFile[Ros - 1][Drawer] == NULL) {
241 ATH_MSG_ERROR( "Can't read input sample 3 RMS files." );
242 return StatusCode::FAILURE;
243 }
244
245 ATH_MSG_DEBUG( " **** Start of sample 3 RMS Read Out" );
246 FILE* rms_file = Sample3RMSFile[Ros - 1][Drawer];
247 //if(fgets(buff, sizeof(buff), rms_file) != NULL) {
248 // if (lDebug)
249 // log << MSG::DEBUG << "Vector is being loaded: "<< buff << endmsg;
250 //}
251 // load tokens to be searched for in a string
252 char* word;
253 const char* TOKENS = { " \t\n" };
254 // read Vector
255 int dima = 48;
256 for (int line = 0; line < dima; line++) {
257 if (fgets(buff, sizeof(buff), rms_file) != NULL) {
258 ATH_MSG_DEBUG( "line " << line << " is " << buff );
259 // Check for comment lines
260 if (*buff == '!' || *buff == '*') continue;
261 // read value
262 double pippo;
263 char* saveptr = nullptr;
264 if ((word = strtok_r(buff, TOKENS, &saveptr)) == NULL) pippo = 0;
265 else pippo = atof(word);
266 // read value
267 ATH_MSG_VERBOSE ( "elem is " << pippo );
268 int chline = line;
269 // read rms vector in pmt order but save it in channel order if m_pmtOrder is true
270 if (m_pmtOrder) {
271 if (Ros < 3) chline = PmtToChannelBarrel[line] - 1;
272 else chline = PmtToChannelExtendedBarrel[line] - 1;
273 }
274 m_sample3RMS[Ros - 1][Drawer][chline] = pippo;
275 }
276 }
277 fclose(rms_file);
278 }
279 }
280
281 ATH_CHECK( m_inputDigitsContainerKey.initialize() );
283
284 if (!m_useMeanFiles) {
285 ATH_CHECK( m_tileToolNoiseSample.retrieve() );
286 }
287
288 ATH_MSG_INFO( "Initialization completed successfully" );
289
290 return StatusCode::SUCCESS;
291}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
double atof(std::string_view str)
Converts a string into a double / float.
TFile * file

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_alphaMatrix

std::unique_ptr<AlphaMatrix> TileRawCorrelatedNoise::m_alphaMatrix
private

Definition at line 66 of file TileRawCorrelatedNoise.h.

◆ m_alphaMatrixFilePrefix

std::string TileRawCorrelatedNoise::m_alphaMatrixFilePrefix
private

Definition at line 58 of file TileRawCorrelatedNoise.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_inputDigitsContainerKey

SG::ReadHandleKey<TileDigitsContainer> TileRawCorrelatedNoise::m_inputDigitsContainerKey
private
Initial value:
{this, "TileDigitsContainer",
"TileDigitsCnt",
"Input Tile digits container key"}

Definition at line 46 of file TileRawCorrelatedNoise.h.

46 {this, "TileDigitsContainer",
47 "TileDigitsCnt",
48 "Input Tile digits container key"};

◆ m_meanFilePrefix

std::string TileRawCorrelatedNoise::m_meanFilePrefix
private

Definition at line 60 of file TileRawCorrelatedNoise.h.

◆ m_meanSamples

float TileRawCorrelatedNoise::m_meanSamples[4][64][48][7] {}
private

Definition at line 67 of file TileRawCorrelatedNoise.h.

67{};

◆ m_nRMS_threshold

float TileRawCorrelatedNoise::m_nRMS_threshold
private

Definition at line 55 of file TileRawCorrelatedNoise.h.

◆ m_outputDigitsContainerKey

SG::WriteHandleKey<TileDigitsContainer> TileRawCorrelatedNoise::m_outputDigitsContainerKey
private
Initial value:
{this, "OutputTileDigitsContainer",
"NewDigitsContainer",
"Output Tile digits container key"}

Definition at line 50 of file TileRawCorrelatedNoise.h.

50 {this, "OutputTileDigitsContainer",
51 "NewDigitsContainer",
52 "Output Tile digits container key"};

◆ m_pmtOrder

bool TileRawCorrelatedNoise::m_pmtOrder
private

Definition at line 71 of file TileRawCorrelatedNoise.h.

◆ m_sample3RMS

float TileRawCorrelatedNoise::m_sample3RMS[4][64][48] {}
private

Definition at line 68 of file TileRawCorrelatedNoise.h.

68{};

◆ m_sample3RMSFilePrefix

std::string TileRawCorrelatedNoise::m_sample3RMSFilePrefix
private

Definition at line 59 of file TileRawCorrelatedNoise.h.

◆ m_tileToolNoiseSample

ToolHandle<TileCondToolNoiseSample> TileRawCorrelatedNoise::m_tileToolNoiseSample
private
Initial value:
{this,
"TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"}

Definition at line 73 of file TileRawCorrelatedNoise.h.

73 {this,
74 "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"};

◆ m_useMeanFiles

bool TileRawCorrelatedNoise::m_useMeanFiles
private

Definition at line 70 of file TileRawCorrelatedNoise.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: