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 ---
31 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliPHOSQAVirtualCheckable.h"
38 #include "AliPHOSQAChecker.h"
39 #include "AliPHOSQAAlarm.h"
41 ClassImp(AliPHOSQAVirtualCheckable)
44 //____________________________________________________________________________
45 AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
47 // ctor, creates the task(s)
49 // create a new folder that will hold the list of alarms
50 // get the alice folder
51 TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
52 // the folder that contains the alarms for PHOS
53 fAlarms = (TFolder*)alice->FindObject("folders/QAAlarms/PHOS");
54 // make it the owner of the objects that it contains
56 // add the alarms list to //YSAlice/folders/QAAlarms/PHOS
57 TList * alarms = new TList() ; // deleted when fAlarms is deleted
58 alarms->SetName(name) ;
59 fAlarms->Add(alarms) ;
63 //____________________________________________________________________________
64 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 TList * 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 : //YSAlice/folders/QAAlarms/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 TList * 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() ) )