]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQAChecker.cxx
moving FMD1 1.5 cm forward. Better eta coverage...
[u/mrichter/AliRoot.git] / ITS / AliITSQAChecker.cxx
CommitLineData
1507771f 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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// *****************************************
19// Checks the quality assurance
20// by comparing with reference data
3647765c 21// W.Ferrarese P.Cerello Mag 2008
1507771f 22// INFN Torino
23
24// --- ROOT system ---
5dfa9b71 25#include "TH1.h"
3647765c 26#include <Riostream.h>
1507771f 27
28// --- AliRoot header files ---
29#include "AliITSQAChecker.h"
5dfa9b71 30#include "AliITSQASPDChecker.h"
31#include "AliITSQASDDChecker.h"
32#include "AliITSQASSDChecker.h"
1507771f 33
34ClassImp(AliITSQAChecker)
35
5dfa9b71 36//____________________________________________________________________________
37AliITSQAChecker::AliITSQAChecker(Bool_t kMode, Short_t subDet, Short_t ldc) :
c71529b0 38AliQACheckerBase("ITS","SDD Quality Assurance Checker"),
39fkOnline(0),
40fDet(0),
41fLDC(0),
42fSPDOffset(0),
43fSDDOffset(0),
44fSSDOffset(0),
45fSPDChecker(0), // SPD Checker
46fSDDChecker(0), // SDD Checker
47fSSDChecker(0) // SSD Checker
5dfa9b71 48{
8b51d296 49 // Standard constructor
5dfa9b71 50 fkOnline = kMode; fDet = subDet; fLDC = ldc;
51 if(fDet == 0 || fDet == 1) {
5379c4a3 52 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
5dfa9b71 53 }
54 if(fDet == 0 || fDet == 2) {
5379c4a3 55 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
5dfa9b71 56 }
57 if(fDet == 0 || fDet == 3) {
5379c4a3 58 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
5dfa9b71 59 }
60
61}
62
8b51d296 63//____________________________________________________________________________
64AliITSQAChecker::AliITSQAChecker(const AliITSQAChecker& qac):
65AliQACheckerBase(qac.GetName(), qac.GetTitle()),
66fkOnline(qac.fkOnline),
67fDet(qac.fDet),
68fLDC(qac.fLDC),
69fSPDOffset(qac.fSPDOffset),
70fSDDOffset(qac.fSDDOffset),
71fSSDOffset(qac.fSSDOffset),
72fSPDChecker(0),
73fSDDChecker(0),
74fSSDChecker(0) {
75 // copy constructor
76 AliError("Copy should not be used with this class\n");
77}
78//____________________________________________________________________________
79AliITSQAChecker& AliITSQAChecker::operator=(const AliITSQAChecker& qac){
80 // assignment operator
81 this->~AliITSQAChecker();
82 new(this)AliITSQAChecker(qac);
83 return *this;
84}
85
57acd2d2 86//____________________________________________________________________________
4e25ac79 87Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
5dfa9b71 88{
3647765c 89
5dfa9b71 90 // Super-basic check on the QA histograms on the input list:
91 // look whether they are empty!
4e25ac79 92 if(index == AliQAv1::kESD){
57acd2d2 93 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
94 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
95 rv[specie] = 0.0 ;
4e25ac79 96 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 97 continue ;
5379c4a3 98 AliDebug(AliQAv1::GetQADebugLevel(),"Checker for ESD");
57acd2d2 99 Int_t tested = 0;
100 Int_t empty = 0;
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
882ac7f1 110 }
57acd2d2 111 else {
112 TIter next1(list[specie]);
113 TH1 * hdata;
114 Int_t nskipped=0;
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())) ) {
118 if(!hdata) continue;
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) {
123 nskipped++;
124 skipped[k-1]=kTRUE;
125 }
126 }
127 }
128 TIter next(list[specie]);
129 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
130 if(hdata){
131 TString hname = hdata->GetName();
132 Double_t entries = hdata->GetEntries();
133 ++tested;
134 if(!(entries>0.))++empty;
5379c4a3 135 AliDebug(AliQAv1::GetQADebugLevel(),Form("ESD hist name %s - entries %12.1g",hname.Data(),entries));
57acd2d2 136 if(hname.Contains("hESDClusterMapSA") && entries>0.){
137 cluMapSA = kTRUE;
5379c4a3 138 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 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.)){
145 cluMapSA = kFALSE;
5379c4a3 146 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
57acd2d2 147 }
148 }
149 }
8ea6e205 150
57acd2d2 151 else if(hname.Contains("hESDClusterMapMI") && entries>0.){
152 // Check if there are layers with anomalously low
153 // contributing points to MI reconstructed tracks
5379c4a3 154 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 155 cluMapMI = kTRUE;
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.)){
160 cluMapMI = kFALSE;
5379c4a3 161 AliDebug(AliQAv1::GetQADebugLevel(), Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
57acd2d2 162 }
163 }
164 }
8ea6e205 165
57acd2d2 166 else if(hname.Contains("hESDClustersMI") && entries>0.){
167 // Check if 6 clusters MI tracks are the majority
5379c4a3 168 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 169 cluMI = kTRUE;
170 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
171 for(Int_t k=2; k<7-nskipped; k++){
172 if(hdata->GetBinContent(k)>maxlaytracks){
173 cluMI = kFALSE;
5379c4a3 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));
57acd2d2 175 }
176 }
177 }
8ea6e205 178
57acd2d2 179 else if(hname.Contains("hESDClustersSA") && entries>0.){
180 // Check if 6 clusters SA tracks are the majority
5379c4a3 181 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 182 cluSA = kTRUE;
183 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
184 for(Int_t k=2; k<7-nskipped; k++){
185 if(hdata->GetBinContent(k)>maxlaytracks){
186 cluSA = kFALSE;
5379c4a3 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));
57acd2d2 188 }
189 }
190 }
8ea6e205 191
57acd2d2 192 else if(hname.Contains("hSPDVertexZ") && entries>0.){
193 // Check if average Z vertex coordinate is -5 < z < 5 cm
5379c4a3 194 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 195 verSPDZ = kTRUE;
196 if(hdata->GetMean()<-5. && hdata->GetMean()>5.){
197 verSPDZ = kFALSE;
5379c4a3 198 AliDebug(AliQAv1::GetQADebugLevel(), Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
57acd2d2 199 }
200 }
201 }
8ea6e205 202
57acd2d2 203 else{
204 AliError("ESD Checker - invalid data type");
205 }
8ea6e205 206
57acd2d2 207 rv[specie] = 0.;
208 if(tested>0){
209 if(tested == empty){
210 rv[specie] = 0.1;
211 AliWarning("All ESD histograms are empty");
212 }
213 else {
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;
220 }
221 }
222 }
223 }
5379c4a3 224 AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
57acd2d2 225 }
226 return rv ;
8ea6e205 227 } // end of ESD QA
57acd2d2 228
229 Double_t * retval = new Double_t[AliRecoParam::kNSpecies] ;
614c7e17 230 //____________________________________________________________________________
231
c71529b0 232 Double_t spdCheck, sddCheck, ssdCheck;
614c7e17 233 //pixel
5dfa9b71 234 if(fDet == 0 || fDet == 1) {
5379c4a3 235 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
3647765c 236 if(!fSPDChecker) {
237 fSPDChecker = new AliITSQASPDChecker();
238 }
239 fSPDChecker->SetTaskOffset(fSPDOffset);
57acd2d2 240 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
241 retval[specie] = 1.0 ;
4e25ac79 242 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
57acd2d2 243 spdCheck = fSPDChecker->Check(index, list[specie]);
244 if(spdCheck<retval[specie])retval[specie] = spdCheck;
245 }
246 }
5dfa9b71 247 }
614c7e17 248 //drift
5dfa9b71 249 if(fDet == 0 || fDet == 2) {
5379c4a3 250 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
3647765c 251 if(!fSDDChecker) {
252 fSDDChecker = new AliITSQASDDChecker();
253 }
254 fSDDChecker->SetTaskOffset(fSDDOffset);
57acd2d2 255 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
256 retval[specie] = 1.0 ;
4e25ac79 257 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
57acd2d2 258 sddCheck = fSDDChecker->Check(index, list[specie]);
259 if(sddCheck<retval[specie])retval[specie] = sddCheck;
260 }
261 }
882ac7f1 262 }
614c7e17 263 //strip
5dfa9b71 264 if(fDet == 0 || fDet == 3) {
5379c4a3 265 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
3647765c 266 if(!fSSDChecker) {
267 fSSDChecker = new AliITSQASSDChecker();
5379c4a3 268 AliDebug(AliQAv1::GetQADebugLevel(), Form("Number of monitored objects SSD: %d", list[AliRecoParam::kDefault]->GetEntries()));
3647765c 269 }
270 fSSDChecker->SetTaskOffset(fSSDOffset);
57acd2d2 271 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
272 retval[specie] = 1.0 ;
4e25ac79 273 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
57acd2d2 274 ssdCheck = fSSDChecker->Check(index, list[specie]);
275 if(ssdCheck<retval[specie])retval[specie] = ssdCheck;
276 }
277 }
278 }
5dfa9b71 279 // here merging part for common ITS QA result
c71529b0 280 //
57acd2d2 281
282 return retval;
5dfa9b71 283}
284
285
c71529b0 286//____________________________________________________________________________
287void AliITSQAChecker::SetTaskOffset(Int_t SPDOffset, Int_t SDDOffset, Int_t SSDOffset)
288{
289 //Setting the 3 offsets for each task called
290 fSPDOffset = SPDOffset;
291 fSDDOffset = SDDOffset;
292 fSSDOffset = SSDOffset;
293}
614c7e17 294
295 //____________________________________________________________________________
296 void AliITSQAChecker::SetDetTaskOffset(Int_t subdet,Int_t offset)
297 {
298 switch(subdet){
299 case 1:
300 SetSPDTaskOffset(offset);
301 break;
302 case 2:
303 SetSDDTaskOffset(offset);
304 break;
305 case 3:
306 SetSSDTaskOffset(offset);
307 break;
308 default:
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);
311 break;
312 }
313 }