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