]>
Commit | Line | Data |
---|---|---|
e087fe7f | 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 | ||
30178c30 | 16 | /* $Id$ */ |
e087fe7f | 17 | |
d1525c79 | 18 | // ------------------ |
19 | // Class AliMUONTriggerResponseV1 | |
20 | // ------------------ | |
21 | // Trigger chamber response | |
22 | // with cluster size activated | |
23 | ||
30178c30 | 24 | #include <TMath.h> |
25 | #include <TRandom.h> | |
e087fe7f | 26 | |
27 | #include "AliMUONResponseTriggerV1.h" | |
337c9041 | 28 | #include "AliMUONGeometrySegmentation.h" |
4e702a25 | 29 | #include "AliMpPad.h" |
30 | #include "AliMUON.h" | |
31 | #include "AliMUONDigit.h" | |
32 | #include "AliMUONGeometryTransformer.h" | |
33 | #include "AliMpVSegmentation.h" | |
34 | #include "AliRun.h" | |
35 | #include "AliMUONSegmentation.h" | |
e087fe7f | 36 | |
37 | ClassImp(AliMUONResponseTriggerV1) | |
38 | ||
4e702a25 | 39 | namespace |
40 | { | |
41 | AliMUON* muon() | |
42 | { | |
43 | return static_cast<AliMUON*>(gAlice->GetModule("MUON")); | |
44 | } | |
45 | ||
46 | void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg, | |
47 | Double_t& xl, Double_t& yl, Double_t& zl) | |
48 | { | |
49 | // ideally should be : | |
50 | // Double_t x,y,z; | |
51 | // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z); | |
52 | // but while waiting for this geometry singleton, let's go through | |
53 | // AliMUON still. | |
54 | ||
55 | const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer(); | |
56 | transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl); | |
57 | } | |
58 | ||
59 | AliMUONSegmentation* Segmentation() | |
60 | { | |
61 | static AliMUONSegmentation* segmentation = muon()->GetSegmentation(); | |
62 | return segmentation; | |
63 | } | |
64 | } | |
65 | ||
e087fe7f | 66 | //------------------------------------------------------------------ |
30178c30 | 67 | AliMUONResponseTriggerV1::AliMUONResponseTriggerV1() |
1657f946 | 68 | : AliMUONResponseTrigger(), |
69 | fGenerCluster(0), | |
70 | fA(0), | |
71 | fB(0), | |
72 | fC(0) | |
30178c30 | 73 | { |
e087fe7f | 74 | // default constructor |
75 | Float_t hv=9.2; | |
76 | SetParameters(hv); | |
77 | } | |
78 | ||
79 | //------------------------------------------------------------------ | |
30178c30 | 80 | AliMUONResponseTriggerV1::AliMUONResponseTriggerV1(Float_t hv) |
1657f946 | 81 | : AliMUONResponseTrigger(), |
82 | fGenerCluster(0), | |
83 | fA(0), | |
84 | fB(0), | |
85 | fC(0) | |
30178c30 | 86 | { |
e087fe7f | 87 | // Constructor |
88 | SetParameters(hv); | |
89 | } | |
90 | ||
91 | //------------------------------------------------------------------ | |
92 | void AliMUONResponseTriggerV1::SetParameters(Float_t hv){ | |
93 | // initialize parameters accoring to HV | |
94 | // (see V.Barret B.Espagnon and P.Rosnet Alice/note xxx) | |
95 | fA = 6.089 * hv - 52.70; | |
96 | fB = 2.966; | |
97 | fC = 4.3e-4 * hv - 3.5e-3; | |
98 | } | |
99 | ||
100 | //------------------------------------------------------------------ | |
101 | Int_t AliMUONResponseTriggerV1::SetGenerCluster(){ | |
102 | // Set the GenerCluster parameter and return 1 | |
103 | fGenerCluster = gRandom->Rndm(); | |
104 | return 1; | |
337c9041 | 105 | } |
e087fe7f | 106 | |
107 | //------------------------------------------------------------------ | |
85fec35d | 108 | Float_t AliMUONResponseTriggerV1::FireStripProb(Float_t x4, Float_t theta) |
109 | const | |
110 | { | |
e087fe7f | 111 | // parametrisation of the probability that a strip neighbour of the main |
4e702a25 | 112 | // strip is fired (V.Barret B.Espagnon and P.Rosnet INT/DIM/01-04 (2001) |
e087fe7f | 113 | // WARNING : need to convert x4 from cm to mm |
114 | ||
4e702a25 | 115 | return |
116 | (TMath::Cos(theta)*fA/(fA+TMath::Cos(theta)*TMath::Power(x4*10.,fB))+fC)/ | |
117 | (TMath::Cos(theta)+fC); | |
118 | } | |
119 | ||
120 | //------------------------------------------------------------------ | |
121 | void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits) | |
122 | { | |
123 | // | |
124 | // Generate digits (on each cathode) from 1 hit, with cluster-size | |
125 | // generation. | |
126 | // | |
127 | ||
128 | digits.Clear(); | |
129 | ||
130 | Float_t xhit = hit.X(); | |
131 | Float_t yhit = hit.Y(); | |
132 | Float_t zhit = 0; // FIXME : should it be hit.Z() ? | |
133 | Int_t detElemId = hit.DetElemId(); | |
134 | ||
135 | Double_t x,y,z; | |
136 | Global2Local(detElemId,xhit,yhit,zhit,x,y,z); | |
137 | ||
138 | Float_t tof = hit.Age(); | |
139 | Int_t twentyNano(100); | |
140 | if (tof<fgkTofLimit) | |
141 | { | |
142 | twentyNano=1; | |
143 | } | |
144 | ||
145 | for ( Int_t cath = 0; cath < 2; ++cath ) | |
146 | { | |
147 | const AliMpVSegmentation* seg = Segmentation()->GetMpSegmentation(detElemId,cath); | |
148 | ||
149 | AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE); | |
150 | Int_t ix = pad.GetIndices().GetFirst(); | |
151 | Int_t iy = pad.GetIndices().GetSecond(); | |
152 | ||
153 | AliMUONDigit* d = new AliMUONDigit; | |
154 | d->SetDetElemId(detElemId); | |
155 | ||
156 | d->SetPadX(ix); | |
157 | d->SetPadY(iy); | |
158 | ||
159 | d->SetSignal(twentyNano); | |
160 | d->AddPhysicsSignal(d->Signal()); | |
161 | d->SetCathode(cath); | |
162 | digits.Add(d); | |
163 | ||
164 | SetGenerCluster(); // 1 randum number per cathode (to be checked) | |
165 | ||
166 | Int_t xList[10], yList[10]; | |
167 | Neighbours(cath,ix,iy,xList,yList); | |
168 | ||
169 | // cout << " detElemId cath ix iy = " << detElemId << " " << cath | |
170 | // << " " << ix << " " << iy << "\n"; | |
171 | // for (Int_t i=0; i<10; i++) cout << " " << xList[i] << " " << yList[i]; | |
172 | // cout << "\n"; | |
173 | ||
174 | Int_t qp = 0; // fired/no-fired strip = 1/0 | |
175 | for (Int_t i=0; i<10; i++) { // loop on neighbors | |
176 | if (i==0||i==5||qp!=0) { // built-up cluster | |
177 | ||
178 | // need to iterate in iy/ix for bending/non-bending plane | |
179 | Int_t ixNeigh = ( cath == 0 ) ? ix : xList[i]; | |
180 | Int_t iyNeigh = ( cath == 0 ) ? yList[i] : iy; | |
181 | ||
182 | AliMpIntPair pairNeigh = AliMpIntPair(ixNeigh,iyNeigh); | |
183 | AliMpPad padNeigh = seg->PadByIndices(pairNeigh,kFALSE); | |
184 | if(padNeigh.IsValid()){ // existing neighbourg | |
185 | ||
186 | Int_t dix=-(ixNeigh-ix); | |
187 | Int_t diy=-(iyNeigh-iy); | |
188 | Float_t xlocalNeigh = padNeigh.Position().X(); | |
189 | Float_t ylocalNeigh = padNeigh.Position().Y(); | |
190 | Float_t dpx = padNeigh.Dimensions().X(); | |
191 | Float_t dpy = padNeigh.Dimensions().Y(); | |
192 | Float_t distX = TMath::Abs((Float_t)dix) * ((Float_t)dix * dpx + xlocalNeigh - x); | |
193 | Float_t distY = TMath::Abs((Float_t)diy) * ((Float_t)diy * dpy + ylocalNeigh - y); | |
194 | Float_t dist = TMath::Sqrt(distX*distX+distY*distY); | |
195 | ||
196 | // cout << " here " << dist << " " << fGenerCluster << " " << FireStripProb(dist,0) << "\n"; | |
197 | ||
198 | if (fGenerCluster<FireStripProb(dist,0)) qp = 1; | |
199 | else qp = 0; | |
200 | ||
201 | if (qp == 1) { // this digit is fired | |
202 | AliMUONDigit* dNeigh = new AliMUONDigit; | |
203 | dNeigh->SetDetElemId(detElemId); | |
204 | ||
205 | dNeigh->SetPadX(ixNeigh); | |
206 | dNeigh->SetPadY(iyNeigh); | |
207 | ||
208 | dNeigh->SetSignal(twentyNano); | |
209 | dNeigh->AddPhysicsSignal(dNeigh->Signal()); | |
210 | dNeigh->SetCathode(cath); | |
211 | digits.Add(dNeigh); | |
212 | } // digit fired | |
213 | } // pad is valid | |
214 | } // built-up cluster | |
215 | } // loop on neighbors | |
216 | } // loop on cathode | |
217 | } | |
218 | ||
219 | //------------------------------------------------------------------ | |
220 | void AliMUONResponseTriggerV1::Neighbours(const Int_t cath, | |
221 | const Int_t ix, const Int_t iy, | |
222 | Int_t Xlist[10], Int_t Ylist[10]) | |
223 | { | |
224 | ||
225 | //-----------------BENDING----------------------------------------- | |
226 | // Returns list of 10 next neighbours for given X strip (ix, iy) | |
227 | // neighbour number 4 in the list - | |
228 | // neighbour number 3 in the list | | |
229 | // neighbour number 2 in the list |_ Upper part | |
230 | // neighbour number 1 in the list | | |
231 | // neighbour number 0 in the list - | |
232 | // X strip (ix, iy) | |
233 | // neighbour number 5 in the list - | |
234 | // neighbour number 6 in the list | _ Lower part | |
235 | // neighbour number 7 in the list | | |
236 | // neighbour number 8 in the list | | |
237 | // neighbour number 9 in the list - | |
238 | ||
239 | //-----------------NON-BENDING------------------------------------- | |
240 | // Returns list of 10 next neighbours for given Y strip (ix, iy) | |
241 | // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list | |
242 | // \_______/ \_______/ | |
243 | // left right | |
244 | ||
245 | for (Int_t i=0; i<10; i++) { | |
246 | Xlist[i]=-1; | |
247 | Ylist[i]=-1; | |
248 | } | |
249 | ||
250 | Int_t iList[10]={9,8,7,6,5, 0,1,2,3,4}; | |
251 | ||
252 | // need to iterate in iy/ix for bending/non-bending plane | |
253 | Int_t iNeigh = ( cath == 0 ) ? iy : ix; | |
254 | ||
255 | Int_t i=0; | |
256 | for (Int_t j=iNeigh-5; j<=iNeigh+5; j++){ | |
257 | if (j == iNeigh) continue; | |
258 | // need to iterate in iy/ix for bending/non-bending plane | |
259 | Int_t ixNeigh = ( cath == 0 ) ? ix : j; | |
260 | Int_t iyNeigh = ( cath == 0 ) ? j : iy; | |
261 | ||
262 | // cout << " " << cath << " " << ix << " " << iy | |
263 | // << " " << ixNeigh << " " << iyNeigh << "\n"; | |
264 | ||
265 | Xlist[iList[i]]=ixNeigh; | |
266 | Ylist[iList[i]]=iyNeigh; | |
267 | i++; | |
268 | } | |
e087fe7f | 269 | } |
270 |