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, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/)
90 // Super-basic check on the QA histograms on the input list:
91 // look whether they are empty!
92 if(index == AliQAv1::kESD){
93 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
94 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
96 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
98 AliDebug(AliQAv1::GetQADebugLevel(),"Checker for ESD");
101 // The following flags are set to kTRUE if the corresponding
102 // QA histograms exceed a given quality threshold
103 Bool_t cluMapSA = kFALSE;
104 Bool_t cluMapMI = kFALSE;
105 Bool_t cluMI = kFALSE;
106 Bool_t cluSA = kFALSE;
107 Bool_t verSPDZ = kFALSE;
108 if (list[specie]->GetEntries() == 0) {
109 rv[specie] = 0.; // nothing to check
112 TIter next1(list[specie]);
115 Bool_t skipped[6]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
116 // look for layers that we wanted to skip
117 while ( (hdata = dynamic_cast<TH1 *>(next1())) ) {
119 TString hname = hdata->GetName();
120 if(!hname.Contains("hESDSkippedLayers")) continue;
121 for(Int_t k=1; k<7; k++) {
122 if(hdata->GetBinContent(k)>0) {
128 TIter next(list[specie]);
129 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
131 TString hname = hdata->GetName();
132 Double_t entries = hdata->GetEntries();
134 if(!(entries>0.))++empty;
135 AliDebug(AliQAv1::GetQADebugLevel(),Form("ESD hist name %s - entries %12.1g",hname.Data(),entries));
136 if(hname.Contains("hESDClusterMapSA") && entries>0.){
138 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
139 // Check if there are layers with anomalously low
140 // contributing points to SA reconstructed tracks
141 for(Int_t k=1;k<7;k++){
142 // check if the layer was skipped
143 if(skipped[k-1]) continue;
144 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
146 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
151 else if(hname.Contains("hESDClusterMapMI") && entries>0.){
152 // Check if there are layers with anomalously low
153 // contributing points to MI reconstructed tracks
154 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
156 for(Int_t k=1;k<7;k++){
157 // check if the layer was skipped
158 if(skipped[k-1]) continue;
159 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
161 AliDebug(AliQAv1::GetQADebugLevel(), Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
166 else if(hname.Contains("hESDClustersMI") && entries>0.){
167 // Check if 6 clusters MI tracks are the majority
168 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
170 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
171 for(Int_t k=2; k<7-nskipped; k++){
172 if(hdata->GetBinContent(k)>maxlaytracks){
174 AliDebug(AliQAv1::GetQADebugLevel(), Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
179 else if(hname.Contains("hESDClustersSA") && entries>0.){
180 // Check if 6 clusters SA tracks are the majority
181 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
183 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
184 for(Int_t k=2; k<7-nskipped; k++){
185 if(hdata->GetBinContent(k)>maxlaytracks){
187 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersSA",k-1,6-nskipped));
192 else if(hname.Contains("hSPDVertexZ") && entries>0.){
193 // Check if average Z vertex coordinate is -5 < z < 5 cm
194 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
196 if(hdata->GetMean()<-5. && hdata->GetMean()>5.){
198 AliDebug(AliQAv1::GetQADebugLevel(), Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
204 AliError("ESD Checker - invalid data type");
211 AliWarning("All ESD histograms are empty");
214 rv[specie] = 0.1+0.4*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested));
215 if(cluMapSA)rv[specie]+=0.1;
216 if(cluMapMI)rv[specie]+=0.1;
217 if(cluMI)rv[specie]+=0.1;
218 if(cluSA)rv[specie]+=0.1;
219 if(verSPDZ)rv[specie]+=0.1;
224 AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
229 Double_t * retval = new Double_t[AliRecoParam::kNSpecies] ;
230 //____________________________________________________________________________
232 Double_t spdCheck, sddCheck, ssdCheck;
234 if(fDet == 0 || fDet == 1) {
235 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
237 fSPDChecker = new AliITSQASPDChecker();
239 fSPDChecker->SetTaskOffset(fSPDOffset);
240 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
241 retval[specie] = 1.0 ;
242 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
243 spdCheck = fSPDChecker->Check(index, list[specie]);
244 if(spdCheck<retval[specie])retval[specie] = spdCheck;
249 if(fDet == 0 || fDet == 2) {
250 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
252 fSDDChecker = new AliITSQASDDChecker();
254 fSDDChecker->SetTaskOffset(fSDDOffset);
255 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
256 retval[specie] = 1.0 ;
257 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
258 sddCheck = fSDDChecker->Check(index, list[specie]);
259 if(sddCheck<retval[specie])retval[specie] = sddCheck;
264 if(fDet == 0 || fDet == 3) {
265 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
267 fSSDChecker = new AliITSQASSDChecker();
268 AliDebug(AliQAv1::GetQADebugLevel(), Form("Number of monitored objects SSD: %d", list[AliRecoParam::kDefault]->GetEntries()));
270 fSSDChecker->SetTaskOffset(fSSDOffset);
271 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
272 retval[specie] = 1.0 ;
273 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
274 ssdCheck = fSSDChecker->Check(index, list[specie]);
275 if(ssdCheck<retval[specie])retval[specie] = ssdCheck;
279 // here merging part for common ITS QA result
286 //____________________________________________________________________________
287 void AliITSQAChecker::SetTaskOffset(Int_t SPDOffset, Int_t SDDOffset, Int_t SSDOffset)
289 //Setting the 3 offsets for each task called
290 fSPDOffset = SPDOffset;
291 fSDDOffset = SDDOffset;
292 fSSDOffset = SSDOffset;
295 //____________________________________________________________________________
296 void AliITSQAChecker::SetDetTaskOffset(Int_t subdet,Int_t offset)
300 SetSPDTaskOffset(offset);
303 SetSDDTaskOffset(offset);
306 SetSSDTaskOffset(offset);
309 AliWarning("No specific (SPD,SDD or SSD) subdetector correspond to to this number!!! all offsets set to zero for all the detectors\n");
310 SetTaskOffset(0, 0, 0);