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 ---
27 // --- Standard library ---
29 // --- AliRoot header files ---
31 #include "AliPHOSQAChecker.h"
32 #include "AliPHOSQAVirtualCheckable.h"
34 ClassImp(AliPHOSQAChecker)
37 //____________________________________________________________________________
38 AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title)
41 // stores checkers in the PHOS QA TTask folder //Folders/Task/QA
42 TTask * aliceQA = (TTask*)gROOT->FindObjectAny("Folders/Tasks/QA") ;
43 TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
44 if (phosQA) // PHOS QA Tasks container exists
46 else // create //Folders/Task/QA/PHOS
49 fCheckablesList = new TList() ;
53 //____________________________________________________________________________
54 AliPHOSQAChecker::~AliPHOSQAChecker()
56 // dtor remove the checker from the task list of the associated checker
58 TIter next(fCheckablesList) ;
59 AliPHOSQAVirtualCheckable * checkable ;
60 while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) )
61 checkable->RemoveChecker(this) ;
65 //____________________________________________________________________________
66 void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca)
68 // does the check for the given checkable
71 TList * l = GetListOfTasks() ;
73 AliPHOSQAChecker * checker ;
74 while ( (checker = (AliPHOSQAChecker*)next()) )
75 checker->SetCheckable(ca) ;
80 //____________________________________________________________________________
81 void AliPHOSQAChecker::CheckIt()
83 // does the check for all attached chekables
84 if ( fCheckablesList->IsEmpty() )
87 TIter next( fCheckablesList ) ;
88 AliPHOSQAVirtualCheckable * checkable ;
89 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
90 fCheckable = checkable ;
96 //____________________________________________________________________________
97 void AliPHOSQAChecker::Exec(Option_t *option)
99 // Performs various tasks as indicated by option
102 // C --> does the comparison on all the checkables declared
103 // --> does the comparison on only one checkable (the one which asks CheckMe() )
104 // A --> list the alarms raised in the associated checkables
105 // R --> reset the alarms
106 // D --> calls the dtor
108 if ( !(strcmp(option,"P")) )
111 else if ( !(strcmp(option,"S")) )
114 else if ( !(strcmp(option,"C")) ) {
115 TIter next( fCheckablesList ) ;
116 AliPHOSQAVirtualCheckable * checkable ;
117 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
118 fCheckable = checkable ;
119 TString message = CheckingOperation();
120 if ( !message.IsNull() ) {
122 TString time(dt.AsSQLString()) ;
123 message = time + message ;
124 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
129 else if ( !(strcmp(option,"R")) ) {
130 TIter next( fCheckablesList ) ;
131 AliPHOSQAVirtualCheckable * checkable ;
132 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
133 fCheckable = checkable ;
134 fCheckable->ResetAlarms() ;
138 else if ( !(strcmp(option,"")) ) {
139 TString message = CheckingOperation();
140 if ( !message.IsNull() ) {
142 TString time(dt.AsSQLString()) ;
143 message = time + message ;
144 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
148 else if ( !(strcmp(option,"A")) )
151 else if ( !(strcmp(option,"D")) )
155 //____________________________________________________________________________
156 void AliPHOSQAChecker::Print()
158 // print the checker and sub-checkers, if any, name.
160 Info("Print", "Checker : %s", GetName()) ;
164 //____________________________________________________________________________
165 void AliPHOSQAChecker::PrintAlarms()
167 // Prints the alarms of all attached checkables
168 Info("PrintAlarms", "Checker name : %s", GetName()) ;
169 if ( !(fCheckablesList->IsEmpty() ) ) {
170 TIter next( fCheckablesList ) ;
171 AliPHOSQAVirtualCheckable * checkable ;
172 while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) )
173 checkable->Alarms() ;
177 //____________________________________________________________________________
178 void AliPHOSQAChecker::Status()
180 // Prints the checkables attached to this checker
181 if ( fCheckablesList->IsEmpty() )
182 Info("Status", "No checkables are checked by %s", GetName()) ;
184 Info("Status", "The following checkables are checked by %s", GetName()) ;
185 TIter next(fCheckablesList) ;
186 AliPHOSQAVirtualCheckable * checkable ;
187 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) )