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