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.10 2002/10/14 14:57:32 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.9.6.1 2002/06/10 15:12:46 hristov
24 Revision 1.9 2001/11/08 20:10:45 dibari
25 ctor with initialising of parmeters added
27 Revision 1.8 2001/09/05 09:09:38 hristov
28 The energy of feedback photons calculated correctly
30 Revision 1.7 2001/05/10 12:32:27 jbarbosa
31 Changed call to SetTrack.
33 Revision 1.6 2001/02/23 17:39:02 jbarbosa
34 Removed verbose output.
36 Revision 1.5 2001/02/23 17:25:08 jbarbosa
37 Re-definition of IntPH() to accomodate for wire sag effect.
39 Revision 1.4 2000/12/01 17:37:44 morsch
40 Replace in argument of SetTrack(..) string constant by kPFeedBackPhoton.
42 Revision 1.3 2000/10/03 21:44:09 morsch
43 Use AliSegmentation and AliHit abstract base classes.
45 Revision 1.2 2000/10/02 21:28:12 fca
46 Removal of useless dependecies via forward declarations
48 Revision 1.1 2000/06/12 15:29:37 jbarbosa
53 #include "AliRICHResponseV0.h"
54 #include "AliSegmentation.h"
59 #include <TParticle.h>
60 //___________________________________________
61 ClassImp(AliRICHResponseV0)
63 AliRICHResponseV0::AliRICHResponseV0()
65 SetSigmaIntegration(5.);
67 SetChargeSpread(0.18, 0.18);
69 SetAlphaFeedback(0.036);
70 SetEIonisation(26.e-9);
71 SetSqrtKx3(0.77459667);
74 SetSqrtKy3(0.77459667);
78 SetWireSag(1); // 1->On, 0->Off
79 SetVoltage(2150); // Should only be 2000, 2050, 2100 or 2150
80 }//AliRICHResponseV0::ctor()
81 Float_t AliRICHResponseV0::IntPH(Float_t eloss, Float_t yhit)
83 // Get number of electrons and return charge
86 nel= Int_t(eloss/fEIonisation);
95 //printf("Voltage:%d, Yhit:%f\n",fVoltage, yhit);
99 gain_var = 9e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0316*TMath::Power(yhit,2) - 3e-4*yhit + 25.367;
100 //gain_var = 9e-5*TMath::Power(yhit,4) + 2e-6*TMath::Power(yhit,3) - 0.316*TMath::Power(yhit,2) - 3e-3*yhit + 253.67;
103 gain_var = 8e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0283*TMath::Power(yhit,2) - 2e-4*yhit + 23.015;
105 gain_var = 7e-6*TMath::Power(yhit,4) + 1e-7*TMath::Power(yhit,3) - 0.0254*TMath::Power(yhit,2) - 2e-4*yhit + 20.888;
107 gain_var = 6e-6*TMath::Power(yhit,4) + 8e-8*TMath::Power(yhit,3) - 0.0227*TMath::Power(yhit,2) - 1e-4*yhit + 18.961;
109 gain_var = gain_var/100;
110 //printf("Yhit:%f, Gain variation:%f\n",yhit,gain_var);
112 Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9;
113 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
115 for (Int_t i=1;i<=nel;i++) {
116 charge -= gain*TMath::Log(gRandom->Rndm());
121 for (Int_t i=1;i<=nel;i++) {
122 charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
129 Float_t AliRICHResponseV0::IntPH(Float_t yhit)
132 // Get number of electrons and return charge, for a single photon
141 gain_var = 9e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0316*TMath::Power(yhit,2) - 3e-4*yhit + 25.367;
142 //gain_var = 9e-5*TMath::Power(yhit,4) + 2e-6*TMath::Power(yhit,3) - 0.316*TMath::Power(yhit,2) - 3e-3*yhit + 253.67;
145 gain_var = 8e-6*TMath::Power(yhit,4) + 2e-7*TMath::Power(yhit,3) - 0.0283*TMath::Power(yhit,2) - 2e-4*yhit + 23.015;
147 gain_var = 7e-6*TMath::Power(yhit,4) + 1e-7*TMath::Power(yhit,3) - 0.0254*TMath::Power(yhit,2) - 2e-4*yhit + 20.888;
149 gain_var = 6e-6*TMath::Power(yhit,4) + 8e-8*TMath::Power(yhit,3) - 0.0227*TMath::Power(yhit,2) - 1e-4*yhit + 18.961;
151 gain_var = gain_var/100;
152 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain_var);
154 Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9;
156 charge -= gain*TMath::Log(gRandom->Rndm());
157 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
161 charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
168 // -------------------------------------------
169 Float_t AliRICHResponseV0::IntXY(AliSegmentation * segmentation)
172 const Float_t kInversePitch = 1/fPitch;
175 // Integration limits defined by segmentation model
178 Float_t xi1, xi2, yi1, yi2;
179 segmentation->IntegrationLimits(xi1,xi2,yi1,yi2);
181 xi1=xi1*kInversePitch;
182 xi2=xi2*kInversePitch;
183 yi1=yi1*kInversePitch;
184 yi2=yi2*kInversePitch;
186 //printf("Integration Limits: %f-%f, %f-%f\n",xi1,xi2,yi1,yi2);
188 //printf("KInversePitch:%f\n",kInversePitch);
191 // The Mathieson function
192 Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1);
193 Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2);
195 Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1);
196 Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2);
198 //printf("Integration Data: %f-%f, %f-%f\n",ux1,ux2,uy1,uy2);
200 //printf("%f %f %f %f\n",fSqrtKx3,fKx2,fKy4,fKx4);
202 response=4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1));
204 //printf("Response:%f\n",response);
210 Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
213 // Generate FeedBack photons
222 Float_t cthf, phif, enfp = 0, sthf;
224 Float_t e1[3], e2[3], e3[3];
230 Float_t pol[3], mom[4];
231 TLorentzVector position;
233 // Determine number of feedback photons
235 // Get weight of current particle
236 TParticle *current = (TParticle*)
237 (*gAlice->Particles())[gAlice->CurrentTrack()];
239 ifeed = Int_t(current->GetWeight()/100+0.5);
240 ipart = gMC->TrackPid();
241 fp = fAlphaFeedback * qtot;
242 nfp = gRandom->Poisson(fp);
244 // This call to fill the time of flight
245 gMC->TrackPosition(position);
246 //printf("Track position: %f %f %f %15.12f\n", position[0],position[1],position[2],position[3]);
249 for (i = 0; i <nfp; i++) {
252 gMC->GetRandom()->RndmArray(2,ranf);
253 cthf = ranf[0] * 2 - 1.;
254 if (cthf < 0) continue;
255 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
256 phif = ranf[1] * 2 * TMath::Pi();
258 //gMC->Rndm(&random, 1);
259 gMC->GetRandom()->RndmArray(1, &random);
262 } else if (random <= .7) {
268 dir[0] = sthf * TMath::Sin(phif);
270 dir[2] = sthf * TMath::Cos(phif);
271 gMC->Gdtom(dir, mom, 2);
275 mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
276 //printf("Dir %f %f %f\n",dir[0],dir[1],dir[2]);
277 //printf("Momentum %15.12f %15.12f %15.12f\n",mom[0],mom[1],mom[2]);
278 //printf("Energy %e\n", mom[3]);
294 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
295 if (!vmod) for(j=0;j<3;j++) {
301 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
302 if (!vmod) for(j=0;j<3;j++) {
309 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
310 vmod=TMath::Sqrt(1/vmod);
311 for(j=0;j<3;j++) e1[j]*=vmod;
314 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
315 vmod=TMath::Sqrt(1/vmod);
316 for(j=0;j<3;j++) e2[j]*=vmod;
318 //gMC->Rndm(ranf, 1);
319 gMC->GetRandom()->RndmArray(1,ranf);
320 phi = ranf[0] * 2 * TMath::Pi();
321 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
322 gMC->Gdtom(pol, pol, 2);
324 // Put photon on the stack and label it as feedback (51, 52)
327 gAlice->SetTrack(Int_t(1), gAlice->CurrentTrack(), Int_t(50000051),
328 mom[0],mom[1],mom[2],mom[3],source[0],source[1],source[2],position[3],pol[0],pol[1],pol[2],
329 kPFeedBackPhoton, nt, 1.);
331 //printf("Adding feedback with tof %f and going to %f %f %f\n",position[3],mom[0],mom[1],mom[2]);
334 //printf("feedbacks produced:%d\n",sNfeed);