]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | /* | |
17 | $Log$ | |
f74bb6f5 | 18 | Revision 1.20 2000/06/30 12:07:49 kowal2 |
19 | Updated from the TPC-PreRelease branch | |
20 | ||
73042f01 | 21 | Revision 1.19.2.4 2000/06/26 07:39:42 kowal2 |
22 | Changes to obey the coding rules | |
23 | ||
24 | Revision 1.19.2.3 2000/06/25 08:38:41 kowal2 | |
25 | Splitted from AliTPCtracking | |
26 | ||
27 | Revision 1.19.2.2 2000/06/16 12:59:28 kowal2 | |
28 | Changed parameter settings | |
29 | ||
30 | Revision 1.19.2.1 2000/06/09 07:15:07 kowal2 | |
31 | ||
32 | Defaults loaded automatically (hard-wired) | |
33 | Optional parameters can be set via macro called in the constructor | |
34 | ||
35 | Revision 1.19 2000/04/18 19:00:59 fca | |
36 | Small bug fixes to TPC files | |
37 | ||
4d68a14a | 38 | Revision 1.18 2000/04/17 09:37:33 kowal2 |
39 | removed obsolete AliTPCDigitsDisplay.C | |
40 | ||
cc80f89e | 41 | Revision 1.17.2.2 2000/04/10 08:15:12 kowal2 |
42 | ||
43 | New, experimental data structure from M. Ivanov | |
44 | New tracking algorithm | |
45 | Different pad geometry for different sectors | |
46 | Digitization rewritten | |
47 | ||
48 | Revision 1.17.2.1 2000/04/10 07:56:53 kowal2 | |
49 | Not used anymore - removed | |
50 | ||
51 | Revision 1.17 2000/01/19 17:17:30 fca | |
52 | Introducing a list of lists of hits -- more hits allowed for detector now | |
53 | ||
1cedd08a | 54 | Revision 1.16 1999/11/05 09:29:23 fca |
55 | Accept only signals > 0 | |
56 | ||
921bf71a | 57 | Revision 1.15 1999/10/08 06:26:53 fca |
58 | Removed ClustersIndex - not used anymore | |
59 | ||
e674b993 | 60 | Revision 1.14 1999/09/29 09:24:33 fca |
61 | Introduction of the Copyright and cvs Log | |
62 | ||
4c039060 | 63 | */ |
64 | ||
fe4da5cc | 65 | /////////////////////////////////////////////////////////////////////////////// |
66 | // // | |
67 | // Time Projection Chamber // | |
68 | // This class contains the basic functions for the Time Projection Chamber // | |
69 | // detector. Functions specific to one particular geometry are // | |
70 | // contained in the derived classes // | |
71 | // // | |
72 | //Begin_Html | |
73 | /* | |
1439f98e | 74 | <img src="picts/AliTPCClass.gif"> |
fe4da5cc | 75 | */ |
76 | //End_Html | |
77 | // // | |
8c555625 | 78 | // // |
fe4da5cc | 79 | /////////////////////////////////////////////////////////////////////////////// |
80 | ||
73042f01 | 81 | // |
82 | ||
fe4da5cc | 83 | #include <TMath.h> |
84 | #include <TRandom.h> | |
85 | #include <TVector.h> | |
8c555625 | 86 | #include <TMatrix.h> |
fe4da5cc | 87 | #include <TGeometry.h> |
88 | #include <TNode.h> | |
89 | #include <TTUBS.h> | |
90 | #include <TObjectTable.h> | |
1578254f | 91 | #include "TParticle.h" |
fe4da5cc | 92 | #include "AliTPC.h" |
73042f01 | 93 | #include <TFile.h> |
fe4da5cc | 94 | #include "AliRun.h" |
95 | #include <iostream.h> | |
96 | #include <fstream.h> | |
97 | #include "AliMC.h" | |
98 | ||
cc80f89e | 99 | |
73042f01 | 100 | #include "AliTPCParamSR.h" |
8c555625 | 101 | #include "AliTPCPRF2D.h" |
102 | #include "AliTPCRF1D.h" | |
cc80f89e | 103 | #include "AliDigits.h" |
104 | #include "AliSimDigits.h" | |
105 | ||
106 | #include "AliTPCDigitsArray.h" | |
107 | #include "AliCluster.h" | |
108 | #include "AliClusters.h" | |
109 | #include "AliTPCClustersRow.h" | |
110 | #include "AliTPCClustersArray.h" | |
8c555625 | 111 | |
73042f01 | 112 | #include "AliTPCcluster.h" |
113 | #include "AliTPCclusterer.h" | |
114 | #include "AliTPCtracker.h" | |
8c555625 | 115 | |
73042f01 | 116 | #include <TInterpreter.h> |
1283eee5 | 117 | |
fe4da5cc | 118 | ClassImp(AliTPC) |
119 | ||
120 | //_____________________________________________________________________________ | |
121 | AliTPC::AliTPC() | |
122 | { | |
123 | // | |
124 | // Default constructor | |
125 | // | |
126 | fIshunt = 0; | |
fe4da5cc | 127 | fHits = 0; |
128 | fDigits = 0; | |
fe4da5cc | 129 | fNsectors = 0; |
cc80f89e | 130 | //MI changes |
131 | fDigitsArray = 0; | |
132 | fClustersArray = 0; | |
73042f01 | 133 | fTPCParam=0; |
fe4da5cc | 134 | } |
135 | ||
136 | //_____________________________________________________________________________ | |
137 | AliTPC::AliTPC(const char *name, const char *title) | |
138 | : AliDetector(name,title) | |
139 | { | |
140 | // | |
141 | // Standard constructor | |
142 | // | |
143 | ||
144 | // | |
145 | // Initialise arrays of hits and digits | |
146 | fHits = new TClonesArray("AliTPChit", 176); | |
4d68a14a | 147 | gAlice->AddHitList(fHits); |
cc80f89e | 148 | //MI change |
149 | fDigitsArray = 0; | |
150 | fClustersArray= 0; | |
fe4da5cc | 151 | // |
152 | // Initialise counters | |
cc80f89e | 153 | fNsectors = 0; |
cc80f89e | 154 | |
fe4da5cc | 155 | // |
156 | fIshunt = 0; | |
157 | // | |
158 | // Initialise color attributes | |
159 | SetMarkerColor(kYellow); | |
73042f01 | 160 | |
161 | // | |
162 | // Set TPC parameters | |
163 | // | |
164 | ||
165 | if (!strcmp(title,"Default")) { | |
166 | fTPCParam = new AliTPCParamSR; | |
167 | } else { | |
168 | cerr<<"AliTPC warning: in Config.C you must set non-default parameters\n"; | |
169 | fTPCParam=0; | |
170 | } | |
171 | ||
fe4da5cc | 172 | } |
173 | ||
174 | //_____________________________________________________________________________ | |
175 | AliTPC::~AliTPC() | |
176 | { | |
177 | // | |
178 | // TPC destructor | |
179 | // | |
73042f01 | 180 | |
fe4da5cc | 181 | fIshunt = 0; |
182 | delete fHits; | |
183 | delete fDigits; | |
73042f01 | 184 | delete fTPCParam; |
fe4da5cc | 185 | } |
186 | ||
fe4da5cc | 187 | //_____________________________________________________________________________ |
188 | void AliTPC::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
189 | { | |
190 | // | |
191 | // Add a hit to the list | |
192 | // | |
193 | TClonesArray &lhits = *fHits; | |
194 | new(lhits[fNhits++]) AliTPChit(fIshunt,track,vol,hits); | |
195 | } | |
196 | ||
fe4da5cc | 197 | //_____________________________________________________________________________ |
198 | void AliTPC::BuildGeometry() | |
199 | { | |
cc80f89e | 200 | |
fe4da5cc | 201 | // |
202 | // Build TPC ROOT TNode geometry for the event display | |
203 | // | |
73042f01 | 204 | TNode *nNode, *nTop; |
fe4da5cc | 205 | TTUBS *tubs; |
206 | Int_t i; | |
207 | const int kColorTPC=19; | |
1283eee5 | 208 | char name[5], title[25]; |
fe4da5cc | 209 | const Double_t kDegrad=TMath::Pi()/180; |
1283eee5 | 210 | const Double_t kRaddeg=180./TMath::Pi(); |
211 | ||
1283eee5 | 212 | |
73042f01 | 213 | Float_t innerOpenAngle = fTPCParam->GetInnerAngle(); |
214 | Float_t outerOpenAngle = fTPCParam->GetOuterAngle(); | |
1283eee5 | 215 | |
73042f01 | 216 | Float_t innerAngleShift = fTPCParam->GetInnerAngleShift(); |
217 | Float_t outerAngleShift = fTPCParam->GetOuterAngleShift(); | |
1283eee5 | 218 | |
219 | Int_t nLo = fTPCParam->GetNInnerSector()/2; | |
220 | Int_t nHi = fTPCParam->GetNOuterSector()/2; | |
221 | ||
73042f01 | 222 | const Double_t kloAng = (Double_t)TMath::Nint(innerOpenAngle*kRaddeg); |
223 | const Double_t khiAng = (Double_t)TMath::Nint(outerOpenAngle*kRaddeg); | |
224 | const Double_t kloAngSh = (Double_t)TMath::Nint(innerAngleShift*kRaddeg); | |
225 | const Double_t khiAngSh = (Double_t)TMath::Nint(outerAngleShift*kRaddeg); | |
1283eee5 | 226 | |
227 | ||
73042f01 | 228 | const Double_t kloCorr = 1/TMath::Cos(0.5*kloAng*kDegrad); |
229 | const Double_t khiCorr = 1/TMath::Cos(0.5*khiAng*kDegrad); | |
1283eee5 | 230 | |
231 | Double_t rl,ru; | |
232 | ||
233 | ||
fe4da5cc | 234 | // |
235 | // Get ALICE top node | |
fe4da5cc | 236 | // |
1283eee5 | 237 | |
73042f01 | 238 | nTop=gAlice->GetGeometry()->GetNode("alice"); |
1283eee5 | 239 | |
240 | // inner sectors | |
241 | ||
cc80f89e | 242 | rl = fTPCParam->GetInnerRadiusLow(); |
243 | ru = fTPCParam->GetInnerRadiusUp(); | |
1283eee5 | 244 | |
245 | ||
fe4da5cc | 246 | for(i=0;i<nLo;i++) { |
247 | sprintf(name,"LS%2.2d",i); | |
1283eee5 | 248 | name[4]='\0'; |
249 | sprintf(title,"TPC low sector %3d",i); | |
250 | title[24]='\0'; | |
251 | ||
73042f01 | 252 | tubs = new TTUBS(name,title,"void",rl*kloCorr,ru*kloCorr,250., |
253 | kloAng*(i-0.5)+kloAngSh,kloAng*(i+0.5)+kloAngSh); | |
fe4da5cc | 254 | tubs->SetNumberOfDivisions(1); |
73042f01 | 255 | nTop->cd(); |
256 | nNode = new TNode(name,title,name,0,0,0,""); | |
257 | nNode->SetLineColor(kColorTPC); | |
258 | fNodes->Add(nNode); | |
fe4da5cc | 259 | } |
1283eee5 | 260 | |
fe4da5cc | 261 | // Outer sectors |
1283eee5 | 262 | |
cc80f89e | 263 | rl = fTPCParam->GetOuterRadiusLow(); |
264 | ru = fTPCParam->GetOuterRadiusUp(); | |
1283eee5 | 265 | |
fe4da5cc | 266 | for(i=0;i<nHi;i++) { |
267 | sprintf(name,"US%2.2d",i); | |
1283eee5 | 268 | name[4]='\0'; |
fe4da5cc | 269 | sprintf(title,"TPC upper sector %d",i); |
1283eee5 | 270 | title[24]='\0'; |
73042f01 | 271 | tubs = new TTUBS(name,title,"void",rl*khiCorr,ru*khiCorr,250, |
272 | khiAng*(i-0.5)+khiAngSh,khiAng*(i+0.5)+khiAngSh); | |
fe4da5cc | 273 | tubs->SetNumberOfDivisions(1); |
73042f01 | 274 | nTop->cd(); |
275 | nNode = new TNode(name,title,name,0,0,0,""); | |
276 | nNode->SetLineColor(kColorTPC); | |
277 | fNodes->Add(nNode); | |
fe4da5cc | 278 | } |
cc80f89e | 279 | |
73042f01 | 280 | } |
1283eee5 | 281 | |
fe4da5cc | 282 | //_____________________________________________________________________________ |
283 | Int_t AliTPC::DistancetoPrimitive(Int_t , Int_t ) | |
284 | { | |
285 | // | |
286 | // Calculate distance from TPC to mouse on the display | |
287 | // Dummy procedure | |
288 | // | |
289 | return 9999; | |
290 | } | |
291 | ||
73042f01 | 292 | void AliTPC::Clusters2Tracks(TFile *of) { |
3c0f9266 | 293 | //----------------------------------------------------------------- |
294 | // This is a track finder. | |
3c0f9266 | 295 | //----------------------------------------------------------------- |
73042f01 | 296 | AliTPCtracker::Clusters2Tracks(fTPCParam,of); |
fe4da5cc | 297 | } |
298 | ||
299 | //_____________________________________________________________________________ | |
300 | void AliTPC::CreateMaterials() | |
301 | { | |
8c555625 | 302 | //----------------------------------------------- |
fe4da5cc | 303 | // Create Materials for for TPC |
8c555625 | 304 | //----------------------------------------------- |
305 | ||
306 | //----------------------------------------------------------------- | |
307 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
308 | //----------------------------------------------------------------- | |
1283eee5 | 309 | |
73042f01 | 310 | Int_t iSXFLD=gAlice->Field()->Integ(); |
311 | Float_t sXMGMX=gAlice->Field()->Max(); | |
1283eee5 | 312 | |
313 | Float_t amat[5]; // atomic numbers | |
314 | Float_t zmat[5]; // z | |
315 | Float_t wmat[5]; // proportions | |
316 | ||
317 | Float_t density; | |
318 | ||
319 | // ********************* Gases ******************* | |
320 | ||
321 | //-------------------------------------------------------------- | |
322 | // pure gases | |
323 | //-------------------------------------------------------------- | |
324 | ||
325 | // Ne | |
326 | ||
327 | ||
73042f01 | 328 | Float_t aNe = 20.18; |
329 | Float_t zNe = 10.; | |
fe4da5cc | 330 | |
1283eee5 | 331 | density = 0.0009; |
332 | ||
73042f01 | 333 | AliMaterial(20,"Ne",aNe,zNe,density,999.,999.); |
1283eee5 | 334 | |
335 | // Ar | |
336 | ||
73042f01 | 337 | Float_t aAr = 39.948; |
338 | Float_t zAr = 18.; | |
1283eee5 | 339 | |
340 | density = 0.001782; | |
341 | ||
73042f01 | 342 | AliMaterial(21,"Ar",aAr,zAr,density,999.,999.); |
1283eee5 | 343 | |
73042f01 | 344 | Float_t aPure[2]; |
fe4da5cc | 345 | |
73042f01 | 346 | aPure[0] = aNe; |
347 | aPure[1] = aAr; | |
fe4da5cc | 348 | |
1283eee5 | 349 | |
350 | //-------------------------------------------------------------- | |
351 | // gases - compounds | |
352 | //-------------------------------------------------------------- | |
353 | ||
354 | Float_t amol[3]; | |
355 | ||
356 | // CO2 | |
357 | ||
358 | amat[0]=12.011; | |
359 | amat[1]=15.9994; | |
360 | ||
361 | zmat[0]=6.; | |
362 | zmat[1]=8.; | |
363 | ||
364 | wmat[0]=1.; | |
365 | wmat[1]=2.; | |
366 | ||
367 | density=0.001977; | |
368 | ||
369 | amol[0] = amat[0]*wmat[0]+amat[1]*wmat[1]; | |
370 | ||
371 | AliMixture(10,"CO2",amat,zmat,density,-2,wmat); | |
372 | ||
373 | // CF4 | |
374 | ||
375 | amat[0]=12.011; | |
376 | amat[1]=18.998; | |
377 | ||
378 | zmat[0]=6.; | |
379 | zmat[1]=9.; | |
380 | ||
381 | wmat[0]=1.; | |
382 | wmat[1]=4.; | |
383 | ||
384 | density=0.003034; | |
385 | ||
386 | amol[1] = amat[0]*wmat[0]+amat[1]*wmat[1]; | |
387 | ||
388 | AliMixture(11,"CF4",amat,zmat,density,-2,wmat); | |
389 | ||
390 | // CH4 | |
391 | ||
392 | amat[0]=12.011; | |
393 | amat[1]=1.; | |
394 | ||
395 | zmat[0]=6.; | |
396 | zmat[1]=1.; | |
397 | ||
398 | wmat[0]=1.; | |
399 | wmat[1]=4.; | |
400 | ||
401 | density=0.000717; | |
402 | ||
403 | amol[2] = amat[0]*wmat[0]+amat[1]*wmat[1]; | |
404 | ||
405 | AliMixture(12,"CH4",amat,zmat,density,-2,wmat); | |
406 | ||
407 | //---------------------------------------------------------------- | |
408 | // gases - mixtures, ID >= 20 pure gases, <= 10 ID < 20 -compounds | |
409 | //---------------------------------------------------------------- | |
410 | ||
fe4da5cc | 411 | char namate[21]; |
1283eee5 | 412 | |
413 | density = 0.; | |
414 | Float_t am=0; | |
415 | Int_t nc; | |
416 | ||
73042f01 | 417 | Float_t a,z,rho,absl,x0,buf[1]; |
1283eee5 | 418 | Int_t nbuf; |
419 | ||
420 | for(nc = 0;nc<fNoComp;nc++) | |
421 | { | |
422 | ||
423 | // retrive material constants | |
424 | ||
73042f01 | 425 | gMC->Gfmate((*fIdmate)[fMixtComp[nc]],namate,a,z,rho,x0,absl,buf,nbuf); |
1283eee5 | 426 | |
427 | amat[nc] = a; | |
428 | zmat[nc] = z; | |
429 | ||
430 | Int_t nnc = (fMixtComp[nc]>=20) ? fMixtComp[nc]%20 : fMixtComp[nc]%10; | |
431 | ||
73042f01 | 432 | am += fMixtProp[nc]*((fMixtComp[nc]>=20) ? aPure[nnc] : amol[nnc]); |
1283eee5 | 433 | density += fMixtProp[nc]*rho; // density of the mixture |
434 | ||
435 | } | |
436 | ||
437 | // mixture proportions by weight! | |
438 | ||
439 | for(nc = 0;nc<fNoComp;nc++) | |
440 | { | |
441 | ||
442 | Int_t nnc = (fMixtComp[nc]>=20) ? fMixtComp[nc]%20 : fMixtComp[nc]%10; | |
443 | ||
73042f01 | 444 | wmat[nc] = fMixtProp[nc]*((fMixtComp[nc]>=20) ? aPure[nnc] : amol[nnc])/am; |
1283eee5 | 445 | |
446 | } | |
fe4da5cc | 447 | |
1283eee5 | 448 | AliMixture(31,"Drift gas 1",amat,zmat,density,fNoComp,wmat); |
449 | AliMixture(32,"Drift gas 2",amat,zmat,density,fNoComp,wmat); | |
450 | AliMixture(33,"Drift gas 3",amat,zmat,density,fNoComp,wmat); | |
451 | ||
73042f01 | 452 | AliMedium(2, "Drift gas 1", 31, 0, iSXFLD, sXMGMX, 10., 999.,.1, .001, .001); |
453 | AliMedium(3, "Drift gas 2", 32, 0, iSXFLD, sXMGMX, 10., 999.,.1, .001, .001); | |
454 | AliMedium(4, "Drift gas 3", 33, 1, iSXFLD, sXMGMX, 10., 999.,.1, .001, .001); | |
1283eee5 | 455 | |
456 | // Air | |
457 | ||
458 | AliMaterial(24, "Air", 14.61, 7.3, .001205, 30420., 67500.); | |
459 | ||
73042f01 | 460 | AliMedium(24, "Air", 24, 0, iSXFLD, sXMGMX, 10., .1, .1, .1, .1); |
1283eee5 | 461 | |
462 | //---------------------------------------------------------------------- | |
463 | // solid materials | |
464 | //---------------------------------------------------------------------- | |
465 | ||
466 | // Al | |
467 | ||
468 | AliMaterial(30, "Al", 26.98, 13., 2.7, 8.9, 37.2); | |
469 | ||
73042f01 | 470 | AliMedium(0, "Al",30, 0, iSXFLD, sXMGMX, 10., .1, .1, .1, .1); |
1283eee5 | 471 | |
472 | // Si | |
473 | ||
474 | AliMaterial(31, "Si", 28.086, 14.,2.33, 9.36, 999.); | |
475 | ||
73042f01 | 476 | AliMedium(7, "Al",31, 0, iSXFLD, sXMGMX, 10., .1, .1, .1, .1); |
fe4da5cc | 477 | |
1283eee5 | 478 | |
479 | // Mylar C5H4O2 | |
480 | ||
481 | amat[0]=12.011; | |
482 | amat[1]=1.; | |
483 | amat[2]=15.9994; | |
484 | ||
485 | zmat[0]=6.; | |
486 | zmat[1]=1.; | |
487 | zmat[2]=8.; | |
488 | ||
489 | wmat[0]=5.; | |
490 | wmat[1]=4.; | |
491 | wmat[2]=2.; | |
492 | ||
493 | density = 1.39; | |
fe4da5cc | 494 | |
1283eee5 | 495 | AliMixture(32, "Mylar",amat,zmat,density,-3,wmat); |
496 | ||
73042f01 | 497 | AliMedium(5, "Mylar",32, 0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 498 | |
499 | ||
500 | ||
501 | ||
502 | // Carbon (normal) | |
503 | ||
504 | AliMaterial(33,"C normal",12.011,6.,2.265,18.8,999.); | |
505 | ||
73042f01 | 506 | AliMedium(6,"C normal",33,0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 507 | |
508 | // G10 for inner and outr field cage | |
509 | // G10 is 60% SiO2 + 40% epoxy, right now I use A and Z for SiO2 | |
510 | ||
511 | Float_t rhoFactor; | |
512 | ||
513 | amat[0]=28.086; | |
514 | amat[1]=15.9994; | |
515 | ||
516 | zmat[0]=14.; | |
517 | zmat[1]=8.; | |
518 | ||
519 | wmat[0]=1.; | |
520 | wmat[1]=2.; | |
521 | ||
522 | density = 1.7; | |
fe4da5cc | 523 | |
1283eee5 | 524 | |
525 | AliMixture(34,"G10 aux.",amat,zmat,density,-2,wmat); | |
526 | ||
527 | ||
73042f01 | 528 | gMC->Gfmate((*fIdmate)[34],namate,a,z,rho,x0,absl,buf,nbuf); |
1283eee5 | 529 | |
530 | Float_t thickX0 = 0.0052; // field cage in X0 units | |
fe4da5cc | 531 | |
1283eee5 | 532 | Float_t thick = 2.; // in cm |
533 | ||
73042f01 | 534 | x0=19.4; // G10 |
1283eee5 | 535 | |
73042f01 | 536 | rhoFactor = x0*thickX0/thick; |
1283eee5 | 537 | density = rho*rhoFactor; |
538 | ||
539 | AliMaterial(35,"G10-fc",a,z,density,999.,999.); | |
540 | ||
73042f01 | 541 | AliMedium(8,"G10-fc",35,0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 542 | |
543 | thickX0 = 0.0027; // inner vessel (eta <0.9) | |
544 | thick=0.5; | |
73042f01 | 545 | rhoFactor = x0*thickX0/thick; |
1283eee5 | 546 | density = rho*rhoFactor; |
547 | ||
548 | AliMaterial(36,"G10-iv",a,z,density,999.,999.); | |
549 | ||
73042f01 | 550 | AliMedium(9,"G10-iv",36,0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 551 | |
552 | // Carbon fibre | |
fe4da5cc | 553 | |
73042f01 | 554 | gMC->Gfmate((*fIdmate)[33],namate,a,z,rho,x0,absl,buf,nbuf); |
1283eee5 | 555 | |
556 | thickX0 = 0.0133; // outer vessel | |
557 | thick=3.0; | |
73042f01 | 558 | rhoFactor = x0*thickX0/thick; |
1283eee5 | 559 | density = rho*rhoFactor; |
560 | ||
561 | ||
562 | AliMaterial(37,"C-ov",a,z,density,999.,999.); | |
563 | ||
73042f01 | 564 | AliMedium(10,"C-ov",37,0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 565 | |
566 | thickX0=0.015; // inner vessel (cone, eta > 0.9) | |
567 | thick=1.5; | |
73042f01 | 568 | rhoFactor = x0*thickX0/thick; |
1283eee5 | 569 | density = rho*rhoFactor; |
570 | ||
571 | AliMaterial(38,"C-ivc",a,z,density,999.,999.); | |
572 | ||
73042f01 | 573 | AliMedium(11,"C-ivc",38,0, iSXFLD, sXMGMX, 10., .1, .1, .001, .01); |
1283eee5 | 574 | |
575 | // | |
576 | ||
73042f01 | 577 | AliMedium(12,"CO2",10,0, iSXFLD, sXMGMX, 10., 999.,.1, .001, .001); |
1283eee5 | 578 | |
fe4da5cc | 579 | } |
580 | ||
fe4da5cc | 581 | |
73042f01 | 582 | void AliTPC::Digits2Clusters(TFile *of) |
fe4da5cc | 583 | { |
3c0f9266 | 584 | //----------------------------------------------------------------- |
585 | // This is a simple cluster finder. | |
3c0f9266 | 586 | //----------------------------------------------------------------- |
73042f01 | 587 | AliTPCclusterer::Digits2Clusters(fTPCParam,of); |
fe4da5cc | 588 | } |
589 | ||
73042f01 | 590 | extern Double_t SigmaY2(Double_t, Double_t, Double_t); |
591 | extern Double_t SigmaZ2(Double_t, Double_t); | |
fe4da5cc | 592 | //_____________________________________________________________________________ |
73042f01 | 593 | void AliTPC::Hits2Clusters(TFile *of) |
fe4da5cc | 594 | { |
8c555625 | 595 | //-------------------------------------------------------- |
fe4da5cc | 596 | // TPC simple cluster generator from hits |
597 | // obtained from the TPC Fast Simulator | |
8c555625 | 598 | // The point errors are taken from the parametrization |
599 | //-------------------------------------------------------- | |
600 | ||
601 | //----------------------------------------------------------------- | |
602 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
603 | //----------------------------------------------------------------- | |
73042f01 | 604 | // Adopted to Marian's cluster data structure by I.Belikov, CERN, |
605 | // Jouri.Belikov@cern.ch | |
606 | //---------------------------------------------------------------- | |
607 | ||
608 | ///////////////////////////////////////////////////////////////////////////// | |
609 | // | |
610 | //--------------------------------------------------------------------- | |
611 | // ALICE TPC Cluster Parameters | |
612 | //-------------------------------------------------------------------- | |
613 | ||
614 | ||
615 | ||
616 | // Cluster width in rphi | |
617 | const Float_t kACrphi=0.18322; | |
618 | const Float_t kBCrphi=0.59551e-3; | |
619 | const Float_t kCCrphi=0.60952e-1; | |
620 | // Cluster width in z | |
621 | const Float_t kACz=0.19081; | |
622 | const Float_t kBCz=0.55938e-3; | |
623 | const Float_t kCCz=0.30428; | |
624 | ||
625 | TDirectory *savedir=gDirectory; | |
626 | ||
627 | if (!of->IsOpen()) { | |
628 | cerr<<"AliTPC::Hits2Clusters(): output file not open !\n"; | |
629 | return; | |
630 | } | |
3c0f9266 | 631 | |
cc80f89e | 632 | if(fTPCParam == 0){ |
633 | printf("AliTPCParam MUST be created firstly\n"); | |
634 | return; | |
635 | } | |
636 | ||
73042f01 | 637 | Float_t sigmaRphi,sigmaZ,clRphi,clZ; |
fe4da5cc | 638 | // |
1578254f | 639 | TParticle *particle; // pointer to a given particle |
fe4da5cc | 640 | AliTPChit *tpcHit; // pointer to a sigle TPC hit |
73042f01 | 641 | TClonesArray *particles; //pointer to the particle list |
fe4da5cc | 642 | Int_t sector,nhits; |
643 | Int_t ipart; | |
644 | Float_t xyz[5]; | |
645 | Float_t pl,pt,tanth,rpad,ratio; | |
fe4da5cc | 646 | Float_t cph,sph; |
647 | ||
648 | //--------------------------------------------------------------- | |
649 | // Get the access to the tracks | |
650 | //--------------------------------------------------------------- | |
651 | ||
73042f01 | 652 | TTree *tH = gAlice->TreeH(); |
653 | Stat_t ntracks = tH->GetEntries(); | |
654 | particles=gAlice->Particles(); | |
655 | ||
656 | //Switch to the output file | |
657 | of->cd(); | |
658 | ||
659 | fTPCParam->Write(fTPCParam->GetTitle()); | |
660 | AliTPCClustersArray carray; | |
661 | carray.Setup(fTPCParam); | |
662 | carray.SetClusterType("AliTPCcluster"); | |
663 | carray.MakeTree(); | |
664 | ||
665 | Int_t nclusters=0; //cluster counter | |
fe4da5cc | 666 | |
667 | //------------------------------------------------------------ | |
cc80f89e | 668 | // Loop over all sectors (72 sectors for 20 deg |
669 | // segmentation for both lower and upper sectors) | |
670 | // Sectors 0-35 are lower sectors, 0-17 z>0, 17-35 z<0 | |
3c0f9266 | 671 | // Sectors 36-71 are upper sectors, 36-53 z>0, 54-71 z<0 |
fe4da5cc | 672 | // |
3c0f9266 | 673 | // First cluster for sector 0 starts at "0" |
fe4da5cc | 674 | //------------------------------------------------------------ |
cc80f89e | 675 | |
676 | for(Int_t isec=0;isec<fTPCParam->GetNSector();isec++){ | |
8c555625 | 677 | //MI change |
cc80f89e | 678 | fTPCParam->AdjustCosSin(isec,cph,sph); |
fe4da5cc | 679 | |
680 | //------------------------------------------------------------ | |
681 | // Loop over tracks | |
682 | //------------------------------------------------------------ | |
683 | ||
684 | for(Int_t track=0;track<ntracks;track++){ | |
685 | ResetHits(); | |
73042f01 | 686 | tH->GetEvent(track); |
fe4da5cc | 687 | // |
73042f01 | 688 | // Get number of the TPC hits |
fe4da5cc | 689 | // |
690 | nhits=fHits->GetEntriesFast(); | |
fe4da5cc | 691 | // |
692 | // Loop over hits | |
693 | // | |
694 | for(Int_t hit=0;hit<nhits;hit++){ | |
695 | tpcHit=(AliTPChit*)fHits->UncheckedAt(hit); | |
cc80f89e | 696 | if (tpcHit->fQ == 0.) continue; //information about track (I.Belikov) |
fe4da5cc | 697 | sector=tpcHit->fSector; // sector number |
698 | if(sector != isec) continue; //terminate iteration | |
699 | ipart=tpcHit->fTrack; | |
73042f01 | 700 | particle=(TParticle*)particles->UncheckedAt(ipart); |
1578254f | 701 | pl=particle->Pz(); |
702 | pt=particle->Pt(); | |
fe4da5cc | 703 | if(pt < 1.e-9) pt=1.e-9; |
704 | tanth=pl/pt; | |
705 | tanth = TMath::Abs(tanth); | |
706 | rpad=TMath::Sqrt(tpcHit->fX*tpcHit->fX + tpcHit->fY*tpcHit->fY); | |
707 | ratio=0.001*rpad/pt; // pt must be in MeV/c - historical reason | |
73042f01 | 708 | |
fe4da5cc | 709 | // space-point resolutions |
710 | ||
73042f01 | 711 | sigmaRphi=SigmaY2(rpad,tanth,pt); |
712 | sigmaZ =SigmaZ2(rpad,tanth ); | |
fe4da5cc | 713 | |
714 | // cluster widths | |
715 | ||
73042f01 | 716 | clRphi=kACrphi-kBCrphi*rpad*tanth+kCCrphi*ratio*ratio; |
717 | clZ=kACz-kBCz*rpad*tanth+kCCz*tanth*tanth; | |
fe4da5cc | 718 | |
719 | // temporary protection | |
720 | ||
73042f01 | 721 | if(sigmaRphi < 0.) sigmaRphi=0.4e-3; |
722 | if(sigmaZ < 0.) sigmaZ=0.4e-3; | |
723 | if(clRphi < 0.) clRphi=2.5e-3; | |
724 | if(clZ < 0.) clZ=2.5e-5; | |
fe4da5cc | 725 | |
726 | // | |
cc80f89e | 727 | |
728 | // | |
729 | // smearing --> rotate to the 1 (13) or to the 25 (49) sector, | |
fe4da5cc | 730 | // then the inaccuracy in a X-Y plane is only along Y (pad row)! |
731 | // | |
73042f01 | 732 | Float_t xprim= tpcHit->fX*cph + tpcHit->fY*sph; |
fe4da5cc | 733 | Float_t yprim=-tpcHit->fX*sph + tpcHit->fY*cph; |
73042f01 | 734 | xyz[0]=gRandom->Gaus(yprim,TMath::Sqrt(sigmaRphi)); // y |
735 | Float_t alpha=(isec < fTPCParam->GetNInnerSector()) ? | |
736 | fTPCParam->GetInnerAngle() : fTPCParam->GetOuterAngle(); | |
737 | Float_t ymax=xprim*TMath::Tan(0.5*alpha); | |
738 | if (TMath::Abs(xyz[0])>ymax) xyz[0]=yprim; | |
739 | xyz[1]=gRandom->Gaus(tpcHit->fZ,TMath::Sqrt(sigmaZ)); // z | |
740 | if (TMath::Abs(xyz[1])>fTPCParam->GetZLength()) xyz[1]=tpcHit->fZ; | |
cc80f89e | 741 | xyz[2]=tpcHit->fQ; // q |
73042f01 | 742 | xyz[3]=sigmaRphi; // fSigmaY2 |
743 | xyz[4]=sigmaZ; // fSigmaZ2 | |
744 | ||
745 | AliTPCClustersRow *clrow=carray.GetRow(sector,tpcHit->fPadRow); | |
746 | if (!clrow) clrow=carray.CreateRow(sector,tpcHit->fPadRow); | |
747 | ||
748 | Int_t tracks[3]={tpcHit->fTrack, -1, -1}; | |
749 | AliTPCcluster cluster(xyz,tracks); | |
750 | ||
751 | clrow->InsertCluster(&cluster); nclusters++; | |
752 | ||
fe4da5cc | 753 | } // end of loop over hits |
73042f01 | 754 | |
755 | } // end of loop over tracks | |
756 | ||
757 | Int_t nrows=fTPCParam->GetNRow(isec); | |
758 | for (Int_t irow=0; irow<nrows; irow++) { | |
759 | AliTPCClustersRow *clrow=carray.GetRow(isec,irow); | |
760 | if (!clrow) continue; | |
761 | carray.StoreRow(isec,irow); | |
762 | carray.ClearRow(isec,irow); | |
763 | } | |
764 | ||
cc80f89e | 765 | } // end of loop over sectors |
73042f01 | 766 | |
767 | cerr<<"Number of made clusters : "<<nclusters<<" \n"; | |
768 | ||
769 | carray.GetTree()->Write(); | |
770 | ||
771 | savedir->cd(); //switch back to the input file | |
cc80f89e | 772 | |
773 | } // end of function | |
774 | ||
775 | //_________________________________________________________________ | |
776 | void AliTPC::Hits2ExactClustersSector(Int_t isec) | |
777 | { | |
778 | //-------------------------------------------------------- | |
779 | //calculate exact cross point of track and given pad row | |
780 | //resulting values are expressed in "digit" coordinata | |
781 | //-------------------------------------------------------- | |
782 | ||
783 | //----------------------------------------------------------------- | |
784 | // Origin: Marian Ivanov GSI Darmstadt, m.ivanov@gsi.de | |
785 | //----------------------------------------------------------------- | |
786 | // | |
787 | if (fClustersArray==0){ | |
788 | return; | |
789 | } | |
790 | // | |
791 | TParticle *particle; // pointer to a given particle | |
792 | AliTPChit *tpcHit; // pointer to a sigle TPC hit | |
73042f01 | 793 | TClonesArray *particles; //pointer to the particle list |
cc80f89e | 794 | Int_t sector,nhits; |
795 | Int_t ipart; | |
73042f01 | 796 | const Int_t kcmaxhits=30000; |
797 | TVector * xxxx = new TVector(kcmaxhits*4); | |
cc80f89e | 798 | TVector & xxx = *xxxx; |
73042f01 | 799 | Int_t maxhits = kcmaxhits; |
cc80f89e | 800 | //construct array for each padrow |
801 | for (Int_t i=0; i<fTPCParam->GetNRow(isec);i++) | |
802 | fClustersArray->CreateRow(isec,i); | |
fe4da5cc | 803 | |
cc80f89e | 804 | //--------------------------------------------------------------- |
805 | // Get the access to the tracks | |
806 | //--------------------------------------------------------------- | |
807 | ||
73042f01 | 808 | TTree *tH = gAlice->TreeH(); |
809 | Stat_t ntracks = tH->GetEntries(); | |
810 | particles=gAlice->Particles(); | |
811 | Int_t npart = particles->GetEntriesFast(); | |
cc80f89e | 812 | |
813 | //------------------------------------------------------------ | |
814 | // Loop over tracks | |
815 | //------------------------------------------------------------ | |
fe4da5cc | 816 | |
cc80f89e | 817 | for(Int_t track=0;track<ntracks;track++){ |
818 | ResetHits(); | |
73042f01 | 819 | tH->GetEvent(track); |
cc80f89e | 820 | // |
821 | // Get number of the TPC hits and a pointer | |
822 | // to the particles | |
823 | // | |
824 | nhits=fHits->GetEntriesFast(); | |
825 | // | |
826 | // Loop over hits | |
827 | // | |
828 | Int_t currentIndex=0; | |
829 | Int_t lastrow=-1; //last writen row | |
830 | for(Int_t hit=0;hit<nhits;hit++){ | |
831 | tpcHit=(AliTPChit*)fHits->UncheckedAt(hit); | |
832 | if (tpcHit==0) continue; | |
833 | sector=tpcHit->fSector; // sector number | |
834 | if(sector != isec) continue; | |
835 | ipart=tpcHit->fTrack; | |
73042f01 | 836 | if (ipart<npart) particle=(TParticle*)particles->UncheckedAt(ipart); |
cc80f89e | 837 | |
838 | //find row number | |
839 | ||
840 | Float_t x[3]={tpcHit->fX,tpcHit->fY,tpcHit->fZ}; | |
841 | Int_t index[3]={1,isec,0}; | |
842 | Int_t currentrow = fTPCParam->GetPadRow(x,index) ; | |
843 | if (currentrow<0) continue; | |
844 | if (lastrow<0) lastrow=currentrow; | |
845 | if (currentrow==lastrow){ | |
846 | if ( currentIndex>=maxhits){ | |
73042f01 | 847 | maxhits+=kcmaxhits; |
cc80f89e | 848 | xxx.ResizeTo(4*maxhits); |
849 | } | |
850 | xxx(currentIndex*4)=x[0]; | |
851 | xxx(currentIndex*4+1)=x[1]; | |
852 | xxx(currentIndex*4+2)=x[2]; | |
853 | xxx(currentIndex*4+3)=tpcHit->fQ; | |
854 | currentIndex++; | |
855 | } | |
856 | else | |
857 | if (currentIndex>2){ | |
858 | Float_t sumx=0; | |
859 | Float_t sumx2=0; | |
860 | Float_t sumx3=0; | |
861 | Float_t sumx4=0; | |
862 | Float_t sumy=0; | |
863 | Float_t sumxy=0; | |
864 | Float_t sumx2y=0; | |
865 | Float_t sumz=0; | |
866 | Float_t sumxz=0; | |
867 | Float_t sumx2z=0; | |
868 | Float_t sumq=0; | |
869 | for (Int_t index=0;index<currentIndex;index++){ | |
870 | Float_t x,x2,x3,x4; | |
871 | x=x2=x3=x4=xxx(index*4); | |
872 | x2*=x; | |
873 | x3*=x2; | |
874 | x4*=x3; | |
875 | sumx+=x; | |
876 | sumx2+=x2; | |
877 | sumx3+=x3; | |
878 | sumx4+=x4; | |
879 | sumy+=xxx(index*4+1); | |
880 | sumxy+=xxx(index*4+1)*x; | |
881 | sumx2y+=xxx(index*4+1)*x2; | |
882 | sumz+=xxx(index*4+2); | |
883 | sumxz+=xxx(index*4+2)*x; | |
884 | sumx2z+=xxx(index*4+2)*x2; | |
885 | sumq+=xxx(index*4+3); | |
886 | } | |
73042f01 | 887 | Float_t centralPad = (fTPCParam->GetNPads(isec,lastrow)-1)/2; |
cc80f89e | 888 | Float_t det=currentIndex*(sumx2*sumx4-sumx3*sumx3)-sumx*(sumx*sumx4-sumx2*sumx3)+ |
889 | sumx2*(sumx*sumx3-sumx2*sumx2); | |
890 | ||
891 | Float_t detay=sumy*(sumx2*sumx4-sumx3*sumx3)-sumx*(sumxy*sumx4-sumx2y*sumx3)+ | |
892 | sumx2*(sumxy*sumx3-sumx2y*sumx2); | |
893 | Float_t detaz=sumz*(sumx2*sumx4-sumx3*sumx3)-sumx*(sumxz*sumx4-sumx2z*sumx3)+ | |
894 | sumx2*(sumxz*sumx3-sumx2z*sumx2); | |
895 | ||
896 | Float_t detby=currentIndex*(sumxy*sumx4-sumx2y*sumx3)-sumy*(sumx*sumx4-sumx2*sumx3)+ | |
897 | sumx2*(sumx*sumx2y-sumx2*sumxy); | |
898 | Float_t detbz=currentIndex*(sumxz*sumx4-sumx2z*sumx3)-sumz*(sumx*sumx4-sumx2*sumx3)+ | |
899 | sumx2*(sumx*sumx2z-sumx2*sumxz); | |
900 | ||
73042f01 | 901 | Float_t y=detay/det+centralPad; |
cc80f89e | 902 | Float_t z=detaz/det; |
903 | Float_t by=detby/det; //y angle | |
904 | Float_t bz=detbz/det; //z angle | |
905 | sumy/=Float_t(currentIndex); | |
906 | sumz/=Float_t(currentIndex); | |
907 | AliCluster cl; | |
908 | cl.fX=z; | |
909 | cl.fY=y; | |
910 | cl.fQ=sumq; | |
911 | cl.fSigmaX2=bz; | |
912 | cl.fSigmaY2=by; | |
913 | cl.fTracks[0]=ipart; | |
914 | ||
915 | AliTPCClustersRow * row = (fClustersArray->GetRow(isec,lastrow)); | |
916 | if (row!=0) row->InsertCluster(&cl); | |
917 | currentIndex=0; | |
918 | lastrow=currentrow; | |
919 | } //end of calculating cluster for given row | |
920 | ||
921 | ||
922 | ||
923 | } // end of loop over hits | |
924 | } // end of loop over tracks | |
925 | //write padrows to tree | |
926 | for (Int_t ii=0; ii<fTPCParam->GetNRow(isec);ii++) { | |
927 | fClustersArray->StoreRow(isec,ii); | |
928 | fClustersArray->ClearRow(isec,ii); | |
929 | } | |
930 | xxxx->Delete(); | |
931 | ||
fe4da5cc | 932 | } |
933 | ||
cc80f89e | 934 | //__________________________________________________________________ |
8c555625 | 935 | void AliTPC::Hits2Digits() |
936 | { | |
8c555625 | 937 | //---------------------------------------------------- |
cc80f89e | 938 | // Loop over all sectors |
939 | //---------------------------------------------------- | |
940 | ||
941 | if(fTPCParam == 0){ | |
942 | printf("AliTPCParam MUST be created firstly\n"); | |
943 | return; | |
944 | } | |
945 | ||
946 | for(Int_t isec=0;isec<fTPCParam->GetNSector();isec++) Hits2DigitsSector(isec); | |
947 | ||
8c555625 | 948 | } |
949 | ||
950 | ||
fe4da5cc | 951 | //_____________________________________________________________________________ |
8c555625 | 952 | void AliTPC::Hits2DigitsSector(Int_t isec) |
fe4da5cc | 953 | { |
8c555625 | 954 | //------------------------------------------------------------------- |
fe4da5cc | 955 | // TPC conversion from hits to digits. |
8c555625 | 956 | //------------------------------------------------------------------- |
957 | ||
958 | //----------------------------------------------------------------- | |
959 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
960 | //----------------------------------------------------------------- | |
961 | ||
fe4da5cc | 962 | //------------------------------------------------------- |
8c555625 | 963 | // Get the access to the track hits |
fe4da5cc | 964 | //------------------------------------------------------- |
8c555625 | 965 | |
cc80f89e | 966 | |
73042f01 | 967 | TTree *tH = gAlice->TreeH(); // pointer to the hits tree |
968 | Stat_t ntracks = tH->GetEntries(); | |
8c555625 | 969 | |
970 | if( ntracks > 0){ | |
971 | ||
972 | //------------------------------------------- | |
973 | // Only if there are any tracks... | |
974 | //------------------------------------------- | |
975 | ||
8c555625 | 976 | TObjArray **row; |
fe4da5cc | 977 | |
8c555625 | 978 | printf("*** Processing sector number %d ***\n",isec); |
979 | ||
980 | Int_t nrows =fTPCParam->GetNRow(isec); | |
981 | ||
982 | row= new TObjArray* [nrows]; | |
fe4da5cc | 983 | |
73042f01 | 984 | MakeSector(isec,nrows,tH,ntracks,row); |
8c555625 | 985 | |
986 | //-------------------------------------------------------- | |
987 | // Digitize this sector, row by row | |
988 | // row[i] is the pointer to the TObjArray of TVectors, | |
989 | // each one containing electrons accepted on this | |
990 | // row, assigned into tracks | |
991 | //-------------------------------------------------------- | |
992 | ||
993 | Int_t i; | |
994 | ||
cc80f89e | 995 | if (fDigitsArray->GetTree()==0) fDigitsArray->MakeTree(); |
8c555625 | 996 | |
cc80f89e | 997 | for (i=0;i<nrows;i++){ |
8c555625 | 998 | |
cc80f89e | 999 | AliDigits * dig = fDigitsArray->CreateRow(isec,i); |
8c555625 | 1000 | |
cc80f89e | 1001 | DigitizeRow(i,isec,row); |
8c555625 | 1002 | |
cc80f89e | 1003 | fDigitsArray->StoreRow(isec,i); |
8c555625 | 1004 | |
73042f01 | 1005 | Int_t ndig = dig->GetDigitSize(); |
cc80f89e | 1006 | |
1007 | printf("*** Sector, row, compressed digits %d %d %d ***\n",isec,i,ndig); | |
1008 | ||
1009 | fDigitsArray->ClearRow(isec,i); | |
8c555625 | 1010 | |
cc80f89e | 1011 | |
8c555625 | 1012 | } // end of the sector digitization |
8c555625 | 1013 | |
cc80f89e | 1014 | for(i=0;i<nrows;i++){ |
1015 | row[i]->Delete(); | |
1016 | } | |
1017 | ||
8c555625 | 1018 | delete [] row; // delete the array of pointers to TObjArray-s |
1019 | ||
1020 | } // ntracks >0 | |
8c555625 | 1021 | |
cc80f89e | 1022 | } // end of Hits2DigitsSector |
8c555625 | 1023 | |
8c555625 | 1024 | |
8c555625 | 1025 | //_____________________________________________________________________________ |
cc80f89e | 1026 | void AliTPC::DigitizeRow(Int_t irow,Int_t isec,TObjArray **rows) |
8c555625 | 1027 | { |
1028 | //----------------------------------------------------------- | |
1029 | // Single row digitization, coupling from the neighbouring | |
1030 | // rows taken into account | |
1031 | //----------------------------------------------------------- | |
1032 | ||
1033 | //----------------------------------------------------------------- | |
1034 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
cc80f89e | 1035 | // Modified: Marian Ivanov GSI Darmstadt, m.ivanov@gsi.de |
8c555625 | 1036 | //----------------------------------------------------------------- |
1037 | ||
1038 | ||
8c555625 | 1039 | Float_t zerosup = fTPCParam->GetZeroSup(); |
1040 | Int_t nrows =fTPCParam->GetNRow(isec); | |
cc80f89e | 1041 | fCurrentIndex[1]= isec; |
8c555625 | 1042 | |
8c555625 | 1043 | |
73042f01 | 1044 | Int_t nofPads = fTPCParam->GetNPads(isec,irow); |
1045 | Int_t nofTbins = fTPCParam->GetMaxTBin(); | |
1046 | Int_t indexRange[4]; | |
8c555625 | 1047 | // |
1048 | // Integrated signal for this row | |
1049 | // and a single track signal | |
cc80f89e | 1050 | // |
73042f01 | 1051 | TMatrix *m1 = new TMatrix(0,nofPads,0,nofTbins); // integrated |
1052 | TMatrix *m2 = new TMatrix(0,nofPads,0,nofTbins); // single | |
8c555625 | 1053 | // |
73042f01 | 1054 | TMatrix &total = *m1; |
8c555625 | 1055 | |
1056 | // Array of pointers to the label-signal list | |
1057 | ||
73042f01 | 1058 | Int_t nofDigits = nofPads*nofTbins; // number of digits for this row |
1059 | Float_t **pList = new Float_t* [nofDigits]; | |
8c555625 | 1060 | |
1061 | Int_t lp; | |
cc80f89e | 1062 | Int_t i1; |
73042f01 | 1063 | for(lp=0;lp<nofDigits;lp++)pList[lp]=0; // set all pointers to NULL |
8c555625 | 1064 | // |
cc80f89e | 1065 | //calculate signal |
1066 | // | |
1067 | Int_t row1 = TMath::Max(irow-fTPCParam->GetNCrossRows(),0); | |
1068 | Int_t row2 = TMath::Min(irow+fTPCParam->GetNCrossRows(),nrows-1); | |
1069 | for (Int_t row= row1;row<=row2;row++){ | |
1070 | Int_t nTracks= rows[row]->GetEntries(); | |
1071 | for (i1=0;i1<nTracks;i1++){ | |
1072 | fCurrentIndex[2]= row; | |
1073 | fCurrentIndex[3]=irow; | |
1074 | if (row==irow){ | |
1075 | m2->Zero(); // clear single track signal matrix | |
73042f01 | 1076 | Float_t trackLabel = GetSignal(rows[row],i1,m2,m1,indexRange); |
1077 | GetList(trackLabel,nofPads,m2,indexRange,pList); | |
cc80f89e | 1078 | } |
73042f01 | 1079 | else GetSignal(rows[row],i1,0,m1,indexRange); |
cc80f89e | 1080 | } |
8c555625 | 1081 | } |
cc80f89e | 1082 | |
8c555625 | 1083 | Int_t tracks[3]; |
8c555625 | 1084 | |
cc80f89e | 1085 | AliDigits *dig = fDigitsArray->GetRow(isec,irow); |
73042f01 | 1086 | for(Int_t ip=0;ip<nofPads;ip++){ |
1087 | for(Int_t it=0;it<nofTbins;it++){ | |
8c555625 | 1088 | |
73042f01 | 1089 | Float_t q = total(ip,it); |
8c555625 | 1090 | |
73042f01 | 1091 | Int_t gi =it*nofPads+ip; // global index |
8c555625 | 1092 | |
cc80f89e | 1093 | q = gRandom->Gaus(q,fTPCParam->GetNoise()*fTPCParam->GetNoiseNormFac()); |
8c555625 | 1094 | |
cc80f89e | 1095 | q = (Int_t)q; |
1096 | ||
1097 | if(q <=zerosup) continue; // do not fill zeros | |
73042f01 | 1098 | if(q > fTPCParam->GetADCSat()) q = fTPCParam->GetADCSat(); // saturation |
8c555625 | 1099 | |
1100 | // | |
1101 | // "real" signal or electronic noise (list = -1)? | |
1102 | // | |
1103 | ||
1104 | for(Int_t j1=0;j1<3;j1++){ | |
1105 | tracks[j1] = (pList[gi]) ?(Int_t)(*(pList[gi]+j1)) : -1; | |
1106 | } | |
1107 | ||
cc80f89e | 1108 | //Begin_Html |
1109 | /* | |
1110 | <A NAME="AliDigits"></A> | |
1111 | using of AliDigits object | |
1112 | */ | |
1113 | //End_Html | |
1114 | dig->SetDigitFast((Short_t)q,it,ip); | |
1115 | if (fDigitsArray->IsSimulated()) | |
1116 | { | |
1117 | ((AliSimDigits*)dig)->SetTrackIDFast(tracks[0],it,ip,0); | |
1118 | ((AliSimDigits*)dig)->SetTrackIDFast(tracks[1],it,ip,1); | |
1119 | ((AliSimDigits*)dig)->SetTrackIDFast(tracks[2],it,ip,2); | |
1120 | } | |
1121 | ||
8c555625 | 1122 | |
1123 | } // end of loop over time buckets | |
1124 | } // end of lop over pads | |
1125 | ||
1126 | // | |
1127 | // This row has been digitized, delete nonused stuff | |
1128 | // | |
1129 | ||
73042f01 | 1130 | for(lp=0;lp<nofDigits;lp++){ |
8c555625 | 1131 | if(pList[lp]) delete [] pList[lp]; |
1132 | } | |
1133 | ||
1134 | delete [] pList; | |
1135 | ||
1136 | delete m1; | |
1137 | delete m2; | |
cc80f89e | 1138 | // delete m3; |
8c555625 | 1139 | |
1140 | } // end of DigitizeRow | |
cc80f89e | 1141 | |
8c555625 | 1142 | //_____________________________________________________________________________ |
cc80f89e | 1143 | |
1144 | Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2, | |
73042f01 | 1145 | Int_t *indexRange) |
8c555625 | 1146 | { |
1147 | ||
1148 | //--------------------------------------------------------------- | |
1149 | // Calculates 2-D signal (pad,time) for a single track, | |
1150 | // returns a pointer to the signal matrix and the track label | |
1151 | // No digitization is performed at this level!!! | |
1152 | //--------------------------------------------------------------- | |
1153 | ||
1154 | //----------------------------------------------------------------- | |
1155 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
cc80f89e | 1156 | // Modified: Marian Ivanov |
8c555625 | 1157 | //----------------------------------------------------------------- |
1158 | ||
1159 | TVector *tv; | |
8c555625 | 1160 | |
8c555625 | 1161 | tv = (TVector*)p1->At(ntr); // pointer to a track |
1162 | TVector &v = *tv; | |
1163 | ||
1164 | Float_t label = v(0); | |
73042f01 | 1165 | Int_t centralPad = (fTPCParam->GetNPads(fCurrentIndex[1],fCurrentIndex[3])-1)/2; |
8c555625 | 1166 | |
8c555625 | 1167 | Int_t nElectrons = (tv->GetNrows()-1)/4; |
73042f01 | 1168 | indexRange[0]=9999; // min pad |
1169 | indexRange[1]=-1; // max pad | |
1170 | indexRange[2]=9999; //min time | |
1171 | indexRange[3]=-1; // max time | |
8c555625 | 1172 | |
cc80f89e | 1173 | // Float_t IneffFactor = 0.5; // inefficiency in the gain close to the edge, as above |
1174 | ||
1175 | TMatrix &signal = *m1; | |
1176 | TMatrix &total = *m2; | |
8c555625 | 1177 | // |
1178 | // Loop over all electrons | |
1179 | // | |
8c555625 | 1180 | for(Int_t nel=0; nel<nElectrons; nel++){ |
cc80f89e | 1181 | Int_t idx=nel*4; |
1182 | Float_t aval = v(idx+4); | |
1183 | Float_t eltoadcfac=aval*fTPCParam->GetTotalNormFac(); | |
1184 | Float_t xyz[3]={v(idx+1),v(idx+2),v(idx+3)}; | |
1185 | Int_t n = fTPCParam->CalcResponse(xyz,fCurrentIndex,fCurrentIndex[3]); | |
8c555625 | 1186 | |
cc80f89e | 1187 | if (n>0) for (Int_t i =0; i<n; i++){ |
1188 | Int_t *index = fTPCParam->GetResBin(i); | |
73042f01 | 1189 | Int_t pad=index[1]+centralPad; //in digit coordinates central pad has coordinate 0 |
cc80f89e | 1190 | if ( ( pad<(fTPCParam->GetNPads(fCurrentIndex[1],fCurrentIndex[3]))) && (pad>0)) { |
1191 | Int_t time=index[2]; | |
1192 | Float_t weight = fTPCParam->GetResWeight(i); //we normalise response to ADC channel | |
1193 | weight *= eltoadcfac; | |
1194 | ||
1195 | if (m1!=0) signal(pad,time)+=weight; | |
1196 | total(pad,time)+=weight; | |
73042f01 | 1197 | indexRange[0]=TMath::Min(indexRange[0],pad); |
1198 | indexRange[1]=TMath::Max(indexRange[1],pad); | |
1199 | indexRange[2]=TMath::Min(indexRange[2],time); | |
1200 | indexRange[3]=TMath::Max(indexRange[3],time); | |
cc80f89e | 1201 | } |
1202 | } | |
8c555625 | 1203 | } // end of loop over electrons |
cc80f89e | 1204 | |
8c555625 | 1205 | return label; // returns track label when finished |
1206 | } | |
1207 | ||
1208 | //_____________________________________________________________________________ | |
73042f01 | 1209 | void AliTPC::GetList(Float_t label,Int_t np,TMatrix *m,Int_t *indexRange, |
8c555625 | 1210 | Float_t **pList) |
1211 | { | |
1212 | //---------------------------------------------------------------------- | |
1213 | // Updates the list of tracks contributing to digits for a given row | |
1214 | //---------------------------------------------------------------------- | |
1215 | ||
1216 | //----------------------------------------------------------------- | |
1217 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1218 | //----------------------------------------------------------------- | |
1219 | ||
1220 | TMatrix &signal = *m; | |
1221 | ||
1222 | // lop over nonzero digits | |
1223 | ||
73042f01 | 1224 | for(Int_t it=indexRange[2];it<indexRange[3]+1;it++){ |
1225 | for(Int_t ip=indexRange[0];ip<indexRange[1]+1;ip++){ | |
8c555625 | 1226 | |
1227 | ||
921bf71a | 1228 | // accept only the contribution larger than 500 electrons (1/2 s_noise) |
1229 | ||
cc80f89e | 1230 | if(signal(ip,it)<0.5) continue; |
921bf71a | 1231 | |
1232 | ||
73042f01 | 1233 | Int_t globalIndex = it*np+ip; // globalIndex starts from 0! |
8c555625 | 1234 | |
73042f01 | 1235 | if(!pList[globalIndex]){ |
8c555625 | 1236 | |
1237 | // | |
1238 | // Create new list (6 elements - 3 signals and 3 labels), | |
8c555625 | 1239 | // |
1240 | ||
73042f01 | 1241 | pList[globalIndex] = new Float_t [6]; |
8c555625 | 1242 | |
1243 | // set list to -1 | |
1244 | ||
73042f01 | 1245 | *pList[globalIndex] = -1.; |
1246 | *(pList[globalIndex]+1) = -1.; | |
1247 | *(pList[globalIndex]+2) = -1.; | |
1248 | *(pList[globalIndex]+3) = -1.; | |
1249 | *(pList[globalIndex]+4) = -1.; | |
1250 | *(pList[globalIndex]+5) = -1.; | |
8c555625 | 1251 | |
1252 | ||
73042f01 | 1253 | *pList[globalIndex] = label; |
1254 | *(pList[globalIndex]+3) = signal(ip,it); | |
8c555625 | 1255 | } |
1256 | else{ | |
1257 | ||
1258 | // check the signal magnitude | |
1259 | ||
73042f01 | 1260 | Float_t highest = *(pList[globalIndex]+3); |
1261 | Float_t middle = *(pList[globalIndex]+4); | |
1262 | Float_t lowest = *(pList[globalIndex]+5); | |
8c555625 | 1263 | |
1264 | // | |
1265 | // compare the new signal with already existing list | |
1266 | // | |
1267 | ||
1268 | if(signal(ip,it)<lowest) continue; // neglect this track | |
1269 | ||
1270 | // | |
1271 | ||
1272 | if (signal(ip,it)>highest){ | |
73042f01 | 1273 | *(pList[globalIndex]+5) = middle; |
1274 | *(pList[globalIndex]+4) = highest; | |
1275 | *(pList[globalIndex]+3) = signal(ip,it); | |
8c555625 | 1276 | |
73042f01 | 1277 | *(pList[globalIndex]+2) = *(pList[globalIndex]+1); |
1278 | *(pList[globalIndex]+1) = *pList[globalIndex]; | |
1279 | *pList[globalIndex] = label; | |
8c555625 | 1280 | } |
1281 | else if (signal(ip,it)>middle){ | |
73042f01 | 1282 | *(pList[globalIndex]+5) = middle; |
1283 | *(pList[globalIndex]+4) = signal(ip,it); | |
8c555625 | 1284 | |
73042f01 | 1285 | *(pList[globalIndex]+2) = *(pList[globalIndex]+1); |
1286 | *(pList[globalIndex]+1) = label; | |
8c555625 | 1287 | } |
1288 | else{ | |
73042f01 | 1289 | *(pList[globalIndex]+5) = signal(ip,it); |
1290 | *(pList[globalIndex]+2) = label; | |
8c555625 | 1291 | } |
1292 | } | |
1293 | ||
1294 | } // end of loop over pads | |
1295 | } // end of loop over time bins | |
1296 | ||
1297 | ||
1298 | ||
8c555625 | 1299 | }//end of GetList |
1300 | //___________________________________________________________________ | |
1301 | void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH, | |
1302 | Stat_t ntracks,TObjArray **row) | |
1303 | { | |
1304 | ||
1305 | //----------------------------------------------------------------- | |
1306 | // Prepares the sector digitization, creates the vectors of | |
1307 | // tracks for each row of this sector. The track vector | |
1308 | // contains the track label and the position of electrons. | |
1309 | //----------------------------------------------------------------- | |
1310 | ||
1311 | //----------------------------------------------------------------- | |
1312 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1313 | //----------------------------------------------------------------- | |
1314 | ||
cc80f89e | 1315 | Float_t gasgain = fTPCParam->GetGasGain(); |
8c555625 | 1316 | Int_t i; |
cc80f89e | 1317 | Float_t xyz[4]; |
8c555625 | 1318 | |
1319 | AliTPChit *tpcHit; // pointer to a sigle TPC hit | |
1320 | ||
1321 | //---------------------------------------------- | |
1322 | // Create TObjArray-s, one for each row, | |
1323 | // each TObjArray will store the TVectors | |
1324 | // of electrons, one TVector per each track. | |
1325 | //---------------------------------------------- | |
1326 | ||
f74bb6f5 | 1327 | Int_t *nofElectrons = new Int_t [nrows]; // electron counter for each row |
1328 | TVector **tracks = new TVector* [nrows]; //pointers to the track vectors | |
8c555625 | 1329 | for(i=0; i<nrows; i++){ |
1330 | row[i] = new TObjArray; | |
f74bb6f5 | 1331 | nofElectrons[i]=0; |
1332 | tracks[i]=0; | |
8c555625 | 1333 | } |
8c555625 | 1334 | |
1335 | //-------------------------------------------------------------------- | |
1336 | // Loop over tracks, the "track" contains the full history | |
1337 | //-------------------------------------------------------------------- | |
1338 | ||
1339 | Int_t previousTrack,currentTrack; | |
1340 | previousTrack = -1; // nothing to store so far! | |
1341 | ||
1342 | for(Int_t track=0;track<ntracks;track++){ | |
1343 | ||
1344 | ResetHits(); | |
1345 | ||
1346 | TH->GetEvent(track); // get next track | |
1347 | Int_t nhits = fHits->GetEntriesFast(); // get number of hits for this track | |
1348 | ||
1349 | if(nhits == 0) continue; // no hits in the TPC for this track | |
1350 | ||
1351 | //-------------------------------------------------------------- | |
1352 | // Loop over hits | |
1353 | //-------------------------------------------------------------- | |
1354 | ||
1355 | for(Int_t hit=0;hit<nhits;hit++){ | |
1356 | ||
1357 | tpcHit = (AliTPChit*)fHits->UncheckedAt(hit); // get a pointer to a hit | |
1358 | ||
1359 | Int_t sector=tpcHit->fSector; // sector number | |
cc80f89e | 1360 | if(sector != isec) continue; |
8c555625 | 1361 | |
1362 | currentTrack = tpcHit->fTrack; // track number | |
1363 | if(currentTrack != previousTrack){ | |
1364 | ||
1365 | // store already filled fTrack | |
1366 | ||
1367 | for(i=0;i<nrows;i++){ | |
1368 | if(previousTrack != -1){ | |
73042f01 | 1369 | if(nofElectrons[i]>0){ |
cc80f89e | 1370 | TVector &v = *tracks[i]; |
8c555625 | 1371 | v(0) = previousTrack; |
73042f01 | 1372 | tracks[i]->ResizeTo(4*nofElectrons[i]+1); // shrink if necessary |
cc80f89e | 1373 | row[i]->Add(tracks[i]); |
8c555625 | 1374 | } |
1375 | else{ | |
cc80f89e | 1376 | delete tracks[i]; // delete empty TVector |
1377 | tracks[i]=0; | |
8c555625 | 1378 | } |
1379 | } | |
1380 | ||
73042f01 | 1381 | nofElectrons[i]=0; |
cc80f89e | 1382 | tracks[i] = new TVector(481); // TVectors for the next fTrack |
8c555625 | 1383 | |
1384 | } // end of loop over rows | |
1385 | ||
1386 | previousTrack=currentTrack; // update track label | |
1387 | } | |
1388 | ||
73042f01 | 1389 | Int_t qI = (Int_t) (tpcHit->fQ); // energy loss (number of electrons) |
8c555625 | 1390 | |
1391 | //--------------------------------------------------- | |
1392 | // Calculate the electron attachment probability | |
1393 | //--------------------------------------------------- | |
1394 | ||
cc80f89e | 1395 | |
1396 | Float_t time = 1.e6*(fTPCParam->GetZLength()-TMath::Abs(tpcHit->fZ)) | |
1397 | /fTPCParam->GetDriftV(); | |
8c555625 | 1398 | // in microseconds! |
73042f01 | 1399 | Float_t attProb = fTPCParam->GetAttCoef()* |
8c555625 | 1400 | fTPCParam->GetOxyCont()*time; // fraction! |
1401 | ||
1402 | //----------------------------------------------- | |
1403 | // Loop over electrons | |
1404 | //----------------------------------------------- | |
cc80f89e | 1405 | Int_t index[3]; |
1406 | index[1]=isec; | |
73042f01 | 1407 | for(Int_t nel=0;nel<qI;nel++){ |
8c555625 | 1408 | // skip if electron lost due to the attachment |
73042f01 | 1409 | if((gRandom->Rndm(0)) < attProb) continue; // electron lost! |
8c555625 | 1410 | xyz[0]=tpcHit->fX; |
1411 | xyz[1]=tpcHit->fY; | |
cc80f89e | 1412 | xyz[2]=tpcHit->fZ; |
1413 | xyz[3]= (Float_t) (-gasgain*TMath::Log(gRandom->Rndm())); | |
1414 | index[0]=1; | |
1415 | ||
1416 | TransportElectron(xyz,index); //MI change -august | |
73042f01 | 1417 | Int_t rowNumber; |
cc80f89e | 1418 | fTPCParam->GetPadRow(xyz,index); //MI change august |
73042f01 | 1419 | rowNumber = index[2]; |
cc80f89e | 1420 | //transform position to local digit coordinates |
1421 | //relative to nearest pad row | |
73042f01 | 1422 | if ((rowNumber<0)||rowNumber>=fTPCParam->GetNRow(isec)) continue; |
1423 | nofElectrons[rowNumber]++; | |
8c555625 | 1424 | //---------------------------------- |
1425 | // Expand vector if necessary | |
1426 | //---------------------------------- | |
73042f01 | 1427 | if(nofElectrons[rowNumber]>120){ |
1428 | Int_t range = tracks[rowNumber]->GetNrows(); | |
1429 | if((nofElectrons[rowNumber])>(range-1)/4){ | |
cc80f89e | 1430 | |
73042f01 | 1431 | tracks[rowNumber]->ResizeTo(range+400); // Add 100 electrons |
fe4da5cc | 1432 | } |
1433 | } | |
1434 | ||
73042f01 | 1435 | TVector &v = *tracks[rowNumber]; |
1436 | Int_t idx = 4*nofElectrons[rowNumber]-3; | |
8c555625 | 1437 | |
cc80f89e | 1438 | v(idx)= xyz[0]; // X - pad row coordinate |
1439 | v(idx+1)=xyz[1]; // Y - pad coordinate (along the pad-row) | |
1440 | v(idx+2)=xyz[2]; // Z - time bin coordinate | |
1441 | v(idx+3)=xyz[3]; // avalanche size | |
8c555625 | 1442 | } // end of loop over electrons |
1443 | ||
1444 | } // end of loop over hits | |
1445 | } // end of loop over tracks | |
1446 | ||
1447 | // | |
1448 | // store remaining track (the last one) if not empty | |
1449 | // | |
1450 | ||
1451 | for(i=0;i<nrows;i++){ | |
73042f01 | 1452 | if(nofElectrons[i]>0){ |
cc80f89e | 1453 | TVector &v = *tracks[i]; |
8c555625 | 1454 | v(0) = previousTrack; |
73042f01 | 1455 | tracks[i]->ResizeTo(4*nofElectrons[i]+1); // shrink if necessary |
cc80f89e | 1456 | row[i]->Add(tracks[i]); |
fe4da5cc | 1457 | } |
1458 | else{ | |
cc80f89e | 1459 | delete tracks[i]; |
1460 | tracks[i]=0; | |
8c555625 | 1461 | } |
1462 | } | |
1463 | ||
cc80f89e | 1464 | delete [] tracks; |
73042f01 | 1465 | delete [] nofElectrons; |
8c555625 | 1466 | |
8c555625 | 1467 | |
cc80f89e | 1468 | } // end of MakeSector |
8c555625 | 1469 | |
fe4da5cc | 1470 | |
1471 | //_____________________________________________________________________________ | |
1472 | void AliTPC::Init() | |
1473 | { | |
1474 | // | |
1475 | // Initialise TPC detector after definition of geometry | |
1476 | // | |
1477 | Int_t i; | |
1478 | // | |
1479 | printf("\n"); | |
1480 | for(i=0;i<35;i++) printf("*"); | |
1481 | printf(" TPC_INIT "); | |
1482 | for(i=0;i<35;i++) printf("*"); | |
1483 | printf("\n"); | |
1484 | // | |
1485 | for(i=0;i<80;i++) printf("*"); | |
1486 | printf("\n"); | |
1487 | } | |
1488 | ||
1489 | //_____________________________________________________________________________ | |
1490 | void AliTPC::MakeBranch(Option_t* option) | |
1491 | { | |
1492 | // | |
1493 | // Create Tree branches for the TPC. | |
1494 | // | |
1495 | Int_t buffersize = 4000; | |
1496 | char branchname[10]; | |
1497 | sprintf(branchname,"%s",GetName()); | |
1498 | ||
1499 | AliDetector::MakeBranch(option); | |
1500 | ||
73042f01 | 1501 | char *d = strstr(option,"D"); |
fe4da5cc | 1502 | |
73042f01 | 1503 | if (fDigits && gAlice->TreeD() && d) { |
fe4da5cc | 1504 | gAlice->TreeD()->Branch(branchname,&fDigits, buffersize); |
1505 | printf("Making Branch %s for digits\n",branchname); | |
1506 | } | |
fe4da5cc | 1507 | } |
1508 | ||
1509 | //_____________________________________________________________________________ | |
1510 | void AliTPC::ResetDigits() | |
1511 | { | |
1512 | // | |
1513 | // Reset number of digits and the digits array for this detector | |
fe4da5cc | 1514 | // |
1515 | fNdigits = 0; | |
cc80f89e | 1516 | if (fDigits) fDigits->Clear(); |
fe4da5cc | 1517 | } |
1518 | ||
1519 | //_____________________________________________________________________________ | |
1520 | void AliTPC::SetSecAL(Int_t sec) | |
1521 | { | |
8c555625 | 1522 | //--------------------------------------------------- |
fe4da5cc | 1523 | // Activate/deactivate selection for lower sectors |
8c555625 | 1524 | //--------------------------------------------------- |
1525 | ||
1526 | //----------------------------------------------------------------- | |
1527 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1528 | //----------------------------------------------------------------- | |
1529 | ||
fe4da5cc | 1530 | fSecAL = sec; |
1531 | } | |
1532 | ||
1533 | //_____________________________________________________________________________ | |
1534 | void AliTPC::SetSecAU(Int_t sec) | |
1535 | { | |
8c555625 | 1536 | //---------------------------------------------------- |
fe4da5cc | 1537 | // Activate/deactivate selection for upper sectors |
8c555625 | 1538 | //--------------------------------------------------- |
1539 | ||
1540 | //----------------------------------------------------------------- | |
1541 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1542 | //----------------------------------------------------------------- | |
1543 | ||
fe4da5cc | 1544 | fSecAU = sec; |
1545 | } | |
1546 | ||
1547 | //_____________________________________________________________________________ | |
1548 | void AliTPC::SetSecLows(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6) | |
1549 | { | |
8c555625 | 1550 | //---------------------------------------- |
fe4da5cc | 1551 | // Select active lower sectors |
8c555625 | 1552 | //---------------------------------------- |
1553 | ||
1554 | //----------------------------------------------------------------- | |
1555 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1556 | //----------------------------------------------------------------- | |
1557 | ||
fe4da5cc | 1558 | fSecLows[0] = s1; |
1559 | fSecLows[1] = s2; | |
1560 | fSecLows[2] = s3; | |
1561 | fSecLows[3] = s4; | |
1562 | fSecLows[4] = s5; | |
1563 | fSecLows[5] = s6; | |
1564 | } | |
1565 | ||
1566 | //_____________________________________________________________________________ | |
1567 | void AliTPC::SetSecUps(Int_t s1,Int_t s2,Int_t s3,Int_t s4,Int_t s5, Int_t s6, | |
1568 | Int_t s7, Int_t s8 ,Int_t s9 ,Int_t s10, | |
1569 | Int_t s11 , Int_t s12) | |
1570 | { | |
8c555625 | 1571 | //-------------------------------- |
fe4da5cc | 1572 | // Select active upper sectors |
8c555625 | 1573 | //-------------------------------- |
1574 | ||
1575 | //----------------------------------------------------------------- | |
1576 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1577 | //----------------------------------------------------------------- | |
1578 | ||
fe4da5cc | 1579 | fSecUps[0] = s1; |
1580 | fSecUps[1] = s2; | |
1581 | fSecUps[2] = s3; | |
1582 | fSecUps[3] = s4; | |
1583 | fSecUps[4] = s5; | |
1584 | fSecUps[5] = s6; | |
1585 | fSecUps[6] = s7; | |
1586 | fSecUps[7] = s8; | |
1587 | fSecUps[8] = s9; | |
1588 | fSecUps[9] = s10; | |
1589 | fSecUps[10] = s11; | |
1590 | fSecUps[11] = s12; | |
1591 | } | |
1592 | ||
1593 | //_____________________________________________________________________________ | |
1594 | void AliTPC::SetSens(Int_t sens) | |
1595 | { | |
8c555625 | 1596 | |
1597 | //------------------------------------------------------------- | |
1598 | // Activates/deactivates the sensitive strips at the center of | |
1599 | // the pad row -- this is for the space-point resolution calculations | |
1600 | //------------------------------------------------------------- | |
1601 | ||
1602 | //----------------------------------------------------------------- | |
1603 | // Origin: Marek Kowalski IFJ, Krakow, Marek.Kowalski@ifj.edu.pl | |
1604 | //----------------------------------------------------------------- | |
1605 | ||
fe4da5cc | 1606 | fSens = sens; |
1607 | } | |
4b0fdcad | 1608 | |
73042f01 | 1609 | void AliTPC::SetSide(Float_t side=0.) |
4b0fdcad | 1610 | { |
73042f01 | 1611 | // choice of the TPC side |
1612 | ||
4b0fdcad | 1613 | fSide = side; |
1614 | ||
1615 | } | |
1283eee5 | 1616 | //____________________________________________________________________________ |
1617 | void AliTPC::SetGasMixt(Int_t nc,Int_t c1,Int_t c2,Int_t c3,Float_t p1, | |
1618 | Float_t p2,Float_t p3) | |
1619 | { | |
fe4da5cc | 1620 | |
73042f01 | 1621 | // gax mixture definition |
1622 | ||
1283eee5 | 1623 | fNoComp = nc; |
1624 | ||
1625 | fMixtComp[0]=c1; | |
1626 | fMixtComp[1]=c2; | |
1627 | fMixtComp[2]=c3; | |
1628 | ||
1629 | fMixtProp[0]=p1; | |
1630 | fMixtProp[1]=p2; | |
1631 | fMixtProp[2]=p3; | |
1632 | ||
1633 | ||
cc80f89e | 1634 | } |
1635 | //_____________________________________________________________________________ | |
1636 | ||
1637 | void AliTPC::TransportElectron(Float_t *xyz, Int_t *index) | |
1638 | { | |
1639 | // | |
1640 | // electron transport taking into account: | |
1641 | // 1. diffusion, | |
1642 | // 2.ExB at the wires | |
1643 | // 3. nonisochronity | |
1644 | // | |
1645 | // xyz and index must be already transformed to system 1 | |
1646 | // | |
1647 | ||
1648 | fTPCParam->Transform1to2(xyz,index); | |
1649 | ||
1650 | //add diffusion | |
1651 | Float_t driftl=xyz[2]; | |
1652 | if(driftl<0.01) driftl=0.01; | |
1653 | driftl=TMath::Sqrt(driftl); | |
73042f01 | 1654 | Float_t sigT = driftl*(fTPCParam->GetDiffT()); |
1655 | Float_t sigL = driftl*(fTPCParam->GetDiffL()); | |
1656 | xyz[0]=gRandom->Gaus(xyz[0],sigT); | |
1657 | xyz[1]=gRandom->Gaus(xyz[1],sigT); | |
1658 | xyz[2]=gRandom->Gaus(xyz[2],sigL); | |
cc80f89e | 1659 | |
1660 | // ExB | |
1661 | ||
1662 | if (fTPCParam->GetMWPCReadout()==kTRUE){ | |
1663 | Float_t x1=xyz[0]; | |
1664 | fTPCParam->Transform2to2NearestWire(xyz,index); | |
1665 | Float_t dx=xyz[0]-x1; | |
1666 | xyz[1]+=dx*(fTPCParam->GetOmegaTau()); | |
1667 | } | |
1668 | //add nonisochronity (not implemented yet) | |
1669 | ||
1283eee5 | 1670 | } |
fe4da5cc | 1671 | //_____________________________________________________________________________ |
1672 | void AliTPC::Streamer(TBuffer &R__b) | |
1673 | { | |
1674 | // | |
1675 | // Stream an object of class AliTPC. | |
1676 | // | |
1677 | if (R__b.IsReading()) { | |
1678 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
1679 | AliDetector::Streamer(R__b); | |
1680 | if (R__v < 2) return; | |
1681 | R__b >> fNsectors; | |
fe4da5cc | 1682 | } else { |
1683 | R__b.WriteVersion(AliTPC::IsA()); | |
1684 | AliDetector::Streamer(R__b); | |
1685 | R__b << fNsectors; | |
fe4da5cc | 1686 | } |
1687 | } | |
1688 | ||
fe4da5cc | 1689 | ClassImp(AliTPCdigit) |
1690 | ||
1691 | //_____________________________________________________________________________ | |
1692 | AliTPCdigit::AliTPCdigit(Int_t *tracks, Int_t *digits): | |
1693 | AliDigit(tracks) | |
1694 | { | |
1695 | // | |
1696 | // Creates a TPC digit object | |
1697 | // | |
1698 | fSector = digits[0]; | |
1699 | fPadRow = digits[1]; | |
1700 | fPad = digits[2]; | |
1701 | fTime = digits[3]; | |
1702 | fSignal = digits[4]; | |
1703 | } | |
1704 | ||
1705 | ||
1706 | ClassImp(AliTPChit) | |
1707 | ||
1708 | //_____________________________________________________________________________ | |
1709 | AliTPChit::AliTPChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits): | |
1710 | AliHit(shunt,track) | |
1711 | { | |
1712 | // | |
1713 | // Creates a TPC hit object | |
1714 | // | |
1715 | fSector = vol[0]; | |
1716 | fPadRow = vol[1]; | |
1717 | fX = hits[0]; | |
1718 | fY = hits[1]; | |
1719 | fZ = hits[2]; | |
1720 | fQ = hits[3]; | |
1721 | } | |
1722 | ||
8c555625 | 1723 |