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 // Abstract Class for a QA checkable
21 //*-- Author : Yves Schutz (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
24 // --- ROOT system ---
28 #include "TObjArray.h"
30 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliPHOSQAVirtualCheckable.h"
35 #include "AliPHOSQAChecker.h"
36 #include "AliPHOSQAAlarm.h"
37 //#include "AliPHOSGetter.h"
39 ClassImp(AliPHOSQAVirtualCheckable)
41 //____________________________________________________________________________
42 AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
44 // ctor, creates the task(s)
47 // create a new folder that will hold the list of alarms
48 // the folder that contains the alarms for PHOS
49 fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS");
50 // make it the owner of the objects that it contains
52 // add the alarms list to //Folders/Run/Conditions/QA/PHOS
53 TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
55 alarms->SetName(name) ;
56 fAlarms->Add(alarms) ;
60 //____________________________________________________________________________
61 AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
69 //____________________________________________________________________________
70 void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
72 // Associates the checkable object with a task (that can be a list of tasks)
73 ch->AddCheckable(this) ;
80 //____________________________________________________________________________
81 void AliPHOSQAVirtualCheckable::Alarms() const
83 // Prints all the alarms
84 TObjArray * alarms = GetAlarms() ;
85 if (alarms->IsEmpty() )
86 Info("Alarms", "No alarms raised for checkable %s", GetName()) ;
89 AliPHOSQAAlarm * alarm ;
90 while ( (alarm = (AliPHOSQAAlarm*)next()) )
95 //____________________________________________________________________________
96 void AliPHOSQAVirtualCheckable::CheckMe()
98 // All the attached checkers will check this checkable
100 fChecker->CheckIt(this) ;
103 //____________________________________________________________________________
104 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) const
106 // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS..
107 // Info("RaiseAlarm", "%s", message) ;
108 AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
109 GetAlarms()->Add(alarm) ;
112 //____________________________________________________________________________
113 void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
115 // Remove the specified checker from the list of tasks
116 // and the present checkable from the list of checkables of the specified checker
117 fChecker->Remove(ch) ;
118 fChecker->GetListOfCheckables()->Remove(this) ;
123 //____________________________________________________________________________
124 void AliPHOSQAVirtualCheckable::ResetAlarms()
126 // resets the list of alarms (delete the alarms from the list)
127 TObjArray * alarms = GetAlarms() ;
128 if (alarms->IsEmpty() )
129 Info("ResetAlarms", "No alarms raised for checkable %s", GetName()) ;
132 Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ;
136 //____________________________________________________________________________
137 void AliPHOSQAVirtualCheckable::Status() const
139 // Tells which checkers are attached to this checkable
140 TList * list = fChecker->GetListOfTasks();
141 if (list->IsEmpty() )
142 Info("Status", "No checkers are in use for %s", GetName()) ;
144 Info("Status", "The following checkers are in use for %s", GetName()) ;
146 AliPHOSQAChecker * checker ;
147 while ( (checker = (AliPHOSQAChecker*)next() ) )