Fixes for bug #49914: Compilation breaks in trunk, and bug #48629: Trunk cannot read...
[u/mrichter/AliRoot.git] / MUON / AliMUONPadStatusMaker.cxx
CommitLineData
2c780493 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$
78649106 17
3d1463c8 18//-----------------------------------------------------------------------------
2c780493 19/// \class AliMUONPadStatusMaker
20///
21/// Make a 2DStore of pad statuses, using different sources of information,
22/// like pedestal values, gain values, and HV values.
23///
78649106 24/// \author Laurent Aphecetche
3d1463c8 25//-----------------------------------------------------------------------------
2c780493 26
27#include "AliMUONPadStatusMaker.h"
28
4e25ac79 29#include "AliQAv1.h"
004a9ccd 30
2c780493 31#include "AliMUON2DMap.h"
9044498f 32#include "AliMUON2DStoreValidator.h"
33#include "AliMUONCalibParamNI.h"
2c780493 34#include "AliMUONCalibrationData.h"
49e396d9 35#include "AliMUONStringIntMap.h"
2c780493 36#include "AliMUONVCalibParam.h"
004a9ccd 37#include "AliMUONVTrackerData.h"
2ce1c72b 38
2c780493 39#include "AliMpArea.h"
49e396d9 40#include "AliMpArrayI.h"
8d8e920c 41#include "AliMpConstants.h"
49e396d9 42#include "AliMpDDLStore.h"
2c780493 43#include "AliMpDEManager.h"
49e396d9 44#include "AliMpDetElement.h"
49e110ec 45#include "AliMpDCSNamer.h"
49e396d9 46#include "AliMpManuUID.h"
2ce1c72b 47
48#include "AliCDBEntry.h"
49#include "AliCDBManager.h"
50#include "AliCodeTimer.h"
51#include "AliDCSValue.h"
52#include "AliLog.h"
53
9044498f 54#include <Riostream.h>
49e396d9 55#include <TArrayI.h>
56#include <TExMap.h>
004a9ccd 57#include <TFile.h>
58#include <TKey.h>
9044498f 59#include <TMap.h>
004a9ccd 60#include <TROOT.h>
9044498f 61#include <TString.h>
004a9ccd 62#include <TSystem.h>
2c780493 63
78649106 64/// \cond CLASSIMP
2c780493 65ClassImp(AliMUONPadStatusMaker)
78649106 66/// \endcond
2c780493 67
68//_____________________________________________________________________________
69AliMUONPadStatusMaker::AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData)
72dae9ff 70: fkCalibrationData(calibData),
004a9ccd 71fGainA1Limits(0,1E30),
72fGainA2Limits(-1E-30,1E30),
73fGainThresLimits(0,4095),
74fHVSt12Limits(0,5000),
75fHVSt345Limits(0,5000),
76fPedMeanLimits(0,4095),
77fPedSigmaLimits(0,4095),
78fManuOccupancyLimits(0,0.1),
79fStatus(new AliMUON2DMap(true)),
80fHV(new TExMap),
81fPedestals(calibData.Pedestals()),
82fGains(calibData.Gains()),
83fTrackerData(0x0)
2c780493 84{
004a9ccd 85 /// ctor
86 AliDebug(1,Form("ped store %s gain store %s",
87 fPedestals->ClassName(),
88 fGains->ClassName()));
89
4e25ac79 90 TString qaFileName(AliQAv1::GetQADataFileName("MUON",calibData.RunNumber()));
004a9ccd 91
92 // search the QA file in memory first.
93 TFile* f = static_cast<TFile*>(gROOT->GetListOfFiles()->FindObject(qaFileName.Data()));
94
95 if (!f)
96 {
97 // then tries to open it
98 if ( gSystem->AccessPathName(qaFileName.Data()) == kFALSE )
99 {
100 f = TFile::Open(qaFileName.Data());
101 if ( f )
102 {
103 AliDebug(1,Form("Got %s from disk",qaFileName.Data()));
104 }
105 }
106 }
107 else
108 {
109 AliDebug(1,Form("Got %s from memory",qaFileName.Data()));
110 }
111
112 if (f)
113 {
114 TDirectory* d = gDirectory;
115
116 f->cd("MUON/Raws");
117
118 TIter next(gDirectory->GetListOfKeys());
119 TKey* key;
120
121 while ( ( key = static_cast<TKey*>(next()) ) && !fTrackerData )
122 {
123 TString name(key->GetName());
124
125 if ( name.Contains("CALZ") )
126 {
127 fTrackerData = dynamic_cast<AliMUONVTrackerData*>(key->ReadObj());
128 }
129
130 }
131
132 gDirectory = d;
133
134 if ( fTrackerData )
135 {
136 AliInfo(Form("Will make a cut on MANU occupancy from TrackerData=%s",fTrackerData->GetName()));
137 }
138 else
139 {
140 AliWarning(Form("Found a QA file = %s, but could not get the expected TrackerData in there... (probably not a serious problem though)",
141 f->GetName()));
142 }
143 }
144 else
145 {
146 AliWarning("Did not find QA file, so will not use manu occupancy as a criteria");
147 }
2c780493 148}
149
150//_____________________________________________________________________________
151AliMUONPadStatusMaker::~AliMUONPadStatusMaker()
152{
71a2d3aa 153 /// dtor.
49e396d9 154 delete fStatus;
155 delete fHV;
2c780493 156}
157
158//_____________________________________________________________________________
49e396d9 159TString
160AliMUONPadStatusMaker::AsString(Int_t status)
2c780493 161{
49e396d9 162 /// return a human readable version of the integer status
004a9ccd 163
49e396d9 164 Int_t pedStatus;
165 Int_t gainStatus;
166 Int_t hvStatus;
004a9ccd 167 Int_t otherStatus;
168
169 DecodeStatus(status,pedStatus,hvStatus,gainStatus,otherStatus);
170
171 TString s;
172
173 if ( pedStatus & kPedMeanZero ) s += "& Ped Mean is Zero ";
174 if ( pedStatus & kPedMeanTooLow ) s += "& Ped Mean Too Low ";
175 if ( pedStatus & kPedMeanTooHigh ) s += "& Ped Mean Too High ";
176 if ( pedStatus & kPedSigmaTooLow ) s += "& Ped Sigma Too Low ";
177 if ( pedStatus & kPedSigmaTooHigh ) s += "& Ped Sigma Too High ";
178 if ( pedStatus & kPedMissing ) s += "& Ped is missing ";
179
180 if ( gainStatus & kGainA1TooLow ) s+="& Gain A1 is Too Low ";
181 if ( gainStatus & kGainA1TooHigh ) s+="& Gain A1 is Too High ";
182 if ( gainStatus & kGainA2TooLow ) s+="& Gain A2 is Too Low ";
183 if ( gainStatus & kGainA2TooHigh ) s+="& Gain A2 is Too High ";
184 if ( gainStatus & kGainThresTooLow ) s+="& Gain Thres is Too Low ";
185 if ( gainStatus & kGainThresTooHigh ) s+="& Gain Thres is Too High ";
186 if ( gainStatus & kGainMissing ) s+="& Gain is missing ";
187
188 if ( hvStatus & kHVError ) s+="& HV is on error ";
189 if ( hvStatus & kHVTooLow ) s+="& HV is Too Low ";
190 if ( hvStatus & kHVTooHigh ) s+="& HV is Too High ";
191 if ( hvStatus & kHVChannelOFF ) s+="& HV has channel OFF ";
192 if ( hvStatus & kHVSwitchOFF ) s+="& HV has switch OFF ";
193 if ( hvStatus & kHVMissing ) s+="& HV is missing ";
194
195 if ( otherStatus & kManuOccupancyTooHigh ) s+="& manu occupancy too high ";
196 if ( otherStatus & kManuOccupancyTooLow ) s+="& manu occupancy too low ";
49e396d9 197
004a9ccd 198 if ( s[0] == '&' ) s[0] = ' ';
199
200 return s;
201}
49e396d9 202
004a9ccd 203//_____________________________________________________________________________
204TString
205AliMUONPadStatusMaker::AsCondition(Int_t mask)
206{
207 /// return a human readable version of the mask's equivalent condition
208
209 TString s(AsString(mask));
210
211 s.ReplaceAll("&","|");
212
49e396d9 213 return s;
2c780493 214}
215
216//_____________________________________________________________________________
49e396d9 217Int_t
218AliMUONPadStatusMaker::BuildStatus(Int_t pedStatus,
219 Int_t hvStatus,
004a9ccd 220 Int_t gainStatus,
221 Int_t otherStatus)
96199305 222{
49e396d9 223 /// Build a complete status from specific parts (ped,hv,gain)
8d8e920c 224
49e396d9 225 return ( hvStatus & 0xFF ) | ( ( pedStatus & 0xFF ) << 8 ) |
004a9ccd 226 ( ( gainStatus & 0xFF ) << 16 ) |
227 ( ( otherStatus & 0xFF ) << 24 ) ;
49e396d9 228}
229
230//_____________________________________________________________________________
231void
232AliMUONPadStatusMaker::DecodeStatus(Int_t status,
233 Int_t& pedStatus,
234 Int_t& hvStatus,
004a9ccd 235 Int_t& gainStatus,
236 Int_t& otherStatus)
49e396d9 237{
238 /// Decode complete status into specific parts (ped,hv,gain)
96199305 239
004a9ccd 240 otherStatus = ( status & 0xFF000000 ) >> 24;
49e396d9 241 gainStatus = ( status & 0xFF0000 ) >> 16;
242 pedStatus = ( status & 0xFF00 ) >> 8;
243 hvStatus = (status & 0xFF);
96199305 244}
245
246//_____________________________________________________________________________
2c780493 247Bool_t
49e396d9 248AliMUONPadStatusMaker::HVSt12Status(Int_t detElemId, Int_t sector,
249 Bool_t& hvChannelTooLow,
250 Bool_t& hvChannelTooHigh,
251 Bool_t& hvChannelON) const
2c780493 252{
253 /// Get HV status for one HV sector of St12
254
255 /// For a given PCB in a given DE, get the HV status (both the channel
256 /// and the switch).
257 /// Returns false if hv switch changed during the run.
258
49e396d9 259 AliCodeTimerAuto("")
260
2c780493 261 Bool_t error = kFALSE;
262 hvChannelTooLow = kFALSE;
263 hvChannelTooHigh = kFALSE;
264 hvChannelON = kTRUE;
49e396d9 265
49e110ec 266 AliMpDCSNamer hvNamer("TRACKER");
2c780493 267
49e110ec 268 TString hvChannel(hvNamer.DCSChannelName(detElemId,sector));
2c780493 269
72dae9ff 270 TMap* hvMap = fkCalibrationData.HV();
49e396d9 271 TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(hvChannel.Data()));
2c780493 272 if (!hvPair)
273 {
274 AliError(Form("Did not find expected alias (%s) for DE %d",
275 hvChannel.Data(),detElemId));
276 error = kTRUE;
277 }
278 else
279 {
280 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
281 if (!values)
282 {
283 AliError(Form("Could not get values for alias %s",hvChannel.Data()));
284 error = kTRUE;
285 }
286 else
287 {
288 // find out min and max value, and makes a cut
289 Float_t hvMin(1E9);
290 Float_t hvMax(0);
291 TIter next(values);
292 AliDCSValue* val;
293
294 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
295 {
296 Float_t hv = val->GetFloat();
297 hvMin = TMath::Min(hv,hvMin);
298 hvMax = TMath::Max(hv,hvMax);
299 }
300
301 float lowThreshold = fHVSt12Limits.X();
302 float highThreshold = fHVSt12Limits.Y();
303
304 if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
305 if ( hvMax > highThreshold ) hvChannelTooHigh = kTRUE;
306 if ( hvMin < 1 ) hvChannelON = kFALSE;
307 }
308 }
309
310 return error;
311}
312
313//_____________________________________________________________________________
314Bool_t
49e396d9 315AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
316 Bool_t& hvChannelTooLow,
317 Bool_t& hvChannelTooHigh,
318 Bool_t& hvChannelON,
319 Bool_t& hvSwitchON) const
2c780493 320{
321 /// For a given PCB in a given DE, get the HV status (both the channel
322 /// and the switch).
323 /// Returns false if something goes wrong (in particular if
324 /// hv switch changed during the run).
325
49e396d9 326 AliCodeTimerAuto("")
327
2c780493 328 Bool_t error = kFALSE;
329 hvChannelTooLow = kFALSE;
330 hvChannelTooHigh = kFALSE;
331 hvSwitchON = kTRUE;
332 hvChannelON = kTRUE;
333
49e110ec 334 AliMpDCSNamer hvNamer("TRACKER");
2c780493 335
49e110ec 336 TString hvChannel(hvNamer.DCSChannelName(detElemId));
2c780493 337
72dae9ff 338 TMap* hvMap = fkCalibrationData.HV();
49e396d9 339
340 TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(hvChannel.Data()));
2c780493 341 if (!hvPair)
342 {
343 AliError(Form("Did not find expected alias (%s) for DE %d",
344 hvChannel.Data(),detElemId));
345 error = kTRUE;
346 }
347 else
348 {
349 TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
350 if (!values)
351 {
352 AliError(Form("Could not get values for alias %s",hvChannel.Data()));
353 error = kTRUE;
354 }
355 else
356 {
357 // find out min and max value, and makes a cut
358 Float_t hvMin(1E9);
359 Float_t hvMax(0);
360 TIter next(values);
361 AliDCSValue* val;
362
363 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
364 {
365 Float_t hv = val->GetFloat();
366 hvMin = TMath::Min(hv,hvMin);
367 hvMax = TMath::Max(hv,hvMax);
368 }
369
370 float lowThreshold = fHVSt345Limits.X();
371 float highThreshold = fHVSt345Limits.Y();
372
373 if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
49e396d9 374 else if ( hvMax > highThreshold ) hvChannelTooHigh = kTRUE;
2c780493 375 if ( hvMin < 1 ) hvChannelON = kFALSE;
376 }
377 }
378
49e110ec 379 TString hvSwitch(hvNamer.DCSSwitchName(detElemId,pcbIndex));
49e396d9 380 TPair* switchPair = static_cast<TPair*>(hvMap->FindObject(hvSwitch.Data()));
2c780493 381 if (!switchPair)
382 {
383 AliError(Form("Did not find expected alias (%s) for DE %d PCB %d",
384 hvSwitch.Data(),detElemId,pcbIndex));
385 error = kTRUE;
386 }
387 else
388 {
389 TObjArray* values = static_cast<TObjArray*>(switchPair->Value());
390 if (!values)
391 {
392 AliError(Form("Could not get values for alias %s",hvSwitch.Data()));
393 error = kTRUE;
394 }
395 else
396 {
397 // we'll count the number of ON/OFF for this pad, to insure
398 // consistency (i.e. if status changed during the run, we should
399 // at least notify this fact ;-) and hope it's not the norm)
400 Int_t nTrue(0);
401 Int_t nFalse(0);
402 TIter next(values);
403 AliDCSValue* val;
404
405 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
406 {
407 if ( val->GetBool() )
408 {
409 ++nTrue;
410 }
411 else
412 {
413 ++nFalse;
414 }
415 }
416
417 if ( (nTrue>0 && nFalse>0) )
418 {
419 AliWarning(Form("Status of HV Switch %s changed during this run nTrue=%d nFalse=%d! Will consider it OFF",
420 hvSwitch.Data(),nTrue,nFalse));
421 error = kTRUE;
422 }
423
424 if ( nFalse ) hvSwitchON = kFALSE;
425 }
426 }
427 return error;
428}
429
430//_____________________________________________________________________________
49e396d9 431Int_t
432AliMUONPadStatusMaker::HVStatus(Int_t detElemId, Int_t manuId) const
2c780493 433{
49e396d9 434 /// Get HV status of one manu
2c780493 435
49e396d9 436 AliCodeTimerAuto("")
2c780493 437
72dae9ff 438 if ( !fkCalibrationData.HV() ) return kMissing;
49e396d9 439
440 Long_t lint = fHV->GetValue(AliMpManuUID::BuildUniqueID(detElemId,manuId));
2c780493 441
49e396d9 442 if ( lint )
443 {
444 return (Int_t)(lint - 1);
445 }
446
447 Int_t status(0);
2c780493 448
49e110ec 449 AliMpDCSNamer hvNamer("TRACKER");
2c780493 450
49e396d9 451 switch ( AliMpDEManager::GetStationType(detElemId) )
2c780493 452 {
4e51cfd2 453 case AliMp::kStation12:
2c780493 454 {
49e396d9 455 int sector = hvNamer.ManuId2Sector(detElemId,manuId);
456 if ( sector >= 0 )
2c780493 457 {
49e396d9 458 Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON;
459 Bool_t error = HVSt12Status(detElemId,sector,
460 hvChannelTooLow,
461 hvChannelTooHigh,
462 hvChannelON);
463 if ( error ) status |= kHVError;
464 if ( hvChannelTooLow ) status |= kHVTooLow;
465 if ( hvChannelTooHigh ) status |= kHVTooHigh;
466 if ( !hvChannelON ) status |= kHVChannelOFF;
467 // assign this status to all the other manus handled by the same HV channel
468 SetHVStatus(detElemId,sector,status);
469 }
470 }
471 break;
472 case AliMp::kStation345:
473 {
474 int pcbIndex = hvNamer.ManuId2PCBIndex(detElemId,manuId);
475 if ( pcbIndex >= 0 )
476 {
477 Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON,hvSwitchON;
478 Bool_t error = HVSt345Status(detElemId,pcbIndex,
479 hvChannelTooLow,hvChannelTooHigh,
480 hvChannelON,hvSwitchON);
481 if ( error ) status |= kHVError;
482 if ( hvChannelTooLow ) status |= kHVTooLow;
483 if ( hvChannelTooHigh ) status |= kHVTooHigh;
484 if ( !hvSwitchON ) status |= kHVSwitchOFF;
485 if ( !hvChannelON) status |= kHVChannelOFF;
486 // assign this status to all the other manus handled by the same HV channel
487 SetHVStatus(detElemId,pcbIndex,status);
2c780493 488 }
2c780493 489 }
49e396d9 490 break;
491 default:
492 break;
2c780493 493 }
494
49e396d9 495 return status;
496}
497
498//_____________________________________________________________________________
499AliMUONVCalibParam*
500AliMUONPadStatusMaker::Neighbours(Int_t detElemId, Int_t manuId) const
501{
502 /// Get the neighbours parameters for a given manu
72dae9ff 503 AliMUONVStore* neighbourStore = fkCalibrationData.Neighbours();
49e396d9 504 return static_cast<AliMUONVCalibParam*>(neighbourStore->FindObject(detElemId,manuId));
2c780493 505}
506
507//_____________________________________________________________________________
8d8e920c 508AliMUONVStore*
49e396d9 509AliMUONPadStatusMaker::NeighboursStore() const
2c780493 510{
49e396d9 511 /// Return the store containing all the neighbours
72dae9ff 512 return fkCalibrationData.Neighbours();
49e396d9 513}
514
515//_____________________________________________________________________________
516AliMUONVCalibParam*
517AliMUONPadStatusMaker::ComputeStatus(Int_t detElemId, Int_t manuId) const
518{
519 /// Compute the status of a given manu, using all available information,
520 /// i.e. pedestals, gains, and HV
2c780493 521
49e396d9 522 AliMUONVCalibParam* param = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,-1);
523 fStatus->Add(param);
004a9ccd 524
49e396d9 525 AliMUONVCalibParam* pedestals = static_cast<AliMUONVCalibParam*>(fPedestals->FindObject(detElemId,manuId));
526
527 AliMUONVCalibParam* gains = static_cast<AliMUONVCalibParam*>(fGains->FindObject(detElemId,manuId));
2c780493 528
49e396d9 529 Int_t hvStatus = HVStatus(detElemId,manuId);
530
004a9ccd 531 Int_t otherStatus = OtherStatus(detElemId,manuId);
2c780493 532
49e396d9 533 for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel )
2c780493 534 {
49e396d9 535 Int_t pedStatus(0);
536
537 if (pedestals)
2c780493 538 {
49e396d9 539 Float_t pedMean = pedestals->ValueAsFloatFast(manuChannel,0);
540 Float_t pedSigma = pedestals->ValueAsFloatFast(manuChannel,1);
541 if ( pedMean < fPedMeanLimits.X() ) pedStatus |= kPedMeanTooLow;
542 else if ( pedMean > fPedMeanLimits.Y() ) pedStatus |= kPedMeanTooHigh;
543 if ( pedSigma < fPedSigmaLimits.X() ) pedStatus |= kPedSigmaTooLow;
544 else if ( pedSigma > fPedSigmaLimits.Y() ) pedStatus |= kPedSigmaTooHigh;
545 if ( pedMean == 0 ) pedStatus |= kPedMeanZero;
546 }
547 else
548 {
549 pedStatus = kPedMissing;
550 }
551
552 Int_t gainStatus(0);
553
554 if ( gains )
555 {
556 Float_t a0 = gains->ValueAsFloatFast(manuChannel,0);
557 Float_t a1 = gains->ValueAsFloatFast(manuChannel,1);
558 Float_t thres = gains->ValueAsFloatFast(manuChannel,2);
559
004a9ccd 560 if ( a0 < fGainA1Limits.X() ) gainStatus |= kGainA1TooLow;
561 else if ( a0 > fGainA1Limits.Y() ) gainStatus |= kGainA1TooHigh;
562 if ( a1 < fGainA2Limits.X() ) gainStatus |= kGainA2TooLow;
563 else if ( a1 > fGainA2Limits.Y() ) gainStatus |= kGainA2TooHigh;
49e396d9 564 if ( thres < fGainThresLimits.X() ) gainStatus |= kGainThresTooLow;
565 else if ( thres > fGainThresLimits.Y() ) gainStatus |= kGainThresTooHigh;
2c780493 566 }
49e396d9 567 else
568 {
569 gainStatus = kGainMissing;
570 }
571
004a9ccd 572 Int_t status = BuildStatus(pedStatus,hvStatus,gainStatus,otherStatus);
49e396d9 573
574 param->SetValueAsIntFast(manuChannel,0,status);
2c780493 575 }
576
49e396d9 577 return param;
2c780493 578}
579
580//_____________________________________________________________________________
004a9ccd 581Int_t
582AliMUONPadStatusMaker::OtherStatus(Int_t detElemId, Int_t manuId) const
583{
584 /// Get the "other" status for a given manu
585 if ( fTrackerData )
586 {
587 Double_t occ = fTrackerData->Manu(detElemId,manuId,2);
588 if ( occ < fManuOccupancyLimits.X() )
589 {
590 return kManuOccupancyTooLow;
591 }
592 if ( occ > fManuOccupancyLimits.Y() )
593 {
594 return kManuOccupancyTooHigh;
595 }
596 }
597 return 0;
598}
599
600//_____________________________________________________________________________
49e396d9 601AliMUONVCalibParam*
602AliMUONPadStatusMaker::PadStatus(Int_t detElemId, Int_t manuId) const
2c780493 603{
004a9ccd 604 /// Get the status container for a given manu
2c780493 605
49e396d9 606 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatus->FindObject(detElemId,manuId));
607 if (!param)
96199305 608 {
49e396d9 609 // not already there, so compute it now
610 AliCodeTimerAuto("ComputeStatus");
611 param = ComputeStatus(detElemId,manuId);
96199305 612 }
49e396d9 613 return param;
2c780493 614}
615
616//_____________________________________________________________________________
49e396d9 617Int_t
618AliMUONPadStatusMaker::PadStatus(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
2c780493 619{
49e396d9 620 /// Get the status for a given channel
2c780493 621
49e396d9 622 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatus->FindObject(detElemId,manuId));
623 if (!param)
2c780493 624 {
49e396d9 625 // not already there, so compute it now
626 param = ComputeStatus(detElemId,manuId);
627 }
628 return param->ValueAsInt(manuChannel,0);
2c780493 629}
630
631//_____________________________________________________________________________
632void
49e396d9 633AliMUONPadStatusMaker::SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const
2c780493 634{
49e396d9 635 /// Assign status to all manus in a given HV "zone" (defined by index, meaning
636 /// is different thing from St12 and St345)
637
638 AliCodeTimerAuto("")
639
640 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
2c780493 641
49e396d9 642 const AliMpArrayI* manus = de->ManusForHV(index);
2c780493 643
49e396d9 644 for ( Int_t i = 0; i < manus->GetSize(); ++ i )
2c780493 645 {
49e396d9 646 Int_t manuId = manus->GetValue(i);
647 fHV->Add(AliMpManuUID::BuildUniqueID(detElemId,manuId),status + 1);
2c780493 648 }
649}