]>
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 | ||
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), | |
43 | fESDsQAList(0x0), | |
44 | fRawsQAList(0x0), | |
45 | fRecPointsQAList(0x0) | |
46 | { | |
47 | // ctor | |
48 | fDetectorDirName = GetName() ; | |
49 | } | |
50 | ||
51 | //____________________________________________________________________________ | |
52 | AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) : | |
53 | AliQADataMaker(qadm.GetName(), qadm.GetTitle()), | |
54 | fESDsQAList(qadm.fESDsQAList), | |
55 | fRawsQAList(qadm.fRawsQAList), | |
56 | fRecPointsQAList(qadm.fRecPointsQAList) | |
57 | ||
58 | { | |
59 | //copy ctor | |
60 | SetName(qadm.GetName()) ; | |
61 | SetTitle(qadm.GetTitle()) ; | |
62 | fDetectorDirName = GetName() ; | |
63 | } | |
64 | ||
65 | //__________________________________________________________________ | |
66 | AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm ) | |
67 | { | |
68 | // Assignment operator. | |
69 | this->~AliQADataMakerRec(); | |
70 | new(this) AliQADataMakerRec(qadm); | |
71 | return *this; | |
72 | } | |
73 | ||
74 | //____________________________________________________________________________ | |
92a357bf | 75 | void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task) |
04236e67 | 76 | { |
77 | // Finishes a cycle of QA data acquistion | |
78 | ||
79 | TObjArray * list = 0x0 ; | |
80 | ||
81 | if ( task == AliQA::kRAWS ) | |
82 | list = fRawsQAList ; | |
83 | else if ( task == AliQA::kRECPOINTS ) | |
84 | list = fRecPointsQAList ; | |
85 | else if ( task == AliQA::kESDS ) | |
86 | list = fESDsQAList ; | |
7c002d48 | 87 | |
88 | DefaultEndOfDetectorCycle(task) ; | |
0774e4a4 | 89 | EndOfDetectorCycle(task, list) ; |
7c002d48 | 90 | TDirectory * subDir = 0x0 ; |
91 | if (fDetectorDir) | |
92 | subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
45c5be2d | 93 | if ( subDir ) { |
eecc22a3 | 94 | subDir->cd() ; |
7c002d48 | 95 | if (list) |
96 | list->Write() ; | |
eecc22a3 | 97 | } |
04236e67 | 98 | } |
99 | ||
100 | //____________________________________________________________________________ | |
92a357bf | 101 | void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data) |
04236e67 | 102 | { |
103 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
104 | ||
105 | if ( task == AliQA::kRAWS ) { | |
106 | AliDebug(1, "Processing Raws QA") ; | |
107 | AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ; | |
108 | if (rawReader) | |
109 | MakeRaws(rawReader) ; | |
110 | else | |
111 | AliError("Wrong data type") ; | |
112 | } else if ( task == AliQA::kRECPOINTS ) { | |
113 | AliDebug(1, "Processing RecPoints QA") ; | |
114 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
115 | if (tree) { | |
116 | MakeRecPoints(tree) ; | |
117 | } else { | |
118 | AliWarning("data are not a TTree") ; | |
119 | } | |
120 | } else if ( task == AliQA::kESDS ) { | |
121 | AliDebug(1, "Processing ESDs QA") ; | |
122 | AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ; | |
123 | if (esd) | |
124 | MakeESDs(esd) ; | |
125 | else | |
126 | AliError("Wrong type of esd container") ; | |
127 | } | |
128 | } | |
129 | ||
130 | //____________________________________________________________________________ | |
92a357bf | 131 | TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t run, Int_t cycles) |
04236e67 | 132 | { |
133 | // general intialisation | |
134 | ||
135 | TObjArray * rv = NULL ; | |
136 | ||
137 | fRun = run ; | |
138 | if (cycles > 0) | |
139 | SetCycle(cycles) ; | |
140 | ||
141 | if ( task == AliQA::kRAWS ) { | |
142 | fRawsQAList = new TObjArray(100) ; | |
143 | InitRaws() ; | |
144 | rv = fRawsQAList ; | |
145 | } else if ( task == AliQA::kRECPOINTS ) { | |
146 | fRecPointsQAList = new TObjArray(100) ; | |
147 | InitRecPoints() ; | |
148 | rv = fRecPointsQAList ; | |
149 | } else if ( task == AliQA::kESDS ) { | |
150 | fESDsQAList = new TObjArray(100) ; | |
151 | InitESDs() ; | |
152 | rv = fESDsQAList ; | |
153 | } | |
154 | ||
155 | return rv ; | |
156 | } | |
157 | ||
158 | //____________________________________________________________________________ | |
92a357bf | 159 | void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles) |
04236e67 | 160 | { |
161 | // Intialisation by passing the list of QA data booked elsewhere | |
162 | ||
163 | fRun = run ; | |
164 | if (cycles > 0) | |
165 | SetCycle(cycles) ; | |
166 | ||
167 | if ( task == AliQA::kRAWS ) { | |
168 | fRawsQAList = list ; | |
169 | } else if ( task == AliQA::kRECPOINTS ) { | |
170 | fRecPointsQAList = list ; | |
171 | } else if ( task == AliQA::kESDS ) { | |
172 | fESDsQAList = list ; | |
173 | } | |
174 | } | |
175 | ||
176 | //____________________________________________________________________________ | |
92a357bf | 177 | void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, const Bool_t sameCycle) |
04236e67 | 178 | { |
179 | // Finishes a cycle of QA data acquistion | |
04236e67 | 180 | if ( !sameCycle || fCurrentCycle == -1) { |
181 | ResetCycle() ; | |
182 | if (fOutput) | |
183 | fOutput->Close() ; | |
184 | fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ; | |
185 | } | |
7c002d48 | 186 | AliInfo(Form(" Run %d Cycle %d task %s file %s", |
04236e67 | 187 | fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; |
188 | ||
189 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; | |
190 | if (!fDetectorDir) | |
191 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
192 | ||
193 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
194 | if (!subDir) | |
195 | subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; | |
196 | subDir->cd() ; | |
197 | ||
198 | TObjArray * list = 0x0 ; | |
199 | ||
200 | if ( task == AliQA::kRAWS ) | |
201 | list = fRawsQAList ; | |
202 | else if ( task == AliQA::kRECPOINTS) | |
203 | list = fRecPointsQAList ; | |
204 | else if ( task == AliQA::kESDS ) | |
205 | list = fESDsQAList ; | |
075f5ecf | 206 | |
207 | // Should be the choice of detectors | |
208 | // TIter next(list) ; | |
209 | // TH1 * h ; | |
210 | // while ( (h = dynamic_cast<TH1 *>(next())) ) | |
211 | // h->Reset() ; | |
04236e67 | 212 | |
213 | StartOfDetectorCycle() ; | |
214 | } |