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 "AliPHOSLoader.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 con tains the alarms for PHOS
53 TFolder* topfold = AliConfig::Instance()->GetTopFolder(); //get top aliroot folder; skowron
54 TString phosqafn(AliConfig::Instance()->GetQAFolderName()); //get name of QAaut folder relative to top; skowron
55 phosqafn+="/PHOS"; //hard wired string!!! add the detector name to the pathname; skowron
56 fAlarms = (TFolder*)topfold->FindObjectAny(phosqafn); //get the folder
57 // 4 lines above substitute the one below
58 // fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS");
60 if(fAlarms == 0x0) //if there is no folder; skowron
62 Fatal("AliPHOSQAVirtualCheckable","Can not find folder with Alarms for PHOS"); //abort
63 return;//never reached
66 // make it the owner of the objects that it contains
68 // add the alarms list to //Folders/Run/Conditions/QA/PHOS
69 TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
71 alarms->SetName(name) ;
72 fAlarms->Add(alarms) ;
76 //____________________________________________________________________________
77 AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
85 //____________________________________________________________________________
86 void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
88 // Associates the checkable object with a task (that can be a list of tasks)
89 ch->AddCheckable(this) ;
96 //____________________________________________________________________________
97 void AliPHOSQAVirtualCheckable::Alarms() const
99 // Prints all the alarms
100 TObjArray * alarms = GetAlarms() ;
101 if (alarms->IsEmpty() )
102 Info("Alarms", "No alarms raised for checkable %s", GetName()) ;
105 AliPHOSQAAlarm * alarm ;
106 while ( (alarm = (AliPHOSQAAlarm*)next()) )
111 //____________________________________________________________________________
112 void AliPHOSQAVirtualCheckable::CheckMe()
114 // All the attached checkers will check this checkable
116 fChecker->CheckIt(this) ;
119 //____________________________________________________________________________
120 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
122 // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS..
123 // Info("RaiseAlarm", "%s", message) ;
124 AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
125 GetAlarms()->Add(alarm) ;
128 //____________________________________________________________________________
129 void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
131 // Remove the specified checker from the list of tasks
132 // and the present checkable from the list of checkables of the specified checker
133 fChecker->Remove(ch) ;
134 fChecker->GetListOfCheckables()->Remove(this) ;
139 //____________________________________________________________________________
140 void AliPHOSQAVirtualCheckable::ResetAlarms()
142 // resets the list of alarms (delete the alarms from the list)
143 TObjArray * alarms = GetAlarms() ;
144 if (alarms->IsEmpty() )
145 Info("ResetAlarms", "No alarms raised for checkable %s", GetName()) ;
148 Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ;
152 //____________________________________________________________________________
153 void AliPHOSQAVirtualCheckable::Status() const
155 // Tells which checkers are attached to this checkable
156 TList * list = fChecker->GetListOfTasks();
157 if (list->IsEmpty() )
158 Info("Status", "No checkers are in use for %s", GetName()) ;
160 Info("Status", "The following checkers are in use for %s", GetName()) ;
162 AliPHOSQAChecker * checker ;
163 while ( (checker = (AliPHOSQAChecker*)next() ) )