]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQAVirtualCheckable.cxx
Updates on process identification.
[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 "TClass.h"
27 #include "TFolder.h"
28 #include "TROOT.h"
29 #include "TTree.h"
30
31
32 // --- Standard library ---
33
34 // --- AliRoot header files ---
35
36 #include "AliPHOSQAVirtualCheckable.h"
37 #include "AliPHOSQAChecker.h"
38 #include "AliPHOSQAAlarm.h" 
39 #include "AliPHOSGetter.h" 
40 #include "AliPHOS.h" 
41
42 ClassImp(AliPHOSQAVirtualCheckable)
43
44 //____________________________________________________________________________ 
45   AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name) 
46 {
47   // ctor, creates the task(s)
48   fType   = "" ; 
49   fChange = kFALSE ; 
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
54   fAlarms->SetOwner() ;
55   //  add the alarms list to //Folders/Run/Conditions/QA/PHOS
56   TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
57   alarms->SetOwner() ; 
58   alarms->SetName(name) ; 
59   fAlarms->Add(alarms) ; 
60   fChecker = 0 ; 
61 }
62
63 //____________________________________________________________________________ 
64   AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
65 {
66   // dtor 
67
68   fAlarms->Clear() ; 
69   //PH  delete fAlarms ; 
70 }
71
72 //____________________________________________________________________________ 
73   void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
74 {
75   // Associates the checkable object with a task (that can be a list of tasks)
76     ch->AddCheckable(this) ; 
77     if (fChecker)
78       fChecker->Add(ch) ;
79     else 
80       fChecker = ch ; 
81 }
82
83 //____________________________________________________________________________ 
84   void AliPHOSQAVirtualCheckable::Alarms() const
85 {
86   // Prints all the alarms 
87   TObjArray * alarms = GetAlarms() ; 
88   if (alarms->IsEmpty() )
89     Info("Alarms", "No alarms raised for checkable %s", GetName()) ; 
90   else {
91     TIter next(alarms);
92     AliPHOSQAAlarm * alarm ; 
93     while ( (alarm = (AliPHOSQAAlarm*)next()) ) 
94       alarm->Print() ; 
95   }
96 }
97
98 //____________________________________________________________________________ 
99 void AliPHOSQAVirtualCheckable::CheckMe() 
100 {
101   // All the attached checkers will check this checkable
102
103   fChecker->CheckIt(this) ;
104 }
105
106 //____________________________________________________________________________ 
107 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
108 {
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) ; 
113 }
114
115 //____________________________________________________________________________ 
116   void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
117 {
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) ;
122   
123 }
124
125
126 //____________________________________________________________________________ 
127   void AliPHOSQAVirtualCheckable::ResetAlarms()
128 {
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()) ; 
133   else {
134     alarms->Delete() ; 
135     Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ; 
136   }
137 }
138
139 //____________________________________________________________________________ 
140   void AliPHOSQAVirtualCheckable::Status() const  
141 {
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()) ;
146   else {    
147     Info("Status", "The following checkers are in use for %s", GetName()) ;
148     TIter next(list) ; 
149     AliPHOSQAChecker * checker ; 
150     while ( (checker = (AliPHOSQAChecker*)next() ) ) 
151       checker->Print() ; 
152   }
153 }