]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONCalibrationData.cxx
Coverity fix
[u/mrichter/AliRoot.git] / MUON / AliMUONCalibrationData.cxx
CommitLineData
c5bdf179 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16// $Id$
17
18#include "AliMUONCalibrationData.h"
19
20#include "AliCDBEntry.h"
21#include "AliCDBManager.h"
4bec0403 22#include "AliCodeTimer.h"
32f1b761 23#include "AliDCSValue.h"
c5bdf179 24#include "AliLog.h"
32f1b761 25#include "AliMpDCSNamer.h"
26#include "AliMUONConstants.h"
27#include "AliMUONGlobalCrateConfig.h"
28#include "AliMUONRegionalTriggerConfig.h"
0045b488 29#include "AliMUONRejectList.h"
e7d7fa47 30#include "AliMUONTriggerEfficiencyCells.h"
31#include "AliMUONTriggerLut.h"
32f1b761 32#include "AliMUONVCalibParam.h"
a0eca509 33#include "AliMUONVStore.h"
34#include "AliMUONVStore.h"
92c23b09 35
4bec0403 36#include <Riostream.h>
37#include <TClass.h>
38#include <TMap.h>
c5bdf179 39
3d1463c8 40//-----------------------------------------------------------------------------
5398f946 41/// \class AliMUONCalibrationData
42///
48ed403b 43/// For the moment, this class stores pedestals, gains, hv (for tracker)
44/// and lut, masks and efficiencies (for trigger) that are fetched from the CDB.
e7d7fa47 45///
46/// This class is to be considered as a convenience class.
47/// Its aim is to ease retrieval of calibration data from the
48/// condition database.
49///
50/// It acts as a "facade" to a bunch of underlying
51/// containers/calibration classes.
52///
5398f946 53/// \author Laurent Aphecetche
3d1463c8 54//-----------------------------------------------------------------------------
e7d7fa47 55
5398f946 56/// \cond CLASSIMP
c5bdf179 57ClassImp(AliMUONCalibrationData)
5398f946 58/// \endcond
c5bdf179 59
9ee1d6ff 60AliMUONVStore* AliMUONCalibrationData::fgBypassPedestals(0x0);
61AliMUONVStore* AliMUONCalibrationData::fgBypassGains(0x0);
8f29b706 62
c5bdf179 63//_____________________________________________________________________________
64AliMUONCalibrationData::AliMUONCalibrationData(Int_t runNumber,
65 Bool_t deferredInitialization)
66: TObject(),
67fIsValid(kTRUE),
68fRunNumber(runNumber),
69fGains(0x0),
c3ce65fd 70fPedestals(0x0),
48ed403b 71fHV(0x0),
49e110ec 72fTriggerDCS(0x0),
e7d7fa47 73fLocalTriggerBoardMasks(0x0),
92c23b09 74fRegionalTriggerConfig(0x0),
75fGlobalTriggerCrateConfig(0x0),
e7d7fa47 76fTriggerLut(0x0),
c1bbaf66 77fTriggerEfficiency(0x0),
d067ba7c 78fCapacitances(0x0),
2b8a1212 79fNeighbours(0x0),
0045b488 80fOccupancyMap(0x0),
6c870207 81fRejectList(0x0),
82fConfig(0x0)
c5bdf179 83{
5398f946 84/// Default ctor.
85
c3ce65fd 86 // If deferredInitialization is false, we read *all* calibrations
87 // at once.
88 // So when using this class to access only one kind of calibrations (e.g.
89 // only pedestals), you should put deferredInitialization to kTRUE, which
90 // will instruct this object to fetch the data only when neeeded.
5398f946 91
c5bdf179 92 if ( deferredInitialization == kFALSE )
93 {
5562688f 94 Gains();
95 Pedestals();
7eafe398 96 OccupancyMap();
0045b488 97 RejectList();
5562688f 98 HV();
49e110ec 99 TriggerDCS();
5562688f 100 LocalTriggerBoardMasks(0);
92c23b09 101 RegionalTriggerConfig();
102 GlobalTriggerCrateConfig();
5562688f 103 TriggerLut();
104 TriggerEfficiency();
105 Capacitances();
106 Neighbours();
6c870207 107 Config();
c5bdf179 108 }
109}
110
c5bdf179 111//_____________________________________________________________________________
112AliMUONCalibrationData::~AliMUONCalibrationData()
113{
f436adf2 114 /// Destructor. Note that we're the owner of our pointers if the OCDB cache
115 /// is not set. Otherwise the cache is supposed to take care of them...
116 if (!(AliCDBManager::Instance()->GetCacheFlag())) Reset();
c3ce65fd 117}
c3ce65fd 118
119//_____________________________________________________________________________
5562688f 120AliMUONVStore*
121AliMUONCalibrationData::Capacitances() const
c3ce65fd 122{
5562688f 123 /// Create (if needed) and return the internal store for capacitances.
124
125 if (!fCapacitances)
c3ce65fd 126 {
5562688f 127 fCapacitances = CreateCapacitances(fRunNumber);
c3ce65fd 128 }
5562688f 129 return fCapacitances;
c5bdf179 130}
131
132//_____________________________________________________________________________
5562688f 133AliMUONVStore*
143cd71a 134AliMUONCalibrationData::CreateCapacitances(Int_t runNumber, Int_t* startOfValidity)
c5bdf179 135{
5562688f 136 /// Create capa store from OCDB for a given run
137
143cd71a 138 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Capacitances",startOfValidity));
5562688f 139}
5398f946 140
5562688f 141//_____________________________________________________________________________
142AliMUONVStore*
143cd71a 143AliMUONCalibrationData::CreateGains(Int_t runNumber, Int_t* startOfValidity)
5562688f 144{
145 /// Create a new gain store from the OCDB for a given run
143cd71a 146 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Gains",startOfValidity));
c5bdf179 147}
148
149//_____________________________________________________________________________
92c23b09 150AliMUONGlobalCrateConfig*
143cd71a 151AliMUONCalibrationData::CreateGlobalTriggerCrateConfig(Int_t runNumber, Int_t* startOfValidity)
c5bdf179 152{
92c23b09 153 /// Create the internal store for GlobalTriggerCrateConfig from OCDB
48ed403b 154
143cd71a 155 return dynamic_cast<AliMUONGlobalCrateConfig*>(CreateObject(runNumber,"MUON/Calib/GlobalTriggerCrateConfig",startOfValidity));
48ed403b 156}
157
92c23b09 158
32f1b761 159//______________________________________________________________________________
160void AliMUONCalibrationData::PatchHVValues(TObjArray& values,
161 Int_t& nbelowready,
162 Int_t& noff,
163 Int_t& ntrips,
164 Int_t& neor,
165 TString* msg)
166{
167 /// We do here a little bit of massaging of the HV values, if needed.
168 ///
169 /// The main point is to "gather" the values near the end of the run (the last XX seconds)
170 /// to avoid the ramp-down before end-of-run syndrom...
171 ///
172 /// The rest is more of a debug/expert tool to have closer look at trends
173 ///
174
175 Double_t HVBEAMTUNING(1300);
176
177 Bool_t eorProblem(kFALSE);
178
179 UInt_t mergeDelay(300); // in seconds
180
181 // First start by removing values within the last mergeDelay seconds, keeping only
182 // the last one
183
184 AliDCSValue* last = static_cast<AliDCSValue*>(values.At(values.GetLast()));
185
186 Int_t* toberemoved = new Int_t[values.GetLast()+1];
187
188 memset(toberemoved,0,(values.GetLast()+1)*sizeof(Int_t));
189
190 Int_t ntoberemoved(0);
191
192 for ( Int_t i = values.GetLast()-1; i > 0; --i )
193 {
194 AliDCSValue* val = static_cast<AliDCSValue*>(values.At(i));
195
196 if ( last->GetTimeStamp() - val->GetTimeStamp() < mergeDelay )
197 {
198 toberemoved[i]=1;
199 ++ntoberemoved;
200 }
201 }
202
203 if (ntoberemoved)
204 {
205 // ok, we have some values within the same mergeDelay seconds
206 // we'll "merge" them by taking the last one, except if
207 // the last one is below HVBEAMTUNING, in which case we
208 // remove that one too (meaning the ramp-down was requesting
209 // before the end-of-run)
210
211 if ( last->GetFloat() < HVBEAMTUNING )
212 {
213 eorProblem=kTRUE;
214 if (msg) *msg = "ERROR RAMP-DOWN BEFORE EOR";
215 toberemoved[values.GetLast()]=1;
216 }
217
218 for ( Int_t i = 0; i <= values.GetLast(); ++i )
219 {
220 if ( toberemoved[i] ) values.RemoveAt(i);
221 }
222
223 values.Compress();
224
225 }
226
227 delete[] toberemoved;
228
229 if (eorProblem)
230 {
231 ++neor;
232 return;
233 }
234
235 // now for the rest of the diagnosis
236
237 Int_t ntmpoff(0);
238 Int_t ntmpready(0);
239
240 for ( Int_t i = 0; i <= values.GetLast(); ++i )
241 {
242 AliDCSValue* val = static_cast<AliDCSValue*>(values.At(i));
243
244 if ( val->GetFloat() < AliMpDCSNamer::TrackerHVOFF() )
245 {
246 ++ntmpoff;
247 }
248 else if ( val->GetFloat() < HVBEAMTUNING )
249 {
250 ++ntmpready;
251 }
252 }
253
254 if ( ntmpoff )
255 {
256 if ( ntmpoff == values.GetLast()+1 )
257 {
258 if (msg) *msg = "ERROR HV OFF";
259 ++noff;
260 }
261 else
262 {
263 if (msg) *msg = "ERROR TRIP";
264 ++ntrips;
265 }
266 }
267
268 if ( ntmpready == values.GetLast()+1 )
269 {
270 if (msg) *msg = "ERROR BELOW READY";
271 }
272
273 if (ntmpready) ++nbelowready;
274}
92c23b09 275
c1bbaf66 276//_____________________________________________________________________________
5562688f 277TMap*
32f1b761 278AliMUONCalibrationData::CreateHV(Int_t runNumber, Int_t* startOfValidity, Bool_t patched)
c1bbaf66 279{
5562688f 280 /// Create a new HV map from the OCDB for a given run
32f1b761 281 TMap* hvMap = dynamic_cast<TMap*>(CreateObject(runNumber,"MUON/Calib/HV",startOfValidity));
282 if (patched)
283 {
284 TIter next(hvMap);
285 TObjString* hvChannelName;
286
287 while ( ( hvChannelName = static_cast<TObjString*>(next()) ) )
288 {
289 TString name(hvChannelName->String());
290
291 if ( name.Contains("sw") ) continue; // skip switches
292
293 TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(name.Data()));
294 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
295 if (!values)
296 {
297 AliErrorClass(Form("Could not get values for alias %s",name.Data()));
298 }
299 else
300 {
301 int nbelowready(0);
302 int noff(0);
303 int ntrips(0);
304 int neor(0);
305
306 PatchHVValues(*values,nbelowready,noff,ntrips,neor,0x0);
307 if (neor)
308 {
309 nbelowready=noff=ntrips=neor=0;
310 PatchHVValues(*values,nbelowready,noff,ntrips,neor,0x0);
311 if (neor)
312 {
313 AliErrorClass("neor is not null after PatchHVValue ! This is serious !");
314 }
315 }
316 }
317 }
318
319 }
320 return hvMap;
c1bbaf66 321}
322
49e110ec 323//_____________________________________________________________________________
324TMap*
325AliMUONCalibrationData::CreateTriggerDCS(Int_t runNumber, Int_t* startOfValidity)
326{
327 /// Create a new Trigger HV and curent map from the OCDB for a given run
328 return dynamic_cast<TMap*>(CreateObject(runNumber,"MUON/Calib/TriggerDCS",startOfValidity));
329}
330
d067ba7c 331//_____________________________________________________________________________
a0eca509 332AliMUONVStore*
143cd71a 333AliMUONCalibrationData::CreateLocalTriggerBoardMasks(Int_t runNumber, Int_t* startOfValidity)
d067ba7c 334{
5562688f 335 /// Get the internal store for LocalTriggerBoardMasks from OCDB
336
143cd71a 337 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/LocalTriggerBoardMasks",startOfValidity));
d067ba7c 338}
339
48ed403b 340//_____________________________________________________________________________
a0eca509 341AliMUONVStore*
143cd71a 342AliMUONCalibrationData::CreateNeighbours(Int_t runNumber, Int_t* startOfValidity)
48ed403b 343{
5562688f 344 /// Create a neighbour store from the OCDB for a given run
143cd71a 345 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Neighbours",startOfValidity));
c5bdf179 346}
347
d067ba7c 348//_____________________________________________________________________________
5562688f 349TObject*
143cd71a 350AliMUONCalibrationData::CreateObject(Int_t runNumber, const char* path, Int_t* startOfValidity)
d067ba7c 351{
5562688f 352 /// Access the CDB for a given path (e.g. MUON/Calib/Pedestals),
353 /// and return the corresponding TObject.
d067ba7c 354
99c136e1 355 AliCodeTimerAutoClass(Form("%d : %s",runNumber,path),0);
4bec0403 356
5562688f 357 AliCDBManager* man = AliCDBManager::Instance();
358
465302eb 359 AliCDBEntry* entry = man->Get(path,runNumber);
5562688f 360
5562688f 361 if (entry)
d067ba7c 362 {
143cd71a 363 if ( startOfValidity ) *startOfValidity = entry->GetId().GetFirstRun();
364
4bec0403 365 TObject* object = entry->GetObject();
82586209 366 if (!(man->GetCacheFlag()))
367 {
368 entry->SetOwner(kFALSE);
369 delete entry;
370 }
4bec0403 371 return object;
372 }
143cd71a 373 else
374 {
375 if ( startOfValidity ) *startOfValidity = AliCDBRunRange::Infinity();
376 }
377
0045b488 378 {
379
dd0be8a7 380 AliCodeTimerAutoClass(Form("Failed to get %s for run %d",path,runNumber),1);
0045b488 381
382 }
383
5562688f 384 return 0x0;
d067ba7c 385}
386
2b8a1212 387//_____________________________________________________________________________
388AliMUONVStore*
7eafe398 389AliMUONCalibrationData::CreateOccupancyMap(Int_t runNumber, Int_t* startOfValidity)
2b8a1212 390{
7eafe398 391 /// Create a new occupancy map store from the OCDB for a given run
392 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/OccupancyMap",startOfValidity));
2b8a1212 393}
394
0045b488 395//_____________________________________________________________________________
396AliMUONRejectList*
397AliMUONCalibrationData::CreateRejectList(Int_t runNumber, Int_t* startOfValidity)
398{
399 /// Create a new rejectlist store from the OCDB for a given run
400 return dynamic_cast<AliMUONRejectList*>(CreateObject(runNumber,"MUON/Calib/RejectList",startOfValidity));
401}
402
c1bbaf66 403//_____________________________________________________________________________
a0eca509 404AliMUONVStore*
143cd71a 405AliMUONCalibrationData::CreatePedestals(Int_t runNumber, Int_t* startOfValidity)
c1bbaf66 406{
5562688f 407 /// Create a new pedestal store from the OCDB for a given run
143cd71a 408 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Pedestals",startOfValidity));
c1bbaf66 409}
410
6c870207 411//_____________________________________________________________________________
412AliMUONVStore*
413AliMUONCalibrationData::CreateConfig(Int_t runNumber, Int_t* startOfValidity)
414{
415 /// Create a new config store from the OCDB for a given run
416 return dynamic_cast<AliMUONVStore*>(CreateObject(runNumber,"MUON/Calib/Config",startOfValidity));
417}
418
92c23b09 419
c5bdf179 420//_____________________________________________________________________________
92c23b09 421AliMUONRegionalTriggerConfig*
143cd71a 422AliMUONCalibrationData::CreateRegionalTriggerConfig(Int_t runNumber, Int_t* startOfValidity)
5562688f 423{
92c23b09 424 /// Create the internal store for RegionalTriggerConfig from OCDB
5562688f 425
143cd71a 426 return dynamic_cast<AliMUONRegionalTriggerConfig*>(CreateObject(runNumber,"MUON/Calib/RegionalTriggerConfig",startOfValidity));
5562688f 427}
428
429//_____________________________________________________________________________
430AliMUONTriggerEfficiencyCells*
143cd71a 431AliMUONCalibrationData::CreateTriggerEfficiency(Int_t runNumber, Int_t* startOfValidity)
c5bdf179 432{
5562688f 433 /// Create trigger efficiency object from OCBD
434
143cd71a 435 return dynamic_cast<AliMUONTriggerEfficiencyCells*>(CreateObject(runNumber,"MUON/Calib/TriggerEfficiency",startOfValidity));
5562688f 436}
5398f946 437
5562688f 438//_____________________________________________________________________________
439AliMUONTriggerLut*
143cd71a 440AliMUONCalibrationData::CreateTriggerLut(Int_t runNumber, Int_t* startOfValidity)
5562688f 441{
442 /// Create trigger LUT from OCDB
443
143cd71a 444 return dynamic_cast<AliMUONTriggerLut*>(CreateObject(runNumber,"MUON/Calib/TriggerLut",startOfValidity));
5562688f 445}
446
447//_____________________________________________________________________________
448AliMUONVStore*
449AliMUONCalibrationData::Gains() const
450{
451 /// Create (if needed) and return the internal store for gains.
9ee1d6ff 452 if (fgBypassGains) return fgBypassGains;
8f29b706 453
c5bdf179 454 if (!fGains)
455 {
5562688f 456 fGains = CreateGains(fRunNumber);
c5bdf179 457 }
458 return fGains;
459}
460
e7d7fa47 461//_____________________________________________________________________________
5562688f 462AliMUONVCalibParam*
463AliMUONCalibrationData::Gains(Int_t detElemId, Int_t manuId) const
e7d7fa47 464{
5562688f 465/// Return the gains for a given (detElemId, manuId) pair
466/// Note that, unlike the DeadChannel case, if the result is 0x0, that's an
467/// error (meaning that we should get gains for all channels).
5398f946 468
5562688f 469 AliMUONVStore* gains = Gains();
470 if (!gains)
471 {
472 return 0x0;
473 }
474
475 return static_cast<AliMUONVCalibParam*>(gains->FindObject(detElemId,manuId));
e7d7fa47 476}
477
478//_____________________________________________________________________________
92c23b09 479AliMUONGlobalCrateConfig*
480AliMUONCalibrationData::GlobalTriggerCrateConfig() const
e7d7fa47 481{
92c23b09 482 /// Return the config for the global trigger board.
5562688f 483
92c23b09 484 if (!fGlobalTriggerCrateConfig)
e7d7fa47 485 {
92c23b09 486 fGlobalTriggerCrateConfig = CreateGlobalTriggerCrateConfig(fRunNumber);
e7d7fa47 487 }
92c23b09 488 return fGlobalTriggerCrateConfig;
e7d7fa47 489}
490
92c23b09 491
e7d7fa47 492//_____________________________________________________________________________
5562688f 493TMap*
32f1b761 494AliMUONCalibrationData::HV(Bool_t patched) const
e7d7fa47 495{
5562688f 496 /// Return the calibration for a given (detElemId, manuId) pair
48ed403b 497
5562688f 498 if (!fHV)
e7d7fa47 499 {
32f1b761 500 fHV = CreateHV(fRunNumber,0,patched);
e7d7fa47 501 }
5562688f 502 return fHV;
e7d7fa47 503}
504
49e110ec 505//_____________________________________________________________________________
506TMap*
507AliMUONCalibrationData::TriggerDCS() const
508{
509 /// Return the calibration for a given (detElemId, manuId) pair
510
511 if (!fTriggerDCS)
512 {
513 fTriggerDCS = CreateTriggerDCS(fRunNumber);
514 }
515 return fTriggerDCS;
516}
517
e7d7fa47 518//_____________________________________________________________________________
a0eca509 519AliMUONVStore*
5562688f 520AliMUONCalibrationData::Neighbours() const
e7d7fa47 521{
5562688f 522 /// Create (if needed) and return the internal store for neighbours.
523 if (!fNeighbours)
524 {
525 fNeighbours = CreateNeighbours(fRunNumber);
526 }
527 return fNeighbours;
528}
529
530//_____________________________________________________________________________
531AliMUONVCalibParam*
532AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
533{
534/// Return the masks for a given trigger local board.
5398f946 535
e7d7fa47 536 if (!fLocalTriggerBoardMasks)
537 {
5562688f 538 fLocalTriggerBoardMasks = CreateLocalTriggerBoardMasks(fRunNumber);
539 }
540
541 if ( fLocalTriggerBoardMasks )
542 {
543 AliMUONVCalibParam* ltbm =
544 static_cast<AliMUONVCalibParam*>(fLocalTriggerBoardMasks->FindObject(localBoardNumber));
545 if (!ltbm)
e7d7fa47 546 {
5562688f 547 AliError(Form("Could not get mask for localBoardNumber=%d",localBoardNumber));
e7d7fa47 548 }
5562688f 549 return ltbm;
e7d7fa47 550 }
5562688f 551 return 0x0;
e7d7fa47 552}
553
2b8a1212 554//_____________________________________________________________________________
555AliMUONVStore*
7eafe398 556AliMUONCalibrationData::OccupancyMap() const
2b8a1212 557{
7eafe398 558 /// Get occupancy map
559 if (!fOccupancyMap)
2b8a1212 560 {
7eafe398 561 fOccupancyMap = CreateOccupancyMap(fRunNumber);
2b8a1212 562 }
7eafe398 563 return fOccupancyMap;
2b8a1212 564}
565
0045b488 566//_____________________________________________________________________________
567AliMUONRejectList*
568AliMUONCalibrationData::RejectList() const
569{
570 /// Get reject list
571 if (!fRejectList)
572 {
573 fRejectList = CreateRejectList(fRunNumber);
574 }
575 return fRejectList;
576}
577
8f29b706 578//_____________________________________________________________________________
579void
580AliMUONCalibrationData::BypassStores(AliMUONVStore* ped, AliMUONVStore* gain)
581{
582 /// Force the use of those pedestals and gains
9ee1d6ff 583 fgBypassPedestals = ped;
584 fgBypassGains = gain;
8f29b706 585
586}
587
c5bdf179 588//_____________________________________________________________________________
a0eca509 589AliMUONVStore*
5562688f 590AliMUONCalibrationData::Pedestals() const
c5bdf179 591{
5562688f 592 /// Return pedestals
8f29b706 593
9ee1d6ff 594 if (fgBypassPedestals) return fgBypassPedestals;
8f29b706 595
c5bdf179 596 if (!fPedestals)
597 {
5562688f 598 fPedestals = CreatePedestals(fRunNumber);
c5bdf179 599 }
600 return fPedestals;
601}
602
6c870207 603//_____________________________________________________________________________
604AliMUONVStore*
605AliMUONCalibrationData::Config() const
606{
607 /// Return config
608
609 if (!fConfig)
610 {
611 fConfig = CreateConfig(fRunNumber);
612 }
613 return fConfig;
614}
615
5562688f 616//_____________________________________________________________________________
617AliMUONVCalibParam*
618AliMUONCalibrationData::Pedestals(Int_t detElemId, Int_t manuId) const
619{
620 /// Return the pedestals for a given (detElemId, manuId) pair.
621 /// A return value of 0x0 is considered an error, meaning we should get
622 /// pedestals for all channels.
623
624 AliMUONVStore* pedestals = Pedestals();
625 if (!pedestals)
626 {
627 return 0x0;
628 }
629
630 return static_cast<AliMUONVCalibParam*>(pedestals->FindObject(detElemId,manuId));
631}
632
c5bdf179 633//_____________________________________________________________________________
634void
635AliMUONCalibrationData::Print(Option_t*) const
636{
5562688f 637 /// A very basic dump of our guts.
5398f946 638
c5bdf179 639 cout << "RunNumber " << RunNumber()
e7d7fa47 640 << " fGains=" << fGains
641 << " fPedestals=" << fPedestals
6c870207 642 << " fConfig=" << fConfig
48ed403b 643 << " fHV=" << fHV
49e110ec 644 << " fTriggerDCS=" << fTriggerDCS
e7d7fa47 645 << " fLocalTriggerBoardMasks=" << fLocalTriggerBoardMasks
92c23b09 646 << " fRegionalTriggerConfig=" << fRegionalTriggerConfig
647 << " fGlobalTriggerCrateConfig=" << fGlobalTriggerCrateConfig
e7d7fa47 648 << " fTriggerLut=" << fTriggerLut
c5bdf179 649 << endl;
650}
651
92c23b09 652
e7d7fa47 653//_____________________________________________________________________________
92c23b09 654AliMUONRegionalTriggerConfig*
655AliMUONCalibrationData::RegionalTriggerConfig() const
e7d7fa47 656{
92c23b09 657 /// Return the config for the regional trigger board.
48ed403b 658
92c23b09 659 if (!fRegionalTriggerConfig)
e7d7fa47 660 {
92c23b09 661 fRegionalTriggerConfig = CreateRegionalTriggerConfig(fRunNumber);
e7d7fa47 662 }
92c23b09 663 return fRegionalTriggerConfig;
e7d7fa47 664}
665
92c23b09 666
e7d7fa47 667//_____________________________________________________________________________
668AliMUONTriggerEfficiencyCells*
669AliMUONCalibrationData::TriggerEfficiency() const
670{
5398f946 671/// Return the trigger efficiency.
672
e7d7fa47 673 if (!fTriggerEfficiency)
674 {
5562688f 675 fTriggerEfficiency = CreateTriggerEfficiency(fRunNumber);
e7d7fa47 676 }
677 return fTriggerEfficiency;
678}
679
5562688f 680
e7d7fa47 681//_____________________________________________________________________________
682AliMUONTriggerLut*
683AliMUONCalibrationData::TriggerLut() const
684{
5398f946 685/// Return the trigger look up table.
686
e7d7fa47 687 if (!fTriggerLut)
688 {
5562688f 689 fTriggerLut = CreateTriggerLut(fRunNumber);
e7d7fa47 690 }
691 return fTriggerLut;
692}
693
c1bbaf66 694//_____________________________________________________________________________
695void
696AliMUONCalibrationData::Reset()
697{
698/// Reset all data
699
82586209 700 AliCodeTimerAuto("",0);
701
6c870207 702 delete fConfig;
703 fConfig = 0x0;
c1bbaf66 704 delete fPedestals;
705 fPedestals = 0x0;
706 delete fGains;
707 fGains = 0x0;
708 delete fHV;
709 fHV = 0x0;
49e110ec 710 delete fTriggerDCS;
711 fTriggerDCS = 0x0;
c1bbaf66 712 delete fLocalTriggerBoardMasks;
713 fLocalTriggerBoardMasks = 0x0;
92c23b09 714 delete fRegionalTriggerConfig;
715 fRegionalTriggerConfig = 0x0;
716 delete fGlobalTriggerCrateConfig;
717 fGlobalTriggerCrateConfig = 0x0;
718
c1bbaf66 719 delete fTriggerLut;
720 fTriggerLut = 0x0;
721 delete fTriggerEfficiency;
722 fTriggerEfficiency = 0x0;
723 delete fCapacitances;
724 fCapacitances = 0x0;
d067ba7c 725 delete fNeighbours;
726 fNeighbours = 0x0;
c1bbaf66 727}
728
630711ed 729//_____________________________________________________________________________
730void
731AliMUONCalibrationData::Check(Int_t runNumber)
732{
733 /// Self-check to see if we can read all data for a given run
734 /// from the current OCDB...
735
736 if ( ! CreateCapacitances(runNumber) )
737 {
738 AliErrorClass("Could not read capacitances");
739 }
740 else
741 {
742 AliInfoClass("Capacitances read OK");
743 }
744
745 if ( ! CreateGains(runNumber) )
746 {
747 AliErrorClass("Could not read gains");
748 }
749 else
750 {
751 AliInfoClass("Gains read OK");
752 }
753
754 if ( ! CreateGlobalTriggerCrateConfig(runNumber) )
755 {
756 AliErrorClass("Could not read Trigger Crate Config");
757 }
758 else
759 {
760 AliInfoClass("TriggerBoardMasks read OK");
761 }
762
763 if ( ! CreateHV(runNumber) )
764 {
765 AliErrorClass("Could not read HV");
766 }
767 else
768 {
769 AliInfoClass("HV read OK");
49e110ec 770 }
771
772 if ( ! CreateTriggerDCS(runNumber) )
773 {
774 AliErrorClass("Could not read Trigger HV and Currents");
775 }
776 else
777 {
778 AliInfoClass("Trigger HV and Currents read OK");
630711ed 779 }
780
781 if ( ! CreateNeighbours(runNumber) )
782 {
783 AliErrorClass("Could not read Neighbours");
784 }
785 else
786 {
787 AliInfoClass("Neighbours read OK");
788 }
789
790 if ( ! CreateLocalTriggerBoardMasks(runNumber) )
791 {
792 AliErrorClass("Could not read LocalTriggerBoardMasks");
793 }
794 else
795 {
796 AliInfoClass("LocalTriggerBoardMasks read OK");
797 }
798
799 if ( ! CreatePedestals(runNumber) )
800 {
801 AliErrorClass("Could not read pedestals");
802 }
803 else
804 {
805 AliInfoClass("Pedestals read OK");
806 }
6c870207 807
808 if ( ! CreateConfig(runNumber) )
809 {
810 AliErrorClass("Could not read config");
811 }
812 else
813 {
814 AliInfoClass("Config read OK");
815 }
630711ed 816
817 if ( ! CreateRegionalTriggerConfig(runNumber) )
818 {
819 AliErrorClass("Could not read RegionalTriggerConfig");
820 }
821 else
822 {
823 AliInfoClass("RegionalTriggerBoardMasks read OK");
824 }
825
826 if ( ! CreateTriggerLut(runNumber) )
827 {
828 AliErrorClass("Could not read TriggerLut");
829 }
830 else
831 {
832 AliInfoClass("TriggerLut read OK");
833 }
834
835 if ( ! CreateTriggerEfficiency(runNumber) )
836 {
837 AliErrorClass("Could not read TriggerEfficiency");
838 }
839 else
840 {
841 AliInfoClass("TriggerEfficiency read OK");
842 }
843}
e7d7fa47 844
c5bdf179 845