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