]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASPDDataMakerSim.cxx
Shadow warnings fixed
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDDataMakerSim.cxx
CommitLineData
379510c2 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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// Checks the quality assurance
19// by comparing with reference data
20// contained in a DB
21// -------------------------------------------------------------
22// W. Ferrarese + P. Cerello INFN Torino Feb 2008
23// M. Nicassio D. Elia INFN Bari April 2008
24// maria.nicassio@ba.infn.it
25
26// --- ROOT system ---
27#include <TTree.h>
28#include <TH2.h>
29#include <TH1.h>
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliRun.h"
34#include "AliITSQADataMakerSim.h"
35#include "AliITSQASPDDataMakerSim.h"
36#include "AliQA.h"
37#include "AliQAChecker.h"
38#include "AliITSdigit.h"
39#include "AliITSdigitSPD.h"
40#include "AliITS.h"
41#include "AliITSmodule.h"
42#include "AliITShit.h"
43#include "AliITSLoader.h"
44#include "AliRunLoader.h"
45
46ClassImp(AliITSQASPDDataMakerSim)
47
48//____________________________________________________________________________
49AliITSQASPDDataMakerSim::AliITSQASPDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :
50TObject(),
51fAliITSQADataMakerSim(aliITSQADataMakerSim),
52fSPDhDigits(0),
53fSPDhSDigits(0),
54fSPDhHits(0),
c71529b0 55fGenOffset(0)
379510c2 56{
57 //ctor used to discriminate OnLine-Offline analysis
58}
59
60//____________________________________________________________________________
61AliITSQASPDDataMakerSim::AliITSQASPDDataMakerSim(const AliITSQASPDDataMakerSim& qadm) :
62TObject(),
63fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),
64fSPDhDigits(qadm.fSPDhDigits),
65fSPDhSDigits(qadm.fSPDhSDigits),
66fSPDhHits(qadm.fSPDhHits),
c71529b0 67fGenOffset(qadm.fGenOffset)
379510c2 68{
69 //copy ctor
70 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ;
71 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());
72 }
73
74//__________________________________________________________________
75AliITSQASPDDataMakerSim& AliITSQASPDDataMakerSim::operator = (const AliITSQASPDDataMakerSim& qac )
76{
77 // Equal operator.
78 this->~AliITSQASPDDataMakerSim();
79 new(this) AliITSQASPDDataMakerSim(qac);
80 return *this;
81}
82
83//____________________________________________________________________________
84void AliITSQASPDDataMakerSim::StartOfDetectorCycle()
85{
86 //Detector specific actions at start of cycle
87 AliDebug(1,"AliITSQADM::Start of SPD Cycle\n");
88}
89
90//____________________________________________________________________________
91void AliITSQASPDDataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t /*task*/, TObjArray* /*list*/)
92{
93 // launch the QA checking
94 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n");
95
96 //AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
97}
98
99//____________________________________________________________________________
100void AliITSQASPDDataMakerSim::InitDigits()
101{
102 // Initialization for DIGIT data - SPD -
c71529b0 103 fGenOffset = (fAliITSQADataMakerSim->fDigitsQAList)->GetEntries();
379510c2 104 //fSPDhDigits must be incremented by one unit every time a histogram is ADDED to the QA List
105
106 Char_t name[50];
107 Char_t title[50];
108
109 TH1F *hlayer = new TH1F("LayPattern_SPD","Layer map - SPD",6,0.,6.);
110 hlayer->GetXaxis()->SetTitle("Layer number");
111 hlayer->GetYaxis()->SetTitle("Entries");
c71529b0 112 fAliITSQADataMakerSim->Add2DigitsList(hlayer,fGenOffset);
379510c2 113 fSPDhDigits++;
114
115 TH1F **hmod = new TH1F*[2];
116 for (Int_t iLay=0; iLay<2; iLay++) {
117 sprintf(name,"ModPattern_SPD%d",iLay+1);
118 sprintf(title,"Module map - SPD Layer %d",iLay+1);
119 hmod[iLay]=new TH1F(name,title,240,0,240);
120 hmod[iLay]->GetXaxis()->SetTitle("Module number");
121 hmod[iLay]->GetYaxis()->SetTitle("Entries");
c71529b0 122 fAliITSQADataMakerSim->Add2DigitsList(hmod[iLay],1+iLay+fGenOffset);
379510c2 123 fSPDhDigits++;
124 }
125
126 TH1F *hcolumns = new TH1F("Columns_SPD","Columns - SPD",160,0.,160.);
127 hcolumns->GetXaxis()->SetTitle("Column number");
128 hcolumns->GetYaxis()->SetTitle("Entries");
c71529b0 129 fAliITSQADataMakerSim->Add2DigitsList(hcolumns,3+fGenOffset);
379510c2 130 fSPDhDigits++;
131
132 TH1F *hrows = new TH1F("Rows_SPD","Rows - SPD",256,0.,256.);
133 hrows->GetXaxis()->SetTitle("Row number");
134 hrows->GetYaxis()->SetTitle("Entries");
c71529b0 135 fAliITSQADataMakerSim->Add2DigitsList(hrows,4+fGenOffset);
379510c2 136 fSPDhDigits++;
137
138 TH1F** hMultSPDdigits = new TH1F*[2];
139 for (Int_t iLay=0; iLay<2; ++iLay) {
140 sprintf(name,"DigitMultiplicity_SPD%d",iLay+1);
141 sprintf(title,"Digit multiplicity - SPD Layer %d",iLay+1);
142 hMultSPDdigits[iLay]=new TH1F(name,title,200,0.,200.);
143 hMultSPDdigits[iLay]->GetXaxis()->SetTitle("Digit multiplicity");
144 hMultSPDdigits[iLay]->GetYaxis()->SetTitle("Entries");
c71529b0 145 fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenOffset);
379510c2 146 fSPDhDigits++;
147 }
148
149 TH2F *hMultSPDdig2MultSPDdig1 = new TH2F("DigitMultCorrelation_SPD","Digit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
150 hMultSPDdig2MultSPDdig1->GetXaxis()->SetTitle("Digit multiplicity (Layer 1)");
151 hMultSPDdig2MultSPDdig1->GetYaxis()->SetTitle("Digit multiplicity (Layer 2)");
c71529b0 152 fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenOffset);
379510c2 153 fSPDhDigits++;
154
155 AliDebug(1,Form("%d SPD Digits histograms booked\n",fSPDhDigits));
156
157}
158
159//____________________________________________________________________________
160void AliITSQASPDDataMakerSim::MakeDigits(TTree *digits)
161{
162 // Fill QA for DIGIT - SPD -
163 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
164 fITS->SetTreeAddress();
165 TClonesArray *iITSdigits = fITS->DigitsAddress(0); // 0->SPD
166
167 Int_t nDigitsL1=0;
168 Int_t nDigitsL2=0;
169
170 for (Int_t imod=0; imod<240; ++imod){
171 digits->GetEvent(imod);
172 Int_t ndigits = iITSdigits->GetEntries();
173 if (imod<80) {
c71529b0 174 fAliITSQADataMakerSim->GetDigitsData(0+fGenOffset)->Fill(0.5,ndigits);
175 fAliITSQADataMakerSim->GetDigitsData(1+fGenOffset)->Fill(imod,ndigits);
379510c2 176 nDigitsL1+=ndigits;
177 }
178 else {
c71529b0 179 fAliITSQADataMakerSim->GetDigitsData(0+fGenOffset)->Fill(1,ndigits);
180 fAliITSQADataMakerSim->GetDigitsData(2+fGenOffset)->Fill(imod,ndigits);
379510c2 181 nDigitsL2+=ndigits;
182 }
183 for (Int_t idig=0; idig<ndigits; ++idig) {
184 AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
185 Int_t col=dig->GetCoord1(); // cell number z
186 Int_t row=dig->GetCoord2(); // cell number x
c71529b0 187 fAliITSQADataMakerSim->GetDigitsData(3+fGenOffset)->Fill(col);
188 fAliITSQADataMakerSim->GetDigitsData(4+fGenOffset)->Fill(row);
379510c2 189 }
190 }
c71529b0 191 fAliITSQADataMakerSim->GetDigitsData(5+fGenOffset)->Fill(nDigitsL1);
192 fAliITSQADataMakerSim->GetDigitsData(6+fGenOffset)->Fill(nDigitsL2);
193 fAliITSQADataMakerSim->GetDigitsData(7+fGenOffset)->Fill(nDigitsL1,nDigitsL2);
379510c2 194}
195
196//____________________________________________________________________________
197void AliITSQASPDDataMakerSim::InitSDigits()
198{
199 // Initialization for SDIGIT data - SPD -
c71529b0 200 fGenOffset = (fAliITSQADataMakerSim->fSDigitsQAList)->GetEntries();
201 //printf("--W-- AliITSQASPDDataMakerSim::InitSDigits() fGenOffset= %d \n",fGenOffset);
379510c2 202 //fSPDhSDigits must be incremented by one unit every time a histogram is ADDED to the QA List
c71529b0 203
379510c2 204 Char_t name[50];
205 Char_t title[50];
206
207 TH1F *hlayer = new TH1F("LayPattern_SPD","Layer map - SPD",6,0.,6.);
208 hlayer->GetXaxis()->SetTitle("Layer number");
209 hlayer->GetYaxis()->SetTitle("Entries");
c71529b0 210 fAliITSQADataMakerSim->Add2SDigitsList(hlayer,fGenOffset);
379510c2 211 fSPDhSDigits++;
212
213 TH1F **hmod = new TH1F*[2];
214 for (Int_t iLay=0; iLay<2; ++iLay) {
215 sprintf(name,"ModPattern_SPD%d",iLay+1);
216 sprintf(title,"Module map - SPD Layer %d",iLay+1);
217 hmod[iLay]=new TH1F(name,title,240,0,240);
218 hmod[iLay]->GetXaxis()->SetTitle("Module number");
219 hmod[iLay]->GetYaxis()->SetTitle("Entries");
c71529b0 220 fAliITSQADataMakerSim->Add2SDigitsList(hmod[iLay],1+iLay+fGenOffset);
379510c2 221 fSPDhSDigits++;
222 }
223
224
225 AliDebug(1,Form("%d SPD SDigits histograms booked\n",fSPDhSDigits));
226
227}
228
229//____________________________________________________________________________
230void AliITSQASPDDataMakerSim::MakeSDigits(TTree *sdigits)
231{
232 // Fill QA for SDIGIT - SPD -
233 TBranch *brchSDigits = sdigits->GetBranch("ITS");
234 for (Int_t imod=0; imod<240; ++imod){
235 TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );
236 brchSDigits->SetAddress( &sdig );
237 brchSDigits->GetEvent(imod);
238 Int_t nsdig=sdig->GetEntries();
239 if (imod<80) {
c71529b0 240 fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffset)->Fill(0.5,nsdig);
241 fAliITSQADataMakerSim->GetSDigitsData(1+fGenOffset)->Fill(imod,nsdig);
379510c2 242 }
243 else {
c71529b0 244 fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffset)->Fill(1,nsdig);
245 fAliITSQADataMakerSim->GetSDigitsData(2+fGenOffset)->Fill(imod,nsdig);
379510c2 246 }
247 delete sdig;
248 }
249
250}
251
252//____________________________________________________________________________
253void AliITSQASPDDataMakerSim::InitHits()
254{
255 // Initialization for HITS data - SPD -
c71529b0 256 fGenOffset = (fAliITSQADataMakerSim->fHitsQAList)->GetEntries();
257 //printf("--W-- AliITSQASPDDataMakerSim::InitHits() fGenOffset= %d \n",fGenOffset);
379510c2 258 //fSPDhHits must be incremented by one unit every time a histogram is ADDED to the QA List
259 Char_t name[50];
260 Char_t title[50];
261
262 TH1F *hlayer = new TH1F("LayPattern_SPD","Layer map - SPD",6,0.,6.);
263 hlayer->GetXaxis()->SetTitle("Layer number");
264 hlayer->GetYaxis()->SetTitle("Entries");
c71529b0 265 fAliITSQADataMakerSim->Add2HitsList(hlayer,fGenOffset);
379510c2 266 fSPDhHits++;
267
268 TH1F **hmod = new TH1F*[2];
269 for (Int_t iLay=0; iLay<2; ++iLay) {
270 sprintf(name,"ModPattern_SPD%d",iLay+1);
271 sprintf(title,"Module map - SPD Layer %d",iLay+1);
272 hmod[iLay]=new TH1F(name,title,240,0,240);
273 hmod[iLay]->GetXaxis()->SetTitle("Module number");
274 hmod[iLay]->GetYaxis()->SetTitle("Entries");
c71529b0 275 fAliITSQADataMakerSim->Add2HitsList(hmod[iLay],1+iLay+fGenOffset);
379510c2 276 fSPDhHits++;
277 }
278
279 TH1F *hhitlenght = new TH1F("Lenght_SPD","Hit lenght along y_{loc} coord",210,0.,210.);
280 hhitlenght->GetXaxis()->SetTitle("Hit lenght [#mum]");
281 hhitlenght->GetYaxis()->SetTitle("# hits");
c71529b0 282 fAliITSQADataMakerSim->Add2HitsList(hhitlenght,3+fGenOffset);
379510c2 283 fSPDhHits++;
284
285 TH1F *hEdepos = new TH1F("EnergyDeposit_SPD","Deposited energy distribution (y_{loc}>180 #mum)",150,0.,300.);
286 hEdepos->GetXaxis()->SetTitle("Deposited energy [keV]");
287 hEdepos->GetYaxis()->SetTitle("# hits");
c71529b0 288 fAliITSQADataMakerSim->Add2HitsList(hEdepos,4+fGenOffset);
379510c2 289 fSPDhHits++;
290
291 AliDebug(1,Form("%d SPD Hits histograms booked\n",fSPDhHits));
292
293}
294
295//____________________________________________________________________________
296void AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
297{
298 // Fill QA for HITS - SPD -
299 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
300 fITS->SetTreeAddress();
301 Int_t nmodules;
302 fITS->InitModules(-1,nmodules); //-1->number of modules taken from AliITSgeom class kept in fITSgeom
303 //nmodules is set
304
305 fITS->FillModules(hits,0);
306
307 for (Int_t imod=0; imod<240; ++imod){
308 AliITSmodule *module = fITS->GetModule(imod);
309 TObjArray *arrHits = module->GetHits();
310 Int_t nhits = arrHits->GetEntriesFast();
311 if (imod<80) {
c71529b0 312 fAliITSQADataMakerSim->GetHitsData(fGenOffset)->Fill(0.5,nhits);
313 fAliITSQADataMakerSim->GetHitsData(1+fGenOffset)->Fill(imod,nhits);
379510c2 314 } else {
c71529b0 315 fAliITSQADataMakerSim->GetHitsData(fGenOffset)->Fill(1,nhits);
316 fAliITSQADataMakerSim->GetHitsData(2+fGenOffset)->Fill(imod,nhits);
379510c2 317 }
379510c2 318 for (Int_t iHit=0; iHit<nhits; ++iHit) {
319 AliITShit *hit = (AliITShit*) arrHits->At(iHit);
320 Double_t xl,yl,zl,xl0,yl0,zl0;
321 Double_t tof,tof0;
322 hit->GetPositionL(xl,yl,zl,tof);
323 hit->GetPositionL0(xl0,yl0,zl0,tof0);
324 Float_t dyloc=TMath::Abs(yl-yl0)*10000.;
c71529b0 325 fAliITSQADataMakerSim->GetHitsData(3+fGenOffset)->Fill(dyloc);
379510c2 326 Float_t edep=hit->GetIonization()*1000000;
327 if(dyloc>180.){
c71529b0 328 fAliITSQADataMakerSim->GetHitsData(4+fGenOffset)->Fill(edep);
379510c2 329 }
330 }
331 }
332}