1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Class AliMUONTriggerResponseV1
21 // Trigger chamber response
22 // with cluster size activated
24 #include "AliMUONResponseTriggerV1.h"
26 #include "AliMUONDigit.h"
27 #include "AliMUONGeometryTransformer.h"
28 #include "AliMUONConstants.h"
31 #include "AliMpSegmentation.h"
32 #include "AliMpVSegmentation.h"
33 #include "AliMpCathodType.h"
41 ClassImp(AliMUONResponseTriggerV1)
48 return static_cast<AliMUON*>(gAlice->GetModule("MUON"));
51 void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
52 Double_t& xl, Double_t& yl, Double_t& zl)
54 // ideally should be :
56 // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z);
57 // but while waiting for this geometry singleton, let's go through
60 const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
61 transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
66 //------------------------------------------------------------------
67 AliMUONResponseTriggerV1::AliMUONResponseTriggerV1()
68 : AliMUONResponseTrigger(),
74 /// default constructor
79 //------------------------------------------------------------------
80 AliMUONResponseTriggerV1::AliMUONResponseTriggerV1(Float_t hv)
81 : AliMUONResponseTrigger(),
91 //------------------------------------------------------------------
92 AliMUONResponseTriggerV1::~AliMUONResponseTriggerV1()
97 //------------------------------------------------------------------
98 void AliMUONResponseTriggerV1::SetParameters(Float_t hv)
100 /// initialize parameters accoring to HV
101 /// (see V.Barret B.Espagnon and P.Rosnet Alice/note xxx)
102 fA = 6.089 * hv - 52.70;
104 fC = 4.3e-4 * hv - 3.5e-3;
107 //------------------------------------------------------------------
108 Int_t AliMUONResponseTriggerV1::SetGenerCluster()
110 /// Set the GenerCluster parameter and return 1
111 fGenerCluster = gRandom->Rndm();
115 //------------------------------------------------------------------
116 Float_t AliMUONResponseTriggerV1::FireStripProb(Float_t x4, Float_t theta)
119 /// parametrisation of the probability that a strip neighbour of the main
120 /// strip is fired (V.Barret B.Espagnon and P.Rosnet INT/DIM/01-04 (2001)
121 /// WARNING : need to convert x4 from cm to mm
124 (TMath::Cos(theta)*fA/(fA+TMath::Cos(theta)*TMath::Power(x4*10.,fB))+fC)/
125 (TMath::Cos(theta)+fC);
128 //------------------------------------------------------------------
129 void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits)
131 /// Generate digits (on each cathode) from 1 hit, with cluster-size
136 Float_t xhit = hit.X();
137 Float_t yhit = hit.Y();
138 Float_t zhit = 0; // FIXME : should it be hit.Z() ?
139 Int_t detElemId = hit.DetElemId();
142 Global2Local(detElemId,xhit,yhit,zhit,x,y,z);
144 Float_t tof = hit.Age();
145 Int_t twentyNano(100);
146 if (tof<AliMUONConstants::TriggerTofLimit())
151 for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
153 const AliMpVSegmentation* seg
154 = AliMpSegmentation::Instance()
155 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
157 AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE);
158 Int_t ix = pad.GetIndices().GetFirst();
159 Int_t iy = pad.GetIndices().GetSecond();
161 AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocation(0).GetFirst(),
162 pad.GetLocation(0).GetSecond(),
166 d->SetCharge(twentyNano);
169 SetGenerCluster(); // 1 randum number per cathode (to be checked)
171 Int_t xList[10], yList[10];
172 Neighbours(cath,ix,iy,xList,yList);
174 // cout << " detElemId cath ix iy = " << detElemId << " " << cath
175 // << " " << ix << " " << iy << "\n";
176 // for (Int_t i=0; i<10; i++) cout << " " << xList[i] << " " << yList[i];
179 Int_t qp = 0; // fired/no-fired strip = 1/0
180 for (Int_t i=0; i<10; i++) { // loop on neighbors
181 if (i==0||i==5||qp!=0) { // built-up cluster
183 // need to iterate in iy/ix for bending/non-bending plane
184 Int_t ixNeigh = ( cath == 0 ) ? ix : xList[i];
185 Int_t iyNeigh = ( cath == 0 ) ? yList[i] : iy;
187 AliMpIntPair pairNeigh = AliMpIntPair(ixNeigh,iyNeigh);
188 AliMpPad padNeigh = seg->PadByIndices(pairNeigh,kFALSE);
189 if(padNeigh.IsValid()){ // existing neighbourg
191 Int_t dix=-(ixNeigh-ix);
192 Int_t diy=-(iyNeigh-iy);
193 Float_t xlocalNeigh = padNeigh.Position().X();
194 Float_t ylocalNeigh = padNeigh.Position().Y();
195 Float_t dpx = padNeigh.Dimensions().X();
196 Float_t dpy = padNeigh.Dimensions().Y();
197 Float_t distX = TMath::Abs((Float_t)dix) * ((Float_t)dix * dpx + xlocalNeigh - x);
198 Float_t distY = TMath::Abs((Float_t)diy) * ((Float_t)diy * dpy + ylocalNeigh - y);
199 Float_t dist = TMath::Sqrt(distX*distX+distY*distY);
201 // cout << " here " << dist << " " << fGenerCluster << " " << FireStripProb(dist,0) << "\n";
203 if (fGenerCluster<FireStripProb(dist,0)) qp = 1;
206 if (qp == 1) { // this digit is fired
207 AliMUONDigit* dNeigh = new AliMUONDigit(detElemId,padNeigh.GetLocation(0).GetFirst(),
208 padNeigh.GetLocation(0).GetSecond(),
211 dNeigh->SetPadXY(ixNeigh,iyNeigh);
212 dNeigh->SetCharge(twentyNano);
216 } // built-up cluster
217 } // loop on neighbors
221 //------------------------------------------------------------------
222 void AliMUONResponseTriggerV1::Neighbours(const Int_t cath,
223 const Int_t ix, const Int_t iy,
224 Int_t Xlist[10], Int_t Ylist[10])
226 ///-----------------BENDING----------------------------------------- /n
227 /// Returns list of 10 next neighbours for given X strip (ix, iy) /n
228 /// neighbour number 4 in the list - /n
229 /// neighbour number 3 in the list | /n
230 /// neighbour number 2 in the list |_ Upper part /n
231 /// neighbour number 1 in the list | /n
232 /// neighbour number 0 in the list - /n
233 /// X strip (ix, iy) /n
234 /// neighbour number 5 in the list - /n
235 /// neighbour number 6 in the list | _ Lower part /n
236 /// neighbour number 7 in the list | /n
237 /// neighbour number 8 in the list | /n
238 /// neighbour number 9 in the list - /n
240 ///-----------------NON-BENDING------------------------------------- /n
241 /// Returns list of 10 next neighbours for given Y strip (ix, iy) /n
242 /// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list /n
243 /// |_______| |_______/ /n
247 for (Int_t i=0; i<10; i++) {
252 Int_t iList[10]={9,8,7,6,5, 0,1,2,3,4};
254 // need to iterate in iy/ix for bending/non-bending plane
255 Int_t iNeigh = ( cath == 0 ) ? iy : ix;
258 for (Int_t j=iNeigh-5; j<=iNeigh+5; j++){
259 if (j == iNeigh) continue;
260 // need to iterate in iy/ix for bending/non-bending plane
261 Int_t ixNeigh = ( cath == 0 ) ? ix : j;
262 Int_t iyNeigh = ( cath == 0 ) ? j : iy;
264 // cout << " " << cath << " " << ix << " " << iy
265 // << " " << ixNeigh << " " << iyNeigh << "\n";
267 Xlist[iList[i]]=ixNeigh;
268 Ylist[iList[i]]=iyNeigh;