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 **************************************************************************/
18 //_________________________________________________________________________
19 // Base class for a QA checker, to be instanciated as a container of user
21 //*-- Author : Yves Schutz (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
24 // --- ROOT system ---
28 // --- Standard library ---
30 // --- AliRoot header files ---
31 #include "AliConfig.h"
33 #include "AliPHOSQAChecker.h"
34 #include "AliPHOSQAVirtualCheckable.h"
36 ClassImp(AliPHOSQAChecker)
39 //____________________________________________________________________________
40 AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title)
43 // stores checkers in the PHOS QA TTask folder //Folders/Task/QA
45 TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron
46 TString phosqatn(AliConfig::Instance()->GetQATaskName()); //skowron
48 TTask * aliceQA = (TTask*)topfold->FindObjectAny(phosqatn); //skowron
51 Fatal("AliPHOSQAChecker","Can not find QA main task");
52 return;//never reached
55 TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS"); //hard wired name !!!; skowron
56 if (phosQA) // PHOS QA Tasks container exists
58 else // create //Folders/Task/QA/PHOS
61 fCheckablesList = new TList() ;
65 //____________________________________________________________________________
66 AliPHOSQAChecker::~AliPHOSQAChecker()
68 // dtor remove the checker from the task list of the associated checker
70 TIter next(fCheckablesList) ;
71 AliPHOSQAVirtualCheckable * checkable ;
72 while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) )
73 checkable->RemoveChecker(this) ;
77 //____________________________________________________________________________
78 void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca)
80 // does the check for the given checkable
83 TList * l = GetListOfTasks() ;
85 AliPHOSQAChecker * checker ;
86 while ( (checker = (AliPHOSQAChecker*)next()) )
87 checker->SetCheckable(ca) ;
92 //____________________________________________________________________________
93 void AliPHOSQAChecker::CheckIt()
95 // does the check for all attached chekables
96 if ( fCheckablesList->IsEmpty() )
99 TIter next( fCheckablesList ) ;
100 AliPHOSQAVirtualCheckable * checkable ;
101 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
102 fCheckable = checkable ;
108 //____________________________________________________________________________
109 void AliPHOSQAChecker::Exec(Option_t *option)
111 // Performs various tasks as indicated by option
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
120 if ( !(strcmp(option,"P")) )
123 else if ( !(strcmp(option,"S")) )
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() ) {
134 TString time(dt.AsSQLString()) ;
135 message = time + message ;
136 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
141 else if ( !(strcmp(option,"R")) ) {
142 TIter next( fCheckablesList ) ;
143 AliPHOSQAVirtualCheckable * checkable ;
144 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
145 fCheckable = checkable ;
146 fCheckable->ResetAlarms() ;
150 else if ( !(strcmp(option,"")) ) {
151 TString message = CheckingOperation();
152 if ( !message.IsNull() ) {
154 TString time(dt.AsSQLString()) ;
155 message = time + message ;
156 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
160 else if ( !(strcmp(option,"A")) )
163 else if ( !(strcmp(option,"D")) )
167 //____________________________________________________________________________
168 void AliPHOSQAChecker::Print()
170 // print the checker and sub-checkers, if any, name.
172 Info("Print", "Checker : %s", GetName()) ;
176 //____________________________________________________________________________
177 void AliPHOSQAChecker::PrintAlarms()
179 // Prints the alarms of all attached checkables
180 Info("PrintAlarms", "Checker name : %s", GetName()) ;
181 if ( !(fCheckablesList->IsEmpty() ) ) {
182 TIter next( fCheckablesList ) ;
183 AliPHOSQAVirtualCheckable * checkable ;
184 while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) )
185 checkable->Alarms() ;
189 //____________________________________________________________________________
190 void AliPHOSQAChecker::Status()
192 // Prints the checkables attached to this checker
193 if ( fCheckablesList->IsEmpty() )
194 Info("Status", "No checkables are checked by %s", GetName()) ;
196 Info("Status", "The following checkables are checked by %s", GetName()) ;
197 TIter next(fCheckablesList) ;
198 AliPHOSQAVirtualCheckable * checkable ;
199 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) )