]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/AliQADataMaker.cxx
ACORDEv1 is now the default
[u/mrichter/AliRoot.git] / STEER / AliQADataMaker.cxx
... / ...
CommitLineData
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
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//
25
26// --- ROOT system ---
27#include <TSystem.h>
28#include <TFile.h>
29#include <TList.h>
30#include <TTree.h>
31#include <TClonesArray.h>
32#include <TParameter.h>
33
34// --- Standard library ---
35
36// --- AliRoot header files ---
37#include "AliLog.h"
38#include "AliQADataMaker.h"
39#include "AliQAChecker.h"
40#include "AliESDEvent.h"
41#include "AliRawReader.h"
42
43ClassImp(AliQADataMaker)
44
45//____________________________________________________________________________
46AliQADataMaker::AliQADataMaker(const char * name, const char * title) :
47 TNamed(name, title),
48 fOutput(0x0),
49 fDetectorDir(0x0),
50 fDetectorDirName(""),
51 fCurrentCycle(-1),
52 fCycle(9999999),
53 fCycleCounter(0),
54 fParameterList(0x0),
55 fRun(0)
56{
57 // ctor
58 fDetectorDirName = GetName() ;
59}
60
61//____________________________________________________________________________
62AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) :
63 TNamed(qadm.GetName(), qadm.GetTitle()),
64 fOutput(qadm.fOutput),
65 fDetectorDir(qadm.fDetectorDir),
66 fDetectorDirName(qadm.fDetectorDirName),
67 fCurrentCycle(qadm.fCurrentCycle),
68 fCycle(qadm.fCycle),
69 fCycleCounter(qadm.fCycleCounter),
70 fParameterList(qadm.fParameterList),
71 fRun(qadm.fRun)
72{
73 //copy ctor
74 fDetectorDirName = GetName() ;
75}
76
77//____________________________________________________________________________
78Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TObjArray * list, const Bool_t saveForCorr)
79{
80 // Set histograms memory resident and add to the list
81 // Maximm allowed is 10000
82 TString className(hist->ClassName()) ;
83 if( ! className.BeginsWith("T") ) {
84 AliError(Form("QA data Object must be a generic ROOT object and not %s", className.Data())) ;
85// return -1 ;
86 }
87 if ( index > 10000 ) {
88 AliError("Max number of authorized QA objects is 10000") ;
89 return -1 ;
90 } else {
91 hist->SetDirectory(0) ;
92 list->AddAtAndExpand(hist, index) ;
93 char * name = Form("%s_%s", list->GetName(), hist->GetName()) ;
94 TParameter<double> * p = new TParameter<double>(name, 9999.9999) ;
95 if(saveForCorr) {
96 if ( ! fParameterList )
97 fParameterList = new TList() ;
98 fParameterList->Add(p) ;
99 }
100 return list->GetLast() ;
101 }
102}
103
104//____________________________________________________________________________
105void AliQADataMaker::DefaultEndOfDetectorCycle(AliQA::TASKINDEX_t task)
106{
107 // this method must be oveloaded by detectors
108 // sets the QA result to Fatal
109 AliQA::Instance(AliQA::GetDetIndex(GetName())) ;
110 AliQA * qa = AliQA::Instance(task) ;
111 qa->Set(AliQA::kFATAL) ;
112 AliQA::GetQAResultFile()->cd() ;
113 qa->Write(AliQA::GetQAName(), kWriteDelete) ;
114 AliQA::GetQAResultFile()->Close() ;
115}
116
117//____________________________________________________________________________
118void AliQADataMaker::Finish() const
119{
120 // write to the output File
121 if (fOutput)
122 fOutput->Close() ;
123}
124
125//____________________________________________________________________________
126TObject * AliQADataMaker::GetData(TObjArray * list, const Int_t index)
127{
128 // Returns the QA object at index. Limit is 100.
129 if (list) {
130 if ( index > 10000 ) {
131 AliError("Max number of authorized QA objects is 10000") ;
132 return NULL ;
133 } else {
134 return list->At(index) ;
135 }
136 } else {
137 AliError("Data list is NULL !!") ;
138 return NULL ;
139 }
140}
141
142//____________________________________________________________________________
143void AliQADataMaker::Reset(const Bool_t sameCycle)
144{
145 // Resets defaut value of data members
146 if (!sameCycle) {
147 fCycleCounter = 0 ;
148 }
149}