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