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