]>
Commit | Line | Data |
---|---|---|
6255180c | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
d53fc881 | 16 | /* |
17 | $Log$ | |
041f7f97 | 18 | Revision 1.5 2003/08/13 17:37:29 hristov |
19 | Bug fix (Alpha) | |
20 | ||
de4a225a | 21 | Revision 1.4 2003/08/05 16:14:20 morsch |
22 | Some problems with too big fluctuations corrected. (A. de Falco) | |
23 | ||
d53fc881 | 24 | Revision 1.1 2003/01/06 10:13:09 morsch |
25 | First commit. | |
26 | ||
27 | */ | |
6255180c | 28 | |
041f7f97 | 29 | // Implementation of AliFastResponse for the Muon Spectrometer resolution. |
30 | // The response depends on the charge of the muon and | |
31 | // the background level. | |
32 | // The class uses the instance of an object of type AliMUONFastTracking to | |
33 | // obtain the smearing parameters. | |
34 | // Author: andreas.morsch@cern.ch | |
35 | ||
6255180c | 36 | #include "AliFastMuonTrackingRes.h" |
37 | #include "AliMUONFastTracking.h" | |
38 | #include <TRandom.h> | |
39 | #include <TF1.h> | |
40 | ||
41 | ClassImp(AliFastMuonTrackingRes) | |
42 | ||
43 | ||
44 | AliFastMuonTrackingRes::AliFastMuonTrackingRes() : | |
45 | AliFastResponse("Resolution", "Muon Tracking Resolution") | |
46 | { | |
041f7f97 | 47 | // Deafault constructor |
6255180c | 48 | SetBackground(); |
49 | } | |
50 | ||
51 | void AliFastMuonTrackingRes::Init() | |
52 | { | |
041f7f97 | 53 | // Initialisation |
6255180c | 54 | fFastTracking = AliMUONFastTracking::Instance(); |
55 | fFastTracking->Init(fBackground); | |
56 | } | |
57 | ||
58 | ||
59 | ||
60 | void AliFastMuonTrackingRes::Evaluate(Float_t p, Float_t theta , Float_t phi, | |
61 | Float_t& pS, Float_t& thetaS, Float_t& phiS) | |
62 | { | |
041f7f97 | 63 | // |
64 | // Evaluate Gaussian smearing from given kinematics | |
65 | // | |
6255180c | 66 | |
67 | Double_t meanp = fFastTracking->MeanP (p, theta, phi, Int_t(fCharge)); | |
68 | Double_t sigmap = fFastTracking->SigmaP (p, theta, phi, Int_t(fCharge)); | |
69 | Double_t sigma1p = fFastTracking->Sigma1P(p, theta, phi, Int_t(fCharge)); | |
70 | Double_t normg2 = fFastTracking->NormG2 (p, theta, phi, Int_t(fCharge)); | |
71 | Double_t meang2 = fFastTracking->MeanG2 (p, theta, phi, Int_t(fCharge)); | |
72 | Double_t sigmag2 = fFastTracking->SigmaG2(p, theta, phi, Int_t(fCharge)); | |
73 | ||
74 | Int_t ip,itheta,iphi; | |
6255180c | 75 | fFastTracking->GetIpIthetaIphi(p, theta, phi, Int_t(fCharge), ip, itheta, iphi); |
d53fc881 | 76 | TF1* fitp = fFastTracking->GetFitP(ip,itheta,iphi); |
77 | ||
78 | Float_t curmeanp = fitp->GetParameter(0); | |
79 | Float_t cursigmap = fitp->GetParameter(1); | |
80 | Float_t cursigma1p = fitp->GetParameter(2); | |
81 | Float_t curnormg2 = fitp->GetParameter(3); | |
82 | Float_t curmeang2 = fitp->GetParameter(4); | |
83 | Float_t cursigmag2 = fitp->GetParameter(5); | |
84 | if (curmeanp != meanp || cursigmap != sigmap || cursigma1p != sigma1p || | |
85 | curnormg2 != normg2 || curmeang2 != meang2 || cursigmag2 != sigmag2){ | |
86 | printf ("Setting new parameters for ip=%d itheta=%d iphi=%d\n",ip,itheta,iphi); | |
87 | fitp->SetParameters(meanp,sigmap,sigma1p,normg2,meang2,sigmag2); | |
6255180c | 88 | } |
6255180c | 89 | |
90 | Double_t meantheta = fFastTracking->MeanTheta (p, theta, phi, Int_t(fCharge)); | |
91 | Double_t sigmatheta = fFastTracking->SigmaTheta(p, theta, phi, Int_t(fCharge)); | |
92 | Double_t meanphi = fFastTracking->MeanPhi (p, theta, phi, Int_t(fCharge)); | |
93 | Double_t sigmaphi = fFastTracking->SigmaPhi (p, theta, phi, Int_t(fCharge)); | |
d53fc881 | 94 | |
de4a225a | 95 | if (sigmatheta<0 || sigmaphi<0) |
d53fc881 | 96 | printf ("bin %d %d %d sigmatheta = %f, sigmaphi = %f\n", |
97 | ip,itheta,iphi,sigmatheta,sigmaphi); | |
6255180c | 98 | // Components different from ip=0 have the RMS bigger than mean |
99 | Float_t ptp[3] = { 1.219576,-0.354764,-0.690117 }; | |
100 | Float_t ptph[3] = { 0.977522, 0.016269, 0.023158 }; | |
101 | Float_t pphp[3] = { 1.303256,-0.464847,-0.869322 }; | |
102 | ||
103 | // Smeared momentum | |
d53fc881 | 104 | pS = -1.; |
105 | // Float_t dpmax = 5. + ip * 2.5; | |
106 | // Float_t dpmax = 5. + ip * 2; | |
107 | Float_t dpmax; | |
108 | if (sigmag2<999.) dpmax = 5. * (sigmap + sigmag2); | |
109 | else dpmax = 5. * sigmap; | |
110 | Float_t dp = 100; | |
111 | while (pS<0 || TMath::Abs(dp)>dpmax) { | |
112 | pS = p + fitp->GetRandom(); | |
113 | dp = pS - p; | |
114 | } | |
6255180c | 115 | // Smeared phi |
d53fc881 | 116 | Float_t sigmaphiold=sigmaphi; |
6255180c | 117 | if (ip==0) sigmaphi *= pphp[0] + pphp[1] * dp + pphp[2] * dp*dp; |
d53fc881 | 118 | if (sigmaphi<0.5 * sigmaphiold) sigmaphi = 0.5 * sigmaphiold; |
119 | if (sigmaphi>2. * sigmaphiold) sigmaphi = 2. * sigmaphiold; | |
6255180c | 120 | phiS = phi + gRandom->Gaus(meanphi, sigmaphi); |
121 | Float_t dphi = phiS - phi; | |
122 | // Smeared theta | |
d53fc881 | 123 | Float_t sigmathetaold=sigmatheta; |
6255180c | 124 | if (ip==0) sigmatheta *= ptp[0] + ptp[1] * dp + ptp[2] * dp*dp; |
125 | if (ip==0) sigmatheta *= ptph[0] + ptph[1] * dphi + ptph[2] * dphi*dphi; | |
d53fc881 | 126 | if (sigmatheta<0.5 * sigmathetaold) sigmatheta = 0.5 * sigmathetaold; |
127 | if (sigmatheta>2. * sigmathetaold) sigmatheta = 2. * sigmathetaold; | |
6255180c | 128 | thetaS = theta + gRandom->Gaus(meantheta,sigmatheta); |
129 | } | |
130 | ||
131 | ||
132 | ||
133 | ||
134 | ||
135 |