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
27 #include "AliMUONResponseTriggerV1.h"
28 #include "AliMUONGeometrySegmentation.h"
31 #include "AliMUONDigit.h"
32 #include "AliMUONGeometryTransformer.h"
33 #include "AliMpVSegmentation.h"
35 #include "AliMUONSegmentation.h"
36 #include "AliMUONConstants.h"
38 ClassImp(AliMUONResponseTriggerV1)
44 return static_cast<AliMUON*>(gAlice->GetModule("MUON"));
47 void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
48 Double_t& xl, Double_t& yl, Double_t& zl)
50 // ideally should be :
52 // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z);
53 // but while waiting for this geometry singleton, let's go through
56 const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
57 transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
60 AliMUONSegmentation* Segmentation()
62 static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
67 //------------------------------------------------------------------
68 AliMUONResponseTriggerV1::AliMUONResponseTriggerV1()
69 : AliMUONResponseTrigger(),
75 // default constructor
80 //------------------------------------------------------------------
81 AliMUONResponseTriggerV1::AliMUONResponseTriggerV1(Float_t hv)
82 : AliMUONResponseTrigger(),
92 //------------------------------------------------------------------
93 void AliMUONResponseTriggerV1::SetParameters(Float_t hv){
94 // initialize parameters accoring to HV
95 // (see V.Barret B.Espagnon and P.Rosnet Alice/note xxx)
96 fA = 6.089 * hv - 52.70;
98 fC = 4.3e-4 * hv - 3.5e-3;
101 //------------------------------------------------------------------
102 Int_t AliMUONResponseTriggerV1::SetGenerCluster(){
103 // Set the GenerCluster parameter and return 1
104 fGenerCluster = gRandom->Rndm();
108 //------------------------------------------------------------------
109 Float_t AliMUONResponseTriggerV1::FireStripProb(Float_t x4, Float_t theta)
112 // parametrisation of the probability that a strip neighbour of the main
113 // strip is fired (V.Barret B.Espagnon and P.Rosnet INT/DIM/01-04 (2001)
114 // WARNING : need to convert x4 from cm to mm
117 (TMath::Cos(theta)*fA/(fA+TMath::Cos(theta)*TMath::Power(x4*10.,fB))+fC)/
118 (TMath::Cos(theta)+fC);
121 //------------------------------------------------------------------
122 void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits)
125 // Generate digits (on each cathode) from 1 hit, with cluster-size
131 Float_t xhit = hit.X();
132 Float_t yhit = hit.Y();
133 Float_t zhit = 0; // FIXME : should it be hit.Z() ?
134 Int_t detElemId = hit.DetElemId();
137 Global2Local(detElemId,xhit,yhit,zhit,x,y,z);
139 Float_t tof = hit.Age();
140 Int_t twentyNano(100);
141 if (tof<AliMUONConstants::TriggerTofLimit())
146 for ( Int_t cath = 0; cath < 2; ++cath )
148 const AliMpVSegmentation* seg = Segmentation()->GetMpSegmentation(detElemId,cath);
150 AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE);
151 Int_t ix = pad.GetIndices().GetFirst();
152 Int_t iy = pad.GetIndices().GetSecond();
154 AliMUONDigit* d = new AliMUONDigit;
155 d->SetDetElemId(detElemId);
160 d->SetSignal(twentyNano);
161 d->AddPhysicsSignal(d->Signal());
165 SetGenerCluster(); // 1 randum number per cathode (to be checked)
167 Int_t xList[10], yList[10];
168 Neighbours(cath,ix,iy,xList,yList);
170 // cout << " detElemId cath ix iy = " << detElemId << " " << cath
171 // << " " << ix << " " << iy << "\n";
172 // for (Int_t i=0; i<10; i++) cout << " " << xList[i] << " " << yList[i];
175 Int_t qp = 0; // fired/no-fired strip = 1/0
176 for (Int_t i=0; i<10; i++) { // loop on neighbors
177 if (i==0||i==5||qp!=0) { // built-up cluster
179 // need to iterate in iy/ix for bending/non-bending plane
180 Int_t ixNeigh = ( cath == 0 ) ? ix : xList[i];
181 Int_t iyNeigh = ( cath == 0 ) ? yList[i] : iy;
183 AliMpIntPair pairNeigh = AliMpIntPair(ixNeigh,iyNeigh);
184 AliMpPad padNeigh = seg->PadByIndices(pairNeigh,kFALSE);
185 if(padNeigh.IsValid()){ // existing neighbourg
187 Int_t dix=-(ixNeigh-ix);
188 Int_t diy=-(iyNeigh-iy);
189 Float_t xlocalNeigh = padNeigh.Position().X();
190 Float_t ylocalNeigh = padNeigh.Position().Y();
191 Float_t dpx = padNeigh.Dimensions().X();
192 Float_t dpy = padNeigh.Dimensions().Y();
193 Float_t distX = TMath::Abs((Float_t)dix) * ((Float_t)dix * dpx + xlocalNeigh - x);
194 Float_t distY = TMath::Abs((Float_t)diy) * ((Float_t)diy * dpy + ylocalNeigh - y);
195 Float_t dist = TMath::Sqrt(distX*distX+distY*distY);
197 // cout << " here " << dist << " " << fGenerCluster << " " << FireStripProb(dist,0) << "\n";
199 if (fGenerCluster<FireStripProb(dist,0)) qp = 1;
202 if (qp == 1) { // this digit is fired
203 AliMUONDigit* dNeigh = new AliMUONDigit;
204 dNeigh->SetDetElemId(detElemId);
206 dNeigh->SetPadX(ixNeigh);
207 dNeigh->SetPadY(iyNeigh);
209 dNeigh->SetSignal(twentyNano);
210 dNeigh->AddPhysicsSignal(dNeigh->Signal());
211 dNeigh->SetCathode(cath);
215 } // built-up cluster
216 } // loop on neighbors
220 //------------------------------------------------------------------
221 void AliMUONResponseTriggerV1::Neighbours(const Int_t cath,
222 const Int_t ix, const Int_t iy,
223 Int_t Xlist[10], Int_t Ylist[10])
226 //-----------------BENDING-----------------------------------------
227 // Returns list of 10 next neighbours for given X strip (ix, iy)
228 // neighbour number 4 in the list -
229 // neighbour number 3 in the list |
230 // neighbour number 2 in the list |_ Upper part
231 // neighbour number 1 in the list |
232 // neighbour number 0 in the list -
234 // neighbour number 5 in the list -
235 // neighbour number 6 in the list | _ Lower part
236 // neighbour number 7 in the list |
237 // neighbour number 8 in the list |
238 // neighbour number 9 in the list -
240 //-----------------NON-BENDING-------------------------------------
241 // Returns list of 10 next neighbours for given Y strip (ix, iy)
242 // neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
243 // \_______/ \_______/
246 for (Int_t i=0; i<10; i++) {
251 Int_t iList[10]={9,8,7,6,5, 0,1,2,3,4};
253 // need to iterate in iy/ix for bending/non-bending plane
254 Int_t iNeigh = ( cath == 0 ) ? iy : ix;
257 for (Int_t j=iNeigh-5; j<=iNeigh+5; j++){
258 if (j == iNeigh) continue;
259 // need to iterate in iy/ix for bending/non-bending plane
260 Int_t ixNeigh = ( cath == 0 ) ? ix : j;
261 Int_t iyNeigh = ( cath == 0 ) ? j : iy;
263 // cout << " " << cath << " " << ix << " " << iy
264 // << " " << ixNeigh << " " << iyNeigh << "\n";
266 Xlist[iList[i]]=ixNeigh;
267 Ylist[iList[i]]=iyNeigh;