]>
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 | ||
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 | |
44 | ClassImp(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 |
66f72ab4 | 59 | alarms->SetName(name) ; |
60 | fAlarms->Add(alarms) ; | |
d2528142 | 61 | fChecker = 0 ; |
66f72ab4 | 62 | } |
63 | ||
64 | //____________________________________________________________________________ | |
65 | AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable() | |
66 | { | |
67 | // ctor | |
68 | delete fAlarms ; | |
66f72ab4 | 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 | |
7b7c1533 | 86 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 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 | { | |
7a9d98f9 | 108 | // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS.. |
66f72ab4 | 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) | |
7b7c1533 | 129 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 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 | } |