]>
Commit | Line | Data |
---|---|---|
7771752e | 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 | /// | |
18 | /// \class AliMUONTrackHitPattern | |
19 | /// | |
20 | /// This class propagates tracks to trigger chambers | |
21 | /// searching for fired strips. | |
22 | /// | |
23 | /// To each track, a hit pattern for trigger chambers is set. | |
24 | /// The hit pattern is a UShort_t with 8 bits used: | |
25 | /// | |
26 | /// 1 1 0 1 1 1 0 1 | |
27 | /// | | | | |
28 | /// ----------- ------------ | |
29 | /// chamber: 11 12 13 14 | 11 12 13 14 | |
30 | /// cathode: bending | non-bending | |
31 | /// | |
32 | /// The main method is: | |
33 | /// * GetHitPattern | |
34 | /// | |
35 | /// \author Diego Stocco | |
36 | /// | |
37 | //////////////////////////////////// | |
38 | ||
39 | ||
40 | #include "AliMUONTrackHitPattern.h" | |
7ec3b9cf | 41 | |
42 | #include "AliLog.h" | |
7771752e | 43 | #include "AliMUONConstants.h" |
7ec3b9cf | 44 | #include "AliMUONVDigit.h" |
45 | #include "AliMUONDigitMaker.h" | |
46 | #include "AliMUONDigitStoreV1.h" | |
7771752e | 47 | #include "AliMUONGeometryTransformer.h" |
7771752e | 48 | #include "AliMUONLocalTrigger.h" |
7771752e | 49 | #include "AliMUONLocalTriggerBoard.h" |
7ec3b9cf | 50 | #include "AliMUONTrack.h" |
51 | #include "AliMUONTrackExtrap.h" | |
52 | #include "AliMUONTrackParam.h" | |
53 | #include "AliMUONVTrackStore.h" | |
54 | #include "AliMUONVTriggerStore.h" | |
55 | #include "AliMagF.h" | |
7771752e | 56 | #include "AliMpPad.h" |
7771752e | 57 | #include "AliMpSegmentation.h" |
7ec3b9cf | 58 | #include "AliMpVSegmentation.h" |
7771752e | 59 | #include "AliTracker.h" |
7771752e | 60 | #include <Riostream.h> |
7ec3b9cf | 61 | #include <TArrayS.h> |
7771752e | 62 | #include <TClonesArray.h> |
63 | #include <TMath.h> | |
64 | #include <TMatrixD.h> | |
7771752e | 65 | |
66 | /// \cond CLASSIMP | |
67 | ClassImp(AliMUONTrackHitPattern) // Class implementation in ROOT context | |
68 | /// \endcond | |
69 | ||
70 | ||
71 | //______________________________________________________________________________ | |
7ec3b9cf | 72 | AliMUONTrackHitPattern::AliMUONTrackHitPattern(const AliMUONGeometryTransformer& transformer, |
73 | const AliMUONDigitMaker& digitMaker) | |
7771752e | 74 | : TObject(), |
7ec3b9cf | 75 | fTransformer(transformer), |
76 | fDigitMaker(digitMaker) | |
7771752e | 77 | { |
78 | /// Default constructor | |
79 | ||
80 | // Set magnetic field | |
81 | const AliMagF* kField = AliTracker::GetFieldMap(); | |
82 | if (!kField) AliFatal("No field available"); | |
83 | AliMUONTrackExtrap::SetField(kField); | |
7771752e | 84 | } |
85 | ||
86 | ||
87 | //______________________________________________________________________________ | |
88 | AliMUONTrackHitPattern::~AliMUONTrackHitPattern(void) | |
89 | { | |
7ec3b9cf | 90 | /// Destructor |
7771752e | 91 | } |
92 | ||
93 | ||
94 | //______________________________________________________________________________ | |
7ec3b9cf | 95 | void AliMUONTrackHitPattern::GetHitPattern(AliMUONVTrackStore& trackStore, |
96 | const AliMUONVTriggerStore& triggerStore) const | |
7771752e | 97 | { |
98 | // | |
99 | /// Main method: | |
100 | /// Loops on reco tracks, extrapolates them to trigger chambers | |
101 | /// and searches for matching digits | |
102 | // | |
103 | ||
7ec3b9cf | 104 | const Int_t kMask[2][4]= {{0x80, 0x40, 0x20, 0x10}, |
105 | {0x08, 0x04, 0x02, 0x01}}; | |
7771752e | 106 | Bool_t isMatch[2]; |
7ec3b9cf | 107 | |
7771752e | 108 | UShort_t pattern=0; |
7ec3b9cf | 109 | |
110 | AliMUONDigitStoreV1 digitStore; | |
111 | ||
112 | TriggerDigits(triggerStore,digitStore); | |
113 | ||
114 | AliMUONTrack* muonTrack; | |
115 | TIter next(trackStore.CreateIterator()); | |
116 | ||
117 | while ( ( muonTrack = static_cast<AliMUONTrack*>(next()) ) ) | |
118 | { | |
119 | pattern = 0; | |
120 | AliMUONTrackParam *trackParam = static_cast<AliMUONTrackParam*> | |
121 | (muonTrack->GetTrackParamAtHit()->Last()); | |
122 | ||
123 | for(Int_t ch=0; ch<4; ++ch) | |
124 | { | |
125 | AliMUONTrackExtrap::ExtrapToZCov(trackParam, AliMUONConstants::DefaultChamberZ(10+ch)); | |
126 | FindPadMatchingTrack(digitStore,*trackParam, isMatch, ch); | |
127 | for(Int_t cath=0; cath<2; ++cath) | |
128 | { | |
129 | if(isMatch[cath]) pattern |= kMask[cath][ch]; | |
7771752e | 130 | } |
7ec3b9cf | 131 | } |
132 | muonTrack->SetHitsPatternInTrigCh(pattern); | |
7771752e | 133 | } |
7771752e | 134 | } |
135 | ||
136 | ||
137 | //______________________________________________________________________________ | |
7ec3b9cf | 138 | void |
139 | AliMUONTrackHitPattern::FindPadMatchingTrack(AliMUONVDigitStore& digitStore, | |
140 | const AliMUONTrackParam& trackParam, | |
141 | Bool_t isMatch[2], Int_t /*iChamber*/) const | |
7771752e | 142 | { |
143 | // | |
144 | /// Given track position, searches for matching digits. | |
145 | // | |
146 | ||
147 | Float_t minMatchDist[2]; | |
148 | ||
7ec3b9cf | 149 | for(Int_t cath=0; cath<2; ++cath) |
150 | { | |
151 | isMatch[cath]=kFALSE; | |
152 | minMatchDist[cath]=9999.; | |
7771752e | 153 | } |
154 | ||
7ec3b9cf | 155 | TIter next(digitStore.CreateIterator()); |
156 | AliMUONVDigit* mDigit; | |
157 | ||
158 | while ( ( mDigit = static_cast<AliMUONVDigit*>(next()) ) ) | |
159 | { | |
160 | Int_t currDetElemId = mDigit->DetElemId(); | |
161 | Int_t cathode = mDigit->Cathode(); | |
162 | Int_t ix = mDigit->PadX(); | |
163 | Int_t iy = mDigit->PadY(); | |
164 | Float_t xpad, ypad, zpad; | |
165 | const AliMpVSegmentation* seg = AliMpSegmentation::Instance() | |
166 | ->GetMpSegmentation(currDetElemId,AliMp::GetCathodType(cathode)); | |
167 | ||
168 | AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); | |
169 | Float_t xlocal1 = pad.Position().X(); | |
170 | Float_t ylocal1 = pad.Position().Y(); | |
171 | Float_t dpx = pad.Dimensions().X(); | |
172 | Float_t dpy = pad.Dimensions().Y(); | |
173 | fTransformer.Local2Global(currDetElemId, xlocal1, ylocal1, 0, xpad, ypad, zpad); | |
174 | Float_t matchDist = MinDistanceFromPad(xpad, ypad, zpad, dpx, dpy, trackParam); | |
175 | if(matchDist>minMatchDist[cathode])continue; | |
176 | isMatch[cathode] = kTRUE; | |
177 | minMatchDist[cathode] = matchDist; | |
7771752e | 178 | } |
7771752e | 179 | } |
180 | ||
181 | ||
182 | //______________________________________________________________________________ | |
7ec3b9cf | 183 | Float_t |
184 | AliMUONTrackHitPattern::MinDistanceFromPad(Float_t xPad, Float_t yPad, Float_t zPad, | |
185 | Float_t dpx, Float_t dpy, | |
186 | const AliMUONTrackParam& trackParam) const | |
7771752e | 187 | { |
188 | // | |
189 | /// Decides if the digit belongs to the track. | |
190 | // | |
7ec3b9cf | 191 | Float_t xTrackAtPad = trackParam.GetNonBendingCoor(); |
192 | Float_t yTrackAtPad = trackParam.GetBendingCoor(); | |
7771752e | 193 | |
194 | Float_t sigmaX, sigmaY, sigmaMS; | |
195 | GetPosUncertainty(trackParam, zPad, sigmaX, sigmaY, sigmaMS); | |
196 | ||
197 | Float_t maxDistX = 3.*(sigmaX + sigmaMS); // in cm | |
198 | Float_t maxDistY = 3.*(sigmaY + sigmaMS); // in cm | |
199 | ||
200 | Float_t deltaX = TMath::Abs(xPad-xTrackAtPad)-dpx; | |
201 | Float_t deltaY = TMath::Abs(yPad-yTrackAtPad)-dpy; | |
202 | ||
203 | Float_t matchDist = 99999.; | |
204 | if(deltaX<=maxDistX && deltaY<=maxDistY) matchDist = TMath::Max(deltaX, deltaY); | |
205 | return matchDist; | |
206 | } | |
207 | ||
208 | ||
209 | //______________________________________________________________________________ | |
7ec3b9cf | 210 | void |
211 | AliMUONTrackHitPattern::GetPosUncertainty(const AliMUONTrackParam& trackParam, | |
212 | Float_t zChamber, | |
213 | Float_t &sigmaX, Float_t &sigmaY, | |
214 | Float_t &sigmaMS) const | |
7771752e | 215 | { |
216 | // | |
217 | /// Returns uncertainties on extrapolated position. | |
218 | /// Takes into account Branson plane corrections in the iron wall. | |
219 | // | |
220 | ||
7dc68cf4 | 221 | const Float_t kAlpha = 0.1123; // GeV/c |
7771752e | 222 | |
223 | // Find a better way to get such parameters ??? | |
224 | const Float_t kZFilterIn = 1471.; // From STRUCT/SHILConst2.h | |
225 | const Float_t kZFilterOut = kZFilterIn + 120.; // From STRUCT/SHILConst2.h | |
226 | ||
7dc68cf4 | 227 | const Float_t kZBranson = - (kZFilterIn + (kZFilterOut - kZFilterIn)*2./3. ); // - sign because distance are positive |
228 | Float_t zDistFromWall = TMath::Abs(zChamber - kZBranson); | |
7771752e | 229 | Float_t zDistFromLastTrackCh = TMath::Abs(zChamber - AliMUONConstants::DefaultChamberZ(9)); |
230 | ||
7ec3b9cf | 231 | TMatrixD *covParam = trackParam.GetCovariances(); |
7771752e | 232 | |
233 | sigmaX = (*covParam)(0,0); | |
234 | sigmaY = (*covParam)(2,2); | |
235 | ||
236 | // If covariance matrix is not extrapolated, use "reasonable" errors | |
237 | // (To be removed as soon as covariance matrix is correctly propagated). | |
238 | if (sigmaX==0.)sigmaX = 0.003 * zDistFromLastTrackCh; | |
239 | if (sigmaY==0.)sigmaY = 0.004 * zDistFromLastTrackCh; | |
240 | ||
7ec3b9cf | 241 | Float_t p = trackParam.P(); |
7dc68cf4 | 242 | Float_t thetaMS = kAlpha/p; |
7771752e | 243 | sigmaMS = zDistFromWall * TMath::Tan(thetaMS); |
7771752e | 244 | } |
245 | ||
246 | ||
7ec3b9cf | 247 | //______________________________________________________________________________ |
248 | Bool_t | |
249 | AliMUONTrackHitPattern::TriggerDigits(const AliMUONVTriggerStore& triggerStore, | |
250 | AliMUONVDigitStore& digitStore) const | |
7771752e | 251 | { |
7ec3b9cf | 252 | // |
253 | /// make (S)Digit for trigger | |
254 | // | |
255 | ||
256 | digitStore.Clear(); | |
257 | ||
258 | AliMUONLocalTrigger* locTrg; | |
259 | TIter next(triggerStore.CreateLocalIterator()); | |
260 | ||
261 | while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) ) | |
262 | { | |
24754ef8 | 263 | if (locTrg->IsNull()) continue; |
264 | ||
7ec3b9cf | 265 | TArrayS xyPattern[2]; |
24754ef8 | 266 | locTrg->GetXPattern(xyPattern[0]); |
267 | locTrg->GetYPattern(xyPattern[1]); | |
268 | ||
269 | // do we need this ? (Ch.F.) | |
270 | // for(Int_t cath=0; cath<2; ++cath) | |
271 | // { | |
272 | // for(Int_t ch=0; ch<4; ++ch) | |
273 | // { | |
274 | // if(xyPattern[cath][ch]==0) continue; | |
275 | // } | |
276 | // } | |
7ec3b9cf | 277 | |
278 | Int_t nBoard = locTrg->LoCircuit(); | |
279 | fDigitMaker.TriggerDigits(nBoard, xyPattern, digitStore); | |
280 | } | |
281 | return kTRUE; | |
7771752e | 282 | } |