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"
35 ClassImp(AliPHOSQAChecker)
38 //____________________________________________________________________________
39 AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title)
42 // stores checkers in the PHOS QA TTask folder //Folders/Task/QA
44 TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron
45 TString phosqatn(AliConfig::Instance()->GetQATaskName()); //skowron
47 TTask * aliceQA = (TTask*)topfold->FindObjectAny(phosqatn); //skowron
50 Fatal("AliPHOSQAChecker","Can not find QA main task");
51 return;//never reached
54 TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS"); //hard wired name !!!; skowron
55 if (phosQA) // PHOS QA Tasks container exists
57 else // create //Folders/Task/QA/PHOS
60 fCheckablesList = new TList() ;
64 //____________________________________________________________________________
65 AliPHOSQAChecker::~AliPHOSQAChecker()
67 // dtor remove the checker from the task list of the associated checker
69 TIter next(fCheckablesList) ;
70 AliPHOSQAVirtualCheckable * checkable ;
71 while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) )
72 checkable->RemoveChecker(this) ;
76 //____________________________________________________________________________
77 void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca)
79 // does the check for the given checkable
82 TList * l = GetListOfTasks() ;
84 AliPHOSQAChecker * checker ;
85 while ( (checker = (AliPHOSQAChecker*)next()) )
86 checker->SetCheckable(ca) ;
91 //____________________________________________________________________________
92 void AliPHOSQAChecker::CheckIt()
94 // does the check for all attached chekables
95 if ( fCheckablesList->IsEmpty() )
98 TIter next( fCheckablesList ) ;
99 AliPHOSQAVirtualCheckable * checkable ;
100 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
101 fCheckable = checkable ;
107 //____________________________________________________________________________
108 void AliPHOSQAChecker::Exec(Option_t *option)
110 // Performs various tasks as indicated by option
113 // C --> does the comparison on all the checkables declared
114 // --> does the comparison on only one checkable (the one which asks CheckMe() )
115 // A --> list the alarms raised in the associated checkables
116 // R --> reset the alarms
117 // D --> calls the dtor
119 if ( !(strcmp(option,"P")) )
122 else if ( !(strcmp(option,"S")) )
125 else if ( !(strcmp(option,"C")) ) {
126 TIter next( fCheckablesList ) ;
127 AliPHOSQAVirtualCheckable * checkable ;
128 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
129 fCheckable = checkable ;
130 TString message = CheckingOperation();
131 if ( !message.IsNull() ) {
133 TString time(dt.AsSQLString()) ;
134 message = time + message ;
135 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
140 else if ( !(strcmp(option,"R")) ) {
141 TIter next( fCheckablesList ) ;
142 AliPHOSQAVirtualCheckable * checkable ;
143 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
144 fCheckable = checkable ;
145 fCheckable->ResetAlarms() ;
149 else if ( !(strcmp(option,"")) ) {
150 TString message = CheckingOperation();
151 if ( !message.IsNull() ) {
153 TString time(dt.AsSQLString()) ;
154 message = time + message ;
155 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
159 else if ( !(strcmp(option,"A")) )
162 else if ( !(strcmp(option,"D")) )
166 //____________________________________________________________________________
167 void AliPHOSQAChecker::Print()
169 // print the checker and sub-checkers, if any, name.
171 Info("Print", "Checker : %s", GetName()) ;
175 //____________________________________________________________________________
176 void AliPHOSQAChecker::PrintAlarms()
178 // Prints the alarms of all attached checkables
179 Info("PrintAlarms", "Checker name : %s", GetName()) ;
180 if ( !(fCheckablesList->IsEmpty() ) ) {
181 TIter next( fCheckablesList ) ;
182 AliPHOSQAVirtualCheckable * checkable ;
183 while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) )
184 checkable->Alarms() ;
188 //____________________________________________________________________________
189 void AliPHOSQAChecker::Status()
191 // Prints the checkables attached to this checker
192 if ( fCheckablesList->IsEmpty() )
193 Info("Status", "No checkables are checked by %s", GetName()) ;
195 Info("Status", "The following checkables are checked by %s", GetName()) ;
196 TIter next(fCheckablesList) ;
197 AliPHOSQAVirtualCheckable * checkable ;
198 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) )