Remove AliPoint from TRD code
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDDataMakerSim.cxx
CommitLineData
3647765c 1/**************************************************************************\r
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id$ */\r
17\r
18// *************************************************************\r
19// Checks the quality assurance \r
20// by comparing with reference data\r
21// contained in a DB\r
22// -------------------------------------------------------------\r
23// W. Ferrarese + P. Cerello Feb 2008\r
24// INFN Torino\r
25// SSD QA part: P. Christakoglou - NIKHEF/UU\r
26\r
27// --- ROOT system ---\r
28#include <TTree.h>\r
29#include <TH1.h>\r
30#include <TH2.h>\r
31#include <TMath.h>\r
32// --- Standard library ---\r
33\r
34// --- AliRoot header files ---\r
35#include "AliITS.h"\r
36#include "AliITSmodule.h"\r
37#include "AliITShit.h"\r
38#include "AliITSdigit.h"\r
39#include "AliITSpListItem.h"\r
40#include "AliRun.h"\r
41#include "AliITSQADataMakerSim.h"\r
42#include "AliITSQASSDDataMakerSim.h"\r
43#include "AliLog.h"\r
44#include "AliQA.h"\r
45#include "AliQAChecker.h"\r
46#include "AliRawReader.h"\r
47\r
48ClassImp(AliITSQASSDDataMakerSim)\r
49\r
50//____________________________________________________________________________ \r
51AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(AliITSQADataMakerSim *aliITSQADataMakerSim) :\r
52TObject(),\r
53fAliITSQADataMakerSim(aliITSQADataMakerSim),\r
54fSSDhTask(0),\r
3f905799 55fGenOffsetH(0),\r
56fGenOffsetS(0), \r
57fGenOffsetD(0) \r
58{\r
3647765c 59 //ctor used to discriminate OnLine-Offline analysis \r
60}\r
61\r
62//____________________________________________________________________________ \r
63AliITSQASSDDataMakerSim::AliITSQASSDDataMakerSim(const AliITSQASSDDataMakerSim& qadm) :\r
64TObject(),\r
65fAliITSQADataMakerSim(qadm.fAliITSQADataMakerSim),\r
66fSSDhTask(qadm.fSSDhTask),\r
3f905799 67fGenOffsetH(qadm.fGenOffsetH), \r
68fGenOffsetS(qadm.fGenOffsetS), \r
69fGenOffsetD(qadm.fGenOffsetD) \r
70{\r
3647765c 71 //copy ctor \r
72 fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ; \r
73 fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());\r
74 }\r
75\r
76//__________________________________________________________________\r
77AliITSQASSDDataMakerSim& AliITSQASSDDataMakerSim::operator = (const AliITSQASSDDataMakerSim& qac ) {\r
78 // Equal operator.\r
79 this->~AliITSQASSDDataMakerSim();\r
80 new(this) AliITSQASSDDataMakerSim(qac);\r
81 return *this;\r
82}\r
83\r
84//____________________________________________________________________________ \r
85void AliITSQASSDDataMakerSim::StartOfDetectorCycle() {\r
86 //Detector specific actions at start of cycle\r
87 AliDebug(1,"AliITSQADM::Start of SSD Cycle\n");\r
88}\r
89\r
90//____________________________________________________________________________ \r
e78937db 91void AliITSQASSDDataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray* list) {\r
3647765c 92 // launch the QA checking\r
93 AliDebug(1,"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)\n"); \r
94 \r
e78937db 95 AliQAChecker::Instance()->Run( AliQA::kITS , task, list);\r
3647765c 96}\r
97\r
98//____________________________________________________________________________ \r
99void AliITSQASSDDataMakerSim::InitDigits() { \r
100 // Initialization for DIGIT data - SSD -\r
3f905799 101 fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList)->GetEntries();\r
3647765c 102\r
103 // custom code here\r
104 TH1F *fHistSSDModule = new TH1F("fHistSSDDigitsModule",\r
105 ";SSD Module Number;N_{DIGITS}",\r
106 1698,499.5,2197.5); \r
107 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModule,\r
3f905799 108 fGenOffsetD + 0);\r
3647765c 109 fSSDhTask += 1;\r
110 TH2F *fHistSSDModuleStrip = new TH2F("fHistSSDDigitsModuleStrip",\r
111 ";N_{Strip};N_{Module}",\r
112 1540,0,1540,1698,499.5,2197.5); \r
113 fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModuleStrip,\r
3f905799 114 fGenOffsetD + 1);\r
3647765c 115 fSSDhTask += 1;\r
116\r
117 AliDebug(1,Form("%d SSD Digits histograms booked\n",fSSDhTask));\r
118\r
119}\r
120\r
121//____________________________________________________________________________\r
122void AliITSQASSDDataMakerSim::MakeDigits(TTree *digits) { \r
123 // Fill QA for DIGIT - SSD -\r
124 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
125 fITS->SetTreeAddress();\r
126 TClonesArray *iSSDdigits = fITS->DigitsAddress(2);\r
127 for(Int_t iModule = 500; iModule < 2198; iModule++) {\r
128 iSSDdigits->Clear();\r
129 digits->GetEvent(iModule); \r
130 Int_t ndigits = iSSDdigits->GetEntries();\r
3f905799 131 fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 0)->Fill(iModule,ndigits);\r
3647765c 132 if(ndigits != 0)\r
133 AliDebug(1,Form("Module: %d - Digits: %d",iModule,ndigits));\r
134 \r
135 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {\r
136 AliITSdigit *dig = (AliITSdigit*)iSSDdigits->UncheckedAt(iDigit);\r
137 Int_t fStripNumber = (dig->GetCoord1() == 0) ? dig->GetCoord2() : dig->GetCoord2() + fgkNumberOfPSideStrips;\r
3f905799 138 ((TH2F *)fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 1))->Fill(fStripNumber,iModule,dig->GetSignal());\r
3647765c 139 }//digit loop\r
140 }//module loop\r
141}\r
142\r
143//____________________________________________________________________________ \r
144void AliITSQASSDDataMakerSim::InitSDigits() { \r
145 // Initialization for SDIGIT data - SSD -\r
3f905799 146 fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList)->GetEntries();\r
3647765c 147\r
148 // custom code here\r
149 TH1F *fHistSSDModule = new TH1F("fHistSSDSDigitsModule",\r
150 ";SSD Module Number;N_{SDIGITS}",\r
151 1698,499.5,2197.5); \r
152 fAliITSQADataMakerSim->Add2SDigitsList(fHistSSDModule,\r
3f905799 153 fGenOffsetS + 0);\r
3647765c 154 fSSDhTask += 1; \r
155\r
156 AliDebug(1,Form("%d SSD SDigits histograms booked\n",fSSDhTask));\r
157}\r
158\r
159//____________________________________________________________________________\r
160void AliITSQASSDDataMakerSim::MakeSDigits(TTree *sdigits) { \r
161 // Fill QA for SDIGIT - SSD -\r
162 static TClonesArray iSSDEmpty("AliITSpListItem",10000);\r
163 iSSDEmpty.Clear();\r
164 TClonesArray *iSSDsdigits = &iSSDEmpty;\r
165\r
3f905799 166 AliInfo(Form("Trying to access the sdigits histogram: %d\n",fGenOffsetS));\r
e78937db 167\r
3647765c 168 TBranch *brchSDigits = sdigits->GetBranch("ITS");\r
169 brchSDigits->SetAddress(&iSSDsdigits);\r
170 for(Int_t iModule = 500; iModule < 2198; iModule++) {\r
171 iSSDsdigits->Clear();\r
172 sdigits->GetEvent(iModule); \r
173 Int_t ndigits = iSSDsdigits->GetEntries();\r
3f905799 174 fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS + 0)->Fill(iModule,ndigits);\r
3647765c 175 if(ndigits != 0)\r
176 AliDebug(1,Form("Module: %d - Digits: %d",iModule,ndigits));\r
177\r
178 for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {\r
179 AliITSpListItem *dig=(AliITSpListItem*)iSSDsdigits->At(iDigit);\r
180 dig=0;\r
181 }//digit loop\r
182 }//module loop\r
183}\r
184\r
185//____________________________________________________________________________ \r
186void AliITSQASSDDataMakerSim::InitHits() { \r
187 // Initialization for HITS data - SSD -\r
3f905799 188 fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList)->GetEntries();\r
3647765c 189\r
190 // custom code here\r
191 TH1F *fHistSSDModule = new TH1F("fHistSSDHitsModule",\r
192 ";SDD Module Number;N_{HITS}",\r
193 1698,499.5,2197.5); \r
194 fAliITSQADataMakerSim->Add2HitsList(fHistSSDModule,\r
3f905799 195 fGenOffsetH + 0);\r
3647765c 196 fSSDhTask += 1;\r
197 TH1F *fHistSSDGlobalX = new TH1F("fHistSSDHitsGlobalX",\r
198 ";x [cm];Entries",\r
199 1000,-50.,50.);\r
200 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalX,\r
3f905799 201 fGenOffsetH + 1);\r
3647765c 202 fSSDhTask += 1;\r
203 TH1F *fHistSSDGlobalY = new TH1F("fHistSSDHitsGlobalY",\r
204 ";y [cm];Entries",\r
205 1000,-50.,50.);\r
206 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalY,\r
3f905799 207 fGenOffsetH + 2);\r
3647765c 208 fSSDhTask += 1;\r
209 TH1F *fHistSSDGlobalZ = new TH1F("fHistSSDHitsGlobalZ",\r
210 ";z [cm];Entries",\r
211 1000,-60.,60.);\r
212 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalZ,\r
3f905799 213 fGenOffsetH + 3);\r
3647765c 214 fSSDhTask += 1;\r
215 TH1F *fHistSSDLocalX = new TH1F("fHistSSDHitsLocalX",\r
216 ";x [cm];Entries",\r
217 1000,-4.,4.);\r
218 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalX,\r
3f905799 219 fGenOffsetH + 4);\r
3647765c 220 fSSDhTask += 1;\r
221 TH1F *fHistSSDLocalY = new TH1F("fHistSSDHitsLocalY",\r
222 ";y [cm];Entries",\r
223 1000,-0.1,0.1);\r
224 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalY,\r
3f905799 225 fGenOffsetH + 5);\r
3647765c 226 fSSDhTask += 1;\r
227 TH1F *fHistSSDLocalZ = new TH1F("fHistSSDHitsLocalZ",\r
228 ";z [cm];Entries",\r
229 1000,-4.,4.);\r
230 fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalZ,\r
3f905799 231 fGenOffsetH + 6);\r
3647765c 232 fSSDhTask += 1;\r
233 TH1F *fHistSSDIonization = new TH1F("fHistSSDHitsIonization",\r
234 ";log(dE/dx) [KeV];N_{Hits}",\r
235 100,-7,-2);\r
236 fAliITSQADataMakerSim->Add2HitsList(fHistSSDIonization,\r
3f905799 237 fGenOffsetH + 7 );\r
3647765c 238 fSSDhTask += 1;\r
239 TH2F *fHistSSDGlobalXY = new TH2F("fHistSSDHitsGlobalXY",\r
240 ";x [cm];y [cm]",\r
241 1000,-50.,50.,\r
242 1000,-50.,50.);\r
243 fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalXY,\r
3f905799 244 fGenOffsetH + 8 );\r
3647765c 245 fSSDhTask += 1;\r
246 \r
247 AliDebug(1,Form("%d SSD Hits histograms booked\n",fSSDhTask));\r
248}\r
249\r
250\r
251//____________________________________________________________________________\r
252void AliITSQASSDDataMakerSim::MakeHits(TTree *hits) { \r
253 // Fill QA for HITS - SSD -\r
254 AliITS *fITS = (AliITS*)gAlice->GetModule("ITS");\r
255 fITS->SetTreeAddress();\r
256 Int_t nmodules;\r
257 fITS->InitModules(-1,nmodules);\r
258 fITS->FillModules(hits,0);\r
259 for(Int_t iModule = 500; iModule < 2198; iModule++) {\r
260 AliITSmodule *module = fITS->GetModule(iModule);\r
261 TObjArray *arrHits = module->GetHits();\r
262 Int_t nhits = arrHits->GetEntriesFast();\r
263 if(nhits != 0)\r
264 AliDebug(1,Form("Module: %d - Hits: %d",iModule,nhits));\r
265 for (Int_t iHit = 0; iHit < nhits; iHit++) {\r
266 AliITShit *hit = (AliITShit*) arrHits->At(iHit);\r
267 \r
3f905799 268 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 0)->Fill(iModule);\r
269 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 1)->Fill(hit->GetXG());\r
270 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 2)->Fill(hit->GetYG());\r
271 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 3)->Fill(hit->GetZG());\r
272 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 4)->Fill(hit->GetXL());\r
273 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 5)->Fill(hit->GetYL());\r
274 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 6)->Fill(hit->GetZL());\r
3647765c 275 if(hit->GetIonization())\r
3f905799 276 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 7)->Fill(TMath::Log10(hit->GetIonization()));\r
277 fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 8)->Fill(hit->GetXG(),hit->GetYG());\r
3647765c 278 }//hit loop\r
279 }//module loop \r
280}\r