]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added the QA checkable-chekers using TTask and TFolder
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2001 15:58:27 +0000 (15:58 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2001 15:58:27 +0000 (15:58 +0000)
14 files changed:
PHOS/AliPHOSQAAlarm.cxx [new file with mode: 0644]
PHOS/AliPHOSQAAlarm.h [new file with mode: 0644]
PHOS/AliPHOSQAChecker.cxx [new file with mode: 0644]
PHOS/AliPHOSQAChecker.h [new file with mode: 0644]
PHOS/AliPHOSQAFloatCheckable.cxx [new file with mode: 0644]
PHOS/AliPHOSQAFloatCheckable.h [new file with mode: 0644]
PHOS/AliPHOSQAIntCheckable.cxx [new file with mode: 0644]
PHOS/AliPHOSQAIntCheckable.h [new file with mode: 0644]
PHOS/AliPHOSQAMeanChecker.cxx [new file with mode: 0644]
PHOS/AliPHOSQAMeanChecker.h [new file with mode: 0644]
PHOS/AliPHOSQAObjectCheckable.cxx [new file with mode: 0644]
PHOS/AliPHOSQAObjectCheckable.h [new file with mode: 0644]
PHOS/AliPHOSQAVirtualCheckable.cxx [new file with mode: 0644]
PHOS/AliPHOSQAVirtualCheckable.h [new file with mode: 0644]

diff --git a/PHOS/AliPHOSQAAlarm.cxx b/PHOS/AliPHOSQAAlarm.cxx
new file mode 100644 (file)
index 0000000..5d14e71
--- /dev/null
@@ -0,0 +1,58 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// An alarm object that is instanciated by a AliPHOSQACheckable in response to
+// a AliPHOSQAChecker
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+// --- Standard library ---
+
+#include <iostream.h>
+// --- AliRoot header files ---
+
+#include "AliPHOSQAAlarm.h"
+
+ClassImp(AliPHOSQAAlarm)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAAlarm::AliPHOSQAAlarm(TString time, TString checked, TString checker, TString  message)  
+{
+  // ctor
+ fTime    = time ; 
+ fCable   = checked ; 
+ fCer     = checker ; 
+ fMessage = message ; 
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAAlarm::~AliPHOSQAAlarm()
+{
+  // dtor
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAAlarm::Print()
+{
+  // print the message 
+
+  cout << fMessage << endl;  
+}
diff --git a/PHOS/AliPHOSQAAlarm.h b/PHOS/AliPHOSQAAlarm.h
new file mode 100644 (file)
index 0000000..c21c20b
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef ALIPHOSQAALARM_H
+#define ALIPHOSQAALARM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// An alarm object that is instanciated by a AliPHOSQACheckable in response to
+// a AliPHOSQAChecker
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system --- 
+
+#include "TObject.h"  
+#include "TString.h"  
+
+// --- Standard library ---
+
+#include <assert.h>
+
+// --- AliRoot header files ---
+
+
+class AliPHOSQAAlarm : public TObject {
+
+public:
+
+  AliPHOSQAAlarm(){} ;          // default ctor (not to be used)
+  AliPHOSQAAlarm(TString time, TString checked, TString checker, TString  message) ; // ctor
+  virtual ~AliPHOSQAAlarm() ; // dtor
+  virtual void Print() ; 
+
+ private:
+
+  
+  TString fTime ;    // time when the alarm was raised 
+  TString fCable ;   // checkable name that raised the alarm
+  TString fCer ;     // checker name that raised the alarm    
+  TString fMessage ; // the whole error message 
+
+  ClassDef(AliPHOSQAAlarm,1)  // description 
+
+};
+
+#endif // ALIPHOSQAAlarm_H
diff --git a/PHOS/AliPHOSQAChecker.cxx b/PHOS/AliPHOSQAChecker.cxx
new file mode 100644 (file)
index 0000000..9945f88
--- /dev/null
@@ -0,0 +1,193 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Base class for a QA checker, to be instanciated as a container of user 
+// defined tasks
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+#include "TROOT.h"
+#include "TFolder.h" 
+
+// --- Standard library ---
+
+#include <iostream.h>
+// --- AliRoot header files ---
+
+#include "AliPHOSQAChecker.h"
+#include "AliPHOSQAVirtualCheckable.h"
+
+ClassImp(AliPHOSQAChecker)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAChecker::AliPHOSQAChecker(const char * name, const char * title) : TTask(name,title) 
+{
+  // ctor
+  // stores checkers in the PHOS QA TTask folder //YSAlice/tasks/QA/PHOS
+  TFolder * alice  = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ; 
+  TTask * aliceQA  = (TTask*)alice->FindObject("tasks/QA") ; 
+  TTask * phosQA   = (TTask*)aliceQA->GetListOfTasks()->FindObject("PHOS") ;
+
+  if (phosQA)  // PHOS QA Tasks container exists
+    phosQA->Add(this) ;
+  else     // create //YSAlice/tasks/QA/PHOS
+    aliceQA->Add(this) ; 
+
+  fCheckablesList = new TList() ; 
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAChecker::~AliPHOSQAChecker()
+{
+  // dtor remove the checker from the task list of the associated checker
+  
+  TIter next(fCheckablesList) ; 
+  AliPHOSQAVirtualCheckable * checkable ; 
+  while ( (checkable = (AliPHOSQAVirtualCheckable*)next()) ) 
+    checkable->RemoveChecker(this) ; 
+  ExecuteTasks("D") ; 
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::CheckIt(AliPHOSQAVirtualCheckable *ca) 
+{
+  // does the check for the given checkable 
+  
+  SetCheckable(ca) ;
+  TList * l = GetListOfTasks() ; 
+  TIter next(l) ; 
+  AliPHOSQAChecker * checker ; 
+  while ( (checker = (AliPHOSQAChecker*)next()) ) 
+    checker->SetCheckable(ca) ; 
+  ExecuteTask("") ;   
+  fCheckable = 0 ; 
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::CheckIt()
+{
+  // does the check for all attached chekables 
+  if ( fCheckablesList->IsEmpty() ) 
+    ExecuteTask("C") ; 
+  else {
+    TIter next( fCheckablesList ) ;
+    AliPHOSQAVirtualCheckable * checkable ; 
+    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
+      fCheckable = checkable ; 
+      ExecuteTask("") ;
+    }
+  }
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::Exec(Option_t *option)
+{
+  // Performs various tasks as indicated by option
+  // P --> Print 
+  // S --> Status
+  // C --> does the comparison on all the checkables declared 
+  //   --> does the comparison on only one checkable (the one which asks CheckMe() )
+  // A --> list the alarms raised in  the associated checkables 
+  // R --> reset the alarms
+  // D --> calls the dtor
+
+  if ( !(strcmp(option,"P")) ) 
+    Print() ;
+
+  else if ( !(strcmp(option,"S")) ) 
+    Status() ;
+
+  else if ( !(strcmp(option,"C")) ) {  
+    TIter next( fCheckablesList ) ;
+    AliPHOSQAVirtualCheckable * checkable ; 
+    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
+      fCheckable = checkable ;
+      TString message = CheckingOperation(); 
+      if ( !message.IsNull() ) { 
+       TDatime dt ;
+       TString time(dt.AsSQLString()) ;
+       message = time + message ; 
+       fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; 
+      }        
+    }
+  }
+  
+  else if ( !(strcmp(option,"R")) ) {  
+    TIter next( fCheckablesList ) ;
+    AliPHOSQAVirtualCheckable * checkable ; 
+    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) {
+      fCheckable = checkable ; 
+      fCheckable->ResetAlarms() ; 
+    }  
+  }
+  
+  else if ( !(strcmp(option,"")) ) {
+    TString message = CheckingOperation(); 
+    if ( !message.IsNull() ) { 
+      TDatime dt ;
+      TString time(dt.AsSQLString()) ;
+      message = time + message ; 
+      fCheckable->RaiseAlarm(dt.AsSQLString(), fCheckable->GetName(), GetName(), message.Data()) ; 
+    }
+  }    
+    
+  else if ( !(strcmp(option,"A")) )
+    PrintAlarms() ; 
+  else if ( !(strcmp(option,"D")) )
+    Delete() ;
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::Print()
+{
+  // print the checker and sub-checkers, if any, name.  
+
+  cout << "Checker : " << GetName() << endl ;  
+
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::PrintAlarms()
+{
+  // Prints the alarms of all attached checkables
+  cout << "Checker name : " << GetName() << endl ; 
+  if ( !(fCheckablesList->IsEmpty() ) ) {
+    TIter next( fCheckablesList ) ; 
+    AliPHOSQAVirtualCheckable * checkable ; 
+    while ( (checkable = (AliPHOSQAVirtualCheckable *)next() ) ) 
+      checkable->Alarms() ; 
+  }
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAChecker::Status() 
+{
+  // Prints the checkables attached to this checker
+  if ( fCheckablesList->IsEmpty() ) 
+    cout << "No checkables are checked by " << GetName() << endl ; 
+  else {
+    cout << "The following checkables are checked by " << GetName() << endl ; 
+    TIter next(fCheckablesList) ; 
+    AliPHOSQAVirtualCheckable * checkable ; 
+    while ( (checkable = (AliPHOSQAVirtualCheckable*)next() ) ) 
+      checkable->Print() ; 
+  }
+}
diff --git a/PHOS/AliPHOSQAChecker.h b/PHOS/AliPHOSQAChecker.h
new file mode 100644 (file)
index 0000000..c6d9671
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef ALIPHOSQACHECKER_H
+#define ALIPHOSQACHECKER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+//  Base class of a checker, to be instanciated as a task container  
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+class TString ; 
+#include "TTask.h"
+
+// --- Standard library ---
+
+#include <assert.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAVirtualCheckable.h"
+
+class AliPHOSQAChecker : public TTask {
+
+public:
+
+  AliPHOSQAChecker(){} ;          // default ctor (not to be used)
+  AliPHOSQAChecker(const char * name, const char * title) ; // ctor
+  AliPHOSQAChecker(AliPHOSQAChecker& obj) {assert(0==1);}
+  virtual ~AliPHOSQAChecker() ; // dtor
+
+  void Alarms() { ExecuteTask("A") ; }  
+  virtual TString CheckingOperation(){ return TString(""); } // where the checking operation must be implemented
+  void CheckIt() ; 
+  void CheckIt(AliPHOSQAVirtualCheckable *ca)  ;
+  void Delete() { delete this ; } // Hara-Kiri
+  TList * GetListOfCheckables() const { return fCheckablesList ; } 
+  virtual void  Exec(Option_t *option) ;   
+  virtual void Print() ;
+  void PrintAlarms() ; 
+  void PrintAll() { ExecuteTask("P") ; } 
+  void Remove(AliPHOSQAChecker * ch) {GetListOfTasks()->Remove(ch); }  
+  void Status() ; 
+  void StatusAll() { ExecuteTask("S") ; } 
+
+  friend void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch) ;
+  friend AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) ;
+
+
+ private:
+
+  void SetCheckable(AliPHOSQAVirtualCheckable * ca) { fCheckable = ca ; } 
+
+ protected:
+
+  void AddCheckable(AliPHOSQAVirtualCheckable *ca) {fCheckablesList->Add(ca) ;}
+    
+  AliPHOSQAVirtualCheckable * fCheckable ; // current checkable 
+  TList * fCheckablesList ;     // list of checkable objects to be checked 
+
+  ClassDef(AliPHOSQAChecker,1)  // description 
+
+};
+
+#endif // ALIPHOSQAChecker_H
diff --git a/PHOS/AliPHOSQAFloatCheckable.cxx b/PHOS/AliPHOSQAFloatCheckable.cxx
new file mode 100644 (file)
index 0000000..31d299e
--- /dev/null
@@ -0,0 +1,78 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for a QA checkable that is a Float  
+//
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TClass.h"
+
+// --- Standard library ---
+
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAFloatCheckable.h"
+
+ClassImp(AliPHOSQAFloatCheckable)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAFloatCheckable::AliPHOSQAFloatCheckable(const char * name) : AliPHOSQAVirtualCheckable(name) 
+{
+  //ctor initial value is zero
+  fType = new char[1] ; 
+  strcpy(fType,"F") ;
+  fValue = 0. ; 
+}
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAFloatCheckable::~AliPHOSQAFloatCheckable()
+{
+ // dtor
+  delete fType ; 
+}
+
+
+//____________________________________________________________________________ 
+void AliPHOSQAFloatCheckable::Print() const
+{
+  // Print the chekable name and its value
+  cout << " Checkable-> " << GetName() << " : value = " << fValue << endl ; 
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAFloatCheckable::Set(Float_t value)
+{
+  // Changes the value of the checkable and modifies its status
+  fValue = value ; 
+  fChange = kTRUE ; 
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAFloatCheckable::Update(Float_t value)
+{
+  // Increments the value of the checkable and modifies its status
+  fValue += value ; 
+  fChange = kTRUE ; 
+}
diff --git a/PHOS/AliPHOSQAFloatCheckable.h b/PHOS/AliPHOSQAFloatCheckable.h
new file mode 100644 (file)
index 0000000..3906ea1
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef ALIPHOSQAFLOATCHECKABLE_H
+#define ALIPHOSQAFLOATCHECKABLE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for a QA checkable that is a Float_t    
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAVirtualCheckable.h"
+
+class AliPHOSQAFloatCheckable : public AliPHOSQAVirtualCheckable {
+
+public:
+
+  AliPHOSQAFloatCheckable(){}           // default ctor not to be used
+  AliPHOSQAFloatCheckable(const char * name) ;          // ctor
+  AliPHOSQAFloatCheckable(AliPHOSQAFloatCheckable& obj) {assert(0==1);}
+  virtual ~AliPHOSQAFloatCheckable() ; // dtor
+
+  virtual Float_t GetValue() const { return fValue ; }
+  virtual  void Print() const ; 
+  virtual void Reset() { fValue=0.; fChange=kFALSE ; }
+  void Set(Float_t value) ; 
+  void Update(Float_t value) ;
+
+private:
+  
+  Float_t fValue ; 
+
+  ClassDef(AliPHOSQAFloatCheckable,1)  // description 
+
+};
+
+#endif // ALIPHOSQAFloatCheckable_H
diff --git a/PHOS/AliPHOSQAIntCheckable.cxx b/PHOS/AliPHOSQAIntCheckable.cxx
new file mode 100644 (file)
index 0000000..1a250b1
--- /dev/null
@@ -0,0 +1,77 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for a QA checkable that is an Int  
+//
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TClass.h"
+
+// --- Standard library ---
+
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAIntCheckable.h"
+
+ClassImp(AliPHOSQAIntCheckable)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAIntCheckable::AliPHOSQAIntCheckable(const char * name) : AliPHOSQAVirtualCheckable(name) 
+{
+  //ctor initial value is zero
+  fType = new char[1] ; 
+  strcpy(fType,"I") ; 
+  fValue = 0 ; 
+}
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAIntCheckable::~AliPHOSQAIntCheckable()
+{
+  // dtor
+  delete fType ; 
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAIntCheckable::Print() const 
+{
+  // Print the chekable name and its value
+  cout << " Checkable-> " << GetName() << " : value = " << fValue << endl ; 
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAIntCheckable::Set(Int_t value)
+{
+  // Changes the value of the checkable and modifies its status
+  fValue = value ; 
+  fChange = kTRUE ; 
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAIntCheckable::Update(Int_t value) 
+{
+  // Increments the value of the checkable and modifies its status
+  fValue += value ; 
+  fChange = kTRUE ; 
+}
diff --git a/PHOS/AliPHOSQAIntCheckable.h b/PHOS/AliPHOSQAIntCheckable.h
new file mode 100644 (file)
index 0000000..94a3f55
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef ALIPHOSQAINTCHECKABLE_H
+#define ALIPHOSQAINTCHECKABLE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for a QA checkable that is an Int    
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAVirtualCheckable.h"
+
+class AliPHOSQAIntCheckable : public AliPHOSQAVirtualCheckable {
+
+public:
+
+  AliPHOSQAIntCheckable(){}           // default ctor not to be used
+  AliPHOSQAIntCheckable(const char * name) ;          // ctor
+  AliPHOSQAIntCheckable(AliPHOSQAIntCheckable& obj) {assert(0==1);}
+  virtual ~AliPHOSQAIntCheckable() ; // dtor
+
+  virtual Float_t GetValue() const { return (Float_t)fValue ; }
+  virtual  void Print() const ; 
+  virtual void Reset() { fValue=0; fChange=kFALSE ; }
+  void Set(Int_t value) ; 
+  void Update(Int_t value) ;  
+
+private:
+  
+  Int_t fValue ; 
+
+  ClassDef(AliPHOSQAIntCheckable,1)  // description 
+
+};
+
+#endif // ALIPHOSQAIntCheckable_H
diff --git a/PHOS/AliPHOSQAMeanChecker.cxx b/PHOS/AliPHOSQAMeanChecker.cxx
new file mode 100644 (file)
index 0000000..16f1ad4
--- /dev/null
@@ -0,0 +1,93 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// QA checker that compares a number with an average value plus or minus
+// a width 
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TDatime.h" 
+#include "TFolder.h" 
+
+// --- Standard library ---
+
+#include <iostream.h>
+// --- AliRoot header files ---
+
+#include "AliPHOSQAMeanChecker.h" 
+#include "AliPHOSQAAlarm.h"
+
+ClassImp(AliPHOSQAMeanChecker)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAMeanChecker::AliPHOSQAMeanChecker(const char * name) : AliPHOSQAChecker(name,"") 
+{
+  // ctor
+  SetTitle("checks against average value +/- width") ; 
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAMeanChecker::AliPHOSQAMeanChecker(const char * name, Float_t mean, Float_t rms) : AliPHOSQAChecker(name,"") 
+{
+  // ctor
+  SetTitle("checks against average value +/- width") ; 
+  fMean = mean ; 
+  fRms  = rms ; 
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAMeanChecker::~AliPHOSQAMeanChecker()
+{
+  // dtor
+}
+
+//____________________________________________________________________________ 
+TString AliPHOSQAMeanChecker::CheckingOperation()
+{
+  // The user defined checking operation
+  // Return a non empty string in case the check was not satisfied
+
+  TString rv ; 
+
+  Float_t checked = 0. ;  
+  if ( strcmp(fCheckable->HasA(),"I") &&  strcmp(fCheckable->HasA(),"F") ) {
+    cout << " ERROR : checker " << GetName() << " says you got the wrong checkable " 
+        << fCheckable->GetName() << endl ; 
+    cout << "         or the checkable has no value !" << endl ; 
+  } else {
+    checked = fCheckable->GetValue(); 
+    if (checked < fMean-fRms || checked > fMean+fRms) {
+      char * tempo = new char[110] ;
+      sprintf(tempo, "-->Checkable : %s :: Checker : %s :: Message : %f outside bond %f +/- %f\n", 
+             fCheckable->GetName(), GetName(), checked, fMean, fRms) ; 
+      rv = tempo ;
+    } 
+  }  
+  return rv ; 
+} 
+
+//____________________________________________________________________________ 
+  void AliPHOSQAMeanChecker::Print()
+{
+  // print the name 
+  
+  cout << "Checker : " << GetName() << " : " << GetTitle() << " : Mean = " <<  fMean << " Rms = " << fRms << endl ;  
+}
diff --git a/PHOS/AliPHOSQAMeanChecker.h b/PHOS/AliPHOSQAMeanChecker.h
new file mode 100644 (file)
index 0000000..5c455b2
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef ALIPHOSQAMEANCHECKER_H
+#define ALIPHOSQAMEANCHECKER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// QA checker that compares a number with an average value plus or minus
+// a width     
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+#include "TTask.h"
+
+// --- Standard library ---
+
+#include <assert.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAChecker.h"  
+
+class AliPHOSQAMeanChecker : public AliPHOSQAChecker {
+
+ public:
+
+  AliPHOSQAMeanChecker(){} ;          // default ctor (not to be used)
+  AliPHOSQAMeanChecker(const char * name) ; // ctor
+  AliPHOSQAMeanChecker(const char * name, Float_t mean, Float_t rms) ; //ctor
+  virtual ~AliPHOSQAMeanChecker() ; // dtor
+  virtual TString CheckingOperation() ; // where the checking operation is implemented
+  //  virtual void  Exec(Option_t *option);  
+  virtual void Print() ; 
+
+  void SetMean(Float_t value) { fMean = value ; } 
+  void SetRms(Float_t value) { fRms = value ; } 
+  void Set(Float_t mean, Float_t rms) { fMean = mean ; fRms = rms ; } 
+
+ private:
+
+  Float_t fMean ; // the value that the checkable will be compared to
+  Float_t fRms ;  // the range around the mean in which the test is OK
+  
+  ClassDef(AliPHOSQAMeanChecker,1)  // description 
+
+};
+
+#endif // ALIPHOSQAMeanChecker_H
diff --git a/PHOS/AliPHOSQAObjectCheckable.cxx b/PHOS/AliPHOSQAObjectCheckable.cxx
new file mode 100644 (file)
index 0000000..c38682f
--- /dev/null
@@ -0,0 +1,62 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for a QA checkable that is an Int  
+//
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TClass.h"
+
+// --- Standard library ---
+
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAObjectCheckable.h"
+
+ClassImp(AliPHOSQAObjectCheckable)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAObjectCheckable::AliPHOSQAObjectCheckable(const char * name) : AliPHOSQAVirtualCheckable(name) 
+{
+  fType = new char[1] ; 
+  strcpy(fType,"O") ; 
+  fObject = 0 ; 
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAObjectCheckable::~AliPHOSQAObjectCheckable()
+{
+
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAObjectCheckable::Print() const
+{
+  cout << " Checkable-> " << GetName() << " : value = "  << endl ; 
+  if( fObject ) 
+    fObject->Print() ;
+  else
+    cerr << "ERROR : no object specified yet " << endl ; 
+}
+
diff --git a/PHOS/AliPHOSQAObjectCheckable.h b/PHOS/AliPHOSQAObjectCheckable.h
new file mode 100644 (file)
index 0000000..3dd1a39
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef ALIPHOSQAOBJECTCHECKABLE_H
+#define ALIPHOSQAOBJECTCHECKABLE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Abstact Class for a QA checkable that is a TObject    
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAVirtualCheckable.h"
+
+class AliPHOSQAObjectCheckable : public AliPHOSQAVirtualCheckable {
+
+public:
+
+  AliPHOSQAObjectCheckable(){}           // default ctor not to be used
+  AliPHOSQAObjectCheckable(const char * name) ;          // ctor
+  AliPHOSQAObjectCheckable(AliPHOSQAObjectCheckable& obj) {assert(0==1);}
+  virtual ~AliPHOSQAObjectCheckable() ; // dtor
+
+  virtual TObject * GetObject() const { return fObject ; }
+  virtual Float_t GetValue() const {return 0. ;} 
+  virtual void Print() const ; 
+  virtual void Reset() { fChange=kFALSE ; }
+  virtual void Set(TObject * obj) {fObject = obj ;} 
+  virtual void Update(TObject * value) {} ; 
+
+private:
+  
+  TObject *  fObject ; 
+
+  ClassDef(AliPHOSQAObjectCheckable,1)  // description 
+
+};
+
+#endif // ALIPHOSQAObjectCheckable_H
diff --git a/PHOS/AliPHOSQAVirtualCheckable.cxx b/PHOS/AliPHOSQAVirtualCheckable.cxx
new file mode 100644 (file)
index 0000000..a913a20
--- /dev/null
@@ -0,0 +1,152 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//_________________________________________________________________________
+//  Abstract Class for a QA checkable    
+//
+//*-- Author :  Yves Schutz (SUBATECH) 
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TClass.h"
+#include "TFolder.h"
+#include "TROOT.h"
+
+
+// --- Standard library ---
+
+#include <iostream.h>
+
+// --- AliRoot header files ---
+
+#include "AliPHOSQAVirtualCheckable.h"
+#include "AliPHOSQAChecker.h"
+#include "AliPHOSQAAlarm.h" 
+
+ClassImp(AliPHOSQAVirtualCheckable)
+
+
+//____________________________________________________________________________ 
+  AliPHOSQAVirtualCheckable::AliPHOSQAVirtualCheckable(const char * name) : TNamed(name, name) 
+{
+  // ctor, creates the task(s)
+  fChange = kFALSE ; 
+  // create a new folder that will hold the list of alarms
+  //  get the alice folder
+  TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
+  //  the folder that contains the alarms for PHOS   
+  fAlarms = (TFolder*)alice->FindObject("folders/QAAlarms/PHOS");   
+  //  make it the owner of the objects that it contains
+  fAlarms->SetOwner() ;
+  //  add the alarms list to //YSAlice/folders/QAAlarms/PHOS
+  TList * alarms = new TList() ; // deleted when fAlarms is deleted
+  alarms->SetName(name) ; 
+  fAlarms->Add(alarms) ; 
+
+}
+
+//____________________________________________________________________________ 
+  AliPHOSQAVirtualCheckable::~AliPHOSQAVirtualCheckable()
+{
+  // ctor 
+  delete fAlarms ; 
+  delete fType ; 
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAVirtualCheckable::AddChecker(AliPHOSQAChecker * ch)
+{
+  // Associates the checkable object with a task (that can be a list of tasks)
+    ch->AddCheckable(this) ; 
+    if (fChecker)
+      fChecker->Add(ch) ;
+    else 
+      fChecker = ch ; 
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAVirtualCheckable::Alarms() const
+{
+  // Prints all the alarms 
+  TList * alarms = GetAlarms() ; 
+  if (alarms->IsEmpty() )
+    cout << " No alarms raised for checkable " << GetName() << endl ; 
+  else {
+    TIter next(alarms);
+    AliPHOSQAAlarm * alarm ; 
+    while ( (alarm = (AliPHOSQAAlarm*)next()) ) 
+      alarm->Print() ; 
+  }
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAVirtualCheckable::CheckMe() 
+{
+  // All the attached checkers will check this checkable
+
+  fChecker->CheckIt(this) ;
+}
+
+//____________________________________________________________________________ 
+void AliPHOSQAVirtualCheckable::RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message)
+{
+  // Raise an alarm and store it in the appropriate folder : //YSAlice/folders/QAAlarms/PHOS/..
+  // cout << message ; 
+  AliPHOSQAAlarm * alarm = new AliPHOSQAAlarm(time, checked, checker, message)  ;   
+  GetAlarms()->Add(alarm) ; 
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAVirtualCheckable::RemoveChecker(AliPHOSQAChecker *ch)
+{
+  // Remove the specified checker from the list of tasks
+  // and the present checkable from the list of checkables of the specified checker
+  fChecker->Remove(ch) ;
+  fChecker->GetListOfCheckables()->Remove(this) ;
+  
+}
+
+
+//____________________________________________________________________________ 
+  void AliPHOSQAVirtualCheckable::ResetAlarms()
+{
+  // resets the list of alarms (delete the alarms from the list)
+  TList * alarms = GetAlarms() ; 
+  if (alarms->IsEmpty() )
+    cout << " No alarms raised for checkable " << GetName() << endl ; 
+  else {
+    alarms->Delete() ; 
+    cout << " Reset alarms for checkable " << GetName() << endl ; 
+  }
+}
+
+//____________________________________________________________________________ 
+  void AliPHOSQAVirtualCheckable::Status() const  
+{
+  // Tells which checkers are attached to this checkable
+  TList * list = fChecker->GetListOfTasks(); 
+  if (list->IsEmpty() )
+    cout << "No checkers are in use for " << GetName() << endl ;
+  else {    
+    cout << "The following checkers are in use for " << GetName() << endl ;
+    TIter next(list) ; 
+    AliPHOSQAChecker * checker ; 
+    while ( (checker = (AliPHOSQAChecker*)next() ) ) 
+      checker->Print() ; 
+  }
+}
diff --git a/PHOS/AliPHOSQAVirtualCheckable.h b/PHOS/AliPHOSQAVirtualCheckable.h
new file mode 100644 (file)
index 0000000..4220512
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIPHOSQAVIRTUALCHECKABLE_H
+#define ALIPHOSQAVIRTUALCHECKABLE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+//  Abstract Class for a QA checkable    
+//                  
+//*-- Author: Yves Schutz (SUBATECH)
+
+
+// --- ROOT system ---
+
+#include "TFolder.h" 
+#include "TNamed.h" 
+#include "TTask.h" 
+
+// --- Standard library ---
+
+#include <assert.h>
+
+// --- AliRoot header files ---
+
+class AliPHOSQAChecker ;
+class AliPHOSQAAlarm ; 
+
+class AliPHOSQAVirtualCheckable : public TNamed {
+
+public:
+
+  AliPHOSQAVirtualCheckable(){}           // default ctor not to be used
+  AliPHOSQAVirtualCheckable(const char * name) ;          // ctor
+  AliPHOSQAVirtualCheckable(AliPHOSQAVirtualCheckable& obj) {assert(0==1);}
+  virtual ~AliPHOSQAVirtualCheckable() ; // dtor
+
+  void AddChecker(AliPHOSQAChecker * ch) ; 
+  void Alarms() const ; 
+  void CheckMe() ;
+  virtual Bool_t HasChanged() const { return fChange ; } 
+  TList * GetAlarms() const { return  (TList*)fAlarms->FindObject(GetName()) ; }  
+  virtual Float_t GetValue() const = 0 ; 
+  char * HasA() const { return fType ; }
+  virtual void Print() const = 0 ; 
+  void RaiseAlarm(const char * time, const char * checked, const char * checker, const char * message) ; 
+  void RemoveChecker(AliPHOSQAChecker *ch) ; 
+  virtual void Reset() = 0 ;
+  void ResetAlarms() ;
+  void Status() const  ; 
+
+protected:
+  
+  AliPHOSQAChecker * fChecker ; // the task(s) that is going to act on the checkable
+  char * fType ;            //[1] I, F, or O 
+  TFolder * fAlarms ;       // folder that contains the PHOS alarms  
+  Bool_t fChange ;          // tells if the checkable has been updated
+
+  ClassDef(AliPHOSQAVirtualCheckable,1)  // description 
+
+};
+
+#endif // ALIPHOSQAVirtualCheckable_H