]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackingSector.cxx
Make use of new method AliRawReader::GetNumberOfEvents() - goinf to the last event...
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackingSector.cxx
CommitLineData
885e9b30 1/**************************************************************************\r
2* Copyright(c) 1998-1999, 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: AliTRDtrackingSector.cxx 23810 2008-02-08 09:00:27Z hristov $ */\r
17\r
18///////////////////////////////////////////////////////////////////////////////\r
19// //\r
20// Tracking data container for one sector //\r
21// //\r
22// Authors: //\r
23// Alex Bercuci <A.Bercuci@gsi.de> //\r
24// Markus Fasel <M.Fasel@gsi.de> //\r
25// //\r
26///////////////////////////////////////////////////////////////////////////////\r
27\r
28#include "AliTRDtrackingSector.h"\r
29#include "AliTRDcalibDB.h"\r
30#include "AliTRDCommonParam.h"\r
31#include "AliTRDgeometry.h"\r
32#include "AliTRDpadPlane.h"\r
33#include "AliTRDtrackingChamber.h"\r
34\r
35ClassImp(AliTRDtrackingSector)\r
36\r
37//_____________________________________________________________________________\r
38AliTRDtrackingSector::AliTRDtrackingSector()\r
39 :fSector(-1)\r
40 ,fN(0)\r
41 ,fGeom(0x0)\r
42{\r
43 // Default constructor\r
44 \r
45 for(int ic=0; ic<kNChambersSector; ic++){\r
46 fChamber[ic] = 0x0;\r
47 fIndex[ic] = -1;\r
48 }\r
49 for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;\r
50}\r
51\r
52//_____________________________________________________________________________\r
53AliTRDtrackingSector::AliTRDtrackingSector(AliTRDgeometry *geo, Int_t gs)\r
54 :fSector(gs)\r
55 ,fN(0)\r
56 ,fGeom(geo)\r
57{\r
58 //\r
59 // AliTRDtrackingSector Constructor\r
60 //\r
61\r
62 for(int ic=0; ic<kNChambersSector; ic++){\r
63 fChamber[ic] = 0x0;\r
64 fIndex[ic] = -1;\r
65 }\r
66 for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;\r
67}\r
68\r
69//_____________________________________________________________________________\r
70AliTRDtrackingSector::AliTRDtrackingSector(const AliTRDtrackingSector &/*t*/)\r
71 :fSector(-1)\r
72 ,fN(0)\r
73 ,fGeom(0x0)\r
74{\r
75 //\r
76 // Copy constructor\r
77 //\r
78\r
79}\r
80\r
81//_____________________________________________________________________________\r
82AliTRDtrackingSector::~AliTRDtrackingSector()\r
83{\r
84 //\r
85 // Destructor\r
86 //\r
87\r
88}\r
89 \r
90//_____________________________________________________________________________\r
91void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec)\r
92{ \r
93// Steer building of tracking chambers and build tracking sector.\r
94// Propagate radial position information (calibration/alignment aware) from chambers to sector level\r
95//\r
96 \r
97 AliTRDchamberTimeBin *tb = 0x0;\r
98 AliTRDtrackingChamber *tc = 0x0; int ic = 0; \r
99 while((ic<kNChambersSector) && (tc = fChamber[ic++])){\r
100 for(Int_t itb=0; itb<AliTRDtrackingChamber::kNTimeBins; itb++){\r
101 if(!(tb = tc->GetTB(itb))) continue;\r
102 tb->SetReconstructor(rec);\r
103 }\r
104 tc->Build(fGeom);\r
105 }\r
106 \r
107 Int_t nl;\r
108 for(int il=0; il<AliTRDgeometry::kNlayer; il++){\r
109 fX0[il] = 0.; nl = 0;\r
110 for(int is=0; is<AliTRDgeometry::kNstack; is++){\r
111 Int_t idx = is*AliTRDgeometry::kNlayer + il;\r
112 if(fIndex[idx]<0) continue;\r
113 tc = GetChamber(fIndex[idx]);\r
114 fX0[il] += tc->GetX(); nl++; \r
115 }\r
116 if(!nl){\r
117 //printf("Could not estimate radial position of plane %d in sector %d.\n", ip, fSector);\r
118 continue;\r
119 }\r
120 fX0[il] /= Float_t(nl);\r
121 }\r
122}\r
123\r
124\r
125\r
126//_____________________________________________________________________________\r
127void AliTRDtrackingSector::Clear(const Option_t *opt)\r
128{\r
129// Reset counters and steer chamber clear\r
130\r
131 for(Int_t ich=0; ich<fN; ich++){ \r
132 fChamber[ich]->Clear(opt);\r
133 delete fChamber[ich]; fChamber[ich] = 0x0; // I would avoid\r
134 } \r
135 for(Int_t ich=0; ich<kNChambersSector; ich++) fIndex[ich] = -1;\r
136 fN = 0;\r
137}\r
138\r
139//_____________________________________________________________________________\r
140AliTRDtrackingChamber* AliTRDtrackingSector::GetChamber(Int_t stack, Int_t layer, Bool_t build)\r
141{\r
142// Return chamber at position (stack, plane) in current \r
143// sector or build a new one if it is not already created\r
144 \r
145 Int_t ch = stack*AliTRDgeometry::kNlayer + layer;\r
146 if(fIndex[ch] >= 0) return fChamber[Int_t(fIndex[ch])];\r
147 else if(!build) return 0x0;\r
148 \r
149 // CHAMBER HAS TO BE BUILD\r
150 Int_t rch = ch;do rch--; while(rch>=0 && fIndex[rch]<0);\r
151 fIndex[ch] = rch >=0 ? fIndex[rch]+1 : 0; \r
152 fN++;\r
153 \r
154 memmove(&fChamber[Int_t(fIndex[ch])+1], &fChamber[Int_t(fIndex[ch])], (kNChambersSector-fIndex[ch]-1)*sizeof(void*));\r
155 for(Int_t ic = ch+1; ic<kNChambersSector; ic++) fIndex[ic] += fIndex[ic] >= 0 ? 1 : 0;\r
156 \r
157 return fChamber[Int_t(fIndex[ch])] = new AliTRDtrackingChamber(AliTRDgeometry::GetDetector(layer, stack, fSector));\r
158}\r
159\r
160//_____________________________________________________________________________\r
161AliTRDtrackingChamber** AliTRDtrackingSector::GetStack(Int_t stack)\r
162{\r
163// Return chamber at position (stack, plane) in current \r
164// sector or build a new one if it is not already created\r
165 \r
166 if(stack<0 || stack>=AliTRDgeometry::kNstack) return 0x0;\r
167 \r
168 Int_t ich, n = 0;\r
169 for(int il=0; il<AliTRDgeometry::kNlayer; il++){\r
170 ich = stack*AliTRDgeometry::kNlayer + il;\r
171 if(fIndex[ich] < 0) fStack[il] = 0x0; \r
172 else{\r
173 fStack[il] = fChamber[Int_t(fIndex[ich])];\r
174 n++;\r
175 }\r
176 }\r
177 \r
178 return n ? &fStack[0] : 0x0;\r
179}\r
180\r
181//_____________________________________________________________________________\r
182void AliTRDtrackingSector::Print(Option_t *)\r
183{\r
184// Dump info about this tracking sector and the tracking chamber within\r
185// \r
186\r
187 printf("\tSector %2d\n", fSector);\r
188 for(int il=0; il<6; il++){\r
189 for(int is =0; is<5; is++){\r
190 Int_t ch = is*AliTRDgeometry::kNlayer + il;\r
191 printf("%2d[%2d] ", fIndex[ch], fIndex[ch]>=0 ? fChamber[Int_t(fIndex[ch])]->GetNClusters() : 0);\r
192 }\r
193 printf("\n");\r
194 }\r
195\r
196}\r