]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQADataMaker.cxx
Remove unused responseSPD and responseSSD objects from Calib
[u/mrichter/AliRoot.git] / STEER / AliQADataMaker.cxx
CommitLineData
421ab0fb 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$ */
18
202374b1 19//
20// Base Class
21// Produces the data needed to calculate the quality assurance.
22// All data must be mergeable objects.
23// Y. Schutz CERN July 2007
24//
421ab0fb 25
26// --- ROOT system ---
27#include <TSystem.h>
28#include <TFile.h>
6c18591a 29#include <TList.h>
d76c31f4 30#include <TTree.h>
d5cf81bd 31#include <TClonesArray.h>
a2b64fbd 32#include <TParameter.h>
421ab0fb 33
34// --- Standard library ---
35
36// --- AliRoot header files ---
37#include "AliLog.h"
2e42b4d4 38#include "AliQADataMaker.h"
39#include "AliQAChecker.h"
d76c31f4 40#include "AliESDEvent.h"
d5cf81bd 41#include "AliRawReader.h"
421ab0fb 42
2e42b4d4 43ClassImp(AliQADataMaker)
312e6f8d 44
421ab0fb 45//____________________________________________________________________________
2e42b4d4 46AliQADataMaker::AliQADataMaker(const char * name, const char * title) :
421ab0fb 47 TNamed(name, title),
48 fOutput(0x0),
6c18591a 49 fDetectorDir(0x0),
312e6f8d 50 fDetectorDirName(""),
930e6e3e 51 fCurrentCycle(0),
5b188f2f 52 fCycle(9999999),
53 fCycleCounter(0),
a2b64fbd 54 fParameterList(0x0),
5b188f2f 55 fRun(0)
421ab0fb 56{
57 // ctor
421ab0fb 58 fDetectorDirName = GetName() ;
59}
60
61//____________________________________________________________________________
2e42b4d4 62AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) :
421ab0fb 63 TNamed(qadm.GetName(), qadm.GetTitle()),
64 fOutput(qadm.fOutput),
6c18591a 65 fDetectorDir(qadm.fDetectorDir),
312e6f8d 66 fDetectorDirName(qadm.fDetectorDirName),
5b188f2f 67 fCurrentCycle(qadm.fCurrentCycle),
68 fCycle(qadm.fCycle),
69 fCycleCounter(qadm.fCycleCounter),
a2b64fbd 70 fParameterList(qadm.fParameterList),
a4976ef3 71 fRun(qadm.fRun)
421ab0fb 72{
73 //copy ctor
74 fDetectorDirName = GetName() ;
75}
76
ba7aca7d 77//____________________________________________________________________________
6e65319c 78Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TObjArray * list, const Bool_t expert, const Bool_t saveForCorr)
ba7aca7d 79{
04236e67 80 // Set histograms memory resident and add to the list
ab4351aa 81 // Maximm allowed is 10000
cb905b0f 82 TString className(hist->ClassName()) ;
7f8758be 83 if( ! className.BeginsWith("T") ) {
84 AliError(Form("QA data Object must be a generic ROOT object and not %s", className.Data())) ;
940d8e5f 85// return -1 ;
cb905b0f 86 }
ab4351aa 87 if ( index > 10000 ) {
88 AliError("Max number of authorized QA objects is 10000") ;
04236e67 89 return -1 ;
90 } else {
91 hist->SetDirectory(0) ;
6e65319c 92 if (expert) {
93 TString name(hist->GetTitle()) ;
94 name.Append(AliQA::GetExpert()) ;
95 hist->SetTitle(name) ;
96 }
04236e67 97 list->AddAtAndExpand(hist, index) ;
a2b64fbd 98 char * name = Form("%s_%s", list->GetName(), hist->GetName()) ;
99 TParameter<double> * p = new TParameter<double>(name, 9999.9999) ;
100 if(saveForCorr) {
101 if ( ! fParameterList )
102 fParameterList = new TList() ;
103 fParameterList->Add(p) ;
104 }
105 return list->GetLast() ;
106 }
421ab0fb 107}
108
96d67a8d 109//____________________________________________________________________________
110void AliQADataMaker::DefaultEndOfDetectorCycle(AliQA::TASKINDEX_t task)
111{
112 // this method must be oveloaded by detectors
113 // sets the QA result to Fatal
7c002d48 114 AliQA::Instance(AliQA::GetDetIndex(GetName())) ;
96d67a8d 115 AliQA * qa = AliQA::Instance(task) ;
116 qa->Set(AliQA::kFATAL) ;
117 AliQA::GetQAResultFile()->cd() ;
118 qa->Write(AliQA::GetQAName(), kWriteDelete) ;
119 AliQA::GetQAResultFile()->Close() ;
120}
121
421ab0fb 122//____________________________________________________________________________
c65c502a 123void AliQADataMaker::Finish() const
421ab0fb 124{
96d67a8d 125 // write to the output File
d9cbd8fd 126 if (fOutput)
127 fOutput->Close() ;
421ab0fb 128}
129
130//____________________________________________________________________________
04236e67 131TObject * AliQADataMaker::GetData(TObjArray * list, const Int_t index)
132{
133 // Returns the QA object at index. Limit is 100.
27773260 134 if (list) {
135 if ( index > 10000 ) {
136 AliError("Max number of authorized QA objects is 10000") ;
137 return NULL ;
138 } else {
139 return list->At(index) ;
140 }
04236e67 141 } else {
27773260 142 AliError("Data list is NULL !!") ;
143 return NULL ;
04236e67 144 }
27773260 145}