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