]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCorrQADataMakerRec.cxx
Coding rule violations fixed.
[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   fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ; 
71   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
72     fCorrNt[specie] = qadm.fCorrNt[specie] ; 
73
74 }
75
76 //__________________________________________________________________
77 AliCorrQADataMakerRec& AliCorrQADataMakerRec::operator = (const AliCorrQADataMakerRec& qadm )
78 {
79   // assign operator.
80   this->~AliCorrQADataMakerRec();
81   new(this) AliCorrQADataMakerRec(qadm);
82   return *this;
83 }
84    
85 //____________________________________________________________________________ 
86 AliCorrQADataMakerRec::~AliCorrQADataMakerRec()  
87 {
88   // dtor only destroy the ntuple 
89   if ( fCorrNt ) {
90 //    for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
91 //      if ( fCorrNt[specie] != NULL ) 
92 //        delete fCorrNt[specie] ; 
93 //    }
94                 delete[] fCorrNt ; 
95     fCorrNt = 0x0;
96         }  
97   if ( fMaxRawVar > 0 ) 
98     delete [] fVarvalue ;
99 }
100   
101 //____________________________________________________________________________ 
102 void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** /*list*/)
103 {
104   //Detector specific actions at end of cycle
105   // do the QA checking
106   if (task == AliQAv1::kRAWS) {
107      AliQAChecker::Instance()->Run(AliQAv1::kCORR, task, fCorrNt) ; 
108   }
109 }
110
111 //____________________________________________________________________________ 
112 void AliCorrQADataMakerRec::InitESDs()
113 {
114   //Create histograms to controll ESD
115
116   AliInfo("TO BE IMPLEMENTED") ; 
117 }
118
119
120 //____________________________________________________________________________ 
121 void AliCorrQADataMakerRec::InitRaws()
122 {
123   // createa ntuple taking all the parameters declared by detectors
124   if (fCorrNt && fCorrNt[AliRecoParam::AConvert(fEventSpecie)]) 
125     return ; 
126
127   if (!fCorrNt) {
128     fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ; ;
129     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
130       fCorrNt[specie] = NULL ;
131   } 
132
133   if ( fRawsQAList ) 
134   {
135     delete[] fRawsQAList ; // not needed for the time being 
136     fRawsQAList = NULL ; 
137   }
138   TString varlist("") ;
139   for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
140     AliQADataMaker * qadm = fqadm[detIndex] ; 
141     if ( ! qadm ) 
142       continue ;
143     TList * list = qadm->GetParameterList() ; 
144     if (list) {
145       TIter next(list) ; 
146       TParameter<double> * p ; 
147       while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
148         varlist.Append(p->GetName()) ; 
149         varlist.Append(":") ; 
150         fMaxRawVar++ ; 
151       }
152     }
153   }
154   varlist = varlist.Strip(TString::kTrailing, ':') ; 
155   if (fMaxRawVar == 0) { 
156     AliWarning("NTUPLE not created") ; 
157   } else {
158     char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(fEventSpecie)) ; 
159     fCorrNt[AliRecoParam::AConvert(fEventSpecie)] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;  
160     fVarvalue = new Double_t[fMaxRawVar] ;
161   }  
162 }
163
164 //____________________________________________________________________________ 
165 void AliCorrQADataMakerRec::InitRecPoints()
166 {
167     // create Reconstructed Points histograms in RecPoints subdir
168   
169   AliInfo("TO BE IMPLEMENTED") ; 
170 }
171
172 //____________________________________________________________________________ 
173 void AliCorrQADataMakerRec::InitRecoParams()
174 {
175     // Get the recoparam form the OCDB for every detector involved in CORR
176   
177   AliInfo("TO BE IMPLEMENTED") ; 
178 }
179
180 //____________________________________________________________________________
181 void AliCorrQADataMakerRec::MakeESDs(AliESDEvent * /*esd*/)
182 {
183   // make QA data from ESDs
184
185   AliInfo("TO BE IMPLEMENTED") ; 
186
187 }
188
189 //____________________________________________________________________________
190 void AliCorrQADataMakerRec::MakeRaws(AliRawReader *)
191 {
192   //Fill prepared histograms with Raw digit properties
193   
194   if ( !fCorrNt || ! fCorrNt[AliRecoParam::AConvert(fEventSpecie)])
195       InitRaws() ; 
196   
197   if ( fMaxRawVar > 0 ) {
198     Int_t index = 0 ;
199     for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
200       AliQADataMaker * qadm = fqadm[detIndex] ; 
201       if ( ! qadm ) 
202         continue ;
203       TList * list = qadm->GetParameterList() ; 
204       if (list) {
205         TIter next(list) ; 
206         TParameter<double> * p ; 
207         while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
208           if (index >= fMaxRawVar) {
209             AliError(Form("Variables list size exceeded (%d) !",index));
210             break;
211           }
212           fVarvalue[index] = p->GetVal() ; 
213           index++ ; 
214         }
215       }
216     }
217     static_cast<TNtupleD*>(fCorrNt[AliRecoParam::AConvert(fEventSpecie)])->Fill(fVarvalue);
218   }
219 }
220
221 //____________________________________________________________________________
222 void AliCorrQADataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
223 {
224   AliInfo("TO BE IMPLEMENTED") ; 
225 }
226
227 //____________________________________________________________________________ 
228 void AliCorrQADataMakerRec::StartOfDetectorCycle()
229 {
230   //Detector specific actions at start of cycle  
231
232 }