ATLAS Offline Software
Loading...
Searching...
No Matches
LArOFCAlg.h
Go to the documentation of this file.
1
2//Dear emacs, this is -*- c++ -*-
3
4/*
5 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
6*/
7
8#ifndef LARCALIBUTILS_LAROFCALGORITHM_H
9#define LARCALIBUTILS_LAROFCALGORITHM_H
10
11
13#include "GaudiKernel/ToolHandle.h"
15
17#include "LArCOOLConditions/LArDSPConfig.h" //unique_ptr template param with no explicit d'tor
20
21#include <Eigen/Dense> //Eigen::MatrixXd
22
23#include "tbb/blocked_range.h"
24#include "tbb/global_control.h"
25
26#include <memory>
27#include <vector>
28#include <string>
29
31
32class LArOnlineID_Base;
36class LArWaveCumul;
37
38
40 //Acutally this algo can do internal multi-threading at finalize
41 //but not the way regular athenaMT works, so the thread-safety checker complains
42public:
43
44 LArOFCAlg (const std::string& name, ISvcLocator* pSvcLocator);
45 StatusCode initialize();
46 StatusCode execute() {return StatusCode::SUCCESS;}
47 virtual StatusCode stop();
48 StatusCode finalize(){return StatusCode::SUCCESS;}
49
50private:
51
52 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
53 SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"ScCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"};
54
56 , "CaloDetDescrManager"
57 , "CaloDetDescrManager"
58 , "SG Key for CaloDetDescrManager in the Condition Store" };
59
61 , "CaloSuperCellDetDescrManager"
62 , "CaloSuperCellDetDescrManager"
63 , "SG Key for CaloSuperCellDetDescrManager in the Condition Store" };
64
66 //Input:
69 unsigned gain;
70
71 //Output:
72 std::vector<std::vector<float> > ofc_a;
73 std::vector<std::vector<float> > ofc_b;
74
75 std::vector<std::vector<float> > ofcV2_a;
76 std::vector<std::vector<float> > ofcV2_b;
77
78 std::vector<std::vector<float> >shape;
79 std::vector<std::vector<float> >shapeDer;
80
81 float tstart;
83 unsigned phasewMaxAt3;
86
87
88 perChannelData_t(const LArWaveCumul* wave, const HWIdentifier hi, const unsigned g) :
89 inputWave(wave), chid(hi), gain(g),tstart(0), timeBinWidthOFC(25./24), phasewMaxAt3(0), faultyOFC(false), shortWave(false) {};
90
91 };
92
93
94 std::vector<perChannelData_t> m_allChannelData;
95
96 static void optFilt(const std::vector<float> &gWave_in, const std::vector<float> &gDerivWave_in, const Eigen::MatrixXd& autoCorrInv, //input variables
97 std::vector<float>& OFCa, std::vector<float>& OFCb // Output variables;
98 ) ;
99
100 static void optFiltDelta(const std::vector<float> &gWave_in, const std::vector<float> &gDerivWave_in, const Eigen::MatrixXd& autoCorrInv,
101 const Eigen::VectorXd& delta, //input variables
102 std::vector<float>& vecOFCa, std::vector<float>& vecOFCb // Output variables;
103 ) ;
104
105 static void optFiltPed(const std::vector<float> &gWave_in, const std::vector<float> &gDerivWave_in, const Eigen::MatrixXd& autoCorrInv, //input variables
106 std::vector<float>& OFCa, std::vector<float>& OFCb // Output variables;
107 ) ;
108
109 void process(perChannelData_t&, const LArOnOffIdMapping* cabling) const;
110
111
112 bool verify(const HWIdentifier chid, const std::vector<float>& OFCa, const std::vector<float>& OFCb,
113 const std::vector<float>& Shape, const char* ofcversion, const unsigned phase) const;
114
115 static void printOFCVec(const std::vector<float>& vec, MsgStream& mLog) ;
116
117
118 StatusCode initPhysWaveContainer(const LArOnOffIdMapping* cabling);
119 StatusCode initCaliWaveContainer();
120
121 unsigned int m_nPoints{0};
122
123 StringProperty m_dumpOFCfile{this, "DumpOFCfile", ""};
124 StringArrayProperty m_keylist{this, "KeyList", {}, "List of keys to process"};
125 BooleanProperty m_verify{this, "Verify", true, "Verufy OFCs after computation"};
126 BooleanProperty m_normalize{this, "Normalize", false, "Normalize input wave"};
127 BooleanProperty m_timeShift{this, "TimeShift", false, "Shifting input wave"};
128 IntegerProperty m_timeShiftByIndex{this, "TimeShiftByIndex", -1, "shifting by n bins input wave"} ;
129
130
132
133 UnsignedIntegerProperty m_nSamples{this, "Nsample", 5, "How many sample to compute"};
134 UnsignedIntegerProperty m_nPhases{this, "Nphase", 50, "How many sphases to compute"};
135 UnsignedIntegerProperty m_dPhases{this, "Dphase", 1, "Number of samples between two neighboring phases (OFC sets)"};
136 UnsignedIntegerProperty m_nDelays{this, "Ndelay", 24, "Number of delays in one clock"};
137 FloatProperty m_addOffset{this, "AddTimeOffset", 0., "Time offset to add"} ;
138
139 ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoder{this,"DecoderTool",{} };
140 ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoderV2{this,"DecoderToolV2", {} };
141
145
146 DoubleProperty m_errAmpl{this, "ErrAmplitude", 0.01, "Allowed amplitude difference in check"};
147 DoubleProperty m_errTime{this, "ErrTime", 0.01, "Allowed time difference in check"};
148
149 BooleanProperty m_readCaliWave{this, "ReadCaliWave", true, "If false PhysWave is input"};
150 BooleanProperty m_fillShape{this, "FillShape", false, "Fill also shape object"};
151 StringProperty m_ofcKey{this, "KeyOFC", "LArOFC", "Output key non-pileup OFCs"};
152 StringProperty m_ofcKeyV2{this, "KeyOFCV2", "LArOFCV2", "Output key pileup OFCs"};
153 StringProperty m_shapeKey{this, "KeyShape", "LArShape", "Output key Shape object"};
154 BooleanProperty m_storeMaxPhase{this,"StoreMaxPhase", false, "Store phase of input wave max.?"};
155 StringProperty m_ofcBinKey{this, "LArOFCBinKey", "LArOFCPhase","Key for storing OFCBin object for MAx phase"};
156
157 StringProperty m_groupingType{this, "GroupingType", "SubDetector","Which grouping type to use"};
158 StringProperty m_larPhysWaveBinKey{this,"LArPhysWaveBinKey", "", "Key for object to choose bin"};
159
160 IntegerProperty m_useDelta{this, "UseDelta", 0, "0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3"};
161 IntegerProperty m_useDeltaV2{this, "UseDeltaV2", 0, "Same af before for Delta"};
162 BooleanProperty m_computeV2{this, "ComputeOFCV2", false, "Compute pileup OFCs?"};
163 BooleanProperty m_computePed{this, "ComputeOFCPed", false, "Compute OFCs with additional constraint to pedestal?"};
164 IntegerProperty m_nThreads{this, "nThreads", -1, "-1: No TBB, 0: Let TBB decide, >0 number of threads"};
165
166 BooleanProperty m_readDSPConfig{this, "ReadDSPConfig", false, "Read DSPConfig object ?"};
167 StringProperty m_DSPConfigFolder{this,"DSPConfigFolder","/LAR/Configuration/DSPConfiguration", "Folder for DSPConfig object"};
168 std::unique_ptr<LArDSPConfig> m_DSPConfig;
169
170 BooleanProperty m_forceShift{this, "ForceShift", false, "Forcing shift of input wave ?"};
171
172 BooleanProperty m_isSC{this, "isSC", false, "Running on cells or supercells?"};
173
174 Eigen::VectorXd getDelta(std::vector<float>& samples, const HWIdentifier chid, unsigned nSamples) const;
175
176
177
178 bool useDelta(const HWIdentifier chid, const int jobOFlag, const LArOnOffIdMapping* cabling) const;
179
180 static const float m_fcal3Delta[5];
181 static const float m_fcal2Delta[5];
182 static const float m_fcal1Delta[5];
183
184
185 //Functor for processing with TBB
187 //The way this class gets used is actually thread-safe
188 public:
189 Looper(std::vector<perChannelData_t>* p, const LArOnOffIdMapping* cabling, const LArOFCAlg* a) : m_perChanData(p), m_cabling(cabling), m_ofcAlg(a) {};
190 void operator() (tbb::blocked_range<size_t>& r) const {
191 for (size_t i=r.begin();i!=r.end();++i) {
192 m_ofcAlg->process(m_perChanData->at(i),m_cabling);
193 }
194 }
195 private:
196 std::vector<perChannelData_t>* m_perChanData;
199 };
200};
201
202
203#endif
204
Definition of CaloDetDescrManager.
std::vector< size_t > vec
static Double_t a
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:
Liquid Argon Cumulative Wave Container.
const LArOFCAlg * m_ofcAlg
Definition LArOFCAlg.h:198
Looper(std::vector< perChannelData_t > *p, const LArOnOffIdMapping *cabling, const LArOFCAlg *a)
Definition LArOFCAlg.h:189
std::vector< perChannelData_t > * m_perChanData
Definition LArOFCAlg.h:196
const LArOnOffIdMapping * m_cabling
Definition LArOFCAlg.h:197
UnsignedIntegerProperty m_nSamples
Definition LArOFCAlg.h:133
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition LArOFCAlg.h:55
DoubleProperty m_errAmpl
Definition LArOFCAlg.h:146
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Definition LArOFCAlg.h:53
BooleanProperty m_verify
Definition LArOFCAlg.h:125
UnsignedIntegerProperty m_nDelays
Definition LArOFCAlg.h:136
BooleanProperty m_timeShift
Definition LArOFCAlg.h:127
ToolHandle< ILArAutoCorrDecoderTool > m_AutoCorrDecoder
Definition LArOFCAlg.h:139
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition LArOFCAlg.h:52
StringProperty m_ofcKeyV2
Definition LArOFCAlg.h:152
ToolHandle< ILArAutoCorrDecoderTool > m_AutoCorrDecoderV2
Definition LArOFCAlg.h:140
StatusCode initCaliWaveContainer()
IntegerProperty m_timeShiftByIndex
Definition LArOFCAlg.h:128
UnsignedIntegerProperty m_nPhases
Definition LArOFCAlg.h:134
std::unique_ptr< LArDSPConfig > m_DSPConfig
Definition LArOFCAlg.h:168
DoubleProperty m_errTime
Definition LArOFCAlg.h:147
const CaloDetDescrManager_Base * m_calo_dd_man
Definition LArOFCAlg.h:142
StringProperty m_ofcBinKey
Definition LArOFCAlg.h:155
BooleanProperty m_fillShape
Definition LArOFCAlg.h:150
IntegerProperty m_useDelta
Definition LArOFCAlg.h:160
BooleanProperty m_computeV2
Definition LArOFCAlg.h:162
const LArOnlineID_Base * m_onlineID
Definition LArOFCAlg.h:143
BooleanProperty m_readCaliWave
Definition LArOFCAlg.h:149
UnsignedIntegerProperty m_dPhases
Definition LArOFCAlg.h:135
IntegerProperty m_useDeltaV2
Definition LArOFCAlg.h:161
std::vector< perChannelData_t > m_allChannelData
Definition LArOFCAlg.h:94
StatusCode initPhysWaveContainer(const LArOnOffIdMapping *cabling)
const LArOFCBinComplete * m_larPhysWaveBin
Definition LArOFCAlg.h:144
static void optFilt(const std::vector< float > &gWave_in, const std::vector< float > &gDerivWave_in, const Eigen::MatrixXd &autoCorrInv, std::vector< float > &OFCa, std::vector< float > &OFCb)
static void optFiltPed(const std::vector< float > &gWave_in, const std::vector< float > &gDerivWave_in, const Eigen::MatrixXd &autoCorrInv, std::vector< float > &OFCa, std::vector< float > &OFCb)
BooleanProperty m_readDSPConfig
Definition LArOFCAlg.h:166
StringProperty m_DSPConfigFolder
Definition LArOFCAlg.h:167
BooleanProperty m_forceShift
Definition LArOFCAlg.h:170
StatusCode finalize()
Definition LArOFCAlg.h:48
StringProperty m_larPhysWaveBinKey
Definition LArOFCAlg.h:158
FloatProperty m_addOffset
Definition LArOFCAlg.h:137
BooleanProperty m_storeMaxPhase
Definition LArOFCAlg.h:154
StringProperty m_shapeKey
Definition LArOFCAlg.h:153
bool verify(const HWIdentifier chid, const std::vector< float > &OFCa, const std::vector< float > &OFCb, const std::vector< float > &Shape, const char *ofcversion, const unsigned phase) const
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
Definition LArOFCAlg.h:60
static void printOFCVec(const std::vector< float > &vec, MsgStream &mLog)
StringProperty m_ofcKey
Definition LArOFCAlg.h:151
StringProperty m_dumpOFCfile
Definition LArOFCAlg.h:123
BooleanProperty m_computePed
Definition LArOFCAlg.h:163
BooleanProperty m_normalize
Definition LArOFCAlg.h:126
BooleanProperty m_isSC
Definition LArOFCAlg.h:172
StatusCode execute()
Definition LArOFCAlg.h:46
StringArrayProperty m_keylist
Definition LArOFCAlg.h:124
unsigned int m_nPoints
Definition LArOFCAlg.h:121
LArCaliWaveContainer * m_waveCnt_nc
Definition LArOFCAlg.h:131
LArOFCAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition LArOFCAlg.cxx:40
StringProperty m_groupingType
Definition LArOFCAlg.h:157
static void optFiltDelta(const std::vector< float > &gWave_in, const std::vector< float > &gDerivWave_in, const Eigen::MatrixXd &autoCorrInv, const Eigen::VectorXd &delta, std::vector< float > &vecOFCa, std::vector< float > &vecOFCb)
IntegerProperty m_nThreads
Definition LArOFCAlg.h:164
Helper for the Liquid Argon Calorimeter cell identifiers.
const std::string process
int r
Definition globals.cxx:22
void initialize()
std::vector< std::vector< float > > ofcV2_a
Definition LArOFCAlg.h:75
perChannelData_t(const LArWaveCumul *wave, const HWIdentifier hi, const unsigned g)
Definition LArOFCAlg.h:88
std::vector< std::vector< float > > ofc_b
Definition LArOFCAlg.h:73
std::vector< std::vector< float > > shapeDer
Definition LArOFCAlg.h:79
std::vector< std::vector< float > > ofcV2_b
Definition LArOFCAlg.h:76
std::vector< std::vector< float > > shape
Definition LArOFCAlg.h:78
std::vector< std::vector< float > > ofc_a
Definition LArOFCAlg.h:72
const LArWaveCumul * inputWave
Definition LArOFCAlg.h:67