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 **************************************************************************/
18 Revision 1.3 2000/10/03 21:44:09 morsch
19 Use AliSegmentation and AliHit abstract base classes.
21 Revision 1.2 2000/10/02 21:28:12 fca
22 Removal of useless dependecies via forward declarations
24 Revision 1.1 2000/06/12 15:29:37 jbarbosa
29 #include "AliRICHResponseV0.h"
30 #include "AliSegmentation.h"
36 #include <TParticle.h>
37 //___________________________________________
38 ClassImp(AliRICHResponseV0)
40 Float_t AliRICHResponseV0::IntPH(Float_t eloss)
42 // Get number of electrons and return charge
45 nel= Int_t(eloss/fEIonisation);
49 for (Int_t i=1;i<=nel;i++) {
50 charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
55 Float_t AliRICHResponseV0::IntPH()
58 // Get number of electrons and return charge, for a single photon
60 Float_t charge = -fChargeSlope*TMath::Log(gRandom->Rndm());
66 // -------------------------------------------
67 Float_t AliRICHResponseV0::IntXY(AliSegmentation * segmentation)
70 const Float_t kInversePitch = 1/fPitch;
73 // Integration limits defined by segmentation model
76 Float_t xi1, xi2, yi1, yi2;
77 segmentation->IntegrationLimits(xi1,xi2,yi1,yi2);
79 xi1=xi1*kInversePitch;
80 xi2=xi2*kInversePitch;
81 yi1=yi1*kInversePitch;
82 yi2=yi2*kInversePitch;
84 //printf("Integration Limits: %f-%f, %f-%f\n",xi1,xi2,yi1,yi2);
86 //printf("KInversePitch:%f\n",kInversePitch);
89 // The Mathieson function
90 Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1);
91 Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2);
93 Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1);
94 Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2);
96 //printf("Integration Data: %f-%f, %f-%f\n",ux1,ux2,uy1,uy2);
98 //printf("%f %f %f %f\n",fSqrtKx3,fKx2,fKy4,fKx4);
100 response=4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1));
102 //printf("Response:%f\n",response);
108 Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
111 // Generate FeedBack photons
119 Float_t cthf, ranf[2], phif, enfp = 0, sthf;
121 Float_t e1[3], e2[3], e3[3];
126 Float_t pol[3], mom[3];
127 TLorentzVector position;
129 // Determine number of feedback photons
131 // Get weight of current particle
132 TParticle *current = (TParticle*)
133 (*gAlice->Particles())[gAlice->CurrentTrack()];
135 ifeed = Int_t(current->GetWeight()/100+0.5);
136 ipart = gMC->TrackPid();
137 fp = fAlphaFeedback * qtot;
138 nfp = gRandom->Poisson(fp);
140 // This call to fill the time of flight
141 gMC->TrackPosition(position);
144 for (i = 0; i <nfp; i++) {
148 cthf = ranf[0] * 2 - 1.;
149 if (cthf < 0) continue;
150 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
151 phif = ranf[1] * 2 * TMath::Pi();
153 gMC->Rndm(&random, 1);
156 } else if (random <= .7) {
162 dir[0] = sthf * TMath::Sin(phif);
164 dir[2] = sthf * TMath::Cos(phif);
165 gMC->Gdtom(dir, mom, 2);
184 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
185 if (!vmod) for(j=0;j<3;j++) {
191 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
192 if (!vmod) for(j=0;j<3;j++) {
199 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
200 vmod=TMath::Sqrt(1/vmod);
201 for(j=0;j<3;j++) e1[j]*=vmod;
204 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
205 vmod=TMath::Sqrt(1/vmod);
206 for(j=0;j<3;j++) e2[j]*=vmod;
209 phi = ranf[0] * 2 * TMath::Pi();
210 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
211 gMC->Gdtom(pol, pol, 2);
213 // Put photon on the stack and label it as feedback (51, 52)
216 gAlice->SetTrack(Int_t(1), gAlice->CurrentTrack(), Int_t(50000051),
217 mom,source,pol,position[3],
218 kPFeedBackPhoton, nt, 1.);