1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
21 // Produces the data needed to calculate the quality assurance.
22 // All data must be mergeable objects.
23 // Y. Schutz CERN July 2007
26 // --- ROOT system ---
31 #include <TClonesArray.h>
32 #include <TParameter.h>
44 // --- Standard library ---
46 // --- AliRoot header files ---
48 #include "AliQADataMaker.h"
49 #include "AliQAChecker.h"
50 #include "AliESDEvent.h"
51 #include "AliRawReader.h"
53 ClassImp(AliQADataMaker)
55 //____________________________________________________________________________
56 AliQADataMaker::AliQADataMaker(const char * name, const char * title) :
65 fParameterList(new TList*[AliRecoParam::kNSpecies]),
67 fEventSpecie(AliRecoParam::kDefault)
70 fDetectorDirName = GetName() ;
71 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
72 fParameterList[specie] = NULL ;
75 //____________________________________________________________________________
76 AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) :
77 TNamed(qadm.GetName(), qadm.GetTitle()),
78 fOutput(qadm.fOutput),
79 fDetectorDir(qadm.fDetectorDir),
80 fDetectorDirName(qadm.fDetectorDirName),
81 fCurrentCycle(qadm.fCurrentCycle),
83 fCycleCounter(qadm.fCycleCounter),
84 fWriteExpert(qadm.fWriteExpert),
85 fParameterList(qadm.fParameterList),
87 fEventSpecie(qadm.fEventSpecie)
90 fDetectorDirName = GetName() ;
93 //____________________________________________________________________________
94 Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TObjArray ** list, const Bool_t expert, const Bool_t image, const Bool_t saveForCorr)
96 // Set histograms memory resident and add to the list
97 // Maximm allowed is 10000
100 TClass * classType = hist->Class() ;
101 TString className(classType->GetName()) ;
102 if( ! className.BeginsWith("T") && ! classType->InheritsFrom("TH1") ) {
103 AliError(Form("QA data Object must be a generic ROOT object and derive fom TH1 and not %s", className.Data())) ;
104 } else if ( index > 10000 ) {
105 AliError("Max number of authorized QA objects is 10000") ;
108 hist->SetBit(AliQAv1::GetExpertBit()) ;
110 hist->SetBit(AliQAv1::GetImageBit()) ;
111 TH1 * histClone[AliRecoParam::kNSpecies] ;
112 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
113 histClone[specie] = CloneMe(hist, specie) ;
114 histClone[specie]->SetDirectory(0) ;
115 list[specie]->AddAtAndExpand(histClone[specie], index) ;
117 char * name = Form("%s_%s", list[AliRecoParam::kDefault]->GetName(), hist->GetName()) ;
118 TParameter<double> * p = new TParameter<double>(name, 9999.9999) ;
119 if ( fParameterList[specie] == NULL )
120 fParameterList[specie] = new TList() ;
121 fParameterList[specie]->Add(p) ;
124 rv = list[AliRecoParam::kDefault]->GetLast() ;
130 //____________________________________________________________________________
131 TH1 * AliQADataMaker::CloneMe(TH1 * hist, Int_t specie) const
133 // clones a histogram
134 char * name = Form("%s_%s", AliRecoParam::GetEventSpecieName(specie), hist->GetName()) ;
135 TH1 * hClone = dynamic_cast<TH1 *>(hist->Clone(name)) ;
136 if ( hist->TestBit(AliQAv1::GetExpertBit()) )
137 hClone->SetBit(AliQAv1::GetExpertBit()) ;
138 if ( hist->TestBit(AliQAv1::GetImageBit()) )
139 hClone->SetBit(AliQAv1::GetImageBit()) ;
143 //____________________________________________________________________________
144 void AliQADataMaker::DefaultEndOfDetectorCycle(AliQAv1::TASKINDEX_t task)
146 // this method must be oveloaded by detectors
147 // sets the QA result to Fatal
148 AliQAv1::Instance(AliQAv1::GetDetIndex(GetName())) ;
149 AliQAv1 * qa = AliQAv1::Instance(task) ;
150 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
151 qa->Set(AliQAv1::kFATAL, specie) ;
152 AliQAv1::GetQAResultFile()->cd() ;
153 qa->Write(AliQAv1::GetQAName(), kWriteDelete) ;
154 AliQAv1::GetQAResultFile()->Close() ;
157 //____________________________________________________________________________
158 void AliQADataMaker::Finish() const
160 // write to the output File
165 //____________________________________________________________________________
166 TObject * AliQADataMaker::GetData(TObjArray ** list, const Int_t index)
168 // Returns the QA object at index. Limit is 100.
170 AliError("Data list is NULL !!") ;
173 if (list[AliRecoParam::AConvert(fEventSpecie)]) {
174 if ( index > 10000 ) {
175 AliError("Max number of authorized QA objects is 10000") ;
178 Int_t esindex = AliRecoParam::AConvert(fEventSpecie) ;
179 return list[esindex]->At(index) ;
182 AliError("Data list is NULL !!") ;