]>
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$ | |
18 | Revision 1.1 2003/01/06 10:13:09 morsch | |
19 | First commit. | |
20 | ||
21 | */ | |
6255180c | 22 | |
23 | #include "AliFastMuonTrackingRes.h" | |
24 | #include "AliMUONFastTracking.h" | |
25 | #include <TRandom.h> | |
26 | #include <TF1.h> | |
27 | ||
28 | ClassImp(AliFastMuonTrackingRes) | |
29 | ||
30 | ||
31 | AliFastMuonTrackingRes::AliFastMuonTrackingRes() : | |
32 | AliFastResponse("Resolution", "Muon Tracking Resolution") | |
33 | { | |
34 | SetBackground(); | |
35 | } | |
36 | ||
37 | void AliFastMuonTrackingRes::Init() | |
38 | { | |
39 | fFastTracking = AliMUONFastTracking::Instance(); | |
40 | fFastTracking->Init(fBackground); | |
41 | } | |
42 | ||
43 | ||
44 | ||
45 | void AliFastMuonTrackingRes::Evaluate(Float_t p, Float_t theta , Float_t phi, | |
46 | Float_t& pS, Float_t& thetaS, Float_t& phiS) | |
47 | { | |
48 | ||
49 | Double_t meanp = fFastTracking->MeanP (p, theta, phi, Int_t(fCharge)); | |
50 | Double_t sigmap = fFastTracking->SigmaP (p, theta, phi, Int_t(fCharge)); | |
51 | Double_t sigma1p = fFastTracking->Sigma1P(p, theta, phi, Int_t(fCharge)); | |
52 | Double_t normg2 = fFastTracking->NormG2 (p, theta, phi, Int_t(fCharge)); | |
53 | Double_t meang2 = fFastTracking->MeanG2 (p, theta, phi, Int_t(fCharge)); | |
54 | Double_t sigmag2 = fFastTracking->SigmaG2(p, theta, phi, Int_t(fCharge)); | |
55 | ||
56 | Int_t ip,itheta,iphi; | |
6255180c | 57 | fFastTracking->GetIpIthetaIphi(p, theta, phi, Int_t(fCharge), ip, itheta, iphi); |
d53fc881 | 58 | TF1* fitp = fFastTracking->GetFitP(ip,itheta,iphi); |
59 | ||
60 | Float_t curmeanp = fitp->GetParameter(0); | |
61 | Float_t cursigmap = fitp->GetParameter(1); | |
62 | Float_t cursigma1p = fitp->GetParameter(2); | |
63 | Float_t curnormg2 = fitp->GetParameter(3); | |
64 | Float_t curmeang2 = fitp->GetParameter(4); | |
65 | Float_t cursigmag2 = fitp->GetParameter(5); | |
66 | if (curmeanp != meanp || cursigmap != sigmap || cursigma1p != sigma1p || | |
67 | curnormg2 != normg2 || curmeang2 != meang2 || cursigmag2 != sigmag2){ | |
68 | printf ("Setting new parameters for ip=%d itheta=%d iphi=%d\n",ip,itheta,iphi); | |
69 | fitp->SetParameters(meanp,sigmap,sigma1p,normg2,meang2,sigmag2); | |
6255180c | 70 | } |
6255180c | 71 | |
72 | Double_t meantheta = fFastTracking->MeanTheta (p, theta, phi, Int_t(fCharge)); | |
73 | Double_t sigmatheta = fFastTracking->SigmaTheta(p, theta, phi, Int_t(fCharge)); | |
74 | Double_t meanphi = fFastTracking->MeanPhi (p, theta, phi, Int_t(fCharge)); | |
75 | Double_t sigmaphi = fFastTracking->SigmaPhi (p, theta, phi, Int_t(fCharge)); | |
d53fc881 | 76 | |
77 | if (sigmatheta<0 or sigmaphi<0) | |
78 | printf ("bin %d %d %d sigmatheta = %f, sigmaphi = %f\n", | |
79 | ip,itheta,iphi,sigmatheta,sigmaphi); | |
6255180c | 80 | // Components different from ip=0 have the RMS bigger than mean |
81 | Float_t ptp[3] = { 1.219576,-0.354764,-0.690117 }; | |
82 | Float_t ptph[3] = { 0.977522, 0.016269, 0.023158 }; | |
83 | Float_t pphp[3] = { 1.303256,-0.464847,-0.869322 }; | |
84 | ||
85 | // Smeared momentum | |
d53fc881 | 86 | pS = -1.; |
87 | // Float_t dpmax = 5. + ip * 2.5; | |
88 | // Float_t dpmax = 5. + ip * 2; | |
89 | Float_t dpmax; | |
90 | if (sigmag2<999.) dpmax = 5. * (sigmap + sigmag2); | |
91 | else dpmax = 5. * sigmap; | |
92 | Float_t dp = 100; | |
93 | while (pS<0 || TMath::Abs(dp)>dpmax) { | |
94 | pS = p + fitp->GetRandom(); | |
95 | dp = pS - p; | |
96 | } | |
6255180c | 97 | // Smeared phi |
d53fc881 | 98 | Float_t sigmaphiold=sigmaphi; |
6255180c | 99 | if (ip==0) sigmaphi *= pphp[0] + pphp[1] * dp + pphp[2] * dp*dp; |
d53fc881 | 100 | if (sigmaphi<0.5 * sigmaphiold) sigmaphi = 0.5 * sigmaphiold; |
101 | if (sigmaphi>2. * sigmaphiold) sigmaphi = 2. * sigmaphiold; | |
6255180c | 102 | phiS = phi + gRandom->Gaus(meanphi, sigmaphi); |
103 | Float_t dphi = phiS - phi; | |
104 | // Smeared theta | |
d53fc881 | 105 | Float_t sigmathetaold=sigmatheta; |
6255180c | 106 | if (ip==0) sigmatheta *= ptp[0] + ptp[1] * dp + ptp[2] * dp*dp; |
107 | if (ip==0) sigmatheta *= ptph[0] + ptph[1] * dphi + ptph[2] * dphi*dphi; | |
d53fc881 | 108 | if (sigmatheta<0.5 * sigmathetaold) sigmatheta = 0.5 * sigmathetaold; |
109 | if (sigmatheta>2. * sigmathetaold) sigmatheta = 2. * sigmathetaold; | |
6255180c | 110 | thetaS = theta + gRandom->Gaus(meantheta,sigmatheta); |
111 | } | |
112 | ||
113 | ||
114 | ||
115 | ||
116 | ||
117 |