]>
Commit | Line | Data |
---|---|---|
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 | ||
66f72ab4 | 34 | // --- AliRoot header files --- |
35 | ||
36 | #include "AliPHOSQAVirtualCheckable.h" | |
37 | #include "AliPHOSQAChecker.h" | |
38 | #include "AliPHOSQAAlarm.h" | |
7b7c1533 | 39 | #include "AliPHOSGetter.h" |
40 | #include "AliPHOS.h" | |
66f72ab4 | 41 | |
42 | ClassImp(AliPHOSQAVirtualCheckable) | |
43 | ||
66f72ab4 | 44 | //____________________________________________________________________________ |
45 | AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name) | |
46 | { | |
47 | // ctor, creates the task(s) | |
7b7c1533 | 48 | fType = "" ; |
66f72ab4 | 49 | fChange = kFALSE ; |
50 | // create a new folder that will hold the list of alarms | |
66f72ab4 | 51 | // the folder that contains the alarms for PHOS |
7a9d98f9 | 52 | fAlarms = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS"); |
66f72ab4 | 53 | // make it the owner of the objects that it contains |
54 | fAlarms->SetOwner() ; | |
7a9d98f9 | 55 | // add the alarms list to //Folders/Run/Conditions/QA/PHOS |
7b7c1533 | 56 | TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted |
db3b827a | 57 | alarms->SetOwner() ; |
66f72ab4 | 58 | alarms->SetName(name) ; |
59 | fAlarms->Add(alarms) ; | |
d2528142 | 60 | fChecker = 0 ; |
66f72ab4 | 61 | } |
62 | ||
63 | //____________________________________________________________________________ | |
64 | AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable() | |
65 | { | |
db3b827a | 66 | // dtor |
67 | ||
68 | fAlarms->Clear() ; | |
3cf610e5 | 69 | //PH delete fAlarms ; |
66f72ab4 | 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 | |
7b7c1533 | 87 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 88 | if (alarms->IsEmpty() ) |
21cd0c07 | 89 | Info("Alarms", "No alarms raised for checkable %s", GetName()) ; |
66f72ab4 | 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 | { | |
7a9d98f9 | 109 | // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS.. |
21cd0c07 | 110 | // Info("RaiseAlarm", "%s", message) ; |
66f72ab4 | 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) | |
7b7c1533 | 130 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 131 | if (alarms->IsEmpty() ) |
21cd0c07 | 132 | Info("ResetAlarms", "No alarms raised for checkable %s", GetName()) ; |
66f72ab4 | 133 | else { |
134 | alarms->Delete() ; | |
21cd0c07 | 135 | Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ; |
66f72ab4 | 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() ) | |
21cd0c07 | 145 | Info("Status", "No checkers are in use for %s", GetName()) ; |
66f72ab4 | 146 | else { |
21cd0c07 | 147 | Info("Status", "The following checkers are in use for %s", GetName()) ; |
66f72ab4 | 148 | TIter next(list) ; |
149 | AliPHOSQAChecker * checker ; | |
150 | while ( (checker = (AliPHOSQAChecker*)next() ) ) | |
151 | checker->Print() ; | |
152 | } | |
153 | } |