AliRoot Core  edcc906 (edcc906)
AliMUONPadStatusMaker.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
26 
27 #include "AliMUONPadStatusMaker.h"
28 
29 #include "AliMUON2DMap.h"
31 #include "AliMUONCalibParamNI.h"
32 #include "AliMUONCalibrationData.h"
33 #include "AliMUONLogger.h"
34 #include "AliMUONRecoParam.h"
35 #include "AliMUONStringIntMap.h"
36 #include "AliMUONTrackerData.h"
37 #include "AliMUONVCalibParam.h"
38 
39 #include "AliMpArea.h"
40 #include "AliMpArrayI.h"
41 #include "AliMpBusPatch.h"
42 #include "AliMpCDB.h"
43 #include "AliMpConstants.h"
44 #include "AliMpDDLStore.h"
45 #include "AliMpDEManager.h"
46 #include "AliMpDetElement.h"
47 #include "AliMpDCSNamer.h"
48 #include "AliMpManuIterator.h"
49 #include "AliMpManuUID.h"
50 #include "AliMpStationType.h"
51 
52 #include "AliCDBEntry.h"
53 #include "AliCDBManager.h"
54 #include "AliCodeTimer.h"
55 #include "AliDCSValue.h"
56 #include "AliLog.h"
57 
58 #include <Riostream.h>
59 #include <TArrayI.h>
60 #include <TExMap.h>
61 #include <TFile.h>
62 #include <TKey.h>
63 #include <TMap.h>
64 #include <TROOT.h>
65 #include <TString.h>
66 #include <TSystem.h>
67 
68 using std::cout;
69 using std::endl;
71 ClassImp(AliMUONPadStatusMaker)
73 
74 //_____________________________________________________________________________
76 : fkCalibrationData(calibData),
77 fPedMeanLimits(0,4095),
78 fPedSigmaLimits(0,4095),
79 fManuOccupancyLimits(0,1.0),
80 fBuspatchOccupancyLimits(0,1.0),
81 fDEOccupancyLimits(0,1.0),
82 fStatus(new AliMUON2DMap(true)),
83 fHV(0x0),
84 fLV(0x0),
85 fPedestals(0x0),
86 fTrackerData(0x0),
87 fConfig(0x0)
88 {
90  SetHVLimit(-1,0.0);
91 }
92 
93 //_____________________________________________________________________________
95 {
97 
98  delete fStatus;
99  delete fHV;
100  delete fLV;
101  delete fTrackerData;
102 }
103 
104 //_____________________________________________________________________________
105 TString
107 {
109 
110  if ( status == 0 )
111  {
112  return "Brave New World";
113  }
114 
115  Int_t pedStatus;
116  Int_t lvStatus;
117  Int_t hvStatus;
118  Int_t occStatus;
119 
120  DecodeStatus(status,pedStatus,hvStatus,lvStatus,occStatus);
121 
122  TString s;
123 
124  if ( pedStatus & kPedMeanZero ) s += "& Ped Mean is Zero ";
125  if ( pedStatus & kPedMeanTooLow ) s += "& Ped Mean Too Low ";
126  if ( pedStatus & kPedMeanTooHigh ) s += "& Ped Mean Too High ";
127  if ( pedStatus & kPedSigmaTooLow ) s += "& Ped Sigma Too Low ";
128  if ( pedStatus & kPedSigmaTooHigh ) s += "& Ped Sigma Too High ";
129  if ( pedStatus & kPedMissing ) s += "& Ped is missing ";
130 
131  if ( lvStatus & kLVTooLow ) s+="& LV is Too Low ";
132  if ( lvStatus & kLVMissing ) s+="& LV is missing ";
133 
134  if ( hvStatus & kHVError ) s+="& HV is on error ";
135  if ( hvStatus & kHVTooLow ) s+="& HV is Too Low ";
136  if ( hvStatus & kHVTooHigh ) s+="& HV is Too High ";
137  if ( hvStatus & kHVChannelOFF ) s+="& HV has channel OFF ";
138  if ( hvStatus & kHVSwitchOFF ) s+="& HV has switch OFF ";
139  if ( hvStatus & kHVMissing ) s+="& HV is missing ";
140 
141  if ( occStatus & kManuOccupancyTooHigh ) s+="& manu occupancy too high ";
142  if ( occStatus & kManuOccupancyTooLow ) s+="& manu occupancy too low ";
143  if ( occStatus & kBusPatchOccupancyTooHigh ) s+="& bus patch occupancy too high ";
144  if ( occStatus & kBusPatchOccupancyTooLow ) s+="& bus patch occupancy too low ";
145  if ( occStatus & kDEOccupancyTooHigh ) s+="& DE occupancy too high ";
146  if ( occStatus & kDEOccupancyTooLow ) s+="& DE occupancy too low ";
147 
148  if ( occStatus & kBusPatchRemovedByPAR ) s+="& BusPatch removed during PAR";
149 
150  if ( s[0] == '&' ) s[0] = ' ';
151 
152  return s;
153 }
154 
155 //_____________________________________________________________________________
156 TString
158 {
160 
161  TString s(AsString(mask));
162 
163  s.ReplaceAll("&","|");
164 
165  return s;
166 }
167 
168 //_____________________________________________________________________________
169 Int_t
171  Int_t hvStatus,
172  Int_t lvStatus,
173  Int_t occStatus)
174 {
176 
177  return ( hvStatus & 0xFF ) | ( ( pedStatus & 0xFF ) << 8 ) |
178  ( ( lvStatus & 0xFF ) << 16 ) |
179  ( ( occStatus & 0xFF ) << 24 ) ;
180 }
181 
182 //_____________________________________________________________________________
184  Int_t manuId) const
185 {
188 
189  AliMUONVCalibParam* pedestals = static_cast<AliMUONVCalibParam*>(Pedestals()->FindObject(detElemId,manuId));
190 
191  AliMUONVCalibParam* config = static_cast<AliMUONVCalibParam*>(Config()->FindObject(detElemId,manuId));
192 
193  if ( pedestals == 0 && config == 0 )
194  {
196  return 0;
197  }
198 
199  if ( config == 0 && pedestals )
200  {
201  // a manu present in the pedestal run disappeared in the configuration
202  // that is happening if we removed a bus patch _during_ the run and then
203  // issued a PAR (Pause And Reconfigure) to change the readout configuration
204  //
205  // So, that's normal if all the manus of the same buspatch are in the same case.
206  // Let's check that...
207  AliMpBusPatch* busPatch = AliMpDDLStore::Instance()->GetBusPatch(detElemId,manuId);
208  Int_t n = busPatch->GetNofManus();
209  Int_t missing(0);
210  for ( Int_t i = 0; i < n; ++i )
211  {
212  Int_t manu = busPatch->GetManuId(i);
213  if ( fConfig->FindObject(detElemId,manuId) == 0x0 ) ++missing;
214  }
215  if ( missing != n )
216  {
217  AliError(Form("Got an inconsistent state between config and pedestal information for DE %4d MANU %4d BUSPATCH %4d : not all the manus from this bus patch are missing in the configuration ? ",detElemId,manuId,busPatch->GetId()));
218  return -1;
219  }
220  return 1;
221  }
222 
223  if ( pedestals == 0 && config != 0 )
224  {
225  AliError(Form("Got an inconsistent state between config and pedestal information for DE %4d MANU %4d : got a configuration but no pedestal values ???",detElemId,manuId));
226  return -2;
227  }
228 
229  return 0;
230 }
231 
232 //_____________________________________________________________________________
233 void
235  Int_t& pedStatus,
236  Int_t& hvStatus,
237  Int_t& lvStatus,
238  Int_t& occStatus)
239 {
241 
242  occStatus = ( status & 0xFF000000 ) >> 24;
243  lvStatus = ( status & 0xFF0000 ) >> 16;
244  pedStatus = ( status & 0xFF00 ) >> 8;
245  hvStatus = (status & 0xFF);
246 }
247 
248 //_____________________________________________________________________________
249 Bool_t
250 AliMUONPadStatusMaker::HVSt12Status(Int_t detElemId, Int_t sector,
251  Bool_t& hvChannelTooLow,
252  Bool_t& hvChannelTooHigh,
253  Bool_t& hvChannelON) const
254 {
256 
260 
261  AliCodeTimerAuto("",0)
262 
263  if (!fHV) return kFALSE;
264 
265  Bool_t error = kFALSE;
266  hvChannelTooLow = kFALSE;
267  hvChannelTooHigh = kFALSE;
268  hvChannelON = kTRUE;
269 
270  Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
271 
272  AliMpDCSNamer hvNamer("TRACKER");
273 
274  TString hvChannel(hvNamer.DCSAliasName(detElemId,sector));
275 
276  TMap* hvMap = fkCalibrationData.HV();
277  TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(hvChannel.Data()));
278  if (!hvPair)
279  {
280  AliError(Form("Did not find expected alias (%s) for DE %d",
281  hvChannel.Data(),detElemId));
282  error = kTRUE;
283  }
284  else
285  {
286  TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
287  if (!values)
288  {
289  AliError(Form("Could not get values for alias %s",hvChannel.Data()));
290  error = kTRUE;
291  }
292  else
293  {
294  // find out min value, and makes a cut
295  Float_t hvMin(1E9);
296  TIter next(values);
297  AliDCSValue* val;
298 
299  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
300  {
301  Float_t hv = val->GetFloat();
302  hvMin = TMath::Min(hv,hvMin);
303  }
304 
305  float lowThreshold = HVLimit(chamberId);
306 
307  if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
308  if ( hvMin < hvNamer.TrackerHVOFF() ) hvChannelON = kFALSE;
309  }
310  }
311 
312  return error;
313 }
314 
315 //_____________________________________________________________________________
316 Float_t
318 {
321 
322  // we'll count the number of ON/OFF for this pad, to insure
323  // consistency (i.e. if status changed during the run, we should
324  // at least notify this fact ;-) and hope it's not the norm)
325  Int_t nTrue(0);
326  Int_t nFalse(0);
327  TIter next(&dcsArray);
328  AliDCSValue* val;
329 
330  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
331  {
332  if ( val->GetBool() )
333  {
334  ++nTrue;
335  }
336  else
337  {
338  ++nFalse;
339  }
340  }
341 
342  if ( (nTrue>0 && nFalse>0) )
343  {
344  // change of state during the run, consider it off
345  return 0.0;
346  }
347 
348  if ( nFalse )
349  {
352  return 1.0;
353  }
354 
355  return 0.0;
356 }
357 
358 //_____________________________________________________________________________
359 Bool_t
360 AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
361  Bool_t& hvChannelTooLow,
362  Bool_t& hvChannelTooHigh,
363  Bool_t& hvChannelON,
364  Bool_t& hvSwitchON) const
365 {
370 
371  AliCodeTimerAuto("",0)
372 
373  if (!fHV) return kFALSE;
374 
375  Bool_t error = kFALSE;
376  hvChannelTooLow = kFALSE;
377  hvChannelTooHigh = kFALSE;
378  hvSwitchON = kTRUE;
379  hvChannelON = kTRUE;
380 
381  AliMpDCSNamer hvNamer("TRACKER");
382 
383  Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
384 
385  TString hvChannel(hvNamer.DCSAliasName(detElemId));
386 
387  TMap* hvMap = fkCalibrationData.HV();
388 
389  TPair* hvPair = static_cast<TPair*>(hvMap->FindObject(hvChannel.Data()));
390  if (!hvPair)
391  {
392  AliError(Form("Did not find expected alias (%s) for DE %d",
393  hvChannel.Data(),detElemId));
394  error = kTRUE;
395  }
396  else
397  {
398  TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
399  if (!values)
400  {
401  AliError(Form("Could not get values for alias %s",hvChannel.Data()));
402  error = kTRUE;
403  }
404  else
405  {
406  // find out min value, and makes a cut
407  Float_t hvMin(1E9);
408  TIter next(values);
409  AliDCSValue* val;
410 
411  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
412  {
413  Float_t hv = val->GetFloat();
414  hvMin = TMath::Min(hv,hvMin);
415  }
416 
417  float lowThreshold = HVLimit(chamberId);
418 
419  if ( hvMin < lowThreshold ) hvChannelTooLow = kTRUE;
420  if ( hvMin < hvNamer.TrackerHVOFF() ) hvChannelON = kFALSE;
421  }
422  }
423 
424  TString hvSwitch(hvNamer.DCSSwitchAliasName(detElemId,pcbIndex));
425  TPair* switchPair = static_cast<TPair*>(hvMap->FindObject(hvSwitch.Data()));
426  if (!switchPair)
427  {
428  AliError(Form("Did not find expected alias (%s) for DE %d PCB %d",
429  hvSwitch.Data(),detElemId,pcbIndex));
430  error = kTRUE;
431  }
432  else
433  {
434  TObjArray* values = static_cast<TObjArray*>(switchPair->Value());
435  if (!values)
436  {
437  AliError(Form("Could not get values for alias %s",hvSwitch.Data()));
438  error = kTRUE;
439  }
440  else
441  {
442  Float_t sv = SwitchValue(*values);
443  if ( sv < 0.99 ) hvSwitchON = kFALSE;
444  }
445  }
446  return error;
447 }
448 
449 //_____________________________________________________________________________
450 Int_t
451 AliMUONPadStatusMaker::HVStatus(Int_t detElemId, Int_t manuId) const
452 {
454 
455  AliCodeTimerAuto("",0)
456 
457  if ( !InternalHV() ) return kMissing;
458 
459  Long_t lint = InternalHV()->GetValue(AliMpManuUID::BuildUniqueID(detElemId,manuId));
460 
461  if ( lint )
462  {
463  return (Int_t)(lint - 1);
464  }
465 
466  Int_t status(0);
467 
468  AliMpDCSNamer hvNamer("TRACKER");
469 
470  switch ( AliMpDEManager::GetStationType(detElemId) )
471  {
472  case AliMp::kStation12:
473  {
474  int sector = hvNamer.ManuId2Sector(detElemId,manuId);
475  if ( sector >= 0 )
476  {
477  Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON;
478  Bool_t error = HVSt12Status(detElemId,sector,
479  hvChannelTooLow,
480  hvChannelTooHigh,
481  hvChannelON);
482  if ( error ) status |= kHVError;
483  if ( hvChannelTooLow ) status |= kHVTooLow;
484  if ( hvChannelTooHigh ) status |= kHVTooHigh;
485  if ( !hvChannelON ) status |= kHVChannelOFF;
486  // assign this status to all the other manus handled by the same HV channel
487  SetHVStatus(detElemId,sector,status);
488  }
489  }
490  break;
491  case AliMp::kStation345:
492  {
493  int pcbIndex = hvNamer.ManuId2PCBIndex(detElemId,manuId);
494  if ( pcbIndex >= 0 )
495  {
496  Bool_t hvChannelTooLow, hvChannelTooHigh, hvChannelON,hvSwitchON;
497  Bool_t error = HVSt345Status(detElemId,pcbIndex,
498  hvChannelTooLow,hvChannelTooHigh,
499  hvChannelON,hvSwitchON);
500  if ( error ) status |= kHVError;
501  if ( hvChannelTooLow ) status |= kHVTooLow;
502  if ( hvChannelTooHigh ) status |= kHVTooHigh;
503  if ( !hvSwitchON ) status |= kHVSwitchOFF;
504  if ( !hvChannelON) status |= kHVChannelOFF;
505  // assign this status to all the other manus handled by the same HV channel
506  SetHVStatus(detElemId,pcbIndex,status);
507  }
508  }
509  break;
510  default:
511  break;
512  }
513 
514  return status;
515 }
516 
517 //_____________________________________________________________________________
518 Int_t AliMUONPadStatusMaker::LVStatus(Int_t detElemId, Int_t manuId) const
519 {
521 
522  AliCodeTimerAuto("",0)
523 
524  if ( !InternalLV() ) return kMissing;
525 
527 
528  AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
529 
530  if ( stationType == AliMp::kStation12 && ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) ) ) {
531  // for St12 we need to know the plane type, for St345 we don't care
532  planeType = AliMp::kNonBendingPlane;
533  }
534 
535  Long_t lint = InternalLV()->GetValue(AliMpManuUID::BuildUniqueID(detElemId,planeType));
536 
537  if ( lint )
538  {
539  return (Int_t)(lint - 1);
540  }
541 
542  Int_t status(0);
543  Bool_t error(kFALSE);
544 
545  AliMpDCSNamer lvNamer("TRACKER");
546 
547  Int_t voltageType[] = { -1, 0, 1 };
548 
549  const float lowThreshold[] = { 1.5, 2.3, 1.5 };
550 
551  // we loop on the 3 voltages, and if any of them is below nominal,
552  // we consider the LV group as off
553 
554  TMap* lvMap = fkCalibrationData.LV();
555 
556  Bool_t lvChannelON = kTRUE;
557 
558  for ( Int_t i = 0; i < 3; ++i )
559  {
560  TString lvGroup(lvNamer.DCSMCHLVAliasName(detElemId,voltageType[i],planeType));
561 
562  TPair* lvPair = static_cast<TPair*>(lvMap->FindObject(lvGroup.Data()));
563  if (!lvPair)
564  {
565  AliError(Form("Did not find expected alias (%s) for DE %d",
566  lvGroup.Data(),detElemId));
567  error = kTRUE;
568  }
569  else
570  {
571  TObjArray* values = static_cast<TObjArray*>(lvPair->Value());
572  if (!values)
573  {
574  AliError(Form("Could not get values for alias %s",lvGroup.Data()));
575  error = kTRUE;
576  }
577  else
578  {
579  // find out min value, and makes a cut
580  Float_t lvMin(1E9);
581  TIter next(values);
582  AliDCSValue* val;
583 
584  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
585  {
586  Float_t lv = val->GetFloat();
587  lvMin = TMath::Min(lv,lvMin);
588  }
589 
590  if ( lvMin < lowThreshold[i] ) lvChannelON = kFALSE;
591  }
592  }
593  }
594 
595  if (!lvChannelON) {
596  status |= kLVTooLow;
597  }
598 
599  InternalLV()->Add(AliMpManuUID::BuildUniqueID(detElemId,planeType),status+1);
600 
601  return status;
602 }
603 
604 //_____________________________________________________________________________
606 AliMUONPadStatusMaker::Neighbours(Int_t detElemId, Int_t manuId) const
607 {
609  AliMUONVStore* neighbourStore = fkCalibrationData.Neighbours();
610  return static_cast<AliMUONVCalibParam*>(neighbourStore->FindObject(detElemId,manuId));
611 }
612 
613 //_____________________________________________________________________________
616 {
618  return fkCalibrationData.Neighbours();
619 }
620 
621 //_____________________________________________________________________________
623 AliMUONPadStatusMaker::ComputeStatus(Int_t detElemId, Int_t manuId) const
624 {
627 
628  AliMUONVCalibParam* param = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),detElemId,manuId,-1);
629  fStatus->Add(param);
630 
631  AliMUONVCalibParam* pedestals = static_cast<AliMUONVCalibParam*>(Pedestals()->FindObject(detElemId,manuId));
632 
633  Int_t hvStatus = HVStatus(detElemId,manuId);
634  Int_t lvStatus = LVStatus(detElemId,manuId);
635 
636  Int_t occStatus = OccupancyStatus(detElemId,manuId);
637 
638  for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel )
639  {
640  Int_t pedStatus(0);
641 
642  if (pedestals)
643  {
644  Float_t pedMean = pedestals->ValueAsFloatFast(manuChannel,0);
645  Float_t pedSigma = pedestals->ValueAsFloatFast(manuChannel,1);
646  if ( pedMean < fPedMeanLimits.X() ) pedStatus |= kPedMeanTooLow;
647  else if ( pedMean > fPedMeanLimits.Y() ) pedStatus |= kPedMeanTooHigh;
648  if ( pedSigma < fPedSigmaLimits.X() ) pedStatus |= kPedSigmaTooLow;
649  else if ( pedSigma > fPedSigmaLimits.Y() ) pedStatus |= kPedSigmaTooHigh;
650  if ( pedMean == 0 ) pedStatus |= kPedMeanZero;
651  }
652  else
653  {
654  pedStatus = kPedMissing;
655  }
656 
657  Int_t status = BuildStatus(pedStatus,hvStatus,lvStatus,occStatus);
658 
659  param->SetValueAsIntFast(manuChannel,0,status);
660  }
661 
662  return param;
663 }
664 
665 //_____________________________________________________________________________
666 Int_t
667 AliMUONPadStatusMaker::OccupancyStatus(Int_t detElemId, Int_t manuId) const
668 {
670 
671  Int_t rv(0);
672 
673  if ( InternalTrackerData() )
674  {
675  const Int_t occIndex = 2;
676 
677  Double_t occ = InternalTrackerData()->DetectionElement(detElemId,occIndex);
678 
679  if ( occ <= fDEOccupancyLimits.X() )
680  {
681  rv |= kDEOccupancyTooLow;
682  }
683  else if ( occ > fDEOccupancyLimits.Y() )
684  {
685  rv |= kDEOccupancyTooHigh;
686  }
687 
688  Int_t busPatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId);
689 
690  occ = InternalTrackerData()->BusPatch(busPatchId,occIndex);
691 
692  if ( occ <= fBuspatchOccupancyLimits.X() )
693  {
695  }
696  else if ( occ > fBuspatchOccupancyLimits.Y() )
697  {
699  }
700 
701  occ = InternalTrackerData()->Manu(detElemId,manuId,occIndex);
702 
703  if ( occ <= fManuOccupancyLimits.X() )
704  {
705  rv |= kManuOccupancyTooLow;
706  }
707  else if ( occ > fManuOccupancyLimits.Y() )
708  {
709  rv |= kManuOccupancyTooHigh;
710  }
711  }
712 
713  Int_t config = CheckConfigConsistencyWithPedestalInformation(detElemId,manuId);
714 
715  if (config==1)
716  {
717  Int_t bpid = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId);
718 
719  AliWarning(Form("BusPatchRemovedByPAR : BP %4d",bpid));
720  rv |= kBusPatchRemovedByPAR;
721  }
722 
723  return rv;
724 }
725 
726 //_____________________________________________________________________________
728 AliMUONPadStatusMaker::PadStatus(Int_t detElemId, Int_t manuId) const
729 {
731 
732  AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatus->FindObject(detElemId,manuId));
733  if (!param)
734  {
735  // not already there, so compute it now
736  AliCodeTimerAuto("ComputeStatus",0);
737  param = ComputeStatus(detElemId,manuId);
738  }
739  return param;
740 }
741 
742 //_____________________________________________________________________________
743 Int_t
744 AliMUONPadStatusMaker::PadStatus(Int_t detElemId, Int_t manuId, Int_t manuChannel) const
745 {
747 
748  AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fStatus->FindObject(detElemId,manuId));
749  if (!param)
750  {
751  // not already there, so compute it now
752  param = ComputeStatus(detElemId,manuId);
753  }
754  return param->ValueAsInt(manuChannel,0);
755 }
756 
757 //_____________________________________________________________________________
758 void
759 AliMUONPadStatusMaker::SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const
760 {
763 
764  AliCodeTimerAuto("",0)
765 
767 
768  const AliMpArrayI* manus = de->ManusForHV(index);
769 
770  for ( Int_t i = 0; i < manus->GetSize(); ++ i )
771  {
772  Int_t manuId = manus->GetValue(i);
773  InternalHV()->Add(AliMpManuUID::BuildUniqueID(detElemId,manuId),status + 1);
774  }
775 }
776 
777 //_____________________________________________________________________________
778 Double_t
779 AliMUONPadStatusMaker::HVLimit(Int_t chamberId) const
780 {
782  if ( chamberId >=0 && chamberId < 10 )
783  {
784  return fHVLimit[chamberId];
785  }
786  return 0.0;
787 }
788 
789 //_____________________________________________________________________________
790 void
791 AliMUONPadStatusMaker::SetHVLimit(Int_t chamberId, Double_t hv)
792 {
794 
795  if ( chamberId == -1 )
796  {
797  for ( Int_t i = 0; i < 10; ++i )
798  {
799  fHVLimit[i] = hv;
800  }
801  }
802  else if ( chamberId >= 0 && chamberId < 10 )
803  {
804  fHVLimit[chamberId]=hv;
805  }
806  else
807  {
808  AliError(Form("chamberId=%d is invalid",chamberId));
809  }
810 }
811 
812 //_____________________________________________________________________________
813 void
815 {
817 
818  for ( int i = 0; i < 10; ++i )
819  {
820  SetHVLimit(i,recoParams.HVLimit(i));
821  }
822 
823  SetPedMeanLimits(recoParams.PedMeanLowLimit(),recoParams.PedMeanHighLimit());
824  SetPedSigmaLimits(recoParams.PedSigmaLowLimit(),recoParams.PedSigmaHighLimit());
825 
829 }
830 
831 //_____________________________________________________________________________
832 void
834 {
837 
838  AliInfo("");
839  AliCodeTimerAuto("",0);
840 
841  AliMUONLogger log(1064008);
842 
843  Int_t nBadPads(0);
844  Int_t nPads(0);
845 
847 
848  Int_t detElemId, manuId;
849 
850  while ( it.Next(detElemId,manuId) )
851  {
853 
854  for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i )
855  {
856  if ( de->IsConnectedChannel(manuId,i) )
857  {
858  ++nPads;
859 
860  Int_t status = PadStatus(detElemId,manuId,i);
861 
862  if ( mask && ( status & mask) ) // note that if mask == 0, all pads are good...
863  {
864  ++nBadPads;
865  log.Log(AsString(status));
866  }
867  }
868  }
869  }
870 
871  if (!nPads)
872  {
873  AliError("Got no pad from the iterator ?! That's not normal. Please check !");
874  return;
875  }
876 
877  TString msg;
878  Int_t ntimes;
879 
880  cout << Form("According to mask %x (human readable form below) %6d pads are bad (over a total of %6d, i.e. %7.2f %%)",
881  mask,nBadPads,nPads,nBadPads*100.0/nPads) << endl;
882  cout << AliMUONPadStatusMaker::AsCondition(mask) << endl;
883  cout << "--------" << endl;
884 
885  while ( log.Next(msg,ntimes) )
886  {
887  cout << Form("The message (%120s) occured %15d times (%7.4f %%)",msg.Data(),ntimes,ntimes*100.0/nPads) << endl;
888  }
889 
890  TMap* hvMap = CalibrationData().HV();
891 
892  std::cout << "Map UniqueID = " << hvMap->GetUniqueID() << std::endl;
893 }
894 
895 //_____________________________________________________________________________
897 {
899  {
901  }
902  return fTrackerData;
903 }
904 
905 //_____________________________________________________________________________
907 {
908  if (!fHV && fkCalibrationData.HV())
909  {
910  fHV = new TExMap;
911  }
912  return fHV;
913 }
914 
915 //_____________________________________________________________________________
917 {
918  if (!fLV && fkCalibrationData.LV())
919  {
920  fLV = new TExMap;
921  }
922  return fLV;
923 }
924 
925 //_____________________________________________________________________________
927 {
928  if (!fPedestals)
929  {
931  }
932  return fPedestals;
933 }
934 
935 //_____________________________________________________________________________
937 {
938  if (!fConfig)
939  {
941  }
942  return fConfig;
943 }
Int_t GetNofManus() const
TMap * LV() const
Get the MCH LV.
AliMUONVCalibParam * Neighbours(Int_t detElemId, Int_t manuId) const
Float_t ManuOccupancyHighLimit() const
Retrieve high value of manu occupancy limit.
virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const =0
Get the value for a given DE and given dimension.
AliMUONVStore * fPedestals
! pedestal values
Implementation of AliMUONVTrackerData.
void SetDEOccupancyLimits(float low, float high)
Set Low and High DE occupancy limits.
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId)
Int_t ManuId2PCBIndex(Int_t detElemId, Int_t manuId) const
Returns the index of PCB (within a St345 slat) for a given manu number.
station 1,2 (quadrants)
const AliMUONCalibrationData & fkCalibrationData
! helper class to get data access (not owner)
TVector2 fManuOccupancyLimits
! Low and High manu occupancy limits
static Float_t SwitchValue(const TObjArray &dcsArray)
Int_t GetSize() const
static TString AsString(Int_t status)
TString DCSMCHLVAliasName(Int_t detElemId, Int_t voltageType, AliMp::PlaneType planeType=AliMp::kBendingPlane) const
TMap * HV(Bool_t patched=kTRUE) const
Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB...
Bool_t HVSt345Status(Int_t detElemId, Int_t pcbIndex, Bool_t &hvChannelTooLow, Bool_t &hvChannelTooHigh, Bool_t &hvChannelON, Bool_t &hvSwitchON) const
#define TObjArray
TExMap * fLV
! cache of lv statuses
AliMUONVStore * Neighbours() const
Get the neighbours store.
Int_t LVStatus(Int_t detElemId, Int_t manuId) const
virtual Int_t Size() const =0
The number of channels handled by this object.
static Float_t TrackerHVOFF()
Definition: AliMpDCSNamer.h:75
void SetBuspatchOccupancyLimits(float low, float high)
Set Low and High bus patch occupancy limits.
static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus, Int_t lvStatus, Int_t otherStatus)
virtual Float_t ValueAsFloatFast(Int_t i, Int_t j=0) const =0
Same as above but without bound checking.
Int_t ManuId2Sector(Int_t detElemId, Int_t manuId) const
Return the HV-sector number (within a St12 quadrant) for a given manu number.
Double_t fHVLimit[10]
! Low thresholds for HV
Float_t PedMeanHighLimit() const
Retrieve high limit of ped mean.
station 3,4,5 (slats)
Int_t Log(const char *message)
Float_t BuspatchOccupancyLowLimit() const
Retrieve low value of bp occupancy limit.
Collection of methods usefull to DCS handling for MUON TRK and TRG.
Definition: AliMpDCSNamer.h:22
void SetHVLimit(Int_t chamberId, Double_t hv)
Set HV limit.
TVector2 fDEOccupancyLimits
! Low and High DE occupancy limits
Class with MUON reconstruction parameters.
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
Int_t GetManuId(Int_t index) const
The class defines the electronics properties of detection element.
Float_t GetFloat() const
Bool_t Next(TString &msg, Int_t &occurance)
static void DecodeStatus(Int_t status, Int_t &pedStatus, Int_t &hvStatus, Int_t &lvStatus, Int_t &otherStatus)
#define AliWarning(message)
Definition: AliLog.h:541
Bool_t Next(Int_t &detElemId, Int_t &manuId)
Class to loop over all manus of MUON Tracker.
void SetManuOccupancyLimits(float low, float high)
Set Low and High manu occupancy limits.
A logger that keeps track of the number of times a message appeared.
Definition: AliMUONLogger.h:24
Container of calibration values for a given number of channels.
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
static Int_t ManuNofChannels()
Max number of channels per manu.
AliMUONVCalibParam * PadStatus(Int_t detElemId, Int_t manuId) const
virtual Double_t Manu(Int_t detElemId, Int_t manuId, Int_t dim=0) const =0
Get the value for a given manu and given dimension.
Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const
TVector2 fBuspatchOccupancyLimits
! Low and High buspatch occupancy limits
Implementation of AliMUONVCalibParam for tuples of ints.
Double_t HVLimit(Int_t chamberId) const
Return HV threshold.
void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const
#define AliInfo(message)
Definition: AliLog.h:484
Double_t HVLimit(Int_t chamberId) const
Retrieve HV limit for chamber (chamberId=0..9)
non-bending plane
#define AliCodeTimerAuto(message, counter)
Definition: AliCodeTimer.h:137
Float_t PedSigmaLowLimit() const
Retrieve low limit of ped sigma.
static AliMp::StationType GetStationType(Int_t detElemId)
static TString AsCondition(Int_t status)
AliMpBusPatch * GetBusPatch(Int_t busPatchId, Bool_t warn=true) const
Int_t GetId() const
Return the unique Id.
Definition: AliMpBusPatch.h:89
Bool_t HVSt12Status(Int_t detElemId, Int_t sector, Bool_t &hvChannelTooLow, Bool_t &hvChannelTooHigh, Bool_t &hvChannelON) const
AliMUONVStore * Config() const
Helper class for sorted integer array.
Definition: AliMpArrayI.h:21
Float_t DEOccupancyLowLimit() const
Retrieve low value of DE occupancy limit.
AliMUONVStore * Pedestals() const
Get the pedestal store.
const int ntimes
Definition: kNNSpeed.C:14
virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const =0
Basic implementation of AliMUONVStore container using AliMpExMap internally.
Definition: AliMUON2DMap.h:20
Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const
Int_t CheckConfigConsistencyWithPedestalInformation(Int_t detElemId, Int_t manuId) const
AliMUONCalibrationData * calibData
bending plane
virtual Bool_t Add(TObject *object)=0
Add an object to the store.
TVector2 fPedMeanLimits
! Low and High threshold for pedestal mean
The class defines the properties of BusPatch.
Definition: AliMpBusPatch.h:21
Single entry point to access MUON calibration data.
Bool_t GetBool() const
Float_t PedMeanLowLimit() const
Retrieve low limit of ped mean.
AliMUONVStore * fStatus
! statuses of the pads
virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const =0
Get the value for a given buspatch and given dimension.
AliMUONVStore * Pedestals() const
TExMap * fHV
! cache of hv statuses
virtual void SetValueAsIntFast(Int_t i, Int_t j, Int_t value)=0
Same as above but w/o bound checkings.
AliMUONVTrackerData * fTrackerData
! to get occupancies...
AliMUONVTrackerData * InternalTrackerData() const
TString DCSSwitchAliasName(Int_t detElemId, Int_t pcbNumber) const
AliMUONVStore * OccupancyMap() const
Get the occupancy map store.
Int_t HVStatus(Int_t detElemId, Int_t manuId) const
const AliMpArrayI * ManusForHV(Int_t hvIndex) const
void SetPedSigmaLimits(float low, float high)
Set Low and High threshold for pedestal sigma.
AliMUONVCalibParam * ComputeStatus(Int_t detElemId, Int_t manuId) const
#define AliError(message)
Definition: AliLog.h:591
Int_t GetValue(Int_t index) const
Bool_t IsConnectedChannel(Int_t manuId, Int_t manuChannel) const
Float_t ManuOccupancyLowLimit() const
Retrieve low value of manu occupancy limit.
void SetPedMeanLimits(float low, float high)
Set Low and High threshold for pedestal mean.
Base class for MUON data stores.
Definition: AliMUONVStore.h:22
TString DCSAliasName(Int_t detElemId, Int_t sector=0, Int_t dcsMeasure=0) const
AliMUONVStore * fConfig
! readout configuration
const AliMUONCalibrationData & CalibrationData() const
Get the reference to the calibrationdata object we use.
Float_t PedSigmaHighLimit() const
Retrieve high limit of ped sigma.
Base class for MUON data that can be presented at different levels in the hierarchy of the MUON syste...
AliMUONVStore * NeighboursStore() const
Float_t DEOccupancyHighLimit() const
Retrieve high value of DE occupancy limit.
TVector2 fPedSigmaLimits
! Low and High threshold for pedestal sigma
Make a 2DStore of pad statuses, using different sources of information.
Float_t BuspatchOccupancyHighLimit() const
Retrieve high value of bp occupancy limit.
virtual TObject * FindObject(const char *name) const
Find an object by name.
static Int_t ManuMask(AliMp::PlaneType planeType)
void SetLimits(const AliMUONRecoParam &recoParams)