]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQAVirtualCheckable.cxx
coding conventions corrections
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQAVirtualCheckable.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 //_________________________________________________________________________
19 //  Abstract Class for a QA checkable    
20 //
21 //*-- Author :  Yves Schutz (SUBATECH) 
22 //////////////////////////////////////////////////////////////////////////////
23
24 // --- ROOT system ---
25
26 #include "TFolder.h"
27 #include "TROOT.h"
28 #include "TObjArray.h"
29
30 // --- Standard library ---
31
32 // --- AliRoot header files ---
33
34 #include "AliPHOSQAVirtualCheckable.h"
35 #include "AliPHOSQAChecker.h"
36 #include "AliPHOSQAAlarm.h" 
37   //#include "AliPHOSGetter.h" 
38
39 ClassImp(AliPHOSQAVirtualCheckable)
40
41 //____________________________________________________________________________ 
42   AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name) 
43 {
44   // ctor, creates the task(s)
45   fType   = "" ; 
46   fChange = kFALSE ; 
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
51   fAlarms->SetOwner() ;
52   //  add the alarms list to //Folders/Run/Conditions/QA/PHOS
53   TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
54   alarms->SetOwner() ; 
55   alarms->SetName(name) ; 
56   fAlarms->Add(alarms) ; 
57   fChecker = 0 ; 
58 }
59
60 //____________________________________________________________________________ 
61   AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
62 {
63   // dtor 
64
65   fAlarms->Clear() ; 
66   //PH  delete fAlarms ; 
67 }
68
69 //____________________________________________________________________________ 
70   void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
71 {
72   // Associates the checkable object with a task (that can be a list of tasks)
73     ch->AddCheckable(this) ; 
74     if (fChecker)
75       fChecker->Add(ch) ;
76     else 
77       fChecker = ch ; 
78 }
79
80 //____________________________________________________________________________ 
81   void AliPHOSQAVirtualCheckable::Alarms() const
82 {
83   // Prints all the alarms 
84   TObjArray * alarms = GetAlarms() ; 
85   if (alarms->IsEmpty() )
86     Info("Alarms", "No alarms raised for checkable %s", GetName()) ; 
87   else {
88     TIter next(alarms);
89     AliPHOSQAAlarm * alarm ; 
90     while ( (alarm = (AliPHOSQAAlarm*)next()) ) 
91       alarm->Print() ; 
92   }
93 }
94
95 //____________________________________________________________________________ 
96 void AliPHOSQAVirtualCheckable::CheckMe() 
97 {
98   // All the attached checkers will check this checkable
99
100   fChecker->CheckIt(this) ;
101 }
102
103 //____________________________________________________________________________ 
104 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) const
105 {
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) ; 
110 }
111
112 //____________________________________________________________________________ 
113   void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
114 {
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) ;
119   
120 }
121
122
123 //____________________________________________________________________________ 
124   void AliPHOSQAVirtualCheckable::ResetAlarms()
125 {
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()) ; 
130   else {
131     alarms->Delete() ; 
132     Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ; 
133   }
134 }
135
136 //____________________________________________________________________________ 
137   void AliPHOSQAVirtualCheckable::Status() const  
138 {
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()) ;
143   else {    
144     Info("Status", "The following checkers are in use for %s", GetName()) ;
145     TIter next(list) ; 
146     AliPHOSQAChecker * checker ; 
147     while ( (checker = (AliPHOSQAChecker*)next() ) ) 
148       checker->Print() ; 
149   }
150 }