]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FASTSIM/AliFastMuonTrackingRes.cxx
More EffC++ warnings corrected.
[u/mrichter/AliRoot.git] / FASTSIM / AliFastMuonTrackingRes.cxx
CommitLineData
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
a42548b0 16/* $Id: */
6255180c 17
041f7f97 18// Implementation of AliFastResponse for the Muon Spectrometer resolution.
19// The response depends on the charge of the muon and
20// the background level.
21// The class uses the instance of an object of type AliMUONFastTracking to
22// obtain the smearing parameters.
23// Author: andreas.morsch@cern.ch
24
6255180c 25#include "AliFastMuonTrackingRes.h"
26#include "AliMUONFastTracking.h"
27#include <TRandom.h>
28#include <TF1.h>
29
30ClassImp(AliFastMuonTrackingRes)
31
32
33AliFastMuonTrackingRes::AliFastMuonTrackingRes() :
34 AliFastResponse("Resolution", "Muon Tracking Resolution")
35{
041f7f97 36// Deafault constructor
6255180c 37 SetBackground();
38}
39
a42548b0 40AliFastMuonTrackingRes::AliFastMuonTrackingRes(const AliFastMuonTrackingRes & res)
41 :AliFastResponse(res)
42{
43// Copy constructor
44 res.Copy(*this);
45}
46
6255180c 47void AliFastMuonTrackingRes::Init()
48{
041f7f97 49// Initialisation
6255180c 50 fFastTracking = AliMUONFastTracking::Instance();
51 fFastTracking->Init(fBackground);
52}
53
54
55
56void AliFastMuonTrackingRes::Evaluate(Float_t p, Float_t theta , Float_t phi,
57 Float_t& pS, Float_t& thetaS, Float_t& phiS)
58{
041f7f97 59//
60// Evaluate Gaussian smearing from given kinematics
61//
6255180c 62
63 Double_t meanp = fFastTracking->MeanP (p, theta, phi, Int_t(fCharge));
64 Double_t sigmap = fFastTracking->SigmaP (p, theta, phi, Int_t(fCharge));
65 Double_t sigma1p = fFastTracking->Sigma1P(p, theta, phi, Int_t(fCharge));
66 Double_t normg2 = fFastTracking->NormG2 (p, theta, phi, Int_t(fCharge));
67 Double_t meang2 = fFastTracking->MeanG2 (p, theta, phi, Int_t(fCharge));
68 Double_t sigmag2 = fFastTracking->SigmaG2(p, theta, phi, Int_t(fCharge));
69
70 Int_t ip,itheta,iphi;
6255180c 71 fFastTracking->GetIpIthetaIphi(p, theta, phi, Int_t(fCharge), ip, itheta, iphi);
d53fc881 72 TF1* fitp = fFastTracking->GetFitP(ip,itheta,iphi);
73
74 Float_t curmeanp = fitp->GetParameter(0);
75 Float_t cursigmap = fitp->GetParameter(1);
76 Float_t cursigma1p = fitp->GetParameter(2);
77 Float_t curnormg2 = fitp->GetParameter(3);
78 Float_t curmeang2 = fitp->GetParameter(4);
79 Float_t cursigmag2 = fitp->GetParameter(5);
80 if (curmeanp != meanp || cursigmap != sigmap || cursigma1p != sigma1p ||
81 curnormg2 != normg2 || curmeang2 != meang2 || cursigmag2 != sigmag2){
82 printf ("Setting new parameters for ip=%d itheta=%d iphi=%d\n",ip,itheta,iphi);
83 fitp->SetParameters(meanp,sigmap,sigma1p,normg2,meang2,sigmag2);
6255180c 84 }
6255180c 85
86 Double_t meantheta = fFastTracking->MeanTheta (p, theta, phi, Int_t(fCharge));
87 Double_t sigmatheta = fFastTracking->SigmaTheta(p, theta, phi, Int_t(fCharge));
88 Double_t meanphi = fFastTracking->MeanPhi (p, theta, phi, Int_t(fCharge));
89 Double_t sigmaphi = fFastTracking->SigmaPhi (p, theta, phi, Int_t(fCharge));
d53fc881 90
de4a225a 91 if (sigmatheta<0 || sigmaphi<0)
d53fc881 92 printf ("bin %d %d %d sigmatheta = %f, sigmaphi = %f\n",
93 ip,itheta,iphi,sigmatheta,sigmaphi);
6255180c 94 // Components different from ip=0 have the RMS bigger than mean
95 Float_t ptp[3] = { 1.219576,-0.354764,-0.690117 };
96 Float_t ptph[3] = { 0.977522, 0.016269, 0.023158 };
97 Float_t pphp[3] = { 1.303256,-0.464847,-0.869322 };
98
99 // Smeared momentum
d53fc881 100 pS = -1.;
101 // Float_t dpmax = 5. + ip * 2.5;
102 // Float_t dpmax = 5. + ip * 2;
103 Float_t dpmax;
9a226b7e 104 if (sigmag2<999.) dpmax = 5. * TMath::Abs(sigmap + sigmag2);
105 else dpmax = 5. * TMath::Abs(sigmap);
d53fc881 106 Float_t dp = 100;
107 while (pS<0 || TMath::Abs(dp)>dpmax) {
108 pS = p + fitp->GetRandom();
109 dp = pS - p;
110 }
6255180c 111 // Smeared phi
d53fc881 112 Float_t sigmaphiold=sigmaphi;
6255180c 113 if (ip==0) sigmaphi *= pphp[0] + pphp[1] * dp + pphp[2] * dp*dp;
d53fc881 114 if (sigmaphi<0.5 * sigmaphiold) sigmaphi = 0.5 * sigmaphiold;
115 if (sigmaphi>2. * sigmaphiold) sigmaphi = 2. * sigmaphiold;
6255180c 116 phiS = phi + gRandom->Gaus(meanphi, sigmaphi);
117 Float_t dphi = phiS - phi;
118 // Smeared theta
d53fc881 119 Float_t sigmathetaold=sigmatheta;
6255180c 120 if (ip==0) sigmatheta *= ptp[0] + ptp[1] * dp + ptp[2] * dp*dp;
121 if (ip==0) sigmatheta *= ptph[0] + ptph[1] * dphi + ptph[2] * dphi*dphi;
d53fc881 122 if (sigmatheta<0.5 * sigmathetaold) sigmatheta = 0.5 * sigmathetaold;
123 if (sigmatheta>2. * sigmathetaold) sigmatheta = 2. * sigmathetaold;
6255180c 124 thetaS = theta + gRandom->Gaus(meantheta,sigmatheta);
125}
126
a42548b0 127AliFastMuonTrackingRes& AliFastMuonTrackingRes::operator=(const AliFastMuonTrackingRes& rhs)
128{
129// Assignment operator
130 rhs.Copy(*this);
131 return *this;
132}
6255180c 133
134
135
136