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