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 ---
31 // --- AliRoot header files ---
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
44 TTask * aliceQA = (TTask*)gROOT->FindObjectAny("Folders/Tasks/QA") ;
45 TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
46 if (phosQA) // PHOS QA Tasks container exists
48 else // create //Folders/Task/QA/PHOS
51 fCheckablesList = new TList() ;
55 //____________________________________________________________________________
56 AliPHOSQAChecker::~AliPHOSQAChecker()
58 // dtor remove the checker from the task list of the associated checker
60 TIter next(fCheckablesList) ;
61 AliPHOSQAVirtualCheckable * checkable ;
62 while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) )
63 checkable->RemoveChecker(this) ;
67 //____________________________________________________________________________
68 void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca)
70 // does the check for the given checkable
73 TList * l = GetListOfTasks() ;
75 AliPHOSQAChecker * checker ;
76 while ( (checker = (AliPHOSQAChecker*)next()) )
77 checker->SetCheckable(ca) ;
82 //____________________________________________________________________________
83 void AliPHOSQAChecker::CheckIt()
85 // does the check for all attached chekables
86 if ( fCheckablesList->IsEmpty() )
89 TIter next( fCheckablesList ) ;
90 AliPHOSQAVirtualCheckable * checkable ;
91 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
92 fCheckable = checkable ;
98 //____________________________________________________________________________
99 void AliPHOSQAChecker::Exec(Option_t *option)
101 // Performs various tasks as indicated by option
104 // C --> does the comparison on all the checkables declared
105 // --> does the comparison on only one checkable (the one which asks CheckMe() )
106 // A --> list the alarms raised in the associated checkables
107 // R --> reset the alarms
108 // D --> calls the dtor
110 if ( !(strcmp(option,"P")) )
113 else if ( !(strcmp(option,"S")) )
116 else if ( !(strcmp(option,"C")) ) {
117 TIter next( fCheckablesList ) ;
118 AliPHOSQAVirtualCheckable * checkable ;
119 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
120 fCheckable = checkable ;
121 TString message = CheckingOperation();
122 if ( !message.IsNull() ) {
124 TString time(dt.AsSQLString()) ;
125 message = time + message ;
126 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
131 else if ( !(strcmp(option,"R")) ) {
132 TIter next( fCheckablesList ) ;
133 AliPHOSQAVirtualCheckable * checkable ;
134 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
135 fCheckable = checkable ;
136 fCheckable->ResetAlarms() ;
140 else if ( !(strcmp(option,"")) ) {
141 TString message = CheckingOperation();
142 if ( !message.IsNull() ) {
144 TString time(dt.AsSQLString()) ;
145 message = time + message ;
146 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
150 else if ( !(strcmp(option,"A")) )
153 else if ( !(strcmp(option,"D")) )
157 //____________________________________________________________________________
158 void AliPHOSQAChecker::Print()
160 // print the checker and sub-checkers, if any, name.
162 cout << "Checker : " << GetName() << endl ;
166 //____________________________________________________________________________
167 void AliPHOSQAChecker::PrintAlarms()
169 // Prints the alarms of all attached checkables
170 cout << "Checker name : " << GetName() << endl ;
171 if ( !(fCheckablesList->IsEmpty() ) ) {
172 TIter next( fCheckablesList ) ;
173 AliPHOSQAVirtualCheckable * checkable ;
174 while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) )
175 checkable->Alarms() ;
179 //____________________________________________________________________________
180 void AliPHOSQAChecker::Status()
182 // Prints the checkables attached to this checker
183 if ( fCheckablesList->IsEmpty() )
184 cout << "No checkables are checked by " << GetName() << endl ;
186 cout << "The following checkables are checked by " << GetName() << endl ;
187 TIter next(fCheckablesList) ;
188 AliPHOSQAVirtualCheckable * checkable ;
189 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) )