Update of QA hitograms
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQADataMakerSim.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
17
18//---
19// Produces the data needed to calculate the quality assurance.
20// All data must be mergeable objects.
21
22// Authors:
23//
24// Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
25// Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
26// Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
27//
28// Created: June 13th 2008
29//---
491ceb3e 30// Last Update: Aug. 27th 2008 ---> Implementation to declare QA expert histogram
31
51504028 32
33// --- ROOT system ---
34#include <TClonesArray.h>
35#include <TFile.h>
36#include <TH1F.h>
37#include <TH2F.h>
38#include <TDirectory.h>
39// --- Standard library ---
40
41// --- AliRoot header files ---
42#include "AliESDEvent.h"
43#include "AliLog.h"
44#include "AliACORDEdigit.h"
45#include "AliACORDEhit.h"
46#include "AliACORDEQADataMakerSim.h"
47#include "AliQAChecker.h"
48#include "AliACORDERawReader.h"
49ClassImp(AliACORDEQADataMakerSim)
50
51//____________________________________________________________________________
4e25ac79 52AliACORDEQADataMakerSim::AliACORDEQADataMakerSim():AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kACORDE), "ACORDE Quality Assurance Data Maker")
51504028 53{
54}
55//____________________________________________________________________________
56AliACORDEQADataMakerSim::AliACORDEQADataMakerSim(const AliACORDEQADataMakerSim& qadm) :
57 AliQADataMakerSim()
58{
59 SetName((const char*)qadm.GetName()) ;
60 SetTitle((const char*)qadm.GetTitle());
61}
62//__________________________________________________________________
63AliACORDEQADataMakerSim& AliACORDEQADataMakerSim::operator = (const AliACORDEQADataMakerSim& qadm )
64{
65 // Equal operator.
66 this->~AliACORDEQADataMakerSim();
67 new(this) AliACORDEQADataMakerSim(qadm);
68 return *this;
69}
70//____________________________________________________________________________
4e25ac79 71void AliACORDEQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
51504028 72{
73 //Detector specific actions at end of cycle
74 // do the QA checking
5379c4a3 75 AliDebug(AliQAv1::GetQADebugLevel(), "ACORDE---->Detector specific actions at END of cycle\n................\n");
51504028 76
4e25ac79 77 AliQAChecker::Instance()->Run(AliQAv1::kACORDE, task, list) ;
51504028 78}
79//____________________________________________________________________________
80void AliACORDEQADataMakerSim::StartOfDetectorCycle()
81{
82 //Detector specific actions at start of cycle
5379c4a3 83 AliDebug(AliQAv1::GetQADebugLevel(), "ACORDE---->Detector specific actions at START of cycle\n................\n");
51504028 84}
85//____________________________________________________________________________
86void AliACORDEQADataMakerSim::InitHits()
87{
88 // create Hits histograms in Hits subdir
d461c877 89
7d297381 90 const Bool_t expert = kTRUE ;
91 const Bool_t image = kTRUE ;
1093dbd7 92
93 TH1F * fHitsACORDE;
94
95 fHitsACORDE = new TH1F("ACORDEBitPatternfromHits","Distribution of ACORDE fired modules from HITS",60,1,60);
7d297381 96 Add2HitsList(fHitsACORDE,0,!expert,image);
1093dbd7 97
98 char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
99 "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
100 "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
101 "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
102 "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
103 "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
104
105
106 fHitsACORDE->SetXTitle("Modules");
107 fHitsACORDE->SetYTitle("Counts");
108 for (Int_t i=0;i<60;i++)
109 {
110 fHitsACORDE->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
111 }
112
113
114
51504028 115}
116//____________________________________________________________________________
117void AliACORDEQADataMakerSim::InitDigits()
118{
119 // create Digits histograms in Digits subdir
120
7d297381 121 const Bool_t expert = kTRUE ;
122 const Bool_t image = kTRUE ;
123
124 TH1F * fhDigitsModule;
1093dbd7 125 fhDigitsModule = new TH1F("ACORDEBitPatternfromDigits","Distribution of ACORDE fired modules from DIGITS",60,1,60);
7d297381 126 Add2DigitsList(fhDigitsModule,0,!expert,image);
1093dbd7 127 char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",
128 "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",
129 "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",
130 "3_0","3_1","3_2","3_3","3_4","3_5","3_6","3_7","3_8","3_9",
131 "4_0","4_1","4_2","4_3","4_4","4_5","4_6","4_7","4_8","4_9",
132 "5_0","5_1","5_2","5_3","5_4","5_5","5_6","5_7","5_8","5_9"};
133
134
135 fhDigitsModule->SetXTitle("Modules");
136 fhDigitsModule->SetYTitle("Counts");
137 for (Int_t i=0;i<60;i++)
138 {
139 fhDigitsModule->GetXaxis()->SetBinLabel(i+1,acoModule[i]);
140 }
141
51504028 142
143}
144//____________________________________________________________________________
145
146void AliACORDEQADataMakerSim::MakeHits(TTree *hitTree)
147{
148 // Here we fill the QA histos for Hits declared above
149
6252ceeb 150 if (fHitsArray)
1093dbd7 151 fHitsArray->Clear() ;
152 else
153 fHitsArray = new TClonesArray("AliACORDEhit",1000);
d461c877 154 TBranch * branch = hitTree->GetBranch("ACORDE");
1093dbd7 155 if (!branch)
156 {
d461c877 157 AliWarning("ACORDE branch in Hit Tree not found");
1093dbd7 158 } else
159 {
160 branch->SetAddress(&fHitsArray);
161 for(Int_t track = 0 ; track < branch->GetEntries() ; track++)
162 {
d461c877 163 branch->GetEntry(track);
1093dbd7 164 for(Int_t ihit=0 ; ihit < fHitsArray->GetEntriesFast() ; ihit++)
165 {
6252ceeb 166 AliACORDEhit *AcoHit = (AliACORDEhit*) fHitsArray->UncheckedAt(ihit);
1093dbd7 167 if(!AcoHit)
168 {
d461c877 169 AliError("The unchecked hit doesn't exist");
fcdfb1ff 170 continue ;
d461c877 171 }
1093dbd7 172 GetHitsData(0)->Fill(AcoHit->GetModule());
173 }
174 }
175 }
176
51504028 177}
178//____________________________________________________________________________
179void AliACORDEQADataMakerSim::MakeDigits( TTree *digitsTree)
180{
181 //fills QA histos for Digits
6252ceeb 182 if (fDigitsArray)
183 fDigitsArray->Clear() ;
184 else
185 fDigitsArray = new TClonesArray("AliACORDEdigit",1000);
186
fcdfb1ff 187 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
188 if (!branch) {
189 AliWarning("ACORDE branch in Digits Tree not found");
190 } else {
6252ceeb 191 branch->SetAddress(&fDigitsArray);
fcdfb1ff 192 for(Int_t track = 0 ; track < branch->GetEntries() ; track++) {
193 branch->GetEntry(track);
6252ceeb 194 for(Int_t idigit = 0 ; idigit < fDigitsArray->GetEntriesFast() ; idigit++) {
195 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) fDigitsArray->UncheckedAt(idigit);
fcdfb1ff 196 if (!AcoDigit) {
197 AliError("The unchecked digit doesn't exist");
198 continue ;
51504028 199 }
1093dbd7 200 GetDigitsData(0)->Fill(AcoDigit->GetModule());
fcdfb1ff 201 }
202 }
203 }
51504028 204}