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