Fixes for bug #49914: Compilation breaks in trunk, and bug #48629: Trunk cannot read...
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDDataMakerSim.cxx
CommitLineData
7a0e5776 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// *************************************************************
19// Checks the quality assurance
20// by comparing with reference data
21// contained in a DB
22// -------------------------------------------------------------
23// W. Ferrarese + P. Cerello Feb 2008
24// INFN Torino
25// SSD QA part: P. Christakoglou - NIKHEF/UU
26
27// --- ROOT system ---
28#include <TTree.h>
29#include <TH1.h>
30#include <TH2.h>
31#include <TMath.h>
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliITS.h"
36#include "AliITSmodule.h"
37#include "AliITShit.h"
38#include "AliITSdigit.h"
39#include "AliITSpListItem.h"
40#include "AliRun.h"
41#include "AliITSQADataMakerSim.h"
42#include "AliITSQASSDDataMakerSim.h"
43#include "AliLog.h"
4e25ac79 44#include "AliQAv1.h"
7a0e5776 45#include "AliQAChecker.h"
46#include "AliRawReader.h"
47
48ClassImp(AliITSQASSDDataMakerSim)
49
50//____________________________________________________________________________
51AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :
52TObject(),
53fAliITSQADataMakerSim(aliITSQADataMakerSim),
54//fSSDhTask(0),
55fSSDhHTask(0),
56fSSDhSTask(0),
57fSSDhDTask(0),
58fGenOffsetH(0),
59fGenOffsetS(0),
60fGenOffsetD(0)
61{
62 //ctor used to discriminate OnLine-Offline analysis
63}
64
65//____________________________________________________________________________
66AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(const AliITSQASSDDataMakerSim& qadm) :
67TObject(),
68fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),
69//fSSDhTask(qadm.fSSDhTask),
70fSSDhHTask(qadm.fSSDhHTask),
71fSSDhSTask(qadm.fSSDhSTask),
72fSSDhDTask(qadm.fSSDhDTask),
73fGenOffsetH(qadm.fGenOffsetH),
74fGenOffsetS(qadm.fGenOffsetS),
75fGenOffsetD(qadm.fGenOffsetD)
76{
77 //copy ctor
78 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ;
79 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());
80 }
81
82//__________________________________________________________________
83AliITSQASSDDataMakerSim& AliITSQASSDDataMakerSim::operator = (const AliITSQASSDDataMakerSim& qac ) {
84 // Equal operator.
85 this->~AliITSQASSDDataMakerSim();
86 new(this) AliITSQASSDDataMakerSim(qac);
87 return *this;
88}
89
90//____________________________________________________________________________
91void AliITSQASSDDataMakerSim::StartOfDetectorCycle() {
92 //Detector specific actions at start of cycle
93 AliDebug(1,"AliITSQADM::Start of SSD Cycle\n");
94}
95
96//____________________________________________________________________________
4e25ac79 97void AliITSQASSDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/) {
7a0e5776 98 // launch the QA checking
4e25ac79 99 AliDebug(1,"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n");
7a0e5776 100
4e25ac79 101// AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
7a0e5776 102}
103
104//____________________________________________________________________________
105void AliITSQASSDDataMakerSim::InitDigits() {
106 // Initialization for DIGIT data - SSD -
57acd2d2 107 fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 108
109 // custom code here
110 TH1F *fHistSSDModule = new TH1F("fHistSSDDigitsModule",
111 ";SSD Module Number;N_{DIGITS}",
112 1698,499.5,2197.5);
113 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModule,
114 fGenOffsetD + 0);
115 fSSDhDTask += 1;
116 TH2F *fHistSSDModuleStrip = new TH2F("fHistSSDDigitsModuleStrip",
117 ";N_{Strip};N_{Module}",
118 1540,0,1540,1698,499.5,2197.5);
119 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModuleStrip,
120 fGenOffsetD + 1);
121 fSSDhDTask += 1;
122
123 AliDebug(1,Form("%d SSD Digits histograms booked\n",fSSDhDTask));
124
125}
126
127//____________________________________________________________________________
128void AliITSQASSDDataMakerSim::MakeDigits(TTree *digits) {
129 // Fill QA for DIGIT - SSD -
130 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
131 fITS->SetTreeAddress();
132 TClonesArray *iSSDdigits = fITS->DigitsAddress(2);
133 for(Int_t iModule = 500; iModule < 2198; iModule++) {
134 iSSDdigits->Clear();
135 digits->GetEvent(iModule);
136 Int_t ndigits = iSSDdigits->GetEntries();
137 fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 0)->Fill(iModule,ndigits);
138 if(ndigits != 0)
139 AliDebug(1,Form("Module: %d - Digits: %d",iModule,ndigits));
140
141 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {
142 AliITSdigit *dig = (AliITSdigit*)iSSDdigits->UncheckedAt(iDigit);
143 Int_t fStripNumber = (dig->GetCoord1() == 0) ? dig->GetCoord2() : dig->GetCoord2() + fgkNumberOfPSideStrips;
144 ((TH2F *)fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 1))->Fill(fStripNumber,iModule,dig->GetSignal());
145 }//digit loop
146 }//module loop
147}
148
149//____________________________________________________________________________
150void AliITSQASSDDataMakerSim::InitSDigits() {
151 // Initialization for SDIGIT data - SSD -
57acd2d2 152 fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 153
154 // custom code here
155 TH1F *fHistSSDModule = new TH1F("fHistSSDSDigitsModule",
156 ";SSD Module Number;N_{SDIGITS}",
157 1698,499.5,2197.5);
158 fAliITSQADataMakerSim->Add2SDigitsList(fHistSSDModule,
159 fGenOffsetS + 0);
160 fSSDhSTask += 1;
161
162 AliDebug(1,Form("%d SSD SDigits histograms booked\n",fSSDhSTask));
163}
164
165//____________________________________________________________________________
166void AliITSQASSDDataMakerSim::MakeSDigits(TTree *sdigits) {
167 // Fill QA for SDIGIT - SSD -
168 static TClonesArray iSSDEmpty("AliITSpListItem",10000);
169 iSSDEmpty.Clear();
170 TClonesArray *iSSDsdigits = &iSSDEmpty;
171
172 AliInfo(Form("Trying to access the sdigits histogram: %d\n",fGenOffsetS));
173
174 TBranch *brchSDigits = sdigits->GetBranch("ITS");
175 brchSDigits->SetAddress(&iSSDsdigits);
176 for(Int_t iModule = 500; iModule < 2198; iModule++) {
177 iSSDsdigits->Clear();
178 sdigits->GetEvent(iModule);
179 Int_t ndigits = iSSDsdigits->GetEntries();
180 fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS + 0)->Fill(iModule,ndigits);
181 if(ndigits != 0)
182 AliDebug(1,Form("Module: %d - Digits: %d",iModule,ndigits));
183
184 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {
185 AliITSpListItem *dig=(AliITSpListItem*)iSSDsdigits->At(iDigit);
186 dig=0;
187 }//digit loop
188 }//module loop
189}
190
191//____________________________________________________________________________
192void AliITSQASSDDataMakerSim::InitHits() {
193 // Initialization for HITS data - SSD -
57acd2d2 194 fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();
7a0e5776 195
196 // custom code here
197 TH1F *fHistSSDModule = new TH1F("fHistSSDHitsModule",
198 ";SDD Module Number;N_{HITS}",
199 1698,499.5,2197.5);
200 fAliITSQADataMakerSim->Add2HitsList(fHistSSDModule,
201 fGenOffsetH + 0);
202 fSSDhHTask += 1;
203 TH1F *fHistSSDGlobalX = new TH1F("fHistSSDHitsGlobalX",
204 ";x [cm];Entries",
205 1000,-50.,50.);
206 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalX,
207 fGenOffsetH + 1);
208 fSSDhHTask += 1;
209 TH1F *fHistSSDGlobalY = new TH1F("fHistSSDHitsGlobalY",
210 ";y [cm];Entries",
211 1000,-50.,50.);
212 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalY,
213 fGenOffsetH + 2);
214 fSSDhHTask += 1;
215 TH1F *fHistSSDGlobalZ = new TH1F("fHistSSDHitsGlobalZ",
216 ";z [cm];Entries",
217 1000,-60.,60.);
218 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalZ,
219 fGenOffsetH + 3);
220 fSSDhHTask += 1;
221 TH1F *fHistSSDLocalX = new TH1F("fHistSSDHitsLocalX",
222 ";x [cm];Entries",
223 1000,-4.,4.);
224 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalX,
225 fGenOffsetH + 4);
226 fSSDhHTask += 1;
227 TH1F *fHistSSDLocalY = new TH1F("fHistSSDHitsLocalY",
228 ";y [cm];Entries",
229 1000,-0.1,0.1);
230 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalY,
231 fGenOffsetH + 5);
232 fSSDhHTask += 1;
233 TH1F *fHistSSDLocalZ = new TH1F("fHistSSDHitsLocalZ",
234 ";z [cm];Entries",
235 1000,-4.,4.);
236 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalZ,
237 fGenOffsetH + 6);
238 fSSDhHTask += 1;
239 TH1F *fHistSSDIonization = new TH1F("fHistSSDHitsIonization",
240 ";log(dE/dx) [KeV];N_{Hits}",
241 100,-7,-2);
242 fAliITSQADataMakerSim->Add2HitsList(fHistSSDIonization,
243 fGenOffsetH + 7 );
244 fSSDhHTask += 1;
245 TH2F *fHistSSDGlobalXY = new TH2F("fHistSSDHitsGlobalXY",
246 ";x [cm];y [cm]",
247 1000,-50.,50.,
248 1000,-50.,50.);
249 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalXY,
250 fGenOffsetH + 8 );
251 fSSDhHTask += 1;
252
253 AliDebug(1,Form("%d SSD Hits histograms booked\n",fSSDhHTask));
254}
255
256
257//____________________________________________________________________________
258void AliITSQASSDDataMakerSim::MakeHits(TTree *hits) {
259 // Fill QA for HITS - SSD -
260 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");
261 fITS->SetTreeAddress();
262 Int_t nmodules;
263 fITS->InitModules(-1,nmodules);
264 fITS->FillModules(hits,0);
265 for(Int_t iModule = 500; iModule < 2198; iModule++) {
266 AliITSmodule *module = fITS->GetModule(iModule);
267 TObjArray *arrHits = module->GetHits();
268 Int_t nhits = arrHits->GetEntriesFast();
269 if(nhits != 0)
270 AliDebug(1,Form("Module: %d - Hits: %d",iModule,nhits));
271 for (Int_t iHit = 0; iHit < nhits; iHit++) {
272 AliITShit *hit = (AliITShit*) arrHits->At(iHit);
273
274 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 0)->Fill(iModule);
275 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 1)->Fill(hit->GetXG());
276 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 2)->Fill(hit->GetYG());
277 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 3)->Fill(hit->GetZG());
278 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 4)->Fill(hit->GetXL());
279 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 5)->Fill(hit->GetYL());
280 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 6)->Fill(hit->GetZL());
281 if(hit->GetIonization())
282 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 7)->Fill(TMath::Log10(hit->GetIonization()));
283 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 8)->Fill(hit->GetXG(),hit->GetYG());
284 }//hit loop
285 }//module loop
286}
287
288
289
290
291//____________________________________________________________________________
4e25ac79 292Int_t AliITSQASSDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
7a0e5776 293 // Returns histogram offset according to the specified task
294 Int_t offset=0;
4e25ac79 295 if( task == AliQAv1::kHITS){
7a0e5776 296 offset=fGenOffsetH;
297 }
4e25ac79 298 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 299 offset=fGenOffsetS;
300 }
4e25ac79 301 else if( task == AliQAv1::kDIGITS) {
7a0e5776 302 offset=fGenOffsetD;
303 }
304 else {
305 AliInfo("No task has been selected. TaskHisto set to zero.\n");
306 }
307
308 return offset;
309}
310
311
312//____________________________________________________________________________
4e25ac79 313Int_t AliITSQASSDDataMakerSim::GetTaskHisto(AliQAv1::TASKINDEX_t task) {
7a0e5776 314 // Returns the number of booked histograms for the selected task
315 Int_t histotot=0;
4e25ac79 316 if( task == AliQAv1::kHITS) {
7a0e5776 317 histotot=fSSDhHTask ;
318 }
4e25ac79 319 else if( task == AliQAv1::kSDIGITS) {
7a0e5776 320 histotot=fSSDhSTask;
321 }
4e25ac79 322 else if( task == AliQAv1::kDIGITS) {
7a0e5776 323 histotot=fSSDhDTask ;
324 }
325 else {
326 AliInfo("No task has been selected. TaskHisto set to zero.\n");
327 }
328 return histotot;
329
330}