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