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.9.6.1 2002/06/10 15:12:46 hristov
21 Revision 1.9 2001/11/08 20:10:45 dibari
22 ctor with initialising of parmeters added
24 Revision 1.8 2001/09/05 09:09:38 hristov
25 The energy of feedback photons calculated correctly
27 Revision 1.7 2001/05/10 12:32:27 jbarbosa
28 Changed call to SetTrack.
30 Revision 1.6 2001/02/23 17:39:02 jbarbosa
31 Removed verbose output.
33 Revision 1.5 2001/02/23 17:25:08 jbarbosa
34 Re-definition of IntPH() to accomodate for wire sag effect.
36 Revision 1.4 2000/12/01 17:37:44 morsch
37 Replace in argument of SetTrack(..) string constant by kPFeedBackPhoton.
39 Revision 1.3 2000/10/03 21:44:09 morsch
40 Use AliSegmentation and AliHit abstract base classes.
42 Revision 1.2 2000/10/02 21:28:12 fca
43 Removal of useless dependecies via forward declarations
45 Revision 1.1 2000/06/12 15:29:37 jbarbosa
50 #include "AliRICHResponseV0.h"
51 #include "AliSegmentation.h"
57 #include <TParticle.h>
58 //___________________________________________
59 ClassImp(AliRICHResponseV0)
61 AliRICHResponseV0::AliRICHResponseV0()
63 SetSigmaIntegration(5.);
65 SetChargeSpread(0.18, 0.18);
67 SetAlphaFeedback(0.036);
68 SetEIonisation(26.e-9);
69 SetSqrtKx3(0.77459667);
72 SetSqrtKy3(0.77459667);
76 SetWireSag(1); // 1->On, 0->Off
77 SetVoltage(2150); // Should only be 2000, 2050, 2100 or 2150
78 }//AliRICHResponseV0::ctor()
79 Float_t AliRICHResponseV0::IntPH(Float_t eloss, Float_t yhit)
81 // Get number of electrons and return charge
84 nel= Int_t(eloss/fEIonisation);
93 //printf("Voltage:%d, Yhit:%f\n",fVoltage, yhit);
97 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;
98 //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;
101 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;
103 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;
105 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;
107 gain_var = gain_var/100;
108 //printf("Yhit:%f, Gain variation:%f\n",yhit,gain_var);
110 Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9;
111 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
113 for (Int_t i=1;i<=nel;i++) {
114 charge -= gain*TMath::Log(gRandom->Rndm());
119 for (Int_t i=1;i<=nel;i++) {
120 charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
127 Float_t AliRICHResponseV0::IntPH(Float_t yhit)
130 // Get number of electrons and return charge, for a single photon
139 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;
140 //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;
143 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;
145 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;
147 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;
149 gain_var = gain_var/100;
150 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain_var);
152 Float_t gain = (fChargeSlope + fChargeSlope*gain_var)*.9;
154 charge -= gain*TMath::Log(gRandom->Rndm());
155 //printf(" Yhit:%f, Gain variation:%f\n",yhit, gain);
159 charge -= fChargeSlope*TMath::Log(gRandom->Rndm());
166 // -------------------------------------------
167 Float_t AliRICHResponseV0::IntXY(AliSegmentation * segmentation)
170 const Float_t kInversePitch = 1/fPitch;
173 // Integration limits defined by segmentation model
176 Float_t xi1, xi2, yi1, yi2;
177 segmentation->IntegrationLimits(xi1,xi2,yi1,yi2);
179 xi1=xi1*kInversePitch;
180 xi2=xi2*kInversePitch;
181 yi1=yi1*kInversePitch;
182 yi2=yi2*kInversePitch;
184 //printf("Integration Limits: %f-%f, %f-%f\n",xi1,xi2,yi1,yi2);
186 //printf("KInversePitch:%f\n",kInversePitch);
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 //printf("Integration Data: %f-%f, %f-%f\n",ux1,ux2,uy1,uy2);
198 //printf("%f %f %f %f\n",fSqrtKx3,fKx2,fKy4,fKx4);
200 response=4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1));
202 //printf("Response:%f\n",response);
208 Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot)
211 // Generate FeedBack photons
220 Float_t cthf, phif, enfp = 0, sthf;
222 Float_t e1[3], e2[3], e3[3];
228 Float_t pol[3], mom[4];
229 TLorentzVector position;
231 // Determine number of feedback photons
233 // Get weight of current particle
234 TParticle *current = (TParticle*)
235 (*gAlice->Particles())[gAlice->CurrentTrack()];
237 ifeed = Int_t(current->GetWeight()/100+0.5);
238 ipart = gMC->TrackPid();
239 fp = fAlphaFeedback * qtot;
240 nfp = gRandom->Poisson(fp);
242 // This call to fill the time of flight
243 gMC->TrackPosition(position);
244 //printf("Track position: %f %f %f %15.12f\n", position[0],position[1],position[2],position[3]);
247 for (i = 0; i <nfp; i++) {
250 gMC->GetRandom()->RndmArray(2,ranf);
251 cthf = ranf[0] * 2 - 1.;
252 if (cthf < 0) continue;
253 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
254 phif = ranf[1] * 2 * TMath::Pi();
256 //gMC->Rndm(&random, 1);
257 gMC->GetRandom()->RndmArray(1, &random);
260 } else if (random <= .7) {
266 dir[0] = sthf * TMath::Sin(phif);
268 dir[2] = sthf * TMath::Cos(phif);
269 gMC->Gdtom(dir, mom, 2);
273 mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
274 //printf("Dir %f %f %f\n",dir[0],dir[1],dir[2]);
275 //printf("Momentum %15.12f %15.12f %15.12f\n",mom[0],mom[1],mom[2]);
276 //printf("Energy %e\n", mom[3]);
292 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
293 if (!vmod) for(j=0;j<3;j++) {
299 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
300 if (!vmod) for(j=0;j<3;j++) {
307 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
308 vmod=TMath::Sqrt(1/vmod);
309 for(j=0;j<3;j++) e1[j]*=vmod;
312 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
313 vmod=TMath::Sqrt(1/vmod);
314 for(j=0;j<3;j++) e2[j]*=vmod;
316 //gMC->Rndm(ranf, 1);
317 gMC->GetRandom()->RndmArray(1,ranf);
318 phi = ranf[0] * 2 * TMath::Pi();
319 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
320 gMC->Gdtom(pol, pol, 2);
322 // Put photon on the stack and label it as feedback (51, 52)
325 gAlice->SetTrack(Int_t(1), gAlice->CurrentTrack(), Int_t(50000051),
326 mom[0],mom[1],mom[2],mom[3],source[0],source[1],source[2],position[3],pol[0],pol[1],pol[2],
327 kPFeedBackPhoton, nt, 1.);
329 //printf("Adding feedback with tof %f and going to %f %f %f\n",position[3],mom[0],mom[1],mom[2]);
332 //printf("feedbacks produced:%d\n",sNfeed);