]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 2004, 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 | // Yves? | |
18 | // What | |
19 | // is | |
20 | // this | |
21 | // class | |
22 | // supposed | |
23 | // to | |
24 | // do? | |
25 | //__________________________________________________________________ | |
26 | // | |
27 | // --- ROOT system --- | |
28 | #include <TClass.h> | |
29 | #include <TH1F.h> | |
30 | #include <TH1I.h> | |
31 | #include <TIterator.h> | |
32 | #include <TKey.h> | |
33 | #include <TFile.h> | |
34 | #include <iostream> | |
35 | #include <TCanvas.h> | |
36 | #include <TPaveText.h> | |
37 | ||
38 | // --- AliRoot header files --- | |
39 | #include "AliLog.h" | |
40 | #include "AliQAv1.h" | |
41 | #include "AliQAChecker.h" | |
42 | #include "AliFMDQAChecker.h" | |
43 | #include "AliRecoParam.h" | |
44 | ||
45 | ClassImp(AliFMDQAChecker) | |
46 | #if 0 | |
47 | ; // This is for Emacs! - do not delete | |
48 | #endif | |
49 | //__________________________________________________________________ | |
50 | void AliFMDQAChecker::Check(Double_t* rv, | |
51 | AliQAv1::ALITASK_t what, | |
52 | TObjArray** list, | |
53 | const AliDetectorRecoParam* /*t*/) | |
54 | { | |
55 | // | |
56 | // Member function called to do the actual checking | |
57 | // | |
58 | // Parameters: | |
59 | // rv Array of return values. | |
60 | // what What to check | |
61 | // list Array of arrays of histograms. There's one arrat for | |
62 | // each 'specie' | |
63 | // t Reconstruction parameters - not used. | |
64 | // | |
65 | ||
66 | // Double_t* rv = new Double_t[AliRecoParam::kNSpecies] ; | |
67 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
68 | Int_t count = 0; | |
69 | rv[specie] = 0.; | |
70 | ||
71 | if (!AliQAv1::Instance()->IsEventSpecieSet(specie) ) | |
72 | continue ; | |
73 | ||
74 | if(!list[specie]) continue; | |
75 | ||
76 | TH1F* hist = 0; | |
77 | Int_t nHist = list[specie]->GetEntriesFast(); | |
78 | for(Int_t i= 0; i< nHist; i++) { | |
79 | ||
80 | if (!(hist = static_cast<TH1F*>(list[specie]->At(i)))) continue; | |
81 | ||
82 | if(what == AliQAv1::kESD) | |
83 | rv[specie] += (hist->GetMean() > 0 ? 1 : 0); | |
84 | if(what == AliQAv1::kRAW) | |
85 | rv[specie] += (hist->GetMean() > 0 ? 1 : 0); | |
86 | if(what == AliQAv1::kSIM) | |
87 | rv[specie] += (hist->GetMean() > 0 ? 1 : 0); | |
88 | if(what == AliQAv1::kREC) | |
89 | rv[specie] += (hist->GetMean() > 0 ? 1 : 0); | |
90 | } // for (int i ...) | |
91 | if (count != 0) rv[specie] /= count; | |
92 | } | |
93 | // return rv; | |
94 | } | |
95 | ||
96 | ||
97 | //____________________________________________________________________________ | |
98 | void | |
99 | AliFMDQAChecker::MakeImage(TObjArray** list, | |
100 | AliQAv1::TASKINDEX_t task, | |
101 | AliQAv1::MODE_t mode) | |
102 | { | |
103 | // makes the QA image for sim and rec | |
104 | // | |
105 | // Parameters: | |
106 | // task What to check | |
107 | // list Array of arrays of histograms. There's one array for | |
108 | // each 'specie' | |
109 | // t Reconstruction parameters - not used. | |
110 | // | |
111 | Int_t nImages = 0 ; | |
112 | Double_t max = 0; | |
113 | Double_t min = 10000; | |
114 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
115 | if (!AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ; | |
116 | ||
117 | if(!list[specie]) continue; | |
118 | ||
119 | TH1F* hist = 0; | |
120 | Int_t nHist = list[specie]->GetEntriesFast(); | |
121 | for(Int_t i= 0; i< nHist; i++) { | |
122 | hist = static_cast<TH1F*>(list[specie]->At(i)); | |
123 | if (hist->TestBit(AliQAv1::GetImageBit())) { | |
124 | nImages++; | |
125 | max = TMath::Max(max, hist->GetMaximum()); | |
126 | min = TMath::Min(min, hist->GetMinimum()); | |
127 | } | |
128 | } | |
129 | break ; | |
130 | } | |
131 | min = TMath::Max(0.1, min); | |
132 | max = TMath::Min(1.0, max); | |
133 | ||
134 | if (nImages == 0) { | |
135 | AliDebug(AliQAv1::GetQADebugLevel(), | |
136 | Form("No histogram will be plotted for %s %s\n", GetName(), | |
137 | AliQAv1::GetTaskName(task).Data())); | |
138 | return; | |
139 | } | |
140 | ||
141 | AliDebug(AliQAv1::GetQADebugLevel(), | |
142 | Form("%d histograms will be plotted for %s %s\n", | |
143 | nImages, GetName(), AliQAv1::GetTaskName(task).Data())); | |
144 | ||
145 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
146 | if (!AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ; | |
147 | ||
148 | if(!list[specie]) continue; | |
149 | ||
150 | const Char_t * title = Form("QA_%s_%s_%s", GetName(), | |
151 | AliQAv1::GetTaskName(task).Data(), | |
152 | AliRecoParam::GetEventSpecieName(specie)); | |
153 | if (!fImage[specie]) | |
154 | fImage[specie] = new TCanvas(title, title) ; | |
155 | fImage[specie]->Clear() ; | |
156 | fImage[specie]->SetTitle(title) ; | |
157 | fImage[specie]->cd() ; | |
158 | ||
159 | TPaveText someText(0.015, 0.015, 0.98, 0.98) ; | |
160 | someText.AddText(title) ; | |
161 | someText.Draw() ; | |
162 | fImage[specie]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), | |
163 | AliQAv1::GetModeName(mode), | |
164 | AliQAChecker::Instance()->GetRunNumber(), | |
165 | AliQAv1::GetImageFileFormat()), "ps") ; | |
166 | fImage[specie]->Clear(); | |
167 | ||
168 | Int_t nx = (nImages + .5) / 2; | |
169 | Int_t ny = 2; | |
170 | fImage[specie]->Divide(nx, ny, 0, 0); | |
171 | ||
172 | ||
173 | TH1F* hist = 0; | |
174 | Int_t nHist = list[specie]->GetEntriesFast(); | |
175 | Int_t j = 0; | |
176 | for (Int_t i = 0; i < nHist; i++) { | |
177 | hist = static_cast<TH1F*>(list[specie]->At(i)); | |
178 | if (!hist->TestBit(AliQAv1::GetImageBit())) continue; | |
179 | ||
180 | TVirtualPad* pad = fImage[specie]->cd(++j); | |
181 | pad->SetLogy(); | |
182 | hist->SetMinimum(min); | |
183 | hist->SetMaximum(max); | |
184 | hist->DrawCopy(); | |
185 | } | |
186 | ||
187 | fImage[specie]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), | |
188 | AliQAv1::GetModeName(mode), | |
189 | AliQAChecker::Instance()->GetRunNumber(), | |
190 | AliQAv1::GetImageFileFormat()), "ps"); | |
191 | } | |
192 | } | |
193 | ||
194 | //__________________________________________________________________ | |
195 | // | |
196 | // EOF | |
197 | // |