29 #include "AliCDBManager.h"
30 #include "AliCodeTimer.h"
37 #include "Riostream.h"
39 #include "TDirectory.h"
44 #include "TPaveText.h"
45 #include "TVirtualPad.h"
78 if ( alpha < 0 || alpha >= 0.5 )
89 Int_t* indices =
new Int_t[n];
91 TMath::Sort(n,x,indices,kFALSE);
93 Double_t* sx =
new Double_t[n];
95 for ( Int_t i = 0; i < n; ++i )
97 sx[i] = x[indices[i]];
104 Int_t k = TMath::FloorNint(alpha * n);
108 for ( Int_t i = k; i < n - k ; ++i )
113 tmean = sum / ( n - 2 * k );
117 for ( Int_t i = k; i < n - k; ++i )
119 t2 += (sx[i] - tmean) * (sx[i] - tmean);
124 k * (sx[k] - tmean) * (sx[k] - tmean) +
125 k * (sx[n - k - 1] - tmean) * (sx[n - k - 1] - tmean)
132 for ( Int_t i = k; i < n-k; ++i )
134 min = TMath::Min(min,sx[i]);
135 max = TMath::Max(max,sx[i]);
152 const char* NOTENOUGHEVENTMESSAGE =
"Not enough event to judge. Please wait a bit";
153 const char* NOTIFYEXPERTMESSAGE =
"PLEASE NOTIFY EXPERT !";
154 const char* ALLISFINEMESSAGE =
"All is fine. Just enjoy.";
156 const int NOTENOUGHEVENTLIMIT = 50;
161 Bool_t allIsFine(kFALSE);
168 Double_t y1 = 0.99 - (messages.GetLast()+(allIsFine?1:0)+2)*0.075;
170 TPaveText* text =
new TPaveText(0.5,y1,0.99,0.99,
"NDC");
172 text->AddText(Form(
"MCH RUN %d - %d events seen - %d events used",AliCDBManager::Instance()->GetRun(),neventsseen,neventsused));
174 TIter next(&messages);
177 while ( ( str = static_cast<TObjString*>(next()) ) )
179 text->AddText(str->String());
184 text->AddText(ALLISFINEMESSAGE);
187 text->SetFillColor(GetColorFromCheckCode(code));
189 Int_t color = GetColorFromCheckCode(code);
191 histo.SetFillStyle(1001);
192 histo.SetFillColor(color);
195 histo.SetOption(sopt.Data());
197 histo.SetBit(TH1::kNoTitle);
199 TList* lstF = histo.GetListOfFunctions();
200 TObject* title = lstF->FindObject(
"title");
201 if (title)
delete lstF->Remove(title);
208 void ShowTrueValue(TH1& hrostatusnorm, Int_t v)
213 Int_t bin = hrostatusnorm.FindBin(1.0*v);
215 Double_t value = hrostatusnorm.GetBinContent(bin);
219 TLatex* l =
new TLatex(hrostatusnorm.GetBinCenter(bin),50,Form(
"%g",value));
220 l->SetTextFont(
gStyle->GetTextFont());
223 l->SetTextSize(0.02*hrostatusnorm.GetMarkerSize());
224 hrostatusnorm.GetListOfFunctions()->Add(l);
248 AliCodeTimerAuto(
"",0);
251 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
255 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
274 histo.SetBit(AliQAv1::GetQABit());
286 AliCodeTimerAuto(
"",0);
289 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
292 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
315 AliCodeTimerAuto(
"",0);
317 if (!recoParam)
return 0x0;
321 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
326 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
331 if (!hneventsseen || !hneventsused )
continue;
333 Int_t neventsseen = TMath::Nint(hneventsseen->GetBinContent(1));
334 Int_t neventsused = TMath::Nint(hneventsused->GetBinContent(1));
344 if ( hbp && hbpconfig && hddl )
350 AliError(Form(
"Could not BeautifyOccupancyHistograms : hddl=%p hbpconfig=%p hbp=%p",hddl,hbpconfig,hbp));
357 if ( hrostatus && hrostatusnorm && hbuspatchtokenerrors )
360 neventsseen,neventsused,*recoParam);
364 AliError(Form(
"Could not BeautifyReadoutHistograms : hrostatus=%p hrostatusnorm=%p hbuspatchtokenerrors=%p",
365 hrostatus,hrostatusnorm,hbuspatchtokenerrors));
372 if ( heventsize && heventsizeperevent )
375 neventsseen,neventsused,*recoParam);
379 AliError(Form(
"Could not BeautifyEventsizeHistograms heventsize=%p heventsizeperevent=%p",heventsize,heventsizeperevent));
407 const TH1* hbuspatchconfig,
415 if ( hbuspatchconfig )
417 if ( hbp.GetNbinsX() != hbuspatchconfig->GetNbinsX() ||
418 hbp.GetXaxis()->GetXmin() != hbuspatchconfig->GetXaxis()->GetXmin() ||
419 hbp.GetXaxis()->GetXmax() != hbuspatchconfig->GetXaxis()->GetXmax() )
421 AliError(
"hbp and hbuspatchconfig histograms are not compatible !");
426 hddl.SetStats(kFALSE);
427 hbp.SetXTitle(
"Absolute Bus Patch Id");
428 hbp.SetYTitle(
"Occupancy (percent)");
429 hbp.SetStats(kFALSE);
431 Double_t xmin = hbp.GetXaxis()->GetXmin();
432 Double_t xmax = hbp.GetXaxis()->GetXmax();
434 Double_t occMax(0.1);
437 TLine* line1 =
new TLine(xmin,maxToleratedOccupancy,xmax,maxToleratedOccupancy);
438 line1->SetLineColor(1);
439 line1->SetLineWidth(1);
441 TLine* line2 =
new TLine(xmin,minToleratedOccupancy,xmax,minToleratedOccupancy);
442 line2->SetLineColor(1);
443 line2->SetLineWidth(1);
445 TList* lstF = hbp.GetListOfFunctions();
447 TObject *stats = lstF->FindObject(
"stats");
450 while ((obj = lstF->First())) {
while(lstF->Remove(obj)) { }
delete obj; }
451 if (stats) lstF->Add(stats);
454 hbp.GetListOfFunctions()->Add(line1);
455 hbp.GetListOfFunctions()->Add(line2);
460 Int_t nBusPatches(0);
461 Int_t nMissingBusPatches(0);
463 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
467 Int_t bin = hbp.FindBin(bp->
GetId());
469 if ( hbp.GetBinContent(bin) <= 0.0 )
471 ++nMissingBusPatches;
479 Int_t nBusPatchesAboveLimit(0);
480 Int_t nBusPatchesBelowLimit(0);
482 Double_t tmean(0.0),tvar(0.0);
483 Double_t ymin(0.0),ymax(0.0);
487 Double_t* x =
new Double_t[nBusPatches];
489 while ( ( bp = static_cast<AliMpBusPatch*>(next())) )
491 Int_t bin = hbp.FindBin(bp->
GetId());
492 if ( hbp.GetBinContent(bin) > 0 )
494 x[n] = hbp.GetBinContent(bin);
497 if ( hbp.GetBinContent(bin) > maxToleratedOccupancy )
499 ++nBusPatchesAboveLimit;
501 if ( hbp.GetBinContent(bin) < minToleratedOccupancy )
505 if ( hbuspatchconfig && hbuspatchconfig->GetBinContent(bin) > 0 )
508 ++nBusPatchesBelowLimit;
516 ok = trim(n,x,alpha,tmean,tvar,ymin,ymax);
527 ymax = TMath::Max(ymax,occMax);
530 hbp.SetMaximum(ymax*1.4);
535 messages.SetOwner(kTRUE);
537 if ( neventsseen < NOTENOUGHEVENTLIMIT )
539 messages.Add(
new TObjString(NOTENOUGHEVENTMESSAGE));
545 messages.Add(
new TObjString(
"Could not compute truncated mean. Not enough events ?"));
547 if ( neventsused < TMath::Nint(0.1*neventsseen) )
549 messages.Add(
new TObjString(Form(
"We've actually seen %d events, but used only %d !",neventsseen,neventsused)));
550 messages.Add(
new TObjString(
"For a normal physics run, this is highly suspect !"));
551 messages.Add(
new TObjString(NOTIFYEXPERTMESSAGE));
555 else if (!nBusPatches)
557 messages.Add(
new TObjString(Form(
"Could not get the total number of buspatches (%d). ERROR !!!",
559 messages.Add(
new TObjString(
"Please check with expert !"));
564 Float_t missingBusPatchFraction = nMissingBusPatches*100.0/nBusPatches;
565 Float_t aboveLimitFraction = nBusPatchesAboveLimit*100.0/nBusPatches;
566 Float_t belowLimitFraction = nBusPatchesBelowLimit*100.0/nBusPatches;
568 messages.Add(
new TObjString(Form(
"%5.2f %% of missing buspatches (%d out of %d)",missingBusPatchFraction,nMissingBusPatches,nBusPatches)));
569 messages.Add(
new TObjString(Form(
"%5.2f %% bus patches above the %5.2f %% limit",aboveLimitFraction,maxToleratedOccupancy)));
570 messages.Add(
new TObjString(Form(
"%5.2f %% bus patches below the %e %% limit",belowLimitFraction,minToleratedOccupancy)));
571 messages.Add(
new TObjString(Form(
"Bus patch mean occupancy (truncated at %2d %%) is %7.2f %%",(Int_t)(alpha*100),tmean)));
585 SetupHisto(neventsseen,neventsused,messages,hbp,rv);
588 SetupHisto(neventsseen,neventsused,messages,hddl,rv);
591 hddl.SetStats(kFALSE);
600 const TH1& hbuspatchtokenerrors,
608 hrostatusnorm.Reset();
613 messages.SetOwner(kTRUE);
615 if ( neventsseen < NOTENOUGHEVENTLIMIT )
617 messages.Add(
new TObjString(NOTENOUGHEVENTMESSAGE));
621 hrostatusnorm.Add(&hrostatus,100.0/neventsseen);
622 hrostatusnorm.SetOption(
"TEXT45");
623 hrostatusnorm.SetMinimum(0.0);
624 hrostatusnorm.SetMaximum(100.0);
632 messages.Add(
new TObjString(
"There are some token lost errors !"));
633 messages.Add(
new TObjString(
"PLEASE CHECK THE BUSY TIME FOR MUON !"));
634 messages.Add(
new TObjString(
"If above 5 ms please have the MUON expert"));
635 messages.Add(
new TObjString(
"check the following bus patches :"));
637 for ( Int_t i = 1; i <= hbuspatchtokenerrors.GetNbinsX(); ++i )
639 if ( hbuspatchtokenerrors.GetBinContent(i) > 0 )
641 messages.Add(
new TObjString(Form(
"BP %4d",i)));
648 messages.Add(
new TObjString(
"Too many empty events !"));
649 messages.Add(
new TObjString(NOTIFYEXPERTMESSAGE));
654 SetupHisto(neventsseen,neventsused,messages,hrostatusnorm,rv,
"text45");
667 TH1& heventsizeperevent,
676 heventsizeperevent.Reset();
679 messages.SetOwner(kTRUE);
681 if ( neventsseen < NOTENOUGHEVENTLIMIT )
683 messages.Add(
new TObjString(NOTENOUGHEVENTMESSAGE));
687 heventsizeperevent.Add(&heventsize,1.0/neventsseen/1024.0);
688 heventsizeperevent.SetMinimum(0);
690 Double_t totalEventSizePerEvent = heventsizeperevent.Integral();
698 msg =
"That is really too high.";
699 action = NOTIFYEXPERTMESSAGE;
703 msg =
"That is a bit high.";
704 action =
"Please keep an eye on it.";
712 messages.Add(
new TObjString(Form(
"<MCH event size> %5.1f KB/event\n",totalEventSizePerEvent)));
715 messages.Add(
new TObjString(msg));
716 messages.Add(
new TObjString(action));
720 SetupHisto(neventsseen,neventsused,messages,heventsizeperevent,rv);
Bin for number of token lost errors.
virtual AliMUONVQAChecker::ECheckCode * CheckESD(TObjArray **list, const AliMUONRecoParam *recoParam)
Check the QA object(s) for the ESD.
Number of good physics events seen (and used)
Status of readout (errors, missing pads, etc...)
warning, i.e. might become an error later on
Bin for number of glitch errors.
color for warning (online convention)
ECheckCode
Classification of errors severity.
Float_t BuspatchOccupancyLowLimit() const
Retrieve low value of bp occupancy limit.
Bin for number of parity errors.
virtual AliMUONVQAChecker::ECheckCode * CheckRecPoints(TObjArray **list, const AliMUONRecoParam *recoParam)
Check the QA object(s) for the RecPoints.
Class with MUON reconstruction parameters.
Float_t FractionOfBuspatchOutsideOccupancyLimit() const
Get the fraction of buspatches outside the occupancy limits.
AliMUONVQAChecker::ECheckCode MarkHisto(TH1 &histo, AliMUONVQAChecker::ECheckCode value) const
virtual Double_t EventSizeHardLimit() const
Get the max event size (hard limit)
Bin for number of empty events.
static AliMpDDLStore * Instance(Bool_t warn=true)
color for normal error (online convention)
Token lost errors during readout of the tracker.
event size per DDL per event
AliMUONVQAChecker::ECheckCode BeautifyEventsizeHistograms(TH1 &heventsize, TH1 &heventsizeperevent, Int_t neventsseen, Int_t neventsused, const AliMUONRecoParam &recoParam)
Base class for a MUON QA checker.
Bin for number of padding errors.
Int_t GetId() const
Return the unique Id.
AliMUONVQAChecker::ECheckCode BeautifyReadoutHistograms(TH1 &hroe, TH1 &hroenorm, const TH1 &hbuspatchtokenerrors, Int_t neventsseen, Int_t neventsused, const AliMUONRecoParam &recoParam)
AliMUONVQAChecker::ECheckCode BeautifyOccupancyHistograms(TH1 &hddl, TH1 &hbp, const TH1 *hbuspatchconfig, Int_t neventsseen, Int_t neventsused, const AliMUONRecoParam &recoParam)
normal error, i.e. something is wrong
The class defines the properties of BusPatch.
number of tracks matched with trigger
Configuration of the tracker.
Tracker : number of clusters per DE.
virtual Double_t EventSizeSoftLimit() const
Get the max event size (soft limit)
virtual ~AliMUONTrackerQAChecker()
as kTrackerReadoutStatus but normalized by the number of events
DDL occupancy in percent.
virtual AliMUONVQAChecker::ECheckCode * CheckRaws(TObjArray **list, const AliMUONRecoParam *recoParam)
Check the QA object(s) for the raw data.
AliMUONTrackerQAChecker()
virtual Double_t TokenLostLimit() const
Get the percentage of token lost error we allow.
Implementation of QAChecker for MCH.
Float_t BuspatchOccupancyHighLimit() const
Retrieve high value of bp occupancy limit.
color for information (online convention)
color for fatal error (online convention)