]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQADataMakerRec.cxx
Addition of gaussian truncated at different left and right distances (useful for...
[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),
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//____________________________________________________________________________
54AliQADataMakerRec::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//____________________________________________________________________________
69AliQADataMakerRec::~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//__________________________________________________________________
90AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm )
91{
92 // Assignment operator.
93 this->~AliQADataMakerRec();
94 new(this) AliQADataMakerRec(qadm);
95 return *this;
96}
97
930e6e3e 98//____________________________________________________________________________
99void AliQADataMakerRec::EndOfCycle()
100{
101 // Finishes a cycle of QA for all the tasks
102 EndOfCycle(AliQA::kRAWS) ;
103 EndOfCycle(AliQA::kRECPOINTS) ;
104 EndOfCycle(AliQA::kESDS) ;
105 ResetCycle() ;
106}
107
04236e67 108//____________________________________________________________________________
92a357bf 109void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task)
04236e67 110{
930e6e3e 111 // Finishes a cycle of QA
04236e67 112
a2b64fbd 113 TObjArray * list = NULL ;
04236e67 114
115 if ( task == AliQA::kRAWS )
116 list = fRawsQAList ;
117 else if ( task == AliQA::kRECPOINTS )
118 list = fRecPointsQAList ;
119 else if ( task == AliQA::kESDS )
120 list = fESDsQAList ;
7c002d48 121
930e6e3e 122
123 if ( ! list && ! fObject )
124 return ;
125 //DefaultEndOfDetectorCycle(task) ;
0774e4a4 126 EndOfDetectorCycle(task, list) ;
a2b64fbd 127 TDirectory * subDir = NULL ;
7c002d48 128 if (fDetectorDir)
129 subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
45c5be2d 130 if ( subDir ) {
eecc22a3 131 subDir->cd() ;
6e65319c 132 if (list) {
133 TIter next(list) ;
750730d8 134 TObject * obj ;
135 while( (obj = next()) ) {
136 if (!obj->TestBit(AliQA::GetExpertBit()))
6e65319c 137 obj->Write() ;
6e65319c 138 }
b1af1125 139 if (WriteExpert()) {
140 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
141 if ( expertDir ) { // Write only if requested
142 expertDir->cd() ;
143 next.Reset() ;
750730d8 144 while( (obj = next()) ) {
145 if (!obj->TestBit(AliQA::GetExpertBit()))
b1af1125 146 continue ;
750730d8 147 obj->Write() ;
b1af1125 148 }
149 }
6e65319c 150 }
151 }
87370bcc 152 if (fObject && AliQA::GetDetIndex(GetName()) == AliQA::kCORR) {
6e65319c 153 subDir->cd() ;
a2b64fbd 154 fObject->Write() ;
930e6e3e 155 }
a595ac34 156 fOutput->Save() ;
eecc22a3 157 }
04236e67 158}
159
160//____________________________________________________________________________
92a357bf 161void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data)
04236e67 162{
163 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
164
165 if ( task == AliQA::kRAWS ) {
166 AliDebug(1, "Processing Raws QA") ;
167 AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
168 if (rawReader)
169 MakeRaws(rawReader) ;
170 else
930e6e3e 171 AliInfo("Raw data are not processed") ;
04236e67 172 } else if ( task == AliQA::kRECPOINTS ) {
173 AliDebug(1, "Processing RecPoints QA") ;
174 TTree * tree = dynamic_cast<TTree *>(data) ;
175 if (tree) {
176 MakeRecPoints(tree) ;
177 } else {
178 AliWarning("data are not a TTree") ;
179 }
180 } else if ( task == AliQA::kESDS ) {
181 AliDebug(1, "Processing ESDs QA") ;
182 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
183 if (esd)
184 MakeESDs(esd) ;
185 else
186 AliError("Wrong type of esd container") ;
187 }
188}
189
190//____________________________________________________________________________
930e6e3e 191TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles)
04236e67 192{
193 // general intialisation
194
195 TObjArray * rv = NULL ;
196
04236e67 197 if (cycles > 0)
198 SetCycle(cycles) ;
199
200 if ( task == AliQA::kRAWS ) {
63c6f8ae 201 if (! fRawsQAList ) {
202 fRawsQAList = new TObjArray(100) ;
a2b64fbd 203 fRawsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
63c6f8ae 204 InitRaws() ;
205 }
04236e67 206 rv = fRawsQAList ;
207 } else if ( task == AliQA::kRECPOINTS ) {
63c6f8ae 208 if ( ! fRecPointsQAList ) {
209 fRecPointsQAList = new TObjArray(100) ;
a2b64fbd 210 fRecPointsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
63c6f8ae 211 InitRecPoints() ;
212 }
04236e67 213 rv = fRecPointsQAList ;
214 } else if ( task == AliQA::kESDS ) {
63c6f8ae 215 if ( ! fESDsQAList ) {
a2b64fbd 216 fESDsQAList = new TObjArray(100) ;
217 fESDsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
63c6f8ae 218 InitESDs() ;
219 }
04236e67 220 rv = fESDsQAList ;
221 }
222
223 return rv ;
224}
225
226//____________________________________________________________________________
92a357bf 227void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
04236e67 228{
229 // Intialisation by passing the list of QA data booked elsewhere
230
231 fRun = run ;
232 if (cycles > 0)
233 SetCycle(cycles) ;
234
235 if ( task == AliQA::kRAWS ) {
236 fRawsQAList = list ;
237 } else if ( task == AliQA::kRECPOINTS ) {
238 fRecPointsQAList = list ;
239 } else if ( task == AliQA::kESDS ) {
240 fESDsQAList = list ;
241 }
242}
243
244//____________________________________________________________________________
930e6e3e 245void AliQADataMakerRec::StartOfCycle(Int_t run)
246{
247 // Finishes a cycle of QA for all the tasks
248 Bool_t samecycle = kFALSE ;
249 StartOfCycle(AliQA::kRAWS, run, samecycle) ;
250 samecycle = kTRUE ;
251 StartOfCycle(AliQA::kRECPOINTS, run, samecycle) ;
252 StartOfCycle(AliQA::kESDS, run, samecycle) ;
253}
254
255//____________________________________________________________________________
256void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
04236e67 257{
258 // Finishes a cycle of QA data acquistion
930e6e3e 259 if ( run > 0 )
260 fRun = run ;
04236e67 261 if ( !sameCycle || fCurrentCycle == -1) {
262 ResetCycle() ;
263 if (fOutput)
264 fOutput->Close() ;
930e6e3e 265 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
04236e67 266 }
7c002d48 267 AliInfo(Form(" Run %d Cycle %d task %s file %s",
04236e67 268 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
269
270 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
271 if (!fDetectorDir)
272 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
273
274 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
275 if (!subDir)
276 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
6e65319c 277
278 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
279 if (!expertDir)
280 expertDir = subDir->mkdir(AliQA::GetExpert()) ;
281
04236e67 282 subDir->cd() ;
6e65319c 283
04236e67 284
04236e67 285 StartOfDetectorCycle() ;
286}