]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSQAVirtualCheckable.cxx
General tracking macro by J. Chudoba.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQAVirtualCheckable.cxx
CommitLineData
66f72ab4 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"
7b7c1533 29#include "TTree.h"
66f72ab4 30
31
32// --- Standard library ---
33
34#include <iostream.h>
35
36// --- AliRoot header files ---
37
38#include "AliPHOSQAVirtualCheckable.h"
39#include "AliPHOSQAChecker.h"
40#include "AliPHOSQAAlarm.h"
7b7c1533 41#include "AliPHOSGetter.h"
42#include "AliPHOS.h"
66f72ab4 43
44ClassImp(AliPHOSQAVirtualCheckable)
45
66f72ab4 46//____________________________________________________________________________
47 AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name)
48{
49 // ctor, creates the task(s)
7b7c1533 50 fType = "" ;
66f72ab4 51 fChange = kFALSE ;
52 // create a new folder that will hold the list of alarms
66f72ab4 53 // the folder that contains the alarms for PHOS
7a9d98f9 54 fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS");
66f72ab4 55 // make it the owner of the objects that it contains
56 fAlarms->SetOwner() ;
7a9d98f9 57 // add the alarms list to //Folders/Run/Conditions/QA/PHOS
7b7c1533 58 TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted
db3b827a 59 alarms->SetOwner() ;
66f72ab4 60 alarms->SetName(name) ;
61 fAlarms->Add(alarms) ;
d2528142 62 fChecker = 0 ;
66f72ab4 63}
64
65//____________________________________________________________________________
66 AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
67{
db3b827a 68 // dtor
69
70 fAlarms->Clear() ;
3cf610e5 71 //PH delete fAlarms ;
66f72ab4 72}
73
74//____________________________________________________________________________
75 void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
76{
77 // Associates the checkable object with a task (that can be a list of tasks)
78 ch->AddCheckable(this) ;
79 if (fChecker)
80 fChecker->Add(ch) ;
81 else
82 fChecker = ch ;
83}
84
85//____________________________________________________________________________
86 void AliPHOSQAVirtualCheckable::Alarms() const
87{
88 // Prints all the alarms
7b7c1533 89 TObjArray * alarms = GetAlarms() ;
66f72ab4 90 if (alarms->IsEmpty() )
91 cout << " No alarms raised for checkable " << GetName() << endl ;
92 else {
93 TIter next(alarms);
94 AliPHOSQAAlarm * alarm ;
95 while ( (alarm = (AliPHOSQAAlarm*)next()) )
96 alarm->Print() ;
97 }
98}
99
100//____________________________________________________________________________
101void AliPHOSQAVirtualCheckable::CheckMe()
102{
103 // All the attached checkers will check this checkable
104
105 fChecker->CheckIt(this) ;
106}
107
108//____________________________________________________________________________
109void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
110{
7a9d98f9 111 // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS..
66f72ab4 112 // cout << message ;
113 AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message) ;
114 GetAlarms()->Add(alarm) ;
115}
116
117//____________________________________________________________________________
118 void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
119{
120 // Remove the specified checker from the list of tasks
121 // and the present checkable from the list of checkables of the specified checker
122 fChecker->Remove(ch) ;
123 fChecker->GetListOfCheckables()->Remove(this) ;
124
125}
126
127
128//____________________________________________________________________________
129 void AliPHOSQAVirtualCheckable::ResetAlarms()
130{
131 // resets the list of alarms (delete the alarms from the list)
7b7c1533 132 TObjArray * alarms = GetAlarms() ;
66f72ab4 133 if (alarms->IsEmpty() )
134 cout << " No alarms raised for checkable " << GetName() << endl ;
135 else {
136 alarms->Delete() ;
137 cout << " Reset alarms for checkable " << GetName() << endl ;
138 }
139}
140
141//____________________________________________________________________________
142 void AliPHOSQAVirtualCheckable::Status() const
143{
144 // Tells which checkers are attached to this checkable
145 TList * list = fChecker->GetListOfTasks();
146 if (list->IsEmpty() )
147 cout << "No checkers are in use for " << GetName() << endl ;
148 else {
149 cout << "The following checkers are in use for " << GetName() << endl ;
150 TIter next(list) ;
151 AliPHOSQAChecker * checker ;
152 while ( (checker = (AliPHOSQAChecker*)next() ) )
153 checker->Print() ;
154 }
155}