]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASSDChecker.cxx
- a fast HLT version of the SSD clusterfinder created. The speed on pp mc is ~20kHz...
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDChecker.cxx
CommitLineData
5dfa9b71 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 ---
c71529b0 25#include "TH1.h"
26#include "TString.h"
27#include "Riostream.h"
5dfa9b71 28
29// --- AliRoot header files ---
30#include "AliITSQASSDChecker.h"
c71529b0 31#include "AliLog.h"
5dfa9b71 32
33ClassImp(AliITSQASSDChecker)
5dfa9b71 34//__________________________________________________________________
35AliITSQASSDChecker& AliITSQASSDChecker::operator = (const AliITSQASSDChecker& qac )
36{
37 // Equal operator.
38 this->~AliITSQASSDChecker();
39 new(this) AliITSQASSDChecker(qac);
40 return *this;
41}
42
1b724264 43void AliITSQASSDChecker::CheckRaws(TH1* histo) {
44
45 Double_t minSSDDataSize = 0;
46 Double_t maxSSDDataSize = 200;
47 Double_t minDDLDataSize = 0;
48 Double_t maxDDLDataSize = 50;
49 Double_t minLDCDataSize = 0;
50 Double_t maxLDCDataSize = 100;
51 Double_t minMeanDDLDataSize = 0;
52 Double_t maxMeanDDLDataSize = 50;
53 Double_t minMeanLDCDataSize = 0;
54 Double_t maxMeanLDCDataSize = 100;
55 // Double_t maxOccupancy = 5;
56
57 TString histname = histo->GetName();
58
59 if (histname.EndsWith("SSDEventType")) {
60 if (histo->GetEntries()==0) {
61 AliWarning("Event type histogram is empty");
62 }
63 else if (histo->GetBinContent(histo->FindBin(7))==0) AliWarning("No type 7 (physics) events in EventType");
64 }
65
66 if (histname.EndsWith("SSDDataSize")) {
67 if (histo->GetEntries()==0) AliWarning("SSD data size histogram is empty");
68 if (histo->GetMean()>maxSSDDataSize||histo->GetMean()<minSSDDataSize) AliWarning(Form("SSD mean data size is %-.2g kB", histo->GetMean()));
69 }
70
71 if (histname.EndsWith("SSDDataSizePerDDL")) {
72 if (histo->GetEntries()==0) {
73 AliWarning("Data size per DDL histogram is empty");
74 }
75 else {
76 for(Int_t i = 512; i < 528; i++) {
77 if(histo->GetBinContent(histo->FindBin(i))==0) {
78 AliWarning(Form("Data size / DDL histogram: bin for DDL %i is empty",i));
79 }
80 else if(histo->GetBinContent(histo->FindBin(i))<minDDLDataSize||histo->GetBinContent(histo->FindBin(i))>maxDDLDataSize) AliWarning(Form("Data size DDL %i is %-.2g kB",i,histo->GetBinContent(histo->FindBin(i))));
81 }
82 }
83 }
84
85 if (histname.EndsWith("SSDDataSizePerLDC")) {
86 if (histo->GetEntries()==0) {
87 AliWarning("Data size per LDC histogram is empty");
88 }
89 else {
90 AliInfo(Form("Data size per LDC histogram has %i entries",histo->GetEntries()));
91 for(Int_t i = 170; i < 178; i++) {
92 if(histo->GetBinContent(histo->FindBin(i))==0) {
93 AliWarning(Form("Data size / LDC histogram: bin for LDC %i is empty",i));
94 }
95 else if(histo->GetBinContent(histo->FindBin(i))==minLDCDataSize||histo->GetBinContent(histo->FindBin(i))>maxLDCDataSize) AliWarning(Form("Data size LDC %i is %-.2g kB",i,histo->GetBinContent(i)));
96 }
97 }
98 }
99
100 if (histname.EndsWith("SSDLDCId")) {
101 if (histo->GetEntries()==0) {
102 AliWarning("LDC ID histogram is empty");
103 }
104 else {
105 for(Int_t i = 170; i < 177; i++) {
106 if(histo->GetBinContent(histo->FindBin(i))==0) {
107 AliWarning(Form("LDC ID histogram: No entries for LDC %i",i));
108 }
109 else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) {
110 AliWarning("LDC Id distribution is not uniform");
111 i=176;
112 }
113 }
114 }
115 }
116
117 if (histname.EndsWith("SSDDDLId")) {
118 if (histo->GetEntries()==0) {
119 AliWarning("DDL ID histogram is empty");
120 }
121 else {
122 for(Int_t i = 512; i < 527; i++) {
123 if(histo->GetBinContent(histo->FindBin(i))==0) {
124 AliWarning(Form("DDL ID histogram: No entries for DDL %i",i));
125 }
126 else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) {
127 AliWarning("DDL Id distribution is not uniform");
128 i=526;
129 }
130 }
131 }
132 }
133
134 if (histname.Contains("SSDDataSizeLDC")) {
135 if (histo->GetEntries()==0) {
136 AliWarning(Form("LDC %s data size distribution is empty", histname(histname.Length()-3,3).Data()));
137 }
138 else if (histo->GetMean()<minMeanLDCDataSize||histo->GetMean()>maxMeanLDCDataSize) AliWarning(Form("Mean data size of LDC %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean()));
139 }
140
141 if (histname.Contains("SSDDataSizeDDL")) {
142 if (histo->GetEntries()==0) {
143 AliWarning(Form("DDL %s data size distribution is empty", histname(histname.Length()-3,3).Data()));
144 }
145 else if (histo->GetMean()<minMeanDDLDataSize||histo->GetMean()>maxMeanDDLDataSize) AliWarning(Form("Mean data size of DDL %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean()));
146 }
147
148 if (histname.Contains("SSDAverageOccupancy")) {
149
150 const char* side = "";
151 int ladder = 0;
152 int layernr = 0;
153
154 if (histname.EndsWith("5")) layernr = 499;
155 if (histname.EndsWith("6")) layernr = 599;
156
157 for (Int_t i = 1; i < histo->GetNbinsY() + 1; i++) { //ladder/side loop
158 if(i==3.*int(i/3.)){
159 ladder=int(i/3.)+layernr;
160 side="P side";
161 }
162 else if(i==3.*int(i+1/3.)){
163 ladder=int((i+1)/3.)+layernr;
164 side="N side";
165 }
166
167 for (Int_t j = 1; j < histo->GetNbinsX() + 1; j++) { //module loop
168 //if(histo->GetBinContent(j,i)>maxOccupancy)
169 // AliWarning(Form("Occupancy ladder %i, module %i, %s is %-.2f %%",ladder,j,side, histo->GetBinContent(j,i)));
170 }//module loop
171 }//ladder loop
172 }
173
174}
175
176void AliITSQASSDChecker::CheckRecPoints(TH1* /*histo*/) {
177
178
179}
180
5dfa9b71 181//__________________________________________________________________
4e25ac79 182Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * list) {
5379c4a3 183 AliDebug(AliQAv1::GetQADebugLevel(),Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset));
1b724264 184 //cout<<"(AliITSQASSDChecker::Check): List name "<<list->GetName()<<endl;
5dfa9b71 185 Double_t test = 0.0 ;
186 Int_t count = 0 ;
1b724264 187 TString listname = list->GetName();
188
5dfa9b71 189 if (list->GetEntries() == 0){
190 test = 1. ; // nothing to check
191 }
192 else {
1b724264 193
5dfa9b71 194 TIter next(list) ;
195 TH1 * hdata ;
196 count = 0 ;
197 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
198 if (hdata) {
c71529b0 199 TString histname = hdata->GetName();
200 if(!histname.Contains("fHistSSD")) continue;
5dfa9b71 201 Double_t rv = 0.;
1b724264 202 if(hdata->GetEntries()>0) {
203 rv = 1;
204
205 //if(histname.Contains("PerDDL")) cout << "(AliITSQASSDChecker::Check) " << histname << " has " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl;
206
207 // if(hdata->GetMean()>0&&!histname.Contains("_Ladder")) cout << "(AliITSQASSDChecker::Check) " << histname << " not empty! " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl;
208 }
209
210 // if (listname.Contains("Raws")) CheckRaws(hdata);
211 // if (listname.Contains("RecPoints")) CheckRecPoints(hdata);
212
5379c4a3 213 //AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
c71529b0 214 //cout<<hdata->GetName()<<" - "<<rv<<endl;
5dfa9b71 215 count++ ;
216 test += rv ;
217 }
218 else{
219 AliError("Data type cannot be processed") ;
220 }
5dfa9b71 221 }
222 if (count != 0) {
223 if (test==0) {
224 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
225 test = 0.5; //upper limit value to set kWARNING flag for a task
226 }
227 else {
228 test /= count ;
229 }
230 }
231 }
c71529b0 232
5379c4a3 233 //AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test)) ;
c71529b0 234 //cout<<"Test result: "<<test<<endl;
5dfa9b71 235
5dfa9b71 236 return test ;
c71529b0 237
238 //return 0.;
1b724264 239
240
5dfa9b71 241}
242
3647765c 243//__________________________________________________________________
244void AliITSQASSDChecker::SetTaskOffset(Int_t TaskOffset)
245{
246 fSubDetOffset = TaskOffset;
247}