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