]>
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 | //____________________________________________________________________________ | |
75 | void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX task) | |
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 ; | |
87 | ||
88 | EndOfDetectorCycle(task, list) ; | |
89 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
45c5be2d | 90 | if ( subDir ) { |
eecc22a3 | 91 | subDir->cd() ; |
92 | list->Write() ; | |
93 | } | |
2a139017 | 94 | fOutput->Close() ; |
04236e67 | 95 | } |
96 | ||
97 | //____________________________________________________________________________ | |
98 | void AliQADataMakerRec::Exec(AliQA::TASKINDEX task, TObject * data) | |
99 | { | |
100 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
101 | ||
102 | if ( task == AliQA::kRAWS ) { | |
103 | AliDebug(1, "Processing Raws QA") ; | |
104 | AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ; | |
105 | if (rawReader) | |
106 | MakeRaws(rawReader) ; | |
107 | else | |
108 | AliError("Wrong data type") ; | |
109 | } else if ( task == AliQA::kRECPOINTS ) { | |
110 | AliDebug(1, "Processing RecPoints QA") ; | |
111 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
112 | if (tree) { | |
113 | MakeRecPoints(tree) ; | |
114 | } else { | |
115 | AliWarning("data are not a TTree") ; | |
116 | } | |
117 | } else if ( task == AliQA::kESDS ) { | |
118 | AliDebug(1, "Processing ESDs QA") ; | |
119 | AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ; | |
120 | if (esd) | |
121 | MakeESDs(esd) ; | |
122 | else | |
123 | AliError("Wrong type of esd container") ; | |
124 | } | |
125 | } | |
126 | ||
127 | //____________________________________________________________________________ | |
128 | TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles) | |
129 | { | |
130 | // general intialisation | |
131 | ||
132 | TObjArray * rv = NULL ; | |
133 | ||
134 | fRun = run ; | |
135 | if (cycles > 0) | |
136 | SetCycle(cycles) ; | |
137 | ||
138 | if ( task == AliQA::kRAWS ) { | |
139 | fRawsQAList = new TObjArray(100) ; | |
140 | InitRaws() ; | |
141 | rv = fRawsQAList ; | |
142 | } else if ( task == AliQA::kRECPOINTS ) { | |
143 | fRecPointsQAList = new TObjArray(100) ; | |
144 | InitRecPoints() ; | |
145 | rv = fRecPointsQAList ; | |
146 | } else if ( task == AliQA::kESDS ) { | |
147 | fESDsQAList = new TObjArray(100) ; | |
148 | InitESDs() ; | |
149 | rv = fESDsQAList ; | |
150 | } | |
151 | ||
152 | return rv ; | |
153 | } | |
154 | ||
155 | //____________________________________________________________________________ | |
156 | void AliQADataMakerRec::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run, Int_t cycles) | |
157 | { | |
158 | // Intialisation by passing the list of QA data booked elsewhere | |
159 | ||
160 | fRun = run ; | |
161 | if (cycles > 0) | |
162 | SetCycle(cycles) ; | |
163 | ||
164 | if ( task == AliQA::kRAWS ) { | |
165 | fRawsQAList = list ; | |
166 | } else if ( task == AliQA::kRECPOINTS ) { | |
167 | fRecPointsQAList = list ; | |
168 | } else if ( task == AliQA::kESDS ) { | |
169 | fESDsQAList = list ; | |
170 | } | |
171 | } | |
172 | ||
173 | //____________________________________________________________________________ | |
174 | void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle) | |
175 | { | |
176 | // Finishes a cycle of QA data acquistion | |
04236e67 | 177 | if ( !sameCycle || fCurrentCycle == -1) { |
178 | ResetCycle() ; | |
179 | if (fOutput) | |
180 | fOutput->Close() ; | |
181 | fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ; | |
182 | } | |
2a139017 | 183 | AliDebug(1, Form(" Run %d Cycle %d task %s file %s", |
04236e67 | 184 | fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; |
185 | ||
186 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; | |
187 | if (!fDetectorDir) | |
188 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
189 | ||
190 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
191 | if (!subDir) | |
192 | subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; | |
193 | subDir->cd() ; | |
194 | ||
195 | TObjArray * list = 0x0 ; | |
196 | ||
197 | if ( task == AliQA::kRAWS ) | |
198 | list = fRawsQAList ; | |
199 | else if ( task == AliQA::kRECPOINTS) | |
200 | list = fRecPointsQAList ; | |
201 | else if ( task == AliQA::kESDS ) | |
202 | list = fESDsQAList ; | |
203 | ||
204 | TIter next(list) ; | |
205 | TH1 * h ; | |
206 | while ( (h = dynamic_cast<TH1 *>(next())) ) | |
207 | h->Reset() ; | |
208 | ||
209 | StartOfDetectorCycle() ; | |
210 | } |