Use double precision everywhere (Federico)
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQADataMakerRec.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// Produces the data needed to calculate the quality assurance.
17// All data must be mergeable objects.
18
19
20// Authors:
21//
22// Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
23// Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
24// Arturo Fernandez Tellez <afernan@mail.cern.ch (FCFM-BUAP)
25//
26// Created: June 13th 2008
27//---
491ceb3e 28// Last Update: Aug. 27th 2008 --> Implementation to declare QA expert histogram
51504028 29
30
31// --- ROOT system ---
32#include <TClonesArray.h>
33#include <TFile.h>
34#include <TH1F.h>
35#include <TDirectory.h>
36// --- Standard library ---
37
38// --- AliRoot header files ---
39#include "AliESDEvent.h"
40#include "AliLog.h"
41#include "AliACORDEdigit.h"
42#include "AliACORDEhit.h"
43#include "AliACORDEQADataMakerRec.h"
44#include "AliQAChecker.h"
45#include "AliACORDERawReader.h"
46#include "AliACORDERawStream.h"
47ClassImp(AliACORDEQADataMakerRec)
48
49//____________________________________________________________________________
4e25ac79 50AliACORDEQADataMakerRec::AliACORDEQADataMakerRec():AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kACORDE), "ACORDE Quality Assurance Data Maker")
51504028 51{
52
53}
54//____________________________________________________________________________
55AliACORDEQADataMakerRec::AliACORDEQADataMakerRec(const AliACORDEQADataMakerRec& qadm):AliQADataMakerRec()
56{
57 SetName((const char*)qadm.GetName()) ;
58 SetTitle((const char*)qadm.GetTitle());
59}
60//__________________________________________________________________
61AliACORDEQADataMakerRec& AliACORDEQADataMakerRec::operator = (const AliACORDEQADataMakerRec& qadm )
62{
63 // Equal operator.
64 this->~AliACORDEQADataMakerRec();
65 new(this) AliACORDEQADataMakerRec(qadm);
66 return *this;
67}
68//____________________________________________________________________________
4e25ac79 69void AliACORDEQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
51504028 70{
71 //Detector specific actions at end of cycle
72 // do the QA checking
4e25ac79 73 AliQAChecker::Instance()->Run(AliQAv1::kACORDE, task, list) ;
51504028 74}
75
76//____________________________________________________________________________
77void AliACORDEQADataMakerRec::StartOfDetectorCycle()
78{
79 //Detector specific actions at start of cycle
80
81}
82
83//____________________________________________________________________________
84void AliACORDEQADataMakerRec::InitRaws()
85{
86 // create Raw histograms in Raw subdir
87
7d297381 88 const Bool_t expert = kTRUE ;
89 const Bool_t saveCorr = kTRUE ;
90 const Bool_t image = kTRUE ;
91
92 TH1D *fhACORDEBitPattern[4];
db72ff3b 93 fhACORDEBitPattern[0] = new TH1D("ACORDERawDataSM","ACORDE-SingleMuon;Bit Pattern;Counts",60,1,60);//AcordeSingleMuon BitPattern
94 fhACORDEBitPattern[1] = new TH1D("ACORDERawDataMM","ACORDE-MultiMuon;Bit Pattern;Counts",60,1,60);//AcordeMultiMuon BitPattern
95 fhACORDEBitPattern[2] = new TH1D("ACORDERawDataSMM","ACORDE-SingleMuonMultiplicity;Multiplicity;Counts",60,1,60);//AcordeSingleMuon Multiplicity
96 fhACORDEBitPattern[3] = new TH1D("ACORDERawDataMMM","ACORDE-MultiMuonMultiplicity;Multiplicity;Counts",60,1,60);//AcordeMultiMuon Multiplicity
7d297381 97 for(Int_t i=0;i<4;i++)
98 Add2RawsList(fhACORDEBitPattern[i],i,!expert, image, !saveCorr);
51504028 99}
100//____________________________________________________________________________
44ed7a66 101void AliACORDEQADataMakerRec::InitDigits()
102{
103 // create Digits histograms in Digits subdir
104
105 const Bool_t expert = kTRUE ;
106 const Bool_t image = kTRUE ;
44ed7a66 107 TH1F * fhDigitsModule;
108 TString modulename;
109 modulename = "hDigitsModule";
db72ff3b 110 fhDigitsModule = new TH1F(modulename.Data(),"hDigitsModuleSingle;# of modules;Counts",60,0,60);
44ed7a66 111 Add2DigitsList(fhDigitsModule,0,!expert,image);
db72ff3b 112
44ed7a66 113}
114
115//____________________________________________________________________________
51504028 116
117void AliACORDEQADataMakerRec::InitRecPoints()
118{
119 // create cluster histograms in RecPoint subdir
120 // Not needed for ACORDE by now !!!
121}
db72ff3b 122
51504028 123//____________________________________________________________________________
124void AliACORDEQADataMakerRec::InitESDs()
125{
126 //create ESDs histograms in ESDs subdir
127
7d297381 128 const Bool_t expert = kTRUE ;
129 const Bool_t image = kTRUE ;
130
131 TH1F * fhESDsSingle;
132 TH1F * fhESDsMulti;
51504028 133
134 TString name;
135
136 name = "hESDsSingle";
db72ff3b 137 fhESDsSingle = new TH1F(name.Data(),"hESDsSingle;??;??",60,0,60);
7d297381 138 Add2ESDsList(fhESDsSingle,0,!expert,image);
51504028 139
140 name = "hESDsMulti";
db72ff3b 141 fhESDsMulti = new TH1F(name.Data(),"hESDsMulti;??;??",60,0,60);
7d297381 142 Add2ESDsList(fhESDsMulti,1,!expert,image);
51504028 143}
144//____________________________________________________________________________
145void AliACORDEQADataMakerRec::MakeRaws(AliRawReader* rawReader)
146{
147 //fills QA histos for RAW
eca4fa66 148
149 // Check id histograms already created for this Event Specie
150 if ( ! GetRawsData(0) )
151 InitRaws() ;
152
51504028 153 rawReader->Reset();
154 AliACORDERawStream rawStream(rawReader);
155 size_t contSingle=0;
156 size_t contMulti=0;
157 UInt_t dy[4];
158
159 bool kroSingle[60],kroMulti[60];
160 UInt_t tmpDy;
161
162 for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;}
163
164if(rawStream.Next())
165{
51504028 166 dy[0]=rawStream.GetWord(0);
167 dy[1]=rawStream.GetWord(1);
168 dy[2]=rawStream.GetWord(2);
169 dy[3]=rawStream.GetWord(3);
170 tmpDy=dy[0];
171 for(Int_t r=0;r<30;++r)
172 {
173 kroSingle[r] = tmpDy & 1;
174 tmpDy>>=1;
175 }
176 tmpDy=dy[1];
177 for(Int_t r=30;r<60;++r)
178 {
179 kroSingle[r] = tmpDy & 1;
180 tmpDy>>=1;
181 }
182 tmpDy=dy[2];
183 for(Int_t r=0;r<30;++r)
184 {
185 kroMulti[r] = tmpDy & 1;
186 tmpDy>>=1;
187 }
188 tmpDy=dy[3];
189 for(Int_t r=30;r<60;++r)
190 {
191 kroMulti[r] = tmpDy & 1;
192 tmpDy>>=1;
193 }
194 contSingle=0;
195 contMulti=0;
196 for(Int_t r=0;r<60;++r)
197 {
198 if(kroSingle[r]==1)
199 {
200 GetRawsData(0)->Fill(r+1);
201 contSingle=contSingle+1;
202 }
203 if(kroMulti[r]==1)
204 {
205 GetRawsData(1)->Fill(r+1);
206 contMulti++;
207 }
208
209 }GetRawsData(2)->Fill(contSingle);GetRawsData(3)->Fill(contMulti);
210}
211}
212//____________________________________________________________________________
44ed7a66 213void AliACORDEQADataMakerRec::MakeDigits( TTree *digitsTree)
214{
215 //fills QA histos for Digits
216 TClonesArray * digits = new TClonesArray("AliACORDEdigit",1000);
217 TBranch * branch = digitsTree->GetBranch("ACORDEdigit");
218 if (!branch) {
219 AliWarning("ACORDE branch in Digits Tree not found");
220 } else {
eca4fa66 221
222 // Check id histograms already created for this Event Specie
223 if ( ! GetDigitsData(0) )
224 InitDigits() ;
225
44ed7a66 226 branch->SetAddress(&digits);
227 for(Int_t track = 0 ; track < branch->GetEntries() ; track++) {
228 branch->GetEntry(track);
229 for(Int_t idigit = 0 ; idigit < digits->GetEntriesFast() ; idigit++) {
230 AliACORDEdigit *AcoDigit = (AliACORDEdigit*) digits->UncheckedAt(idigit);
231 if (!AcoDigit) {
232 AliError("The unchecked digit doesn't exist");
233 continue ;
234 }
235 GetDigitsData(0)->Fill(AcoDigit->GetModule()-1);
236 }
237 }
238 }
239}
240
241//____________________________________________________________________________
51504028 242void AliACORDEQADataMakerRec::MakeESDs(AliESDEvent * esd)
243{
244 //fills QA histos for ESD
245
eca4fa66 246 // Check id histograms already created for this Event Specie
247 if ( ! GetESDsData(0) )
248 InitESDs() ;
249
250 AliESDACORDE * fESDACORDE= esd->GetACORDEData();
51504028 251 Int_t *fACORDEMultiMuon =fESDACORDE->GetACORDEMultiMuon();
252 Int_t *fACORDESingleMuon=fESDACORDE->GetACORDESingleMuon();
253
254 for(int i=0;i<60;i++){
255 if(fACORDESingleMuon[i]==1)
256 GetESDsData(0) -> Fill(i);
257 if(fACORDEMultiMuon[i]==1)
258 GetESDsData(1) -> Fill(i);
259 }
51504028 260}
261