1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // *****************************************
19 // Checks the quality assurance
20 // by comparing with reference data
21 // P. Cerello Apr 2008
24 // --- ROOT system ---
28 // --- AliRoot header files ---
29 #include "AliITSQASPDChecker.h"
30 #include "AliITSQADataMakerRec.h"
33 ClassImp(AliITSQASPDChecker)
34 //__________________________________________________________________
35 AliITSQASPDChecker& AliITSQASPDChecker::operator = (const AliITSQASPDChecker& qac )
38 this->~AliITSQASPDChecker();
39 new(this) AliITSQASPDChecker(qac);
44 //__________________________________________________________________
45 Double_t AliITSQASPDChecker::Check(AliQAv1::ALITASK_t index, TObjArray * list, const AliDetectorRecoParam * /*recoParam*/)
48 // General methods for SPD Cheks to be used in RAWS and REC ALITASK_t
51 AliDebug(2, Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
55 // Checks for ALITASK_t AliQAv1::kRAW
56 if(index == AliQAv1::kRAW) {
57 return CheckRawData(list);
59 if (list->GetEntries() == 0) {
60 test = 1.; // nothing to check
66 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
68 TString histName = hdata->GetName();
69 if (!histName.Contains("_SPD")) continue;
71 if (hdata->GetEntries()>0) rv = 1;
72 if (histName.Contains("LayPattern")) {
73 if (hdata->GetBinContent(1)) {
74 Double_t ratio=hdata->GetBinContent(2)/hdata->GetBinContent(1);
75 AliDebug(2, Form("%s: ratio RecPoints lay2 / lay1 = %f", hdata->GetName(), ratio));
78 AliDebug(AliQAv1::GetQADebugLevel(), "No RecPoints in lay1");
80 else if(histName.Contains("ModPattern")) {
82 for(Int_t ibin=0;ibin<hdata->GetNbinsX();ibin++) {
83 if(histName.Contains("SPD1") && ibin<80 && hdata->GetBinContent(ibin+1)>0) ndead++;
84 if(histName.Contains("SPD2") && ibin>79 && hdata->GetBinContent(ibin+1)>0) ndead++;
86 AliDebug(2, Form("%s: Entries = %d number of empty modules = %d",
87 hdata->GetName(),(Int_t)hdata->GetEntries(),ndead));
89 else if(histName.Contains("SizeYvsZ")) {
90 Double_t meanz=hdata->GetMean(1);
91 Double_t meany=hdata->GetMean(2);
92 Double_t rmsz=hdata->GetRMS(1);
93 Double_t rmsy=hdata->GetRMS(2);
94 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeY mean = %f rms = %f", hdata->GetName(),meany,rmsy));
95 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeZ mean = %f rms = %f", hdata->GetName(),meanz,rmsz));
97 else if(histName.Contains("SPDMultiplicity")) {
98 AliDebug(2, Form("%s: Events = %d mean = %f rms = %f",
99 hdata->GetName(),(Int_t)hdata->GetEntries(),hdata->GetMean(),hdata->GetRMS()));}
101 // else AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
106 AliError("Data type cannot be processed") ;
111 if (AliITSQADataMakerRec::AreEqual(test,0)) {
112 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
113 test = fHighSPDValue[AliQAv1::kWARNING]; //upper limit value to set kWARNING flag for a task
121 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test));
125 //__________________________________________________________________
126 Double_t AliITSQASPDChecker::CheckRawData(const TObjArray * list) {
128 // Checks on the raw data histograms [ preliminary version ]
129 // The output of this method is the fraction of SPD histograms which are processed by the checker.
130 // The methods returns fHighSPDValue[AliQAv1::kFATAL] in case of data format errors or MEB errors
136 // basic checks on input data
138 AliError("NO histogram list for RAWS");
142 if(list->GetEntries() == 0) {
143 AliWarning("No histograms in RAW list \n");
147 // loop over the raw data histograms
150 Double_t totalHistos = 0;
151 Double_t goodHistos = 0; // number of histograms which passed the checks
152 Double_t response =0;
153 Bool_t fatalProblem = kFALSE;
155 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
157 TString histName = hdata->GetName();
158 if(!histName.Contains("SPD")) continue;
161 if(histName.Contains("SPDErrorsAll")){
162 if(hdata->Integral(0,hdata->GetNbinsX())>0){
163 response = fHighSPDValue[AliQAv1::kFATAL];
169 if(histName.Contains("MEB")){
170 if(hdata->GetEntries()>0){
171 AliWarning("************* MEB ERROR!!!! ****************\n");
172 response = fHighSPDValue[AliQAv1::kFATAL];
180 if(!fatalProblem) response = goodHistos/totalHistos;
181 // printf("n histos %f - good ones %f ----> ratio %f , fatal response %i\n",totalHistos,goodHistos,goodHistos/totalHistos,(Int_t)fatalProblem);
185 //__________________________________________________________________
186 void AliITSQASPDChecker::SetTaskOffset(Int_t TaskOffset)
188 // Offset for SPD within ITS QA
189 fSubDetOffset = TaskOffset;
192 //__________________________________________________________________
193 void AliITSQASPDChecker::SetStepBit(const Double_t *steprange)
195 // Step bit for SPD within ITS QA
196 fStepBitSPD = new Double_t[AliQAv1::kNBIT];
197 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
199 fStepBitSPD[bit]=steprange[bit];
204 //__________________________________________________________________
205 void AliITSQASPDChecker::SetSPDLimits(const Float_t *lowvalue, const Float_t * highvalue)
207 // SPD limints for QA bit within general ITS QA
208 fLowSPDValue = new Float_t[AliQAv1::kNBIT];
209 fHighSPDValue= new Float_t[AliQAv1::kNBIT];
211 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
213 fLowSPDValue[bit]=lowvalue[bit];
214 fHighSPDValue[bit]= highvalue[bit];