Pluto v6.3.0
Loading...
Searching...
No Matches
PHadesParticleSmearer.cc
Go to the documentation of this file.
1
2// Momentum smearer implementation file
3//
4//
5//
7
8
10#include <iostream>
11#include <cmath>
12
13using namespace std;
14
17 fPriority = FILTER_PRIORITY+1; //for HADES it is standard to filter first and then smear
18}
19
20bool PHadesParticleSmearer::Modify(PParticle **stack, int *, int *num, int) {
21
22 for (int i=0; i<*num; i++) {
23 PParticle *cur = stack[i];
24 //cur->Print();
25
26 if (cur->Is("pi+") || cur->Is("pi-")|| cur->Is("p")
27 || cur->LeptonN()) {
28
29/*
30 Double_t Impulsx = cur->Px();
31 //Impulsx = 5.*Impulsx;
32
33 */
34 //double mom_measured = PUtils::sampleGaus(Impulsx, Impulsx*0.1);
35 //cur->SetPx(mom_measured);
36
37 double res = GetResolution(cur, 4);
38 Smear(cur, res);// momentum smearing / 4mdcs / geidar's parametrisation
39
40 cur->ResetE();
41 }
42 }
43
44 return kTRUE;
45};
46
47double PHadesParticleSmearer::GetResolution(PParticle *pPart, Int_t iSetup) {
48
49 //double resolution_factor = 3;
50 double theta = TMath::RadToDeg()*(pPart->Theta()); // polar angle in degree
51 double phi = 90.-TMath::RadToDeg()*(pPart->Phi()); // azimuthal angle in degree
52 double mass = pPart->M()*1000.;
53 double p = (pPart->Vect()).Mag()*1000.;
54 if (phi<0.) phi += 360.; // TLorentzVector uses ATan2(x,y)
55 if(theta <= 15 || theta > 85) return 0.004;
56 Int_t thetaBin = int((theta-15)/10);
57 Int_t phiBin = int((phi - int(phi/60)*60)/12);
58 double c1, c2, res;
59 switch(iSetup) {
60 case 2:
61 c1 = detkick[thetaBin][phiBin];
62 res = c1*p*p;
63 break;
64
65 case 3:
66 c1 = detrk3[thetaBin][phiBin];
67 c2 = multscrk3[thetaBin][phiBin];
68 res = sqrt(c1*c1*p*p*p*p + c2*c2*(p*p + mass*mass));
69 break;
70
71 case 4:
72 c1 = detrk4[thetaBin][phiBin];
73 c2 = multscrk4[thetaBin][phiBin];
74 res = sqrt(c1*c1*p*p*p*p + c2*c2*(p*p + mass*mass));
75 break;
76
77 default:
78 res = 100;
79 }
80 res = resolution_factor*res/1000;
81 return res;
82}
83
85
86 //double ptot=(p->Vect()).Mag();
87 double ptot = p->P();
88 if (ptot <= 0.) return;
89 double th = p->Theta(), ph=p->Phi(), sth =sin(th), mass=p->M();
90 if (fabs(sth) < 1.e-6)
91 sth = (sth>0.) ? 1.e-6 : -1.e-6;
92 double smeared_ptot = ( rand.Gaus(ptot, gamma ) );
93 if(gamma == 0.1) smeared_ptot = ptot+0.04;
95 // smeared_ptot= ptot;
96 // cout<<ptot<<" "<< smeared_ptot <<endl;
98 //if(fabs(ptot-smeared_ptot)>0.15) cout << ptot << " " << smeared_ptot << endl;
99 double smeared_theta = rand.Gaus(th, 0.0023 );
100 double smeared_phi = ( rand.Gaus(sth*ph, 0.0023 ) )/sth;
101 double theta_check = smeared_theta-2.*TMath::Pi()*int(smeared_theta/(2.*TMath::Pi()));
102 if (theta_check>TMath::Pi() || theta_check<0.)
103 smeared_phi -= TMath::Pi();
104 p->SetRho(smeared_ptot); // keeping theta, phi constant
105 p->SetTheta(smeared_theta); // keeping |p|, phi constant
106 p->SetPhi(smeared_phi); // keeping |p|, theta constant
107 double newp=p->P();
108 p->SetE(sqrt(newp*newp+mass*mass)); // reset energy
109}
110
111// Geidar parametrisation
112double PHadesParticleSmearer::detrk4[7][5] = {{3.04669e-06, 2.92245e-06, 2.88894e-06, 2.54182e-06, 1.79336e-06},
113 {3.45534e-06, 3.52212e-06, 3.43443e-06, 3.3966e-06, 3.31397e-06},
114 {5.01234e-06, 5.46206e-06, 5.25006e-06, 5.06055e-06, 4.87875e-06},
115 {6.29485e-06, 7.83364e-06, 8.64567e-06, 7.44434e-06, 6.44697e-06},
116 {5.90814e-06, 7.49372e-06, 8.44064e-06, 7.33158e-06, 5.8983e-06} ,
117 {5.00201e-06, 6.82347e-06, 8.42634e-06, 6.64071e-06, 4.32283e-06},
118 {4.57113e-06, 7.85962e-06, 9.27056e-06, 7.13838e-06, 4.2649e-06 }};
119
120double PHadesParticleSmearer::multscrk4[7][5] = {{0.00712136, 0.00774792, 0.00745848, 0.0072562, 0.0077318},
121 {0.00947987, 0.00919469, 0.00923363, 0.0090577, 0.0088233},
122 {0.0104807 , 0.0105168 , 0.0114445 , 0.0109526, 0.0103268},
123 {0.0122493 , 0.013979 , 0.0148295 , 0.0142261, 0.0125651},
124 {0.0132593 , 0.0151324 , 0.0171913 , 0.0157784, 0.0133762},
125 {0.0127184 , 0.0166672 , 0.0197425 , 0.0166028, 0.0127183},
126 {0.0121717 , 0.0187349 , 0.0235083 , 0.0183666, 0.0114857}};
127
128double PHadesParticleSmearer::detrk3[7][5] = {{5.08616e-06, 5.57472e-06, 5.90756e-06, 5.30146e-06, 5.12577e-06},
129 {8.64475e-06, 8.44705e-06, 8.58983e-06, 7.7759e-06 , 6.88931e-06},
130 {1.23261e-05, 1.42034e-05, 1.55287e-05, 1.31425e-05, 1.10076e-05},
131 {1.75029e-05, 2.59217e-05, 2.72391e-05, 2.46139e-05, 1.84151e-05},
132 {1.75554e-05, 2.25547e-05, 2.5371e-05 , 2.30453e-05, 1.8036e-05 },
133 {1.5159e-05 , 2.14014e-05, 2.37335e-05, 2.17028e-05, 1.56393e-05},
134 {1.70025e-05, 2.42703e-05, 2.65468e-05, 2.33554e-05, 1.5726e-05 } };
135
136double PHadesParticleSmearer::multscrk3[7][5] = {{0.00705671, 0.00707791, 0.00719795, 0.00686656, 0.00468438},
137 {0.00791494, 0.00971418, 0.00922887, 0.00921739, 0.00882323},
138 {0.0101972 , 0.0108932 , 0.0109951 , 0.0111292 , 0.0103408 },
139 {0.0136591 , 0.0147924 , 0.0152897 , 0.0153152 , 0.0135126 },
140 {0.014621 , 0.0166669 , 0.0175123 , 0.0176646 , 0.0157295 },
141 {0.0146804 , 0.0180094 , 0.0183208 , 0.0172132 , 0.014879 } ,
142 {0.0130367 , 0.018929 , 0.0221153 , 0.0189616 , 0.0147333 } };
143
144double PHadesParticleSmearer::detkick[7][5] = {{0.000095203, 0.000095204, 0.000104141, 0.000099331, 0.000099331},
145 {0.000151284, 0.000148333, 0.000151814, 0.000147953, 0.000143505},
146 {0.000197612, 0.000196251, 0.000191317, 0.000195112, 0.000203217},
147 {0.000156319, 0.000157184, 0.000163081, 0.000157349, 0.000162052},
148 {0.00014439 , 0.000153818, 0.000170083, 0.000160573, 0.000139122},
149 {0.000199936, 0.000236463, 0.000262118, 0.000240549, 0.000199932},
150 {0.000226558, 0.000296774, 0.00032661 , 0.000292281, 0.000226592}};
151
152
ClassImp(PBeamLineSimulation) PBeamLineSimulation
#define FILTER_PRIORITY
void Smear(PParticle *p, double gamma)
static double multscrk4[7][5]
double GetResolution(PParticle *p, Int_t iSetup=4)
static double detkick[7][5]
Bool_t Modify(PParticle **stack, int *decay_done, int *num, int stacksize)
static double multscrk3[7][5]
Int_t LeptonN() const
Definition PParticle.h:122
void ResetE()
Definition PParticle.h:107
Int_t Is(const char *id)
Definition PParticle.h:61
PChannel * c2
PParticle * p
Definition dp_mult.C:24
Double_t mass