]>
Commit | Line | Data |
---|---|---|
66f72ab4 | 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 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // Base class for a QA checker, to be instanciated as a container of user | |
20 | // defined tasks | |
21 | //*-- Author : Yves Schutz (SUBATECH) | |
22 | ////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | // --- ROOT system --- | |
25 | #include "TROOT.h" | |
88cb7938 | 26 | #include "TFolder.h" |
66f72ab4 | 27 | |
28 | // --- Standard library --- | |
29 | ||
66f72ab4 | 30 | // --- AliRoot header files --- |
88cb7938 | 31 | #include "AliConfig.h" |
66f72ab4 | 32 | |
33 | #include "AliPHOSQAChecker.h" | |
34 | #include "AliPHOSQAVirtualCheckable.h" | |
35 | ||
36 | ClassImp(AliPHOSQAChecker) | |
37 | ||
38 | ||
39 | //____________________________________________________________________________ | |
40 | AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title) | |
41 | { | |
42 | // ctor | |
7a9d98f9 | 43 | // stores checkers in the PHOS QA TTask folder //Folders/Task/QA |
88cb7938 | 44 | |
45 | TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron | |
46 | TString phosqatn(AliConfig::Instance()->GetQATaskName()); //skowron | |
47 | ||
48 | TTask * aliceQA = (TTask*)topfold->FindObjectAny(phosqatn); //skowron | |
49 | if (aliceQA == 0x0) | |
50 | { | |
51 | Fatal("AliPHOSQAChecker","Can not find QA main task"); | |
52 | return;//never reached | |
53 | } | |
54 | ||
55 | TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS"); //hard wired name !!!; skowron | |
66f72ab4 | 56 | if (phosQA) // PHOS QA Tasks container exists |
9688c1dd | 57 | phosQA->Add(this) ; |
7a9d98f9 | 58 | else // create //Folders/Task/QA/PHOS |
9688c1dd | 59 | aliceQA->Add(this) ; |
a1d3d38a | 60 | |
2685bf00 | 61 | fCheckablesList = new TList() ; |
62 | fCheckable = 0; | |
66f72ab4 | 63 | } |
64 | ||
65 | //____________________________________________________________________________ | |
66 | AliPHOSQAChecker::~AliPHOSQAChecker() | |
67 | { | |
68 | // dtor remove the checker from the task list of the associated checker | |
69 | ||
70 | TIter next(fCheckablesList) ; | |
71 | AliPHOSQAVirtualCheckable * checkable ; | |
72 | while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) ) | |
73 | checkable->RemoveChecker(this) ; | |
74 | ExecuteTasks("D") ; | |
75 | } | |
76 | ||
77 | //____________________________________________________________________________ | |
78 | void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca) | |
79 | { | |
80 | // does the check for the given checkable | |
81 | ||
82 | SetCheckable(ca) ; | |
83 | TList * l = GetListOfTasks() ; | |
84 | TIter next(l) ; | |
85 | AliPHOSQAChecker * checker ; | |
86 | while ( (checker = (AliPHOSQAChecker*)next()) ) | |
87 | checker->SetCheckable(ca) ; | |
88 | ExecuteTask("") ; | |
89 | fCheckable = 0 ; | |
90 | } | |
91 | ||
92 | //____________________________________________________________________________ | |
93 | void AliPHOSQAChecker::CheckIt() | |
94 | { | |
95 | // does the check for all attached chekables | |
96 | if ( fCheckablesList->IsEmpty() ) | |
97 | ExecuteTask("C") ; | |
98 | else { | |
99 | TIter next( fCheckablesList ) ; | |
100 | AliPHOSQAVirtualCheckable * checkable ; | |
101 | while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) { | |
102 | fCheckable = checkable ; | |
103 | ExecuteTask("") ; | |
104 | } | |
105 | } | |
106 | } | |
107 | ||
108 | //____________________________________________________________________________ | |
109 | void AliPHOSQAChecker::Exec(Option_t *option) | |
110 | { | |
111 | // Performs various tasks as indicated by option | |
112 | // P --> Print | |
113 | // S --> Status | |
114 | // C --> does the comparison on all the checkables declared | |
115 | // --> does the comparison on only one checkable (the one which asks CheckMe() ) | |
116 | // A --> list the alarms raised in the associated checkables | |
117 | // R --> reset the alarms | |
118 | // D --> calls the dtor | |
119 | ||
120 | if ( !(strcmp(option,"P")) ) | |
121 | Print() ; | |
122 | ||
123 | else if ( !(strcmp(option,"S")) ) | |
124 | Status() ; | |
125 | ||
126 | else if ( !(strcmp(option,"C")) ) { | |
127 | TIter next( fCheckablesList ) ; | |
128 | AliPHOSQAVirtualCheckable * checkable ; | |
129 | while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) { | |
130 | fCheckable = checkable ; | |
131 | TString message = CheckingOperation(); | |
132 | if ( !message.IsNull() ) { | |
133 | TDatime dt ; | |
134 | TString time(dt.AsSQLString()) ; | |
135 | message = time + message ; | |
136 | fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; | |
137 | } | |
138 | } | |
139 | } | |
140 | ||
141 | else if ( !(strcmp(option,"R")) ) { | |
142 | TIter next( fCheckablesList ) ; | |
143 | AliPHOSQAVirtualCheckable * checkable ; | |
144 | while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) { | |
145 | fCheckable = checkable ; | |
146 | fCheckable->ResetAlarms() ; | |
147 | } | |
148 | } | |
149 | ||
150 | else if ( !(strcmp(option,"")) ) { | |
151 | TString message = CheckingOperation(); | |
152 | if ( !message.IsNull() ) { | |
153 | TDatime dt ; | |
154 | TString time(dt.AsSQLString()) ; | |
155 | message = time + message ; | |
156 | fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; | |
157 | } | |
158 | } | |
159 | ||
160 | else if ( !(strcmp(option,"A")) ) | |
161 | PrintAlarms() ; | |
162 | ||
163 | else if ( !(strcmp(option,"D")) ) | |
164 | Delete() ; | |
165 | } | |
166 | ||
167 | //____________________________________________________________________________ | |
168 | void AliPHOSQAChecker::Print() | |
169 | { | |
170 | // print the checker and sub-checkers, if any, name. | |
171 | ||
21cd0c07 | 172 | Info("Print", "Checker : %s", GetName()) ; |
66f72ab4 | 173 | |
174 | } | |
175 | ||
176 | //____________________________________________________________________________ | |
177 | void AliPHOSQAChecker::PrintAlarms() | |
178 | { | |
179 | // Prints the alarms of all attached checkables | |
21cd0c07 | 180 | Info("PrintAlarms", "Checker name : %s", GetName()) ; |
66f72ab4 | 181 | if ( !(fCheckablesList->IsEmpty() ) ) { |
182 | TIter next( fCheckablesList ) ; | |
183 | AliPHOSQAVirtualCheckable * checkable ; | |
184 | while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) ) | |
185 | checkable->Alarms() ; | |
186 | } | |
187 | } | |
188 | ||
189 | //____________________________________________________________________________ | |
190 | void AliPHOSQAChecker::Status() | |
191 | { | |
192 | // Prints the checkables attached to this checker | |
193 | if ( fCheckablesList->IsEmpty() ) | |
21cd0c07 | 194 | Info("Status", "No checkables are checked by %s", GetName()) ; |
66f72ab4 | 195 | else { |
21cd0c07 | 196 | Info("Status", "The following checkables are checked by %s", GetName()) ; |
66f72ab4 | 197 | TIter next(fCheckablesList) ; |
198 | AliPHOSQAVirtualCheckable * checkable ; | |
199 | while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) | |
200 | checkable->Print() ; | |
201 | } | |
202 | } |