]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSQualAssChecker.cxx
Corrected copy constructor and assignment operator, fixed memory leaks (Christian)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQualAssChecker.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
17 /* $Id$ */
18
19 /*
20   Checks the quality assurance. 
21   By comparing with reference data
22   Y. Schutz CERN July 2007
23 */
24
25 // --- ROOT system ---
26 #include <TClass.h>
27 #include <TH1F.h> 
28 #include <TH1I.h> 
29 #include <TIterator.h> 
30 #include <TKey.h> 
31 #include <TFile.h> 
32
33 // --- Standard library ---
34
35 // --- AliRoot header files ---
36 #include "AliLog.h"
37 #include "AliQualAss.h"
38 #include "AliQualAssChecker.h"
39 #include "AliPHOSQualAssChecker.h"
40
41 ClassImp(AliPHOSQualAssChecker)
42
43 //__________________________________________________________________
44 AliPHOSQualAssChecker& AliPHOSQualAssChecker::operator = (const AliPHOSQualAssChecker& qadm )
45 {
46   // Equal operator.
47   this->~AliPHOSQualAssChecker();
48   new(this) AliPHOSQualAssChecker(qadm);
49   return *this;
50 }
51
52 //____________________________________________________________________________
53 const Double_t AliPHOSQualAssChecker::Check(const Option_t * opt) 
54 {
55   // Performs the checking
56
57   TDirectory * wRefDir = fDetectorDir->GetDirectory(opt) ; 
58   TDirectory * wInDir  = fDetectorDir ->GetDirectory(opt) ; 
59   Double_t test = 0.0  ;
60
61   if (!wRefDir || !wInDir) 
62     test = -1. ;
63   else {
64     TList * keyList = wRefDir->GetListOfKeys() ; 
65     TIter next(keyList) ; 
66     TKey * key ;
67     Int_t count = 0 ; 
68     while ( (key = static_cast<TKey *>(next())) ) {
69       TObject * oref = wRefDir->Get(key->GetName()) ; 
70       if ( oref->IsA()->InheritsFrom("TH1") ) {
71         TH1 * href = static_cast<TH1F*>(oref) ; 
72         TH1 * hin  = static_cast<TH1F*>(wInDir->Get(key->GetName())) ; 
73         test += DiffK(href, hin) ;
74         AliInfo(Form("test = %f", test)) ; 
75         count++ ; 
76           } else
77           AliError(Form("%s is a class name that cannot be processed", key->GetClassName())) ;
78     }
79     if (count != 0) 
80       test /= count ;
81   }
82     
83   return test ; 
84 }