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 ---
32 #include "AliPHOSQAChecker.h"
33 #include "AliPHOSQAVirtualCheckable.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
43 TTask * aliceQA = (TTask*)gROOT->FindObjectAny("Folders/Tasks/QA") ;
44 TTask * phosQA = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
45 if (phosQA) // PHOS QA Tasks container exists
47 else // create //Folders/Task/QA/PHOS
50 fCheckablesList = new TList() ;
54 //____________________________________________________________________________
55 AliPHOSQAChecker::~AliPHOSQAChecker()
57 // dtor remove the checker from the task list of the associated checker
59 TIter next(fCheckablesList) ;
60 AliPHOSQAVirtualCheckable * checkable ;
61 while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) )
62 checkable->RemoveChecker(this) ;
66 //____________________________________________________________________________
67 void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca)
69 // does the check for the given checkable
72 TList * l = GetListOfTasks() ;
74 AliPHOSQAChecker * checker ;
75 while ( (checker = (AliPHOSQAChecker*)next()) )
76 checker->SetCheckable(ca) ;
81 //____________________________________________________________________________
82 void AliPHOSQAChecker::CheckIt()
84 // does the check for all attached chekables
85 if ( fCheckablesList->IsEmpty() )
88 TIter next( fCheckablesList ) ;
89 AliPHOSQAVirtualCheckable * checkable ;
90 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
91 fCheckable = checkable ;
97 //____________________________________________________________________________
98 void AliPHOSQAChecker::Exec(Option_t *option)
100 // Performs various tasks as indicated by option
103 // C --> does the comparison on all the checkables declared
104 // --> does the comparison on only one checkable (the one which asks CheckMe() )
105 // A --> list the alarms raised in the associated checkables
106 // R --> reset the alarms
107 // D --> calls the dtor
109 if ( !(strcmp(option,"P")) )
112 else if ( !(strcmp(option,"S")) )
115 else if ( !(strcmp(option,"C")) ) {
116 TIter next( fCheckablesList ) ;
117 AliPHOSQAVirtualCheckable * checkable ;
118 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
119 fCheckable = checkable ;
120 TString message = CheckingOperation();
121 if ( !message.IsNull() ) {
123 TString time(dt.AsSQLString()) ;
124 message = time + message ;
125 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
130 else if ( !(strcmp(option,"R")) ) {
131 TIter next( fCheckablesList ) ;
132 AliPHOSQAVirtualCheckable * checkable ;
133 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
134 fCheckable = checkable ;
135 fCheckable->ResetAlarms() ;
139 else if ( !(strcmp(option,"")) ) {
140 TString message = CheckingOperation();
141 if ( !message.IsNull() ) {
143 TString time(dt.AsSQLString()) ;
144 message = time + message ;
145 fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ;
149 else if ( !(strcmp(option,"A")) )
152 else if ( !(strcmp(option,"D")) )
156 //____________________________________________________________________________
157 void AliPHOSQAChecker::Print()
159 // print the checker and sub-checkers, if any, name.
161 Info("Print", "Checker : %s", GetName()) ;
165 //____________________________________________________________________________
166 void AliPHOSQAChecker::PrintAlarms()
168 // Prints the alarms of all attached checkables
169 Info("PrintAlarms", "Checker name : %s", GetName()) ;
170 if ( !(fCheckablesList->IsEmpty() ) ) {
171 TIter next( fCheckablesList ) ;
172 AliPHOSQAVirtualCheckable * checkable ;
173 while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) )
174 checkable->Alarms() ;
178 //____________________________________________________________________________
179 void AliPHOSQAChecker::Status()
181 // Prints the checkables attached to this checker
182 if ( fCheckablesList->IsEmpty() )
183 Info("Status", "No checkables are checked by %s", GetName()) ;
185 Info("Status", "The following checkables are checked by %s", GetName()) ;
186 TIter next(fCheckablesList) ;
187 AliPHOSQAVirtualCheckable * checkable ;
188 while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) )