]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQAVirtualCheckable.cxx
Radius of PHOS equal to 460 (Y.Schutz)
[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 "AliPHOSLoader.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 con tains the alarms for PHOS   
52   
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");   
59   
60   if(fAlarms == 0x0)  //if there is no folder; skowron
61    {
62      Fatal("AliPHOSQAVirtualCheckable","Can not find folder with Alarms for PHOS"); //abort
63      return;//never reached
64    }
65   
66   //  make it the owner of the objects that it contains
67   fAlarms->SetOwner() ;
68   //  add the alarms list to //Folders/Run/Conditions/QA/PHOS
69   TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
70   alarms->SetOwner() ; 
71   alarms->SetName(name) ; 
72   fAlarms->Add(alarms) ; 
73   fChecker = 0 ; 
74 }
75
76 //____________________________________________________________________________ 
77   AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
78 {
79   // dtor 
80
81   fAlarms->Clear() ; 
82   //PH  delete fAlarms ; 
83 }
84
85 //____________________________________________________________________________ 
86   void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
87 {
88   // Associates the checkable object with a task (that can be a list of tasks)
89     ch->AddCheckable(this) ; 
90     if (fChecker)
91       fChecker->Add(ch) ;
92     else 
93       fChecker = ch ; 
94 }
95
96 //____________________________________________________________________________ 
97   void AliPHOSQAVirtualCheckable::Alarms() const
98 {
99   // Prints all the alarms 
100   TObjArray * alarms = GetAlarms() ; 
101   if (alarms->IsEmpty() )
102     Info("Alarms", "No alarms raised for checkable %s", GetName()) ; 
103   else {
104     TIter next(alarms);
105     AliPHOSQAAlarm * alarm ; 
106     while ( (alarm = (AliPHOSQAAlarm*)next()) ) 
107       alarm->Print() ; 
108   }
109 }
110
111 //____________________________________________________________________________ 
112 void AliPHOSQAVirtualCheckable::CheckMe() 
113 {
114   // All the attached checkers will check this checkable
115
116   fChecker->CheckIt(this) ;
117 }
118
119 //____________________________________________________________________________ 
120 void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
121 {
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) ; 
126 }
127
128 //____________________________________________________________________________ 
129   void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
130 {
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) ;
135   
136 }
137
138
139 //____________________________________________________________________________ 
140   void AliPHOSQAVirtualCheckable::ResetAlarms()
141 {
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()) ; 
146   else {
147     alarms->Delete() ; 
148     Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ; 
149   }
150 }
151
152 //____________________________________________________________________________ 
153   void AliPHOSQAVirtualCheckable::Status() const  
154 {
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()) ;
159   else {    
160     Info("Status", "The following checkers are in use for %s", GetName()) ;
161     TIter next(list) ; 
162     AliPHOSQAChecker * checker ; 
163     while ( (checker = (AliPHOSQAChecker*)next() ) ) 
164       checker->Print() ; 
165   }
166 }