Adding macros for ACORDE: sim&rec, read raw-data,esd & hits (*.C macros and AliAnalys...
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQAChecker.cxx
CommitLineData
51504028 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// Checks the quality assurance for ACORDE.
17// Default implementation
18// Authors:
19// Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
20// Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
21// Arturo Fernandez <afernan@mail.cern.ch> (FCFM-BUAP)
1b368017 22// Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP)
51504028 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"
4e25ac79 37#include "AliQAv1.h"
51504028 38#include "AliQAChecker.h"
39#include "AliACORDEQAChecker.h"
fcdfb1ff 40#include "AliCDBEntry.h"
41#include "AliQAManager.h"
51504028 42
43ClassImp(AliACORDEQAChecker)
44
1b368017 45//____________________________________________________________________________
86017bd8 46void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/)
1b368017 47{
1b368017 48 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
86017bd8 49 test[specie] = 0.0 ;
1b368017 50}
51//____________________________________________________________________________
86017bd8 52void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
f307c383 53{
1b368017 54// Close version to the final one for the ACORDE QA Checker
57acd2d2 55
1b368017 56// Loop over the run species (for specie!= cosmic by now we set QA to INFO)
57
58 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
59 {
60 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
86017bd8 61 if (list[specie]->GetEntries() == 0) test[specie] = 1.; // Nothing to check
1b368017 62 else
bd97a569 63 {
1b368017 64 TIter next(list[specie]) ;
65 TH1 * hdata ; // Data created by the AliACORDEQADataMakerXXX (Sim/Rec)
66 while ( (hdata = dynamic_cast<TH1 *>(next())) )
fcdfb1ff 67 {
1b368017 68 if (hdata)
bd97a569 69 {
1b368017 70 Double_t rv = 0.0 ;
71 if(hdata->GetEntries()>0) rv=1;
72 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
73 TString hdataName = hdata->GetName();
74
75 // Here we use the QAref ACORDE data from fRefOCDBSubDir
76
77 if ( (fRefOCDBSubDir[specie]) && (hdataName.Contains("ACORDEBitPattern")) )
bd97a569 78 {
1b368017 79 TH1 * href = NULL;
80 if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
81 else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
86017bd8 82 test[specie] = CheckAcordeRefHits(href,hdata);
1b368017 83 }else if (hdataName.Contains("ACORDEBitPattern"))
84 // Here we use an inner QA Checher without the QAref data
bd97a569 85 {
1b368017 86 Float_t acoDataMax = hdata->GetMaximum();
87 Int_t flagAcoQA = 0;
f31df1cb 88 if (acoDataMax!=0)
bd97a569 89 {
f31df1cb 90 for(Int_t i=0;i<60;i++)
91 {
92 if ((hdata->GetBinContent(i)/acoDataMax) < 0.75) flagAcoQA++;
93 }
bd97a569 94 }
1b368017 95 Double_t simpleFlag = 1.-flagAcoQA/60.;
86017bd8 96 if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) test[specie] = 0.75; // INFO
97 if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) test[specie] = 0.50; // WARNING
98 if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) test[specie] = 0.25; // ERROR
99 if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) ) test[specie] = -1.0; // FATAL
1b368017 100 }
101 // Setting Warning message for possible Empty Events with the ACORDE-Trigger
102
103 if (hdataName.Contains("ACORDEMultiplicity") && (hdata->GetBinContent(0)!=0)) AliWarning("Empty event registered with ACORDE Trigger !!!");
104
105
106 }else AliError("Data type cannot be processed") ;
107
108 }
109 }
86017bd8 110 if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) test[specie] = 0.75;
1b368017 111 }
f307c383 112}
1b368017 113//____________________________________________________________________________
114Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
fcdfb1ff 115{
86017bd8 116 Double_t test = 0.;
1b368017 117 Int_t flag=0;
118 for (Int_t i=0;i<60;i++)
fcdfb1ff 119 {
0200d7cf 120 if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))>10) flag++;
bd97a569 121 }
86017bd8 122 if ((flag>50)&&(flag<=60)) test = -1.;
123 if ((flag>30)&&(flag<=50)) test = 0.25;
124 if ((flag>10)&&(flag<=30)) test = 0.5;
125 if ((flag>0)&&(flag<=10)) test = 0.75;
126 return test;
fcdfb1ff 127}