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 // W.Ferrarese P.Cerello Mag 2008
24 // --- ROOT system ---
26 #include <Riostream.h>
28 // --- AliRoot header files ---
29 #include "AliITSQAChecker.h"
30 #include "AliITSQASPDChecker.h"
31 #include "AliITSQASDDChecker.h"
32 #include "AliITSQASSDChecker.h"
34 ClassImp(AliITSQAChecker)
36 //____________________________________________________________________________
37 AliITSQAChecker::AliITSQAChecker(Bool_t kMode, Short_t subDet, Short_t ldc) :
38 AliQACheckerBase("ITS","SDD Quality Assurance Checker"),
45 fSPDChecker(0), // SPD Checker
46 fSDDChecker(0), // SDD Checker
47 fSSDChecker(0) // SSD Checker
49 // Standard constructor
50 fkOnline = kMode; fDet = subDet; fLDC = ldc;
51 if(fDet == 0 || fDet == 1) {
52 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
54 if(fDet == 0 || fDet == 2) {
55 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
57 if(fDet == 0 || fDet == 3) {
58 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
63 //____________________________________________________________________________
64 AliITSQAChecker::AliITSQAChecker(const AliITSQAChecker& qac):
65 AliQACheckerBase(qac.GetName(), qac.GetTitle()),
66 fkOnline(qac.fkOnline),
69 fSPDOffset(qac.fSPDOffset),
70 fSDDOffset(qac.fSDDOffset),
71 fSSDOffset(qac.fSSDOffset),
76 AliError("Copy should not be used with this class\n");
78 //____________________________________________________________________________
79 AliITSQAChecker& AliITSQAChecker::operator=(const AliITSQAChecker& qac){
80 // assignment operator
81 this->~AliITSQAChecker();
82 new(this)AliITSQAChecker(qac);
86 //____________________________________________________________________________
87 Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
89 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
90 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
95 //____________________________________________________________________________
96 Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
99 // Super-basic check on the QA histograms on the input list:
100 // look whether they are empty!
101 if(index == AliQAv1::kESD){
102 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
103 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
105 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
107 AliDebug(AliQAv1::GetQADebugLevel(),"Checker for ESD");
110 // The following flags are set to kTRUE if the corresponding
111 // QA histograms exceed a given quality threshold
112 Bool_t cluMapSA = kFALSE;
113 Bool_t cluMapMI = kFALSE;
114 Bool_t cluMI = kFALSE;
115 Bool_t cluSA = kFALSE;
116 Bool_t verSPDZ = kFALSE;
117 if (list[specie]->GetEntries() == 0) {
118 rv[specie] = 0.; // nothing to check
121 TIter next1(list[specie]);
124 Bool_t skipped[6]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
125 // look for layers that we wanted to skip
126 while ( (hdata = dynamic_cast<TH1 *>(next1())) ) {
128 TString hname = hdata->GetName();
129 if(!hname.Contains("hESDSkippedLayers")) continue;
130 for(Int_t k=1; k<7; k++) {
131 if(hdata->GetBinContent(k)>0) {
137 TIter next(list[specie]);
138 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
140 TString hname = hdata->GetName();
141 Double_t entries = hdata->GetEntries();
143 if(!(entries>0.))++empty;
144 AliDebug(AliQAv1::GetQADebugLevel(),Form("ESD hist name %s - entries %12.1g",hname.Data(),entries));
145 if(hname.Contains("hESDClusterMapSA") && entries>0.){
147 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
148 // Check if there are layers with anomalously low
149 // contributing points to SA reconstructed tracks
150 for(Int_t k=1;k<7;k++){
151 // check if the layer was skipped
152 if(skipped[k-1]) continue;
153 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
155 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
160 else if(hname.Contains("hESDClusterMapMI") && entries>0.){
161 // Check if there are layers with anomalously low
162 // contributing points to MI reconstructed tracks
163 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
165 for(Int_t k=1;k<7;k++){
166 // check if the layer was skipped
167 if(skipped[k-1]) continue;
168 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
170 AliDebug(AliQAv1::GetQADebugLevel(), Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
175 else if(hname.Contains("hESDClustersMI") && entries>0.){
176 // Check if 6 clusters MI tracks are the majority
177 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
179 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
180 for(Int_t k=2; k<7-nskipped; k++){
181 if(hdata->GetBinContent(k)>maxlaytracks){
183 AliDebug(AliQAv1::GetQADebugLevel(), Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
188 else if(hname.Contains("hESDClustersSA") && entries>0.){
189 // Check if 6 clusters SA tracks are the majority
190 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
192 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
193 for(Int_t k=2; k<7-nskipped; k++){
194 if(hdata->GetBinContent(k)>maxlaytracks){
196 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersSA",k-1,6-nskipped));
201 else if(hname.Contains("hSPDVertexZ") && entries>0.){
202 // Check if average Z vertex coordinate is -5 < z < 5 cm
203 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
205 if(hdata->GetMean()<-5. && hdata->GetMean()>5.){
207 AliDebug(AliQAv1::GetQADebugLevel(), Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
213 AliError("ESD Checker - invalid data type");
220 AliWarning("All ESD histograms are empty");
223 rv[specie] = 0.1+0.4*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested));
224 if(cluMapSA)rv[specie]+=0.1;
225 if(cluMapMI)rv[specie]+=0.1;
226 if(cluMI)rv[specie]+=0.1;
227 if(cluSA)rv[specie]+=0.1;
228 if(verSPDZ)rv[specie]+=0.1;
233 AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
238 Double_t * retval = new Double_t[AliRecoParam::kNSpecies] ;
239 //____________________________________________________________________________
241 Double_t spdCheck, sddCheck, ssdCheck;
243 if(fDet == 0 || fDet == 1) {
244 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
246 fSPDChecker = new AliITSQASPDChecker();
248 fSPDChecker->SetTaskOffset(fSPDOffset);
249 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
250 retval[specie] = 1.0 ;
251 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
252 spdCheck = fSPDChecker->Check(index, list[specie]);
253 if(spdCheck<retval[specie])retval[specie] = spdCheck;
258 if(fDet == 0 || fDet == 2) {
259 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
261 fSDDChecker = new AliITSQASDDChecker();
263 fSDDChecker->SetTaskOffset(fSDDOffset);
264 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
265 retval[specie] = 1.0 ;
266 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
267 sddCheck = fSDDChecker->Check(index, list[specie]);
268 if(sddCheck<retval[specie])retval[specie] = sddCheck;
273 if(fDet == 0 || fDet == 3) {
274 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
276 fSSDChecker = new AliITSQASSDChecker();
277 AliDebug(AliQAv1::GetQADebugLevel(), Form("Number of monitored objects SSD: %d", list[AliRecoParam::kDefault]->GetEntries()));
279 fSSDChecker->SetTaskOffset(fSSDOffset);
280 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
281 retval[specie] = 1.0 ;
282 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
283 ssdCheck = fSSDChecker->Check(index, list[specie]);
284 if(ssdCheck<retval[specie])retval[specie] = ssdCheck;
288 // here merging part for common ITS QA result
295 //____________________________________________________________________________
296 void AliITSQAChecker::SetTaskOffset(Int_t SPDOffset, Int_t SDDOffset, Int_t SSDOffset)
298 //Setting the 3 offsets for each task called
299 fSPDOffset = SPDOffset;
300 fSDDOffset = SDDOffset;
301 fSSDOffset = SSDOffset;
304 //____________________________________________________________________________
305 void AliITSQAChecker::SetDetTaskOffset(Int_t subdet,Int_t offset)
309 SetSPDTaskOffset(offset);
312 SetSDDTaskOffset(offset);
315 SetSSDTaskOffset(offset);
318 AliWarning("No specific (SPD,SDD or SSD) subdetector correspond to to this number!!! all offsets set to zero for all the detectors\n");
319 SetTaskOffset(0, 0, 0);