]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSQASPDChecker.cxx
Update for running on 2010 data (S. Beole')
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDChecker.cxx
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
21 //  P. Cerello Apr 2008
22 //  INFN Torino
23
24 // --- ROOT system ---
25 #include "TH1.h"
26 #include "TString.h"
27
28 // --- AliRoot header files ---
29 #include "AliITSQASPDChecker.h"
30 #include "AliLog.h"
31
32 ClassImp(AliITSQASPDChecker)
33 //__________________________________________________________________
34 AliITSQASPDChecker& AliITSQASPDChecker::operator = (const AliITSQASPDChecker& qac ) 
35 {
36   // Equal operator.
37   this->~AliITSQASPDChecker();
38   new(this) AliITSQASPDChecker(qac);
39   return *this;
40 }
41
42
43 //__________________________________________________________________
44 Double_t AliITSQASPDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * list, const AliDetectorRecoParam * /*recoParam*/)
45 {
46   AliDebug(2, Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
47
48   AliInfo(Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
49
50   Double_t test = 0.0;
51   Int_t count = 0;
52
53   if (list->GetEntries() == 0) {
54     test = 1.; // nothing to check
55   }
56   else {
57     TIter next(list);
58     TH1 * hdata;
59     count = 0;
60     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
61       if (hdata) {
62         TString histName = hdata->GetName();
63         if (!histName.Contains("_SPD")) continue;
64         Double_t rv = 0.;
65         if (hdata->GetEntries()>0) rv = 1;
66         if (histName.Contains("LayPattern")) {
67          if (hdata->GetBinContent(1)) {
68            Double_t ratio=hdata->GetBinContent(2)/hdata->GetBinContent(1);
69            AliDebug(2, Form("%s: ratio RecPoints lay2 / lay1 = %f", hdata->GetName(), ratio));
70          }
71          else
72            AliDebug(AliQAv1::GetQADebugLevel(), "No RecPoints in lay1");
73        }
74         else if(histName.Contains("ModPattern")) {
75            Int_t ndead=0;
76            for(Int_t ibin=0;ibin<hdata->GetNbinsX();ibin++) {
77              if(histName.Contains("SPD1") && ibin<80 && hdata->GetBinContent(ibin+1)>0) ndead++;
78              if(histName.Contains("SPD2") && ibin>79 && hdata->GetBinContent(ibin+1)>0) ndead++;
79            }
80            AliDebug(2, Form("%s: Entries = %d  number of empty modules = %d", 
81                         hdata->GetName(),(Int_t)hdata->GetEntries(),ndead));
82         }
83         else if(histName.Contains("SizeYvsZ")) {
84            Double_t meanz=hdata->GetMean(1);
85            Double_t meany=hdata->GetMean(2);
86            Double_t rmsz=hdata->GetRMS(1);
87            Double_t rmsy=hdata->GetRMS(2);
88            AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeY mean = %f  rms = %f", hdata->GetName(),meany,rmsy));
89            AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeZ mean = %f  rms = %f", hdata->GetName(),meanz,rmsz));
90         }
91         else if(histName.Contains("SPDMultiplicity")) {
92            AliDebug(2, Form("%s: Events = %d  mean = %f  rms = %f",
93                         hdata->GetName(),(Int_t)hdata->GetEntries(),hdata->GetMean(),hdata->GetRMS()));}
94
95         // else AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
96         count++;
97         test += rv;
98       }
99       else {
100         AliError("Data type cannot be processed") ;
101       }
102     }
103
104     if (count != 0) {
105       if (test==0) {
106         AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
107         test = 0.5;  //upper limit value to set kWARNING flag for a task
108       }
109       else {
110         test /= count;
111       }
112     }
113   }
114
115   AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test));
116   return test ;
117
118 }
119
120 //__________________________________________________________________
121 void AliITSQASPDChecker::SetTaskOffset(Int_t TaskOffset)
122 {
123   fSubDetOffset = TaskOffset;
124 }
125
126 //__________________________________________________________________
127 void AliITSQASPDChecker::SetStepBit(Double_t *steprange)
128 {
129
130   fStepBitSPD = new Double_t[AliQAv1::kNBIT];
131   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
132     {
133       fStepBitSPD[bit]=steprange[bit];
134     }
135 }
136
137
138 //__________________________________________________________________
139 void  AliITSQASPDChecker::SetSPDLimits(Float_t *lowvalue, Float_t * highvalue)
140 {
141
142   fLowSPDValue = new Float_t[AliQAv1::kNBIT];
143   fHighSPDValue= new Float_t[AliQAv1::kNBIT];
144
145   for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
146     {
147       fLowSPDValue[bit]=lowvalue[bit];
148       fHighSPDValue[bit]= highvalue[bit];
149     }
150
151 }