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