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