]>
Commit | Line | Data |
---|---|---|
04236e67 | 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 | /* $Id$ */ | |
18 | ||
19 | /* | |
20 | Base Class | |
21 | Produces the data needed to calculate the quality assurance. | |
22 | All data must be mergeable objects. | |
23 | Y. Schutz CERN July 2007 | |
24 | */ | |
25 | ||
26 | // --- ROOT system --- | |
27 | #include <TSystem.h> | |
28 | #include <TFile.h> | |
29 | #include <TList.h> | |
30 | #include <TTree.h> | |
31 | #include <TClonesArray.h> | |
32 | ||
33 | // --- Standard library --- | |
34 | ||
35 | // --- AliRoot header files --- | |
36 | #include "AliLog.h" | |
37 | #include "AliQADataMakerSim.h" | |
38 | #include "AliQAChecker.h" | |
39 | ||
40 | ClassImp(AliQADataMakerSim) | |
41 | ||
42 | //____________________________________________________________________________ | |
43 | AliQADataMakerSim::AliQADataMakerSim(const char * name, const char * title) : | |
44 | AliQADataMaker(name, title), | |
45 | fDigitsQAList(0x0), | |
46 | fHitsQAList(0x0), | |
47 | fSDigitsQAList(0x0) | |
48 | { | |
49 | // ctor | |
50 | fDetectorDirName = GetName() ; | |
51 | } | |
52 | ||
53 | //____________________________________________________________________________ | |
54 | AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) : | |
55 | AliQADataMaker(qadm.GetName(), qadm.GetTitle()), | |
56 | fDigitsQAList(qadm.fDigitsQAList), | |
57 | fHitsQAList(qadm.fHitsQAList), | |
58 | fSDigitsQAList(qadm.fSDigitsQAList) | |
59 | { | |
60 | //copy ctor | |
61 | fDetectorDirName = GetName() ; | |
62 | } | |
63 | ||
64 | //__________________________________________________________________ | |
65 | AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm ) | |
66 | { | |
67 | // Assignment operator. | |
68 | this->~AliQADataMakerSim(); | |
69 | new(this) AliQADataMakerSim(qadm); | |
70 | return *this; | |
71 | } | |
72 | ||
73 | //____________________________________________________________________________ | |
74 | void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX task) | |
75 | { | |
76 | // Finishes a cycle of QA data acquistion | |
77 | TObjArray * list = 0x0 ; | |
78 | ||
79 | if ( task == AliQA::kHITS ) | |
80 | list = fHitsQAList ; | |
81 | else if ( task == AliQA::kSDIGITS ) | |
82 | list = fSDigitsQAList ; | |
83 | else if ( task == AliQA::kDIGITS ) | |
84 | list = fDigitsQAList ; | |
85 | ||
86 | EndOfDetectorCycle(task, list) ; | |
87 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
88 | subDir->cd() ; | |
89 | list->Write() ; | |
90 | } | |
91 | ||
92 | //____________________________________________________________________________ | |
93 | void AliQADataMakerSim::Exec(AliQA::TASKINDEX task, TObject * data) | |
94 | { | |
95 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
96 | ||
97 | if ( task == AliQA::kHITS ) { | |
98 | AliDebug(1, "Processing Hits QA") ; | |
99 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
100 | if (arr) { | |
101 | MakeHits(arr) ; | |
102 | } else { | |
103 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
104 | if (tree) { | |
105 | MakeHits(tree) ; | |
106 | } else { | |
107 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
108 | } | |
109 | } | |
110 | } else if ( task == AliQA::kSDIGITS ) { | |
111 | AliDebug(1, "Processing SDigits QA") ; | |
112 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
113 | if (arr) { | |
114 | MakeSDigits(arr) ; | |
115 | } else { | |
116 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
117 | if (tree) { | |
118 | MakeSDigits(tree) ; | |
119 | } else { | |
120 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
121 | } | |
122 | } | |
123 | } else if ( task == AliQA::kDIGITS ) { | |
124 | AliDebug(1, "Processing Digits QA") ; | |
125 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
126 | if (arr) { | |
127 | MakeDigits(arr) ; | |
128 | } else { | |
129 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
130 | if (tree) { | |
131 | MakeDigits(tree) ; | |
132 | } else { | |
133 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
134 | } | |
135 | } | |
136 | } | |
137 | } | |
138 | ||
139 | //____________________________________________________________________________ | |
140 | TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles) | |
141 | { | |
142 | // general intialisation | |
143 | ||
144 | fRun = run ; | |
145 | if (cycles > 0) | |
146 | SetCycle(cycles) ; | |
147 | TObjArray * rv = NULL ; | |
148 | if ( task == AliQA::kHITS ) { | |
149 | fHitsQAList = new TObjArray(100) ; | |
150 | InitHits() ; | |
151 | rv = fHitsQAList ; | |
152 | } else if ( task == AliQA::kSDIGITS ) { | |
153 | fSDigitsQAList = new TObjArray(100) ; | |
154 | InitSDigits() ; | |
155 | rv = fSDigitsQAList ; | |
156 | } else if ( task == AliQA::kDIGITS ) { | |
157 | fDigitsQAList = new TObjArray(100); | |
158 | InitDigits() ; | |
159 | rv = fDigitsQAList ; | |
160 | } | |
161 | ||
162 | return rv ; | |
163 | } | |
164 | ||
165 | //____________________________________________________________________________ | |
166 | void AliQADataMakerSim::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run, Int_t cycles) | |
167 | { | |
168 | // Intialisation by passing the list of QA data booked elsewhere | |
169 | ||
170 | fRun = run ; | |
171 | if (cycles > 0) | |
172 | SetCycle(cycles) ; | |
173 | ||
174 | if ( task == AliQA::kHITS ) { | |
175 | fHitsQAList = list ; | |
176 | } else if ( task == AliQA::kSDIGITS) { | |
177 | fSDigitsQAList = list ; | |
178 | } else if ( task == AliQA::kDIGITS ) { | |
179 | fDigitsQAList = list ; | |
180 | } | |
181 | } | |
182 | ||
183 | //____________________________________________________________________________ | |
184 | void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle) | |
185 | { | |
186 | // Finishes a cycle of QA data acquistion | |
187 | if ( !sameCycle || fCurrentCycle == -1) { | |
188 | ResetCycle() ; | |
189 | if (fOutput) | |
190 | fOutput->Close() ; | |
191 | fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ; | |
192 | } | |
193 | ||
194 | AliInfo(Form(" Run %d Cycle %d task %s file %s", | |
195 | fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; | |
196 | ||
197 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; | |
198 | if (!fDetectorDir) | |
199 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
200 | ||
201 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
202 | if (!subDir) | |
203 | subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; | |
204 | subDir->cd() ; | |
205 | ||
206 | TObjArray * list = 0x0 ; | |
207 | ||
208 | if ( task == AliQA::kHITS ) | |
209 | list = fHitsQAList ; | |
210 | else if ( task == AliQA::kSDIGITS ) | |
211 | list = fSDigitsQAList ; | |
212 | else if ( task == AliQA::kDIGITS ) | |
213 | list = fDigitsQAList ; | |
214 | ||
215 | TIter next(list) ; | |
216 | TH1 * h ; | |
217 | while ( (h = dynamic_cast<TH1 *>(next())) ) | |
218 | h->Reset() ; | |
219 | ||
220 | StartOfDetectorCycle() ; | |
221 | } |