]>
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 | ||
88cb7938 | 26 | #include "TClass.h" |
66f72ab4 | 27 | #include "TFolder.h" |
28 | #include "TROOT.h" | |
88cb7938 | 29 | #include "TTree.h" |
30 | ||
66f72ab4 | 31 | |
32 | // --- Standard library --- | |
33 | ||
66f72ab4 | 34 | // --- AliRoot header files --- |
35 | ||
36 | #include "AliPHOSQAVirtualCheckable.h" | |
37 | #include "AliPHOSQAChecker.h" | |
38 | #include "AliPHOSQAAlarm.h" | |
88cb7938 | 39 | #include "AliPHOSLoader.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 | |
88cb7938 | 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 | ||
66f72ab4 | 66 | // make it the owner of the objects that it contains |
67 | fAlarms->SetOwner() ; | |
7a9d98f9 | 68 | // add the alarms list to //Folders/Run/Conditions/QA/PHOS |
7b7c1533 | 69 | TObjArray * alarms = new TObjArray() ; // deleted when fAlarms is deleted |
db3b827a | 70 | alarms->SetOwner() ; |
66f72ab4 | 71 | alarms->SetName(name) ; |
72 | fAlarms->Add(alarms) ; | |
d2528142 | 73 | fChecker = 0 ; |
66f72ab4 | 74 | } |
75 | ||
76 | //____________________________________________________________________________ | |
77 | AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable() | |
78 | { | |
db3b827a | 79 | // dtor |
80 | ||
81 | fAlarms->Clear() ; | |
3cf610e5 | 82 | //PH delete fAlarms ; |
66f72ab4 | 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 | |
7b7c1533 | 100 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 101 | if (alarms->IsEmpty() ) |
21cd0c07 | 102 | Info("Alarms", "No alarms raised for checkable %s", GetName()) ; |
66f72ab4 | 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 | //____________________________________________________________________________ | |
88cb7938 | 120 | void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) |
66f72ab4 | 121 | { |
7a9d98f9 | 122 | // Raise an alarm and store it in the appropriate folder : //Folders/Run/Conditions/QA/PHOS.. |
21cd0c07 | 123 | // Info("RaiseAlarm", "%s", message) ; |
66f72ab4 | 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) | |
7b7c1533 | 143 | TObjArray * alarms = GetAlarms() ; |
66f72ab4 | 144 | if (alarms->IsEmpty() ) |
21cd0c07 | 145 | Info("ResetAlarms", "No alarms raised for checkable %s", GetName()) ; |
66f72ab4 | 146 | else { |
147 | alarms->Delete() ; | |
21cd0c07 | 148 | Info("ResetAlarms", " Reset alarms for checkable %s", GetName()) ; |
66f72ab4 | 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() ) | |
21cd0c07 | 158 | Info("Status", "No checkers are in use for %s", GetName()) ; |
66f72ab4 | 159 | else { |
21cd0c07 | 160 | Info("Status", "The following checkers are in use for %s", GetName()) ; |
66f72ab4 | 161 | TIter next(list) ; |
162 | AliPHOSQAChecker * checker ; | |
163 | while ( (checker = (AliPHOSQAChecker*)next() ) ) | |
164 | checker->Print() ; | |
165 | } | |
166 | } |