]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCorrQADataMakerRec.cxx
Fixes for bug #49914: Compilation breaks in trunk, and bug #48629: Trunk cannot read...
[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         }  
87 }
88   
89 //____________________________________________________________________________ 
90 void AliCorrQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** /*list*/)
91 {
92   //Detector specific actions at end of cycle
93   // do the QA checking
94   if (task == AliQAv1::kRAWS) {
95      AliQAChecker::Instance()->Run(AliQAv1::kCORR, task, fCorrNt) ; 
96   }
97 }
98
99 //____________________________________________________________________________ 
100 void AliCorrQADataMakerRec::InitESDs()
101 {
102   //Create histograms to controll ESD
103
104   AliInfo("TO BE IMPLEMENTED") ; 
105 }
106
107 //____________________________________________________________________________ 
108 void AliCorrQADataMakerRec::InitRecPoints()
109 {
110   // create Reconstructed Points histograms in RecPoints subdir
111
112   AliInfo("TO BE IMPLEMENTED") ; 
113 }
114
115 //____________________________________________________________________________ 
116 void AliCorrQADataMakerRec::InitRaws()
117 {
118   // createa ntuple taking all the parameters declared by detectors
119   if (fCorrNt) 
120     return ; 
121   delete fRawsQAList ; // not needed for the time being 
122   fRawsQAList = NULL ; 
123   TString varlist("") ;
124   for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
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 ; 
132       while ( (p = dynamic_cast<TParameter<double>*>(next()) ) ) {
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 {
143     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
144       char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(specie)) ; 
145       fCorrNt[specie] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;  
146     }
147   }  
148 }
149
150 //____________________________________________________________________________
151 void AliCorrQADataMakerRec::MakeESDs(AliESDEvent * /*esd*/)
152 {
153   // make QA data from ESDs
154
155   AliInfo("TO BE IMPLEMENTED") ; 
156
157 }
158
159 //____________________________________________________________________________
160 void AliCorrQADataMakerRec::MakeRaws(AliRawReader *)
161 {
162   //Fill prepared histograms with Raw digit properties
163   if ( fMaxRawVar > 0 ) {
164     const Int_t kSize = fMaxRawVar ; 
165     Double_t  *varvalue = new Double_t[kSize] ;
166     Int_t index = 0 ;
167     for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
168       AliQADataMaker * qadm = fqadm[detIndex] ; 
169       if ( ! qadm ) 
170         continue ;
171       TList * list = qadm->GetParameterList() ; 
172       TIter next(list) ; 
173       TParameter<double> * p ; 
174       while ( (p = dynamic_cast<TParameter<double>*>(next()) ) ) {
175         varvalue[index++] = p->GetVal() ; 
176       }
177     }
178     (dynamic_cast<TNtupleD*>(fCorrNt[(Int_t)TMath::Log2(fEventSpecie)]))->Fill(varvalue);
179     delete [] varvalue;
180   }
181 }
182
183 //____________________________________________________________________________
184 void AliCorrQADataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
185 {
186   AliInfo("TO BE IMPLEMENTED") ; 
187 }
188
189 //____________________________________________________________________________ 
190 void AliCorrQADataMakerRec::StartOfDetectorCycle()
191 {
192   //Detector specific actions at start of cycle  
193
194 }