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 ---
36 // --- AliRoot header files ---
38 #include "AliPHOSQAVirtualCheckable.h"
39 #include "AliPHOSQAChecker.h"
40 #include "AliPHOSQAAlarm.h"
41 #include "AliPHOSGetter.h"
44 ClassImp(AliPHOSQAVirtualCheckable)
46 //____________________________________________________________________________
47 AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
49 // ctor, creates the task(s)
52 // create a new folder that will hold the list of alarms
53 // the folder that contains the alarms for PHOS
54 fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS");
55 // make it the owner of the objects that it contains
57 // add the alarms list to //Folders/Run/Conditions/QA/PHOS
58 TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
59 alarms->SetName(name) ;
60 fAlarms->Add(alarms) ;
64 //____________________________________________________________________________
65 AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
71 //____________________________________________________________________________
72 void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
74 // Associates the checkable object with a task (that can be a list of tasks)
75 ch->AddCheckable(this) ;
82 //____________________________________________________________________________
83 void AliPHOSQAVirtualCheckable::Alarms() const
85 // Prints all the alarms
86 TObjArray * alarms = GetAlarms() ;
87 if (alarms->IsEmpty() )
88 cout << " No alarms raised for checkable " << GetName() << endl ;
91 AliPHOSQAAlarm * alarm ;
92 while ( (alarm = (AliPHOSQAAlarm*)next()) )
97 //____________________________________________________________________________
98 void AliPHOSQAVirtualCheckable::CheckMe()
100 // All the attached checkers will check this checkable
102 fChecker->CheckIt(this) ;
105 //____________________________________________________________________________
106 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
108 // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS..
110 AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
111 GetAlarms()->Add(alarm) ;
114 //____________________________________________________________________________
115 void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
117 // Remove the specified checker from the list of tasks
118 // and the present checkable from the list of checkables of the specified checker
119 fChecker->Remove(ch) ;
120 fChecker->GetListOfCheckables()->Remove(this) ;
125 //____________________________________________________________________________
126 void AliPHOSQAVirtualCheckable::ResetAlarms()
128 // resets the list of alarms (delete the alarms from the list)
129 TObjArray * alarms = GetAlarms() ;
130 if (alarms->IsEmpty() )
131 cout << " No alarms raised for checkable " << GetName() << endl ;
134 cout << " Reset alarms for checkable " << GetName() << endl ;
138 //____________________________________________________________________________
139 void AliPHOSQAVirtualCheckable::Status() const
141 // Tells which checkers are attached to this checkable
142 TList * list = fChecker->GetListOfTasks();
143 if (list->IsEmpty() )
144 cout << "No checkers are in use for " << GetName() << endl ;
146 cout << "The following checkers are in use for " << GetName() << endl ;
148 AliPHOSQAChecker * checker ;
149 while ( (checker = (AliPHOSQAChecker*)next() ) )