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