]>
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 * | |
940d8e5f | 10 | * copies and that both the copyright notice and this permission notifce * |
04236e67 | 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 | ||
202374b1 | 19 | // |
20 | // Base Class | |
21 | // Produces the data needed to calculate the quality assurance for Reconstruction | |
22 | // All data must be mergeable objects. | |
23 | // Y. Schutz CERN July 2007 | |
24 | // | |
04236e67 | 25 | |
26 | // --- ROOT system --- | |
04236e67 | 27 | #include <TFile.h> |
04236e67 | 28 | #include <TTree.h> |
04236e67 | 29 | |
30 | // --- Standard library --- | |
31 | ||
32 | // --- AliRoot header files --- | |
33 | #include "AliLog.h" | |
34 | #include "AliQADataMakerRec.h" | |
04236e67 | 35 | #include "AliESDEvent.h" |
36 | #include "AliRawReader.h" | |
37 | ||
38 | ClassImp(AliQADataMakerRec) | |
39 | ||
40 | //____________________________________________________________________________ | |
41 | AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) : | |
42 | AliQADataMaker(name, title), | |
a2b64fbd | 43 | fESDsQAList(NULL), |
44 | fRawsQAList(NULL), | |
45 | fRecPointsQAList(NULL), | |
46 | fObject(NULL), | |
47 | fRecoParam(NULL) | |
04236e67 | 48 | { |
49 | // ctor | |
50 | fDetectorDirName = GetName() ; | |
51 | } | |
52 | ||
53 | //____________________________________________________________________________ | |
54 | AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) : | |
b8bd1ab8 | 55 | AliQADataMaker(qadm.GetName(), qadm.GetTitle()), |
56 | fESDsQAList(qadm.fESDsQAList), | |
57 | fRawsQAList(qadm.fRawsQAList), | |
58 | fRecPointsQAList(qadm.fRecPointsQAList), | |
a2b64fbd | 59 | fObject(qadm.fObject), |
60 | fRecoParam(qadm.fRecoParam) | |
04236e67 | 61 | { |
62 | //copy ctor | |
63 | SetName(qadm.GetName()) ; | |
64 | SetTitle(qadm.GetTitle()) ; | |
65 | fDetectorDirName = GetName() ; | |
66 | } | |
67 | ||
63c6f8ae | 68 | //____________________________________________________________________________ |
69 | AliQADataMakerRec::~AliQADataMakerRec() | |
70 | { | |
71 | //dtor: delete the TObjArray and thei content | |
7ff8385d | 72 | if ( fESDsQAList ) { |
b3cc11cb | 73 | if ( fESDsQAList->IsOwner() ) |
74 | fESDsQAList->Delete() ; | |
7ff8385d | 75 | delete fESDsQAList ; |
76 | } | |
77 | if ( fRawsQAList ) { | |
b3cc11cb | 78 | if ( fRawsQAList->IsOwner() ) |
79 | fRawsQAList->Delete() ; | |
7ff8385d | 80 | delete fRawsQAList ; |
81 | } | |
82 | if ( fRecPointsQAList ) { | |
b3cc11cb | 83 | if ( fRecPointsQAList->IsOwner() ) |
84 | fRecPointsQAList->Delete() ; | |
7ff8385d | 85 | delete fRecPointsQAList ; |
86 | } | |
63c6f8ae | 87 | } |
88 | ||
04236e67 | 89 | //__________________________________________________________________ |
90 | AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm ) | |
91 | { | |
92 | // Assignment operator. | |
93 | this->~AliQADataMakerRec(); | |
94 | new(this) AliQADataMakerRec(qadm); | |
95 | return *this; | |
96 | } | |
97 | ||
98 | //____________________________________________________________________________ | |
92a357bf | 99 | void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task) |
04236e67 | 100 | { |
101 | // Finishes a cycle of QA data acquistion | |
102 | ||
a2b64fbd | 103 | TObjArray * list = NULL ; |
04236e67 | 104 | |
105 | if ( task == AliQA::kRAWS ) | |
106 | list = fRawsQAList ; | |
107 | else if ( task == AliQA::kRECPOINTS ) | |
108 | list = fRecPointsQAList ; | |
109 | else if ( task == AliQA::kESDS ) | |
110 | list = fESDsQAList ; | |
7c002d48 | 111 | |
a1bb0da7 | 112 | //DefaultEndOfDetectorCycle(task) ; |
0774e4a4 | 113 | EndOfDetectorCycle(task, list) ; |
a2b64fbd | 114 | TDirectory * subDir = NULL ; |
7c002d48 | 115 | if (fDetectorDir) |
116 | subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
45c5be2d | 117 | if ( subDir ) { |
eecc22a3 | 118 | subDir->cd() ; |
7c002d48 | 119 | if (list) |
120 | list->Write() ; | |
a2b64fbd | 121 | if (fObject) |
122 | fObject->Write() ; | |
eecc22a3 | 123 | } |
bc175102 | 124 | //Finish() ; |
04236e67 | 125 | } |
126 | ||
127 | //____________________________________________________________________________ | |
92a357bf | 128 | void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data) |
04236e67 | 129 | { |
130 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
131 | ||
132 | if ( task == AliQA::kRAWS ) { | |
133 | AliDebug(1, "Processing Raws QA") ; | |
134 | AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ; | |
135 | if (rawReader) | |
136 | MakeRaws(rawReader) ; | |
137 | else | |
138 | AliError("Wrong data type") ; | |
139 | } else if ( task == AliQA::kRECPOINTS ) { | |
140 | AliDebug(1, "Processing RecPoints QA") ; | |
141 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
142 | if (tree) { | |
143 | MakeRecPoints(tree) ; | |
144 | } else { | |
145 | AliWarning("data are not a TTree") ; | |
146 | } | |
147 | } else if ( task == AliQA::kESDS ) { | |
148 | AliDebug(1, "Processing ESDs QA") ; | |
149 | AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ; | |
150 | if (esd) | |
151 | MakeESDs(esd) ; | |
152 | else | |
153 | AliError("Wrong type of esd container") ; | |
154 | } | |
155 | } | |
156 | ||
157 | //____________________________________________________________________________ | |
92a357bf | 158 | TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t run, Int_t cycles) |
04236e67 | 159 | { |
160 | // general intialisation | |
161 | ||
162 | TObjArray * rv = NULL ; | |
163 | ||
164 | fRun = run ; | |
165 | if (cycles > 0) | |
166 | SetCycle(cycles) ; | |
167 | ||
168 | if ( task == AliQA::kRAWS ) { | |
63c6f8ae | 169 | if (! fRawsQAList ) { |
170 | fRawsQAList = new TObjArray(100) ; | |
a2b64fbd | 171 | fRawsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ; |
63c6f8ae | 172 | InitRaws() ; |
173 | } | |
04236e67 | 174 | rv = fRawsQAList ; |
175 | } else if ( task == AliQA::kRECPOINTS ) { | |
63c6f8ae | 176 | if ( ! fRecPointsQAList ) { |
177 | fRecPointsQAList = new TObjArray(100) ; | |
a2b64fbd | 178 | fRecPointsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ; |
63c6f8ae | 179 | InitRecPoints() ; |
180 | } | |
04236e67 | 181 | rv = fRecPointsQAList ; |
182 | } else if ( task == AliQA::kESDS ) { | |
63c6f8ae | 183 | if ( ! fESDsQAList ) { |
a2b64fbd | 184 | fESDsQAList = new TObjArray(100) ; |
185 | fESDsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ; | |
63c6f8ae | 186 | InitESDs() ; |
187 | } | |
04236e67 | 188 | rv = fESDsQAList ; |
189 | } | |
190 | ||
191 | return rv ; | |
192 | } | |
193 | ||
194 | //____________________________________________________________________________ | |
92a357bf | 195 | void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles) |
04236e67 | 196 | { |
197 | // Intialisation by passing the list of QA data booked elsewhere | |
198 | ||
199 | fRun = run ; | |
200 | if (cycles > 0) | |
201 | SetCycle(cycles) ; | |
202 | ||
203 | if ( task == AliQA::kRAWS ) { | |
204 | fRawsQAList = list ; | |
205 | } else if ( task == AliQA::kRECPOINTS ) { | |
206 | fRecPointsQAList = list ; | |
207 | } else if ( task == AliQA::kESDS ) { | |
208 | fESDsQAList = list ; | |
209 | } | |
210 | } | |
211 | ||
212 | //____________________________________________________________________________ | |
92a357bf | 213 | void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, const Bool_t sameCycle) |
04236e67 | 214 | { |
215 | // Finishes a cycle of QA data acquistion | |
04236e67 | 216 | if ( !sameCycle || fCurrentCycle == -1) { |
217 | ResetCycle() ; | |
218 | if (fOutput) | |
219 | fOutput->Close() ; | |
220 | fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ; | |
221 | } | |
7c002d48 | 222 | AliInfo(Form(" Run %d Cycle %d task %s file %s", |
04236e67 | 223 | fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; |
224 | ||
225 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; | |
226 | if (!fDetectorDir) | |
227 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
228 | ||
229 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
230 | if (!subDir) | |
231 | subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; | |
232 | subDir->cd() ; | |
233 | ||
a2b64fbd | 234 | TObjArray * list = NULL ; |
04236e67 | 235 | |
236 | if ( task == AliQA::kRAWS ) | |
237 | list = fRawsQAList ; | |
238 | else if ( task == AliQA::kRECPOINTS) | |
239 | list = fRecPointsQAList ; | |
240 | else if ( task == AliQA::kESDS ) | |
241 | list = fESDsQAList ; | |
075f5ecf | 242 | |
243 | // Should be the choice of detectors | |
244 | // TIter next(list) ; | |
245 | // TH1 * h ; | |
246 | // while ( (h = dynamic_cast<TH1 *>(next())) ) | |
247 | // h->Reset() ; | |
04236e67 | 248 | |
249 | StartOfDetectorCycle() ; | |
250 | } |