]>
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 | ||
25 | #include "AliMUONResponseTriggerV1.h" | |
26 | #include "AliMUON.h" | |
27 | #include "AliMUONDigit.h" | |
28 | #include "AliMUONGeometryTransformer.h" | |
29 | #include "AliMUONConstants.h" | |
30 | ||
31 | #include "AliMpPad.h" | |
32 | #include "AliMpSegmentation.h" | |
33 | #include "AliMpVSegmentation.h" | |
34 | #include "AliMpCathodType.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 | } | |
66 | ||
67 | //------------------------------------------------------------------ | |
68 | AliMUONResponseTriggerV1::AliMUONResponseTriggerV1() | |
69 | : AliMUONResponseTrigger(), | |
70 | fGenerCluster(0), | |
71 | fA(0), | |
72 | fB(0), | |
73 | fC(0) | |
74 | { | |
75 | /// default constructor | |
76 | Float_t hv=9.2; | |
77 | SetParameters(hv); | |
78 | } | |
79 | ||
80 | //------------------------------------------------------------------ | |
81 | AliMUONResponseTriggerV1::AliMUONResponseTriggerV1(Float_t hv) | |
82 | : AliMUONResponseTrigger(), | |
83 | fGenerCluster(0), | |
84 | fA(0), | |
85 | fB(0), | |
86 | fC(0) | |
87 | { | |
88 | /// Constructor | |
89 | SetParameters(hv); | |
90 | } | |
91 | ||
92 | //------------------------------------------------------------------ | |
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) | |
103 | /// this parametrisation is valid only for the "streamer" mode | |
104 | fA = 6.089 * hv - 52.70; | |
105 | fB = 2.966; | |
106 | fC = 4.3e-4 * hv - 3.5e-3; | |
107 | } | |
108 | ||
109 | //------------------------------------------------------------------ | |
110 | Int_t AliMUONResponseTriggerV1::SetGenerCluster() | |
111 | { | |
112 | /// Set the GenerCluster parameter and return 1 | |
113 | fGenerCluster = gRandom->Rndm(); | |
114 | return 1; | |
115 | } | |
116 | ||
117 | //------------------------------------------------------------------ | |
118 | Float_t AliMUONResponseTriggerV1::FireStripProb(Float_t x4, Float_t theta) | |
119 | const | |
120 | { | |
121 | /// parametrisation of the probability that a strip neighbour of the main | |
122 | /// strip is fired (V.Barret B.Espagnon and P.Rosnet INT/DIM/01-04 (2001) | |
123 | /// WARNING : need to convert x4 from cm to mm | |
124 | /// this parametrisation is valid only for the "streamer" mode | |
125 | ||
126 | return | |
127 | (TMath::Cos(theta)*fA/(fA+TMath::Cos(theta)*TMath::Power(x4*10.,fB))+fC)/ | |
128 | (TMath::Cos(theta)+fC); | |
129 | } | |
130 | ||
131 | //------------------------------------------------------------------ | |
132 | void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t /*timeDif*/) | |
133 | { | |
134 | /// Generate digits (on each cathode) from 1 hit, with cluster-size | |
135 | /// generation. | |
136 | ||
137 | digits.Clear(); | |
138 | ||
139 | Float_t xhit = hit.X(); | |
140 | Float_t yhit = hit.Y(); | |
141 | Float_t zhit = hit.Z(); | |
142 | Int_t detElemId = hit.DetElemId(); | |
143 | ||
144 | Double_t x,y,z; | |
145 | Global2Local(detElemId,xhit,yhit,zhit,x,y,z); | |
146 | ||
147 | Float_t tof = hit.Age(); | |
148 | Int_t twentyNano(100); | |
149 | if (tof<AliMUONConstants::TriggerTofLimit()) | |
150 | { | |
151 | twentyNano=1; | |
152 | } | |
153 | ||
154 | Bool_t isTrig[2]={kTRUE, kTRUE}; | |
155 | Int_t nboard = 0; | |
156 | ||
157 | for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath ) | |
158 | { | |
159 | const AliMpVSegmentation* seg | |
160 | = AliMpSegmentation::Instance() | |
161 | ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); | |
162 | ||
163 | AliMpPad pad = seg->PadByPosition(x,y,kFALSE); | |
164 | Int_t ix = pad.GetIx(); | |
165 | Int_t iy = pad.GetIy(); | |
166 | ||
167 | AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d", | |
168 | xhit,yhit,x,y,z,ix,iy)); | |
169 | ||
170 | if ( !pad.IsValid() ) | |
171 | { | |
172 | AliWarning(Form("hit w/o strip %d-%d xhit,yhit=%e,%e local x,y,z " | |
173 | "%e,%e,%e ix,iy=%d,%d",detElemId, | |
174 | cath, | |
175 | xhit,yhit,x,y,z,ix,iy)); | |
176 | continue; | |
177 | } | |
178 | ||
179 | if(fTriggerEfficiency){ | |
180 | if(cath==0){ | |
181 | nboard = pad.GetLocalBoardId(0); | |
182 | fTriggerEfficiency->IsTriggered(detElemId, nboard, | |
183 | isTrig[0], isTrig[1]); | |
184 | } | |
185 | if(!isTrig[cath]) continue; | |
186 | } | |
187 | ||
188 | AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0), | |
189 | pad.GetLocalBoardChannel(0), | |
190 | cath); | |
191 | d->SetPadXY(ix,iy); | |
192 | ||
193 | d->SetCharge(twentyNano); | |
194 | ||
195 | ||
196 | digits.Add(d); | |
197 | ||
198 | SetGenerCluster(); // 1 randum number per cathode (to be checked) | |
199 | ||
200 | Int_t xList[10], yList[10]; | |
201 | Neighbours(cath,ix,iy,xList,yList); | |
202 | ||
203 | // cout << " detElemId cath ix iy = " << detElemId << " " << cath | |
204 | // << " " << ix << " " << iy << "\n"; | |
205 | // for (Int_t i=0; i<10; i++) cout << " " << xList[i] << " " << yList[i]; | |
206 | // cout << "\n"; | |
207 | ||
208 | Int_t qp = 0; // fired/no-fired strip = 1/0 | |
209 | for (Int_t i=0; i<10; i++) { // loop on neighbors | |
210 | if (i==0||i==5||qp!=0) { // built-up cluster | |
211 | ||
212 | // need to iterate in iy/ix for bending/non-bending plane | |
213 | Int_t ixNeigh = ( cath == 0 ) ? ix : xList[i]; | |
214 | Int_t iyNeigh = ( cath == 0 ) ? yList[i] : iy; | |
215 | ||
216 | AliMpPad padNeigh = seg->PadByIndices(ixNeigh,iyNeigh,kFALSE); | |
217 | if(padNeigh.IsValid()){ // existing neighbourg | |
218 | ||
219 | Int_t dix=-(ixNeigh-ix); | |
220 | Int_t diy=-(iyNeigh-iy); | |
221 | Float_t xlocalNeigh = padNeigh.GetPositionX(); | |
222 | Float_t ylocalNeigh = padNeigh.GetPositionY(); | |
223 | Float_t dpx = padNeigh.GetDimensionX(); | |
224 | Float_t dpy = padNeigh.GetDimensionY(); | |
225 | Float_t distX = TMath::Abs((Float_t)dix) * ((Float_t)dix * dpx + xlocalNeigh - x); | |
226 | Float_t distY = TMath::Abs((Float_t)diy) * ((Float_t)diy * dpy + ylocalNeigh - y); | |
227 | Float_t dist = TMath::Sqrt(distX*distX+distY*distY); | |
228 | ||
229 | // cout << " here " << dist << " " << fGenerCluster << " " << FireStripProb(dist,0) << "\n"; | |
230 | ||
231 | if (fGenerCluster<FireStripProb(dist,0)) qp = 1; | |
232 | else qp = 0; | |
233 | ||
234 | if (qp == 1) { // this digit is fired | |
235 | AliMUONDigit* dNeigh = new AliMUONDigit(detElemId,padNeigh.GetLocalBoardId(0), | |
236 | padNeigh.GetLocalBoardChannel(0), | |
237 | cath); | |
238 | ||
239 | dNeigh->SetPadXY(ixNeigh,iyNeigh); | |
240 | dNeigh->SetCharge(twentyNano); | |
241 | digits.Add(dNeigh); | |
242 | } // digit fired | |
243 | } // pad is valid | |
244 | } // built-up cluster | |
245 | } // loop on neighbors | |
246 | } // loop on cathode | |
247 | if ( fTriggerEfficiency ) AliDebug(1,Form("MTReff: DetElemId %i Board %3i Fired %i %i", detElemId, nboard, isTrig[0], isTrig[1])); | |
248 | } | |
249 | ||
250 | //------------------------------------------------------------------ | |
251 | void AliMUONResponseTriggerV1::Neighbours(const Int_t cath, | |
252 | const Int_t ix, const Int_t iy, | |
253 | Int_t Xlist[10], Int_t Ylist[10]) const | |
254 | { | |
255 | ///-----------------BENDING----------------------------------------- /n | |
256 | /// Returns list of 10 next neighbours for given X strip (ix, iy) /n | |
257 | /// neighbour number 4 in the list - /n | |
258 | /// neighbour number 3 in the list | /n | |
259 | /// neighbour number 2 in the list |_ Upper part /n | |
260 | /// neighbour number 1 in the list | /n | |
261 | /// neighbour number 0 in the list - /n | |
262 | /// X strip (ix, iy) /n | |
263 | /// neighbour number 5 in the list - /n | |
264 | /// neighbour number 6 in the list | _ Lower part /n | |
265 | /// neighbour number 7 in the list | /n | |
266 | /// neighbour number 8 in the list | /n | |
267 | /// neighbour number 9 in the list - /n | |
268 | /// /n | |
269 | ///-----------------NON-BENDING------------------------------------- /n | |
270 | /// Returns list of 10 next neighbours for given Y strip (ix, iy) /n | |
271 | /// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list /n | |
272 | /// |_______| |_______/ /n | |
273 | ||
274 | /// left right /n | |
275 | ||
276 | for (Int_t i=0; i<10; i++) { | |
277 | Xlist[i]=-1; | |
278 | Ylist[i]=-1; | |
279 | } | |
280 | ||
281 | Int_t iList[10]={9,8,7,6,5, 0,1,2,3,4}; | |
282 | ||
283 | // need to iterate in iy/ix for bending/non-bending plane | |
284 | Int_t iNeigh = ( cath == 0 ) ? iy : ix; | |
285 | ||
286 | Int_t i=0; | |
287 | for (Int_t j=iNeigh-5; j<=iNeigh+5; j++){ | |
288 | if (j == iNeigh) continue; | |
289 | // need to iterate in iy/ix for bending/non-bending plane | |
290 | Int_t ixNeigh = ( cath == 0 ) ? ix : j; | |
291 | Int_t iyNeigh = ( cath == 0 ) ? j : iy; | |
292 | ||
293 | // cout << " " << cath << " " << ix << " " << iy | |
294 | // << " " << ixNeigh << " " << iyNeigh << "\n"; | |
295 | ||
296 | Xlist[iList[i]]=ixNeigh; | |
297 | Ylist[iList[i]]=iyNeigh; | |
298 | i++; | |
299 | } | |
300 | } | |
301 |