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 ---
32 // --- Standard library ---
34 // --- AliRoot header files ---
36 #include "AliPHOSQAVirtualCheckable.h"
37 #include "AliPHOSQAChecker.h"
38 #include "AliPHOSQAAlarm.h"
39 #include "AliPHOSGetter.h"
42 ClassImp(AliPHOSQAVirtualCheckable)
44 //____________________________________________________________________________
45 AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
47 // ctor, creates the task(s)
50 // create a new folder that will hold the list of alarms
51 // the folder that contains the alarms for PHOS
52 fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS");
53 // make it the owner of the objects that it contains
55 // add the alarms list to //Folders/Run/Conditions/QA/PHOS
56 TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
58 alarms->SetName(name) ;
59 fAlarms->Add(alarms) ;
63 //____________________________________________________________________________
64 AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
72 //____________________________________________________________________________
73 void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
75 // Associates the checkable object with a task (that can be a list of tasks)
76 ch->AddCheckable(this) ;
83 //____________________________________________________________________________
84 void AliPHOSQAVirtualCheckable::Alarms() const
86 // Prints all the alarms
87 TObjArray * alarms = GetAlarms() ;
88 if (alarms->IsEmpty() )
89 Info("Alarms", "No alarms raised for checkable %s", GetName()) ;
92 AliPHOSQAAlarm * alarm ;
93 while ( (alarm = (AliPHOSQAAlarm*)next()) )
98 //____________________________________________________________________________
99 void AliPHOSQAVirtualCheckable::CheckMe()
101 // All the attached checkers will check this checkable
103 fChecker->CheckIt(this) ;
106 //____________________________________________________________________________
107 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
109 // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS..
110 // Info("RaiseAlarm", "%s", message) ;
111 AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
112 GetAlarms()->Add(alarm) ;
115 //____________________________________________________________________________
116 void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
118 // Remove the specified checker from the list of tasks
119 // and the present checkable from the list of checkables of the specified checker
120 fChecker->Remove(ch) ;
121 fChecker->GetListOfCheckables()->Remove(this) ;
126 //____________________________________________________________________________
127 void AliPHOSQAVirtualCheckable::ResetAlarms()
129 // resets the list of alarms (delete the alarms from the list)
130 TObjArray * alarms = GetAlarms() ;
131 if (alarms->IsEmpty() )
132 Info("ResetAlarms", "No alarms raised for checkable %s", GetName()) ;
135 Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ;
139 //____________________________________________________________________________
140 void AliPHOSQAVirtualCheckable::Status() const
142 // Tells which checkers are attached to this checkable
143 TList * list = fChecker->GetListOfTasks();
144 if (list->IsEmpty() )
145 Info("Status", "No checkers are in use for %s", GetName()) ;
147 Info("Status", "The following checkers are in use for %s", GetName()) ;
149 AliPHOSQAChecker * checker ;
150 while ( (checker = (AliPHOSQAChecker*)next() ) )