AliRoot Core  3dc7879 (3dc7879)
AliCorrQADataMakerRec.cxx
Go to the documentation of this file.
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 //____________________________________________________________________________
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 //____________________________________________________________________________
59  AliQADataMakerRec(qadm),
60  fMaxRawVar(qadm.fMaxRawVar),
61  fqadm(qadm.fqadm),
62  fVarvalue(NULL)
63 {
64  //copy ctor
65  if ( fMaxRawVar > 0 ) {
66  fVarvalue = new Double_t[fMaxRawVar] ;
67  memcpy(fVarvalue, qadm.fVarvalue, fMaxRawVar*sizeof(Double_t));
68  }
69 
70  // Replace shallow copy done by AliQADataMakerRec by a semi-deep
71  // copy where the pointer container is recreated but the Ntuples pointed
72  // to are simply copied
73  fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
74  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
75  fCorrNt[specie] = qadm.fCorrNt[specie] ;
76 
77 }
78 
79 //__________________________________________________________________
81 {
82  // assign operator.
83  if(this != &qadm) {
85  fMaxRawVar = qadm.fMaxRawVar;
86  fqadm = qadm.fqadm;
87  delete [] fVarvalue;
88  if ( fMaxRawVar > 0 ) {
89  fVarvalue = new Double_t[fMaxRawVar] ;
90  memcpy(fVarvalue, qadm.fVarvalue, fMaxRawVar*sizeof(Double_t));
91  } else fVarvalue = 0;
92 
93  // Replace shallow copy done by AliQADataMakerRec by a semi-deep
94  // copy where the pointer container is recreated but the Ntuples pointed
95  // to are simply copied
96  fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ;
97  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
98  fCorrNt[specie] = qadm.fCorrNt[specie] ;
99  }
100  return *this;
101 }
102 
103 //____________________________________________________________________________
105 {
106  //
107  // dtor only destroy the ntuple otherwise it would violate ownership...
108  // however when the last AliCorrQADataMakerRec is deleted there is
109  // a leak
110  //
111  // if ( fCorrNt )
112  // for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; ++specie)
113  // delete fCorrNt[specie] ;
114  //
115  delete [] fCorrNt ;
116  delete [] fVarvalue ;
117 }
118 
119 //____________________________________________________________________________
121 {
122  //Detector specific actions at end of cycle
123  // do the QA checking
124  if (task == AliQAv1::kRAWS) {
126  }
127 }
128 
129 //____________________________________________________________________________
131 {
132  //Create histograms to controll ESD
133 
134  AliInfo("TO BE IMPLEMENTED") ;
135  //
136  ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
137 }
138 
139 
140 //____________________________________________________________________________
142 {
143  // createa ntuple taking all the parameters declared by detectors
145  return ;
146 
147  if (!fCorrNt) {
148  fCorrNt = new TNtupleD *[AliRecoParam::kNSpecies] ; ;
149  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
150  fCorrNt[specie] = NULL ;
151  }
152 
153  if ( fRawsQAList )
154  {
155  delete[] fRawsQAList ; // not needed for the time being
156  fRawsQAList = NULL ;
157  }
158  TString varlist("") ;
159  for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
160  AliQADataMaker * qadm = fqadm[detIndex] ;
161  if ( ! qadm )
162  continue ;
163  TList * list = qadm->GetParameterList() ;
164  if (list) {
165  TIter next(list) ;
166  TParameter<double> * p ;
167  while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
168  varlist.Append(p->GetName()) ;
169  varlist.Append(":") ;
170  fMaxRawVar++ ;
171  }
172  }
173  }
174  varlist = varlist.Strip(TString::kTrailing, ':') ;
175  if (fMaxRawVar == 0) {
176  AliWarning("NTUPLE not created") ;
177  } else {
178  char * name = Form("%s_%s", AliQAv1::GetQACorrName(), AliRecoParam::GetEventSpecieName(fEventSpecie)) ;
179  fCorrNt[AliRecoParam::AConvert(fEventSpecie)] = new TNtupleD(name, "Raws data correlation among detectors", varlist.Data()) ;
180  fVarvalue = new Double_t[fMaxRawVar] ;
181  }
182  //
183  ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
184 }
185 
186 //____________________________________________________________________________
188 {
189  // create Reconstructed Points histograms in RecPoints subdir
190 
191  AliInfo("TO BE IMPLEMENTED") ;
192  ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
193 }
194 
195 //____________________________________________________________________________
197 {
198  // Get the recoparam form the OCDB for every detector involved in CORR
199 
200  AliInfo("TO BE IMPLEMENTED") ;
201 }
202 
203 //____________________________________________________________________________
205 {
206  // make QA data from ESDs
207 
208  AliInfo("TO BE IMPLEMENTED") ;
211  //
212 }
213 
214 //____________________________________________________________________________
216 {
217  //Fill prepared histograms with Raw digit properties
218 
220  InitRaws() ;
221 
222  if ( fMaxRawVar > 0 ) {
223  Int_t index = 0 ;
224  for ( Int_t detIndex = 0 ; detIndex < AliQAv1::kNDET ; detIndex++ ) {
225  AliQADataMaker * qadm = fqadm[detIndex] ;
226  if ( ! qadm )
227  continue ;
228  TList * list = qadm->GetParameterList() ;
229  if (list) {
230  TIter next(list) ;
231  TParameter<double> * p ;
232  while ( (p = static_cast<TParameter<double>*>(next()) ) ) {
233  if (index >= fMaxRawVar) {
234  AliError(Form("Variables list size exceeded (%d) !",index));
235  break;
236  }
237  fVarvalue[index] = p->GetVal() ;
238  index++ ;
239  }
240  }
241  }
242  static_cast<TNtupleD*>(fCorrNt[AliRecoParam::AConvert(fEventSpecie)])->Fill(fVarvalue);
243  }
244  //
247  //
248 }
249 
250 //____________________________________________________________________________
251 void AliCorrQADataMakerRec::MakeRecPoints(TTree * /*clustersTree*/)
252 {
253  AliInfo("TO BE IMPLEMENTED") ;
256  //
257 }
258 
259 //____________________________________________________________________________
261 {
262  //Detector specific actions at start of cycle
263 
264 }
static const char * GetEventSpecieName(EventSpecie_t es)
AliQADataMakerRec & operator=(const AliQADataMakerRec &qadm)
virtual void MakeRecPoints(TTree *recpoTree)
AliCorrQADataMakerRec(AliQADataMaker **)
Bool_t Run(const char *fileName=NULL, AliDetectorRecoParam *recoParam=NULL)
TObjArray ** fRawsQAList
list of the ESDs QA data objects
#define TObjArray
void IncEvCountTotalRecPoints(Int_t diff=1)
Float_t p[]
Definition: kNNTest.C:133
void IncEvCountCycleRecPoints(Int_t diff=1)
AliQADataMaker ** fqadm
number of raw parameters in the ntuple
#define AliWarning(message)
Definition: AliLog.h:541
virtual void MakeRaws(AliRawReader *)
Double_t * fVarvalue
array of detectors QA data makers pointers
#define AliInfo(message)
Definition: AliLog.h:484
virtual void ClonePerTrigClass(AliQAv1::TASKINDEX_t task)
virtual void MakeESDs(AliESDEvent *esd)
virtual void EndOfDetectorCycle(AliQAv1::TASKINDEX_t, TObjArray **list)
TNtupleD ** fCorrNt
list of the RecPoints QA data objects
AliCorrQADataMakerRec & operator=(const AliCorrQADataMakerRec &qadm)
TASKINDEX_t
Definition: AliQAv1.h:30
void IncEvCountCycleRaws(Int_t diff=1)
void IncEvCountCycleESDs(Int_t diff=1)
void IncEvCountTotalESDs(Int_t diff=1)
#define AliError(message)
Definition: AliLog.h:591
static Int_t AConvert(EventSpecie_t es)
TList * GetParameterList() const
static AliQAChecker * Instance()
static const char * GetQACorrName()
Definition: AliQAv1.h:74
AliRecoParam::EventSpecie_t fEventSpecie
run number
void IncEvCountTotalRaws(Int_t diff=1)