ATLAS Offline Software
Loading...
Searching...
No Matches
LArCondDataTest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
15
16#include "LArCondDataTest.h"
17
19
21
22#include "GaudiKernel/MsgStream.h"
23#include "Gaudi/Property.h"
24#include "GaudiKernel/TypeNameString.h"
25
35#include "LArElecCalib/ILArOFC.h"
36
39
40
42// DESTRUCTOR:
44
47
49// INITIALIZE:
51
53{
54 ATH_CHECK( detStore()->retrieve(m_onlineID) );
55 ATH_CHECK( detStore()->retrieve( m_emid) );
56 ATH_CHECK( m_cablingKey.initialize() );
57 ATH_CHECK( m_CLKey.initialize() );
58 ATH_CHECK( m_RodKey.initialize() );
59
60 ATH_MSG_DEBUG ( "initialize done" );
61 return StatusCode::SUCCESS;
62}
63
65// EXECUTE:
67
68StatusCode LArCondDataTest::execute(const EventContext& ctx)
69{
70 ATH_MSG_DEBUG(" LArCondDataTest::execute() ");
71
73 const LArOnOffIdMapping* cabling{*cablingHdl};
74 if(!cabling){
75 ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key() );
76 return StatusCode::FAILURE;
77 }
79 const LArCalibLineMapping *clCont {*clHdl};
80 if(!clCont){
81 ATH_MSG_ERROR("Do not have calib mapping object " << m_CLKey.key() );
82 return StatusCode::FAILURE;
83 }
85 const LArFebRodMapping *rodCont {*rodHdl};
86 if(!rodCont){
87 ATH_MSG_ERROR("Do not have ROD mapping object " << m_RodKey.key() );
88 return StatusCode::FAILURE;
89 }
90
91 const std::vector<HWIdentifier>& roms = rodCont->getLArRoModIDvec();
92 ATH_MSG_DEBUG ( " Number of LArReadoutModuleIDs= " << roms.size() );
93
94 std::vector<HWIdentifier>::const_iterator it = m_onlineID->channel_begin();
95 std::vector<HWIdentifier>::const_iterator it_end = m_onlineID->channel_end();
96
97 int ntot = it_end-it;
98 ATH_MSG_DEBUG( " Total number of online channels from LArOnlineID "
99 <<ntot );
100
101 int nch = 0;
102 int nconnected = 0;
103 int nerr=0;
104
105 int n_err_uA2MeV=0;
106 int n_err_DAC2uA=0;
107
108
109 const ILArShape* pShape=0;
110 StatusCode sc = detStore()->retrieve(pShape);
111 if (!sc.isSuccess() ){
112 ATH_MSG_ERROR (" Failed to retrieve ILArShape from DetStore");
113 }
114
115
116 const ILArNoise* pNoise=0;
117 sc = detStore()->retrieve(pNoise);
118 if (!sc.isSuccess() ){
119 ATH_MSG_ERROR (" Failed to retrieve ILArNoise from DetStore");
120 }
121
122
123 const ILArRamp* pRamp=0;
124 sc = detStore()->retrieve(pRamp);
125 if (!sc.isSuccess() ){
126 ATH_MSG_ERROR (" Failed to retrieve ILArRamp from DetStore");
127 }
128
129 const ILArDAC2uA* pDAC2uA=0;
130 sc = detStore()->retrieve(pDAC2uA);
131 if (!sc.isSuccess() ){
132 ATH_MSG_ERROR (" Failed to retrieve ILArDAC2uA from DetStore");
133 }
134
135 const ILAruA2MeV* puA2MeV=0;
136 sc = detStore()->retrieve(puA2MeV);
137 if (!sc.isSuccess() ){
138 ATH_MSG_ERROR (" Failed to retrieve ILAruA2MeV from DetStore");
139 }
140
141 const ILArAutoCorr* pAutoCorr=0;
142 sc = detStore()->retrieve(pAutoCorr);
143 if (!sc.isSuccess() ){
144 ATH_MSG_ERROR (" Failed to retrieve ILArAutoCorr from DetStore");
145 }
146
147 const ILArPedestal* pPedestal=0;
148 sc = detStore()->retrieve(pPedestal);
149 if (!sc.isSuccess() ){
150 ATH_MSG_ERROR (" Failed to retrieve ILArPedestal from DetStore");
151 }
152
153 const ILArfSampl* pfSampl=0;
154 sc = detStore()->retrieve(pfSampl);
155 if (!sc.isSuccess() ){
156 ATH_MSG_ERROR (" Failed to retrieve ILArfSampl from DetStore");
157 }
158
159
160 const ILArMinBias* pMinBias=0;
161 sc = detStore()->retrieve(pMinBias);
162 if (!sc.isSuccess() ){
163 ATH_MSG_ERROR (" Failed to retrieve ILArMinBias from DetStore");
164 }
165
166
167 for(;it!=it_end;++it) {
168 HWIdentifier sid = *it;
169 try {
170
171 if(! cabling->isOnlineConnected(sid))
172 continue;
173
174 if(m_onlineID->barrel_ec(sid)==1)
175 {// endcap
176 if(m_onlineID->feedthrough(sid)==6)
177 { // fcal
178 ATH_MSG_DEBUG( " FCAL sid "<<sid);
179 m_emid->print(sid);
180 }
181 }
182
183 ++nconnected;
184 Identifier id = cabling->cnvToIdentifier(sid);
185 HWIdentifier sid2 =cabling->createSignalChannelID(id);
186 ++nch ;
187 if( sid !=sid2 ) {
188 ATH_MSG_ERROR( " HWIdentifier mismatch, sid "
189 <<" "<<sid<<" "<<m_onlineID->show_to_string(sid)
190 <<" offline id = "<< id <<" "<<m_onlineID->show_to_string(id)
191 <<" sid2 = "<< sid2 <<" "<<m_onlineID->show_to_string(sid2)
192 );
193 ++nerr;
194 }
195 else { // good identifier, test conditions objects
196
197 // check Calibration Slot and Channel
198 const std::vector<HWIdentifier>&
199 calib = clCont->calibSlotLine(sid) ;
200 if(calib.size()==0) {
201 ATH_MSG_ERROR( " No calibration for this channel,hdw id="
202 <<sid.get_compact() );
203 }
204 else {
205 ATH_MSG_VERBOSE( " Calib ID ="<<m_onlineID->show_to_string(calib[0]) );
206 }
207
208 const ILArRamp::RampRef_t v = pRamp->ADC2DAC(sid, 0 );
209
210 if(v.size()!=3) {
211 ATH_MSG_ERROR( " Failed to find ramp, hdw id = "
212 <<sid.get_compact() <<" "<< id.get_compact() );
213 m_emid->print(id);
214 }
215
216 float f = puA2MeV->UA2MEV( sid ) ;
217 if(f == ILAruA2MeV::ERRORCODE)
218 {
219 ATH_MSG_ERROR( " Failed to find uA2MeV, hdw id = "
220 <<sid.get_compact() );
221 ++n_err_uA2MeV;
222 }
223 f = pDAC2uA->DAC2UA( sid ) ;
224 if(f == ILArDAC2uA::ERRORCODE)
225 {
226 ATH_MSG_ERROR( " Failed to find DAC2uA, hdw id = "
227 <<sid.get_compact() );
228 ++n_err_DAC2uA;
229 }
230 f = pNoise->noise( sid , 0 ) ;
231 if( f == ILArNoise::ERRORCODE )
232 {
233 ATH_MSG_ERROR( " Failed to find Noise, hdw id = "
234 <<sid.get_compact() );
235 }
236
237 ILArAutoCorr::AutoCorrRef_t v2 = pAutoCorr->autoCorr(sid, 0 );
238 if(v2.size()!=4) {
239 ATH_MSG_ERROR( " Failed to find AutoCorr, hdw id = "
240 <<sid.get_compact() );
241 }
242
243
244 ILArShape::ShapeRef_t vShape=pShape->Shape(sid, 0,m_tbin);
245 ILArShape::ShapeRef_t vShapeDer=pShape->ShapeDer(sid, 0,m_tbin );
246 if(vShape.size() ==0 || vShapeDer.size() == 0 ) {
247 ATH_MSG_ERROR( " Failed to get Shape or ShapeDer, hdw id = "
248 <<sid.get_compact() << " size = " << vShape.size() << " " << vShapeDer.size());
249 } else
250 {
251 if (msgLvl(MSG::VERBOSE)) {
252 msg()<<MSG::VERBOSE<< " hdw id "<<sid.get_compact() <<endmsg;
253 msg()<<MSG::VERBOSE<<" Shape= " ;
254 for (unsigned int i=0; i < vShape.size(); ++i){
255 msg()<<" " << vShape[i] ;
256 }
257 msg()<<endmsg;
258 msg()<<MSG::VERBOSE<<" ShapeDer=" ;
259 for (unsigned int i=0; i < vShapeDer.size(); ++i){
260 msg()<<" " << vShapeDer[i] ;
261 }
262 msg()<<endmsg;
263 }
264 }
265
266
267 // pedestal
268 float vPed = pPedestal->pedestal( sid,0 ) ;
269 if(vPed <= (1.0+LArElecCalib::ERRORCODE)) {
270 ATH_MSG_ERROR( " Failed to find pedestal, hdw id = "
271 <<sid.get_compact() );
272 }
273
274 // fSampl
275 float fs = pfSampl->FSAMPL( sid ) ;
276 ATH_MSG_VERBOSE( " fsample and hdw id ="<<fs<<" " <<sid.get_compact() );
277
279 ATH_MSG_ERROR( " Failed to find fSampl, hdw id = "
280 <<sid.get_compact() );
281 }
282
283 // MinBias
284 float mbs = pMinBias->minBiasRMS( sid ) ;
285 if( mbs== ILArMinBias::ERRORCODE) {
286 ATH_MSG_ERROR( " Failed to find MinBias, hdw id = "
287 <<sid.get_compact() );
288 }
289
290 }
291 }
292 catch (LArID_Exception& except) {
293 // this is allowed.
294 std::string err = m_onlineID->print_to_string(sid);
295 ATH_MSG_VERBOSE( (std::string)except << sid.get_identifier32().get_compact());
296 ATH_MSG_VERBOSE( err );
297 }
298 }
299 ATH_MSG_DEBUG (" Number of Connected Channel ID = " <<nconnected );
300 ATH_MSG_DEBUG (" Number of Valid Channel ID = " <<nch );
301 if(nerr>0) ATH_MSG_ERROR (" Number channels with incorrect mapping= " <<nerr );
302
303 if (n_err_uA2MeV!=0)
304 ATH_MSG_DEBUG (" Number of channels without uA2MeV "<<n_err_uA2MeV);
305 if (n_err_DAC2uA!=0)
306 ATH_MSG_DEBUG (" Number of channels without DAC2uA"<<n_err_DAC2uA);
307
308 return StatusCode::SUCCESS;
309}
310
311
313// FINALIZE:
314// Note that it is NOT NECESSARY to run the finalize of individual
315// sub-algorithms. The framework takes care of it.
317
319{
320 ATH_MSG_DEBUG ( " finalize ");
321
322 if(!m_fixShape)
323 return StatusCode::SUCCESS;
324
325 return StatusCode::SUCCESS;
326
327}
328
329
330// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_VERBOSE(x,...)
This file contains an algorithm for testing lar conditions data access.
This file defines the template class used for I/O of conditions data.
static Double_t fs
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
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 & DAC2UA(const HWIdentifier &id) const =0
access to DAC2UA conversion factor index by Identifier, and gain setting
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 pedestal(const HWIdentifier &id, int gain) const =0
virtual RampRef_t ADC2DAC(const HWIdentifier &id, int gain) const =0
LArVectorProxy RampRef_t
This class defines the interface for accessing Ramp @stereotype Interface.
Definition ILArRamp.h:31
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
Definition ILArShape.h:26
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
virtual const float & FSAMPL(const HWIdentifier &id) const =0
virtual const float & UA2MEV(const HWIdentifier &id) const =0
value_type get_compact() const
Get the compact id.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
const LArOnlineID * m_emid
Gaudi::Property< int > m_tbin
Gaudi::Property< bool > m_fixShape
StatusCode finalize()
SG::ReadCondHandleKey< LArFebRodMapping > m_RodKey
const LArOnlineID * m_onlineID
StatusCode initialize()
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
StatusCode execute(const EventContext &ctx)
Execute method.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const std::vector< HWIdentifier > & getLArRoModIDvec() const
"iterator" on LArReadoutModuleIDs
Exception class for LAr Identifiers.