]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FASTSIM/AliFastMuonTrackingRes.cxx
Transition to NewIO
[u/mrichter/AliRoot.git] / FASTSIM / AliFastMuonTrackingRes.cxx
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
16 /*
17 $Log$
18 Revision 1.1.2.1  2003/04/15 15:57:31  hristov
19 Merging with v3-09-08
20
21 Revision 1.1  2003/01/06 10:13:09  morsch
22 First commit.
23
24 */
25
26 #include "AliFastMuonTrackingRes.h"
27 #include "AliMUONFastTracking.h"
28 #include <TRandom.h>
29 #include <TF1.h>
30
31 ClassImp(AliFastMuonTrackingRes)
32
33
34 AliFastMuonTrackingRes::AliFastMuonTrackingRes() :
35     AliFastResponse("Resolution", "Muon Tracking Resolution")
36 {
37     SetBackground();
38 }
39
40 void AliFastMuonTrackingRes::Init()
41 {
42     fFastTracking = AliMUONFastTracking::Instance();
43     fFastTracking->Init(fBackground);
44 }
45
46
47
48 void AliFastMuonTrackingRes::Evaluate(Float_t   p,  Float_t  theta , Float_t   phi,
49                                          Float_t& pS,  Float_t& thetaS, Float_t&  phiS)
50 {
51
52     Double_t meanp    = fFastTracking->MeanP  (p, theta, phi, Int_t(fCharge));
53     Double_t sigmap   = fFastTracking->SigmaP (p, theta, phi, Int_t(fCharge));
54     Double_t sigma1p  = fFastTracking->Sigma1P(p, theta, phi, Int_t(fCharge));
55     Double_t normg2   = fFastTracking->NormG2 (p, theta, phi, Int_t(fCharge));
56     Double_t meang2   = fFastTracking->MeanG2 (p, theta, phi, Int_t(fCharge));
57     Double_t sigmag2  = fFastTracking->SigmaG2(p, theta, phi, Int_t(fCharge));
58     
59     Int_t ip,itheta,iphi;
60     TF1* fitp = fFastTracking->GetFitP();
61     
62     fFastTracking->GetIpIthetaIphi(p, theta, phi, Int_t(fCharge), ip, itheta, iphi);
63     if (sigmap == 0) {
64         printf ("WARNING!!! sigmap=0:    ");
65         printf ("ip= %d itheta = %d iphi = %d   ", ip, itheta, iphi);  
66         printf ("p= %f theta = %f phi = %f\n", p, theta, phi);  
67     }
68
69     fitp->SetParameters(meanp,sigmap,sigma1p,normg2,meang2,sigmag2);
70   
71     Double_t meantheta  = fFastTracking->MeanTheta (p, theta, phi, Int_t(fCharge));
72     Double_t sigmatheta = fFastTracking->SigmaTheta(p, theta, phi, Int_t(fCharge));
73     Double_t meanphi    = fFastTracking->MeanPhi   (p, theta, phi, Int_t(fCharge));
74     Double_t sigmaphi   = fFastTracking->SigmaPhi  (p, theta, phi, Int_t(fCharge));
75   
76     // Components different from ip=0 have the RMS bigger than mean
77     Float_t ptp[3]  =  { 1.219576,-0.354764,-0.690117 };
78     Float_t ptph[3] =  { 0.977522, 0.016269, 0.023158 }; 
79     Float_t pphp[3] =  { 1.303256,-0.464847,-0.869322 };
80
81     // Smeared momentum
82     pS   = p + fitp->GetRandom();
83     Float_t dp = pS - p; 
84
85     // Smeared phi
86     if (ip==0) sigmaphi *= pphp[0] + pphp[1] * dp + pphp[2] * dp*dp; 
87     phiS = phi + gRandom->Gaus(meanphi, sigmaphi);
88     Float_t dphi = phiS - phi; 
89     // Smeared theta
90     if (ip==0) sigmatheta *= ptp[0] + ptp[1] * dp + ptp[2] * dp*dp; 
91     if (ip==0) sigmatheta *= ptph[0] + ptph[1] * dphi + ptph[2] * dphi*dphi; 
92     thetaS = theta + gRandom->Gaus(meantheta,sigmatheta);
93 }
94
95
96
97
98
99