]>
Commit | Line | Data |
---|---|---|
c03351ac | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | ||
17 | ||
18 | ||
19 | //... | |
20 | // Checks the quality assurance. | |
21 | // By comparing with reference data | |
22 | // Skeleton for T0 | |
23 | //... | |
24 | ||
25 | // --- ROOT system --- | |
26 | #include <TClass.h> | |
27 | #include <TH1F.h> | |
28 | #include <TH1I.h> | |
29 | #include <TIterator.h> | |
30 | #include <TKey.h> | |
31 | #include <TFile.h> | |
446d6ec4 | 32 | #include <TMath.h> |
c03351ac | 33 | |
34 | // --- Standard library --- | |
35 | ||
36 | // --- AliRoot header files --- | |
37 | #include "AliLog.h" | |
38 | #include "AliQA.h" | |
39 | #include "AliQAChecker.h" | |
40 | #include "AliT0QAChecker.h" | |
41 | ||
42 | ClassImp(AliT0QAChecker) | |
43 | ||
44 | //__________________________________________________________________ | |
45 | AliT0QAChecker& AliT0QAChecker::operator = (const AliT0QAChecker& qac ) | |
46 | { | |
47 | // Equal operator. | |
48 | this->~AliT0QAChecker(); | |
49 | new(this) AliT0QAChecker(qac); | |
50 | return *this; | |
51 | } | |
3685c21c | 52 | //__________________________________________________________________ |
53 | ||
54 | const Double_t AliT0QAChecker::Check(TObjArray * list) | |
55 | { | |
56 | ||
57 | // Super-basic check on the QA histograms on the input list: | |
58 | // look whether they are empty! | |
446d6ec4 | 59 | |
3685c21c | 60 | Double_t test = 0.0 ; |
61 | Int_t count = 0 ; | |
446d6ec4 | 62 | Double_t nent[100]; |
63 | memset(nent,0,100*sizeof(Double_t)); | |
64 | Double_t w[100]; | |
65 | memset(w,1.,100*sizeof(Double_t)); | |
66 | ||
c03351ac | 67 | |
3685c21c | 68 | if (list->GetEntries() == 0){ |
69 | test = 1. ; // nothing to check | |
3685c21c | 70 | } |
71 | else { | |
446d6ec4 | 72 | |
3685c21c | 73 | TIter next(list) ; |
74 | TH1 * hdata ; | |
75 | count = 0 ; | |
76 | while ( (hdata = dynamic_cast<TH1 *>(next())) ) { | |
77 | if (hdata) { | |
446d6ec4 | 78 | nent[count] = hdata->GetEntries(); |
79 | AliDebug(1,Form("count %i %s -> %f",count, hdata->GetName(),nent[count])) ; | |
80 | ||
3685c21c | 81 | Double_t rv = 0.; |
82 | if(hdata->GetEntries()>0) rv = 1; | |
3685c21c | 83 | count++ ; |
84 | test += rv ; | |
446d6ec4 | 85 | |
3685c21c | 86 | } |
87 | else{ | |
88 | AliError("Data type cannot be processed") ; | |
89 | } | |
90 | ||
91 | } | |
446d6ec4 | 92 | |
3685c21c | 93 | if (count != 0) { |
94 | if (test==0) { | |
95 | AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING"); | |
96 | test = 0.5; //upper limit value to set kWARNING flag for a task | |
97 | } | |
98 | else { | |
99 | test /= count ; | |
446d6ec4 | 100 | AliDebug(10,Form(" MaxElement %f ", TMath::MaxElement(count,nent))); |
101 | if(TMath::MaxElement(count,nent) > 1000) { | |
102 | Double_t mean = TMath::Mean(count,nent,w); | |
103 | AliDebug(10,Form(" Mean %f ", mean)); | |
104 | for (Int_t i=0; i<count; i++) | |
105 | { | |
106 | Double_t diff = TMath::Abs(nent[i]-mean); | |
107 | if (diff > 0.1*mean ) | |
108 | AliInfo(Form("Problem in Number of entried in hist %i is %f\n", i, nent[i])) ; | |
109 | } | |
110 | } | |
3685c21c | 111 | } |
112 | } | |
113 | } | |
3685c21c | 114 | AliInfo(Form("Test Result = %f", test)) ; |
115 | return test ; | |
116 | } |