Bug fix. Removed delete statement
[u/mrichter/AliRoot.git] / 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),
48 fqadm(qadm)
49{
50 // ctor
57acd2d2 51 fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
52 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
53 fCorrNt[specie] = NULL ;
a64b872d 54}
55
56//____________________________________________________________________________
57AliCorrQADataMakerRec::AliCorrQADataMakerRec(const AliCorrQADataMakerRec& qadm) :
58 AliQADataMakerRec(),
59 fMaxRawVar(qadm.fMaxRawVar),
60 fqadm(qadm.fqadm)
61{
62 //copy ctor
63 SetName((const char*)qadm.GetName()) ;
64 SetTitle((const char*)qadm.GetTitle());
65}
66
67//__________________________________________________________________
68AliCorrQADataMakerRec& AliCorrQADataMakerRec::operator = (const AliCorrQADataMakerRec& qadm )
69{
57acd2d2 70 // assign operator.
a64b872d 71 this->~AliCorrQADataMakerRec();
72 new(this) AliCorrQADataMakerRec(qadm);
73 return *this;
74}
57acd2d2 75
76//____________________________________________________________________________
77AliCorrQADataMakerRec::~AliCorrQADataMakerRec()
78{
79 // dtor only destroy the ntuple
80 if ( fCorrNt ) {
81 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
82 if ( fCorrNt[specie] != NULL )
83 delete fCorrNt[specie] ;
84 }
85 delete[] fCorrNt ;
86 }
87}
88
a64b872d 89//____________________________________________________________________________
4e25ac79 90void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** /*list*/)
a64b872d 91{
92 //Detector specific actions at end of cycle
93 // do the QA checking
4e25ac79 94 if (task == AliQAv1::kRAWS) {
95 AliQAChecker::Instance()->Run(AliQAv1::kCORR, task, fCorrNt) ;
930e6e3e 96 }
a64b872d 97}
98
99//____________________________________________________________________________
100void AliCorrQADataMakerRec::InitESDs()
101{
102 //Create histograms to controll ESD
103
104 AliInfo("TO BE IMPLEMENTED") ;
105}
106
107//____________________________________________________________________________
108void AliCorrQADataMakerRec::InitRecPoints()
109{
110 // create Reconstructed Points histograms in RecPoints subdir
111
112 AliInfo("TO BE IMPLEMENTED") ;
113}
114
115//____________________________________________________________________________
116void AliCorrQADataMakerRec::InitRaws()
117{
118 // createa ntuple taking all the parameters declared by detectors
57acd2d2 119 if (fCorrNt)
a64b872d 120 return ;
121 delete fRawsQAList ; // not needed for the time being
122 fRawsQAList = NULL ;
123 TString varlist("") ;
4e25ac79 124 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
a64b872d 125 AliQADataMaker * qadm = fqadm[detIndex] ;
126 if ( ! qadm )
127 continue ;
128 TList * list = qadm->GetParameterList() ;
129 if (list) {
130 TIter next(list) ;
131 TParameter<double> * p ;
eca4fa66 132 while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
a64b872d 133 varlist.Append(p->GetName()) ;
134 varlist.Append(":") ;
135 fMaxRawVar++ ;
136 }
137 }
138 }
139 varlist = varlist.Strip(TString::kTrailing, ':') ;
140 if (fMaxRawVar == 0) {
141 AliWarning("NTUPLE not created") ;
142 } else {
57acd2d2 143 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 144 char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(specie)) ;
57acd2d2 145 fCorrNt[specie] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;
146 }
a64b872d 147 }
148}
149
150//____________________________________________________________________________
151void AliCorrQADataMakerRec::MakeESDs(AliESDEvent * /*esd*/)
152{
153 // make QA data from ESDs
154
155 AliInfo("TO BE IMPLEMENTED") ;
156
157}
158
159//____________________________________________________________________________
930e6e3e 160void AliCorrQADataMakerRec::MakeRaws(AliRawReader *)
a64b872d 161{
162 //Fill prepared histograms with Raw digit properties
163 if ( fMaxRawVar > 0 ) {
164 const Int_t kSize = fMaxRawVar ;
31316597 165 Double_t *varvalue = new Double_t[kSize] ;
a64b872d 166 Int_t index = 0 ;
4e25ac79 167 for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
a64b872d 168 AliQADataMaker * qadm = fqadm[detIndex] ;
169 if ( ! qadm )
170 continue ;
171 TList * list = qadm->GetParameterList() ;
172 TIter next(list) ;
173 TParameter<double> * p ;
eca4fa66 174 while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
a64b872d 175 varvalue[index++] = p->GetVal() ;
176 }
177 }
eca4fa66 178 (static_cast<TNtupleD*>(fCorrNt[(Int_t)TMath::Log2(fEventSpecie)]))->Fill(varvalue);
31316597 179 delete [] varvalue;
a64b872d 180 }
181}
182
183//____________________________________________________________________________
184void AliCorrQADataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
185{
186 AliInfo("TO BE IMPLEMENTED") ;
187}
188
189//____________________________________________________________________________
190void AliCorrQADataMakerRec::StartOfDetectorCycle()
191{
192 //Detector specific actions at start of cycle
930e6e3e 193
a64b872d 194}