1 #include "AliRICHSegResV0.h"
8 ClassImp(AliRICHsegmentation)
9 ClassImp(AliRICHresponse)
10 //___________________________________________
11 ClassImp(AliRICHsegmentationV0)
13 void AliRICHsegmentationV0::Init(AliRICHchamber* Chamber)
15 fNpx=(Int_t) (Chamber->ROuter()/fDpx+1);
16 fNpy=(Int_t) (Chamber->ROuter()/fDpy+1);
20 Float_t AliRICHsegmentationV0::GetAnod(Float_t xhit)
22 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
26 void AliRICHsegmentationV0::SetPADSIZ(Float_t p1, Float_t p2)
31 void AliRICHsegmentationV0::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
33 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
35 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
36 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
37 if (iy > fNpy) iy= fNpy;
38 if (iy < -fNpy) iy=-fNpy;
39 if (ix > fNpx) ix= fNpx;
40 if (ix < -fNpx) ix=-fNpx;
42 void AliRICHsegmentationV0::
43 GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
45 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
47 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
48 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
51 void AliRICHsegmentationV0::
52 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
55 // Find the wire position (center of charge distribution)
56 Float_t x0a=GetAnod(xhit);
58 // and take fNsigma*sigma around this center
61 Float_t y01=yhit - dy;
62 Float_t y02=yhit + dy;
64 // find the pads over which the charge distributes
65 GetPadIxy(x01,y01,fixmin,fiymin);
66 GetPadIxy(x02,y02,fixmax,fiymax);
68 // Set current pad to lower left corner
71 GetPadCxy(fix,fiy,fx,fy);
74 void AliRICHsegmentationV0::NextPad()
77 // Step to next pad in integration region
80 } else if (fiy != fiymax) {
84 printf("\n Error: Stepping outside integration region\n ");
86 GetPadCxy(fix,fiy,fx,fy);
89 Int_t AliRICHsegmentationV0::MorePads()
92 // Are there more pads in the integration region
94 if (fix == fixmax && fiy == fiymax) {
102 void AliRICHsegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
105 // Initialises pad and wire position during stepping
108 GetPadIxy(x,y,fixt,fiyt);
109 fiwt=Int_t(x/fWireD)+1;
113 Int_t AliRICHsegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
116 // Signal will be generated if particle crosses pad boundary or
117 // boundary between two wires.
119 GetPadIxy(x,y,ixt,iyt);
120 Int_t iwt=Int_t(x/fWireD)+1;
122 if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
128 void AliRICHsegmentationV0::
129 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
138 void AliRICHsegmentationV0::
139 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
141 //Is used for the cluster finder, include diagonal elements
143 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
144 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
147 void AliRICHsegmentationV0::
148 FitXY(AliRICHRecCluster* ,TClonesArray* )
149 // Default : Centre of gravity method
155 //___________________________________________
156 ClassImp(AliRICHresponseV0)
157 Float_t AliRICHresponseV0::IntPH(Float_t eloss)
159 // Get number of electrons and return charge
162 //E9/26=magic number should parameter
163 nel= Int_t(eloss*1.e9/26.);
166 for (Int_t i=1;i<=nel;i++) {
167 charge -= fChslope*TMath::Log(gRandom->Rndm());
171 // -------------------------------------------
172 Float_t AliRICHresponseV0::IntXY(AliRICHsegmentation * segmentation)
175 const Float_t invpitch = 1/fPitch;
178 // Integration limits defined by segmentation model
181 Float_t xi1, xi2, yi1, yi2;
182 segmentation->IntegrationLimits(xi1,xi2,yi1,yi2);
189 // The Mathieson function
190 Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1);
191 Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2);
193 Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1);
194 Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2);
196 response=4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1));
201 //___________________________________________
202 Int_t AliRICHresponseV0::FeedBackPhotons(Float_t source[3], Float_t qtot)
205 // Generate FeedBack photons
209 //Probability of feedback
210 Float_t fAlphaFeed=0.05;
215 Float_t cthf, ranf[2], phif, enfp = 0, sthf, weight;
217 Float_t e1[3], e2[3], e3[3];
222 Float_t pol[3], mom[3];
223 TLorentzVector position;
225 // Determine number of feedback photons
227 // Get weight of current particle
228 TParticle *current = (TParticle*)
229 (*gAlice->Particles())[gAlice->CurrentTrack()];
231 ifeed = Int_t(current->GetWeight()/100+0.5);
232 ipart = gMC->TrackPid();
233 fp = fAlphaFeed * qtot;
234 nfp = gRandom->Poisson(fp);
236 // This call to fill the time of flight
237 gMC->TrackPosition(position);
240 for (i = 0; i <nfp; ++i) {
244 cthf = ranf[0] * 2 - 1.;
245 if (cthf < 0) continue;
246 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
247 phif = ranf[1] * 2 * TMath::Pi();
249 gMC->Rndm(&random, 1);
252 } else if (random <= .7) {
258 dir[0] = sthf * TMath::Sin(phif);
260 dir[2] = sthf * TMath::Cos(phif);
261 gMC->Gdtom(dir, mom, 2);
280 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
281 if (!vmod) for(j=0;j<3;j++) {
287 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
288 if (!vmod) for(j=0;j<3;j++) {
295 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
296 vmod=TMath::Sqrt(1/vmod);
297 for(j=0;j<3;j++) e1[j]*=vmod;
300 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
301 vmod=TMath::Sqrt(1/vmod);
302 for(j=0;j<3;j++) e2[j]*=vmod;
305 phi = ranf[0] * 2 * TMath::Pi();
306 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
307 gMC->Gdtom(pol, pol, 2);
309 // Put photon on the stack and label it as feedback (51, 52)
311 if (ipart == 50000050 && ifeed != 50000052) {
316 gAlice->SetTrack(1, gAlice->CurrentTrack(), gMC->PDGFromId(50),
317 mom,source,pol,position[3],
318 "Cherenkov", nt, weight);