]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEER/AliCorrQADataMakerRec.cxx
Speedup Ds task (Gian Michele)
[u/mrichter/AliRoot.git] / STEER / STEER / AliCorrQADataMakerRec.cxx
CommitLineData
a64b872d 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: AliCorrQADataMakerRec.cxx 27570 2008-07-24 21:49:27Z cvetan $ */
18
19/*
20 Produces the data needed to calculate the quality assurance.
21 All data must be mergeable objects.
22 Y. Schutz CERN July 2007
23*/
24
25// --- ROOT system ---
26#include <TClonesArray.h>
27#include <TFile.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TH2F.h>
31#include <TNtupleD.h>
32#include <TParameter.h>
57acd2d2 33#include <TMath.h>
a64b872d 34
35// --- Standard library ---
36
37// --- AliRoot header files ---
38#include "AliLog.h"
39#include "AliCorrQADataMakerRec.h"
40#include "AliQAChecker.h"
41
42ClassImp(AliCorrQADataMakerRec)
43
44//____________________________________________________________________________
45AliCorrQADataMakerRec::AliCorrQADataMakerRec(AliQADataMaker ** qadm ) :
4e25ac79 46AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kCORR), "Corr Quality Assurance Data Maker"),
a64b872d 47 fMaxRawVar(0),
097485c2 48 fqadm(qadm),
49 fVarvalue(NULL)
a64b872d 50{
51 // ctor
57acd2d2 52 fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
53 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
54 fCorrNt[specie] = NULL ;
a64b872d 55}
56
57//____________________________________________________________________________
58AliCorrQADataMakerRec::AliCorrQADataMakerRec(const AliCorrQADataMakerRec& qadm) :
e3ee6343 59 AliQADataMakerRec(qadm),
a64b872d 60 fMaxRawVar(qadm.fMaxRawVar),
097485c2 61 fqadm(qadm.fqadm),
62 fVarvalue(NULL)
a64b872d 63{
64 //copy ctor
e3ee6343 65 if ( fMaxRawVar > 0 ) {
097485c2 66 fVarvalue = new Double_t[fMaxRawVar] ;
e3ee6343 67 memcpy(fVarvalue, qadm.fVarvalue, fMaxRawVar*sizeof(Double_t));
68 }
4bb9542a 69
e3ee6343 70 // Replace shallow copy done by AliQADataMakerRec by a semi-deep
71 // copy where the pointer container is recreated but the Ntuples pointed
72 // to are simply copied
4bb9542a 73 fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
74 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
75 fCorrNt[specie] = qadm.fCorrNt[specie] ;
76
a64b872d 77}
78
79//__________________________________________________________________
80AliCorrQADataMakerRec& AliCorrQADataMakerRec::operator = (const AliCorrQADataMakerRec& qadm )
81{
57acd2d2 82 // assign operator.
e3ee6343 83 if(this != &qadm) {
84 AliQADataMakerRec::operator=(qadm);
85 fMaxRawVar = qadm.fMaxRawVar;
86 fqadm = qadm.fqadm;
87 delete [] fVarvalue;
88 if ( fMaxRawVar > 0 ) {
89 fVarvalue = new Double_t[fMaxRawVar] ;
90 memcpy(fVarvalue, qadm.fVarvalue, fMaxRawVar*sizeof(Double_t));
91 } else fVarvalue = 0;
92
93 // Replace shallow copy done by AliQADataMakerRec by a semi-deep
94 // copy where the pointer container is recreated but the Ntuples pointed
95 // to are simply copied
96 fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
97 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
98 fCorrNt[specie] = qadm.fCorrNt[specie] ;
99 }
a64b872d 100}
57acd2d2 101
102//____________________________________________________________________________
103AliCorrQADataMakerRec::~AliCorrQADataMakerRec()
104{
e3ee6343 105 //
106 // dtor only destroy the ntuple otherwise it would violate ownership...
107 // however when the last AliCorrQADataMakerRec is deleted there is
108 // a leak
109 //
110 // if ( fCorrNt )
111 // for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; ++specie)
112 // delete fCorrNt[specie] ;
113 //
114 delete [] fCorrNt ;
115 delete [] fVarvalue ;
57acd2d2 116}
117
a64b872d 118//____________________________________________________________________________
4e25ac79 119void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** /*list*/)
a64b872d 120{
121 //Detector specific actions at end of cycle
122 // do the QA checking
4e25ac79 123 if (task == AliQAv1::kRAWS) {
124 AliQAChecker::Instance()->Run(AliQAv1::kCORR, task, fCorrNt) ;
930e6e3e 125 }
a64b872d 126}
127
128//____________________________________________________________________________
129void AliCorrQADataMakerRec::InitESDs()
130{
131 //Create histograms to controll ESD
132
133 AliInfo("TO BE IMPLEMENTED") ;
92664bc8 134 //
135 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
a64b872d 136}
137
a64b872d 138
139//____________________________________________________________________________
140void AliCorrQADataMakerRec::InitRaws()
141{
142 // createa ntuple taking all the parameters declared by detectors
4bb9542a 143 if (fCorrNt && fCorrNt[AliRecoParam::AConvert(fEventSpecie)])
a64b872d 144 return ;
4bb9542a 145
146 if (!fCorrNt) {
147 fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ; ;
148 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
149 fCorrNt[specie] = NULL ;
150 }
151
3136db6f 152 if ( fRawsQAList )
153 {
154 delete[] fRawsQAList ; // not needed for the time being
155 fRawsQAList = NULL ;
156 }
a64b872d 157 TString varlist("") ;
4e25ac79 158 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
a64b872d 159 AliQADataMaker * qadm = fqadm[detIndex] ;
160 if ( ! qadm )
161 continue ;
162 TList * list = qadm->GetParameterList() ;
163 if (list) {
164 TIter next(list) ;
165 TParameter<double> * p ;
eca4fa66 166 while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
a64b872d 167 varlist.Append(p->GetName()) ;
168 varlist.Append(":") ;
169 fMaxRawVar++ ;
170 }
171 }
172 }
173 varlist = varlist.Strip(TString::kTrailing, ':') ;
174 if (fMaxRawVar == 0) {
175 AliWarning("NTUPLE not created") ;
176 } else {
025edd2a 177 char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(fEventSpecie)) ;
178 fCorrNt[AliRecoParam::AConvert(fEventSpecie)] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;
097485c2 179 fVarvalue = new Double_t[fMaxRawVar] ;
a64b872d 180 }
92664bc8 181 //
182 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
a64b872d 183}
184
f14c8c46 185//____________________________________________________________________________
186void AliCorrQADataMakerRec::InitRecPoints()
187{
188 // create Reconstructed Points histograms in RecPoints subdir
189
190 AliInfo("TO BE IMPLEMENTED") ;
92664bc8 191 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
f14c8c46 192}
193
194//____________________________________________________________________________
195void AliCorrQADataMakerRec::InitRecoParams()
196{
197 // Get the recoparam form the OCDB for every detector involved in CORR
198
199 AliInfo("TO BE IMPLEMENTED") ;
200}
201
a64b872d 202//____________________________________________________________________________
203void AliCorrQADataMakerRec::MakeESDs(AliESDEvent * /*esd*/)
204{
205 // make QA data from ESDs
206
207 AliInfo("TO BE IMPLEMENTED") ;
92664bc8 208 IncEvCountCycleESDs();
209 IncEvCountTotalESDs();
210 //
a64b872d 211}
212
213//____________________________________________________________________________
930e6e3e 214void AliCorrQADataMakerRec::MakeRaws(AliRawReader *)
a64b872d 215{
216 //Fill prepared histograms with Raw digit properties
025edd2a 217
4bb9542a 218 if ( !fCorrNt || ! fCorrNt[AliRecoParam::AConvert(fEventSpecie)])
025edd2a 219 InitRaws() ;
220
a64b872d 221 if ( fMaxRawVar > 0 ) {
a64b872d 222 Int_t index = 0 ;
4e25ac79 223 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
a64b872d 224 AliQADataMaker * qadm = fqadm[detIndex] ;
225 if ( ! qadm )
226 continue ;
227 TList * list = qadm->GetParameterList() ;
4bb9542a 228 if (list) {
229 TIter next(list) ;
230 TParameter<double> * p ;
231 while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
232 if (index >= fMaxRawVar) {
233 AliError(Form("Variables list size exceeded (%d) !",index));
234 break;
235 }
236 fVarvalue[index] = p->GetVal() ;
237 index++ ;
238 }
a64b872d 239 }
240 }
097485c2 241 static_cast<TNtupleD*>(fCorrNt[AliRecoParam::AConvert(fEventSpecie)])->Fill(fVarvalue);
a64b872d 242 }
92664bc8 243 //
244 IncEvCountCycleRaws();
245 IncEvCountTotalRaws();
246 //
a64b872d 247}
248
249//____________________________________________________________________________
250void AliCorrQADataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
251{
252 AliInfo("TO BE IMPLEMENTED") ;
92664bc8 253 IncEvCountCycleRecPoints();
254 IncEvCountTotalRecPoints();
255 //
a64b872d 256}
257
258//____________________________________________________________________________
259void AliCorrQADataMakerRec::StartOfDetectorCycle()
260{
261 //Detector specific actions at start of cycle
930e6e3e 262
a64b872d 263}