]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQAMeanChecker.cxx
coding conventions corrections
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQAMeanChecker.cxx
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 // QA checker that compares a number with an average value plus or minus
20 // a width 
21 //*-- Author :  Yves Schutz (SUBATECH) 
22 //////////////////////////////////////////////////////////////////////////////
23
24 // --- ROOT system ---
25
26 // --- Standard library ---
27
28 // --- AliRoot header files ---
29
30 #include "AliPHOSQAMeanChecker.h" 
31
32 ClassImp(AliPHOSQAMeanChecker)
33
34
35 //____________________________________________________________________________ 
36   AliPHOSQAMeanChecker::AliPHOSQAMeanChecker(const char * name) : AliPHOSQAChecker(name,"") 
37 {
38   // ctor
39   SetTitle("checks against average value +/- width") ; 
40 }
41
42 //____________________________________________________________________________ 
43   AliPHOSQAMeanChecker::AliPHOSQAMeanChecker(const char * name, Float_t mean, Float_t rms) : AliPHOSQAChecker(name,"") 
44 {
45   // ctor
46   SetTitle("checks against average value +/- width") ; 
47   fMean = mean ; 
48   fRms  = rms ; 
49 }
50
51 //____________________________________________________________________________ 
52   AliPHOSQAMeanChecker::~AliPHOSQAMeanChecker()
53 {
54   // dtor
55 }
56
57 //____________________________________________________________________________ 
58 TString AliPHOSQAMeanChecker::CheckingOperation()
59 {
60   // The user defined checking operation
61   // Return a non empty string in case the check was not satisfied
62
63   TString rv ; 
64
65   Float_t checked = 0. ;  
66   if ( (fCheckable->HasA() == "I") &&  (fCheckable->HasA() == "F") ) {
67     Error("CheckingOperation", "checker %s says you got the wrong checkable %s or the checkable has no value !", GetName(), fCheckable->GetName()) ;  
68   } else {
69     checked = fCheckable->GetValue(); 
70     if (checked < fMean-fRms || checked > fMean+fRms) {
71       char * tempo = new char[110] ;
72       sprintf(tempo, "-->Checkable : %s :: Checker : %s :: Message : %f outside bond %f +/- %f\n", 
73               fCheckable->GetName(), GetName(), checked, fMean, fRms) ; 
74       rv = tempo ;
75       delete [] tempo ; 
76     } 
77   }  
78   return rv ; 
79
80
81 //____________________________________________________________________________ 
82   void AliPHOSQAMeanChecker::Print()
83 {
84   // print the name 
85   
86   Info("Print", "Checker : %s : %s : Mean = %f Rms = %f", GetName(), GetTitle(), fMean, fRms) ;  
87 }