ATLAS Offline Software
Functions
UserSelections.h File Reference
#include "CLHEP/Vector/LorentzVector.h"
#include "Pythia8B_i/BsJpsiPhiAngles.h"
Include dependency graph for UserSelections.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

CLHEP::HepLorentzVector convertVector (const Pythia8::Vec4 v)
 
double BsJpsiPhi_PDF (double *params, double *x, bool useHelicity)
 

Function Documentation

◆ BsJpsiPhi_PDF()

double BsJpsiPhi_PDF ( double *  params,
double *  x,
bool  useHelicity 
)

Definition at line 26 of file UserSelections.h.

26  {
27 
28  // if ( !checkInput(x) ) return 0.;
29 
30  // Human-readable aliases of the parameters and observables.
31  // Human-readable aliases of the parameters and observables.
32  double A0 = std::sqrt(params[0] * (1 - params[2]));
33  double Al = std::sqrt(params[1] * (1 - params[2]));
34  double As = std::sqrt(params[2]);
35  double &GammaS = params[3];
36  double &DeltaGamma = params[4];
37  double &DeltaM = params[5];
38  double &phiS = params[6];
39  double &delta_p = params[7];
40  double &delta_l = params[8];
41  double delta_s = params[7] - params[9];
42 
43  double &time = x[0];
44  // double &timeErr = x[1]; // pico seconds
45  double &tagprob = x[4]; // 0. anti-particle, 0.5 no tag, 1.0 particle
46 
47  // Calculate A perpendicular from the other parameters
48  double Ap = 0;
49  if ( 1. - As*As - A0*A0 - Al*Al >= 0 ) Ap = std::sqrt(1. - As*As - A0*A0 - Al*Al);
50 
51  // The tabulated function is Sum of: A[i] * ( B1[i] +/- B2[i] ) * C[i]
52 
53  double A[10], B1[10], B2[10], C[10];
54 
55  // Define A cells
56  double sinphiS = std::sin(phiS);
57  double cosphiS = std::cos(phiS);
58 
59  A[0] = 0.5 * A0*A0;
60  A[1] = 0.5 * Al*Al;
61  A[2] = 0.5 * Ap*Ap;
62  A[3] = 0.5 * A0*Al * std::cos(delta_l);
63  A[4] = Al*Ap;
64  A[5] = A0*Ap;
65  A[6] = 0.5 * As*As;
66  A[7] = As*Al;
67  A[8] = 0.5 * As*Ap * std::sin(delta_p - delta_s);
68  A[9] = As*A0;
69 
70 
71 
72  // Define B cells
73  double gammaH = GammaS - DeltaGamma/2.;
74  double gammaL = GammaS + DeltaGamma/2.;
75  double tauL = 1./gammaL;
76  double tauH = 1./gammaH;
77  double norm1 = (1./(tauL*(1.+cosphiS) + tauH*(1.-cosphiS)));
78  double norm2 = (1./(tauL*(1.-cosphiS) + tauH*(1.+cosphiS)));
79  double norm3 = (1./sqrt((tauL-tauH)*(tauL-tauH)*sinphiS*sinphiS+4.*tauL*tauH));
80 
81  double ExpGSSinMT = 0.0;
82  double ExpGSCosMT = 0.0;
83 
84 
85 
86  // Calculate convolution of exp(-gammaL * time) with a gaussian. Not convoluted if sigma == 0.
87  double ExpGL = std::exp(-time * gammaL);
88 
89  // Calculate convolution of exp(-gammaH * time) with a gaussian. Not convoluted if sigma == 0.
90  double ExpGH = std::exp(-time * gammaH);
91 
92  B1[0] = ( (1. + cosphiS) * ExpGL + (1. - cosphiS) * ExpGH ) * norm1;
93  B1[1] = B1[0];
94  B1[2] = ( (1. - cosphiS) * ExpGL + (1. + cosphiS) * ExpGH ) * norm2;
95  B1[3] = B1[0];
96  B1[4] = 0.5 * std::cos(delta_p - delta_l) * sinphiS * (ExpGL - ExpGH) * norm3;
97  B1[5] = 0.5 * std::cos(delta_p) * sinphiS * (ExpGL - ExpGH) * norm3;
98  B1[6] = B1[2];
99  B1[7] = 0.5 * sinphiS * std::sin(delta_l - delta_s) * (ExpGL - ExpGH) * norm3;
100  B1[8] = B1[2];
101  B1[9] = 0.5 * sinphiS * std::sin(delta_s) * (ExpGH - ExpGL) * norm3;
102 
103 
104 
105 
106 
107  // Tagged analysis
108  if( std::abs(tagprob - 0.5) > 1e-6 ){
109 
110 
111  ExpGSSinMT = std::exp(-time * GammaS) * std::sin(DeltaM * time);
112  ExpGSCosMT = std::exp(-time * GammaS) * std::cos(DeltaM * time);
113 
114 
115  B2[0] = 2. * ExpGSSinMT * sinphiS * norm1;
116  B2[1] = B2[0];
117  B2[2] = -2. * ExpGSSinMT * sinphiS * norm2;
118  B2[3] = B2[0];
119  B2[4] = ( ExpGSCosMT * std::sin(delta_p - delta_l) - cosphiS * std::cos(delta_p - delta_l) * ExpGSSinMT ) * norm3;
120  B2[5] = ( ExpGSCosMT * std::sin(delta_p) - cosphiS * std::cos(delta_p) * ExpGSSinMT ) * norm3;
121  B2[6] = B2[2];
122  B2[7] = ( ExpGSCosMT * std::cos(delta_l - delta_s) - cosphiS * std::sin(delta_l - delta_s) * ExpGSSinMT ) * norm3;
123  B2[8] = B2[2];
124  B2[9] = ( ExpGSCosMT * std::cos(delta_s) + cosphiS * std::sin(delta_s) * ExpGSSinMT ) * norm3;
125 
126  } // End of tagged terms
127  else{
128  // Untagged analysis
129  for (int k = 0; k<10; k++) B2[k] = 0;
130 
131  }
132  // Define C cells
133 
134  if (useHelicity) {
135 
136  // Helicity Basis: Input variables are costhetal, costhetak and chi
137  double &costhetal = x[1];
138  double &costhetak = x[2];
139  double &chi = x[3];
140 
141  double sinsqthetal = 1. - (costhetal * costhetal);
142  double sinsqthetak = 1. - (costhetak * costhetak);
143  double cossqthetak = costhetak * costhetak;
144  double coschi = std::cos(chi);
145  double cossqchi = coschi * coschi;
146  double sinchi = std::sin(chi);
147  double sinsqchi = sinchi * sinchi;
148  double sin2thetak = 2. * std::sqrt(1. - costhetak * costhetak) * costhetak;
149  double sin2thetal = 2. * std::sqrt(1. - costhetal * costhetal) * costhetal;
150  double sin2chi = std::sin(2. * chi);
151  double sinthetak = std::sqrt(sinsqthetak);
152 
153  C[0] = 2. * cossqthetak * sinsqthetal; //cossqpsi * (1. - sinsqtheta * cossqphi);
154  C[1] = sinsqthetak * (1 - sinsqthetal * cossqchi); //sinsqpsi * (1. - sinsqtheta * sinsqphi);
155  C[2] = sinsqthetak * (1 - sinsqthetal * sinsqchi); //sinsqpsi * sinsqtheta;
156  C[3] = 1. / std::sqrt(2.) * sin2thetak * sin2thetal * coschi; //* sin2psi * sinsqtheta * sin2phi;
157  C[4] = -1. * sinsqthetak * sinsqthetal * sin2chi; //sinsqpsi * sin2theta * sinphi;
158  C[5] = 1. / std::sqrt(2.) * sin2thetak * sin2thetal * sinchi; //* sin2psi * sin2theta * cosphi;
159  C[6] = 2. / 3. * sinsqthetal; //(1. - sinsqtheta * cossqphi);
160  C[7] = 1. / 3. * std::sqrt(6.) * sinthetak * sin2thetal * coschi; //sinpsi * sinsqtheta * sin2phi;
161  C[8] = 1. / 3. * std::sqrt(6.) * sinthetak * sin2thetal * sinchi; //sinpsi * sin2theta * cosphi;
162  C[9] = 4. / 3. * std::sqrt(3.) * costhetak * sinsqthetal; // cospsi * (1. - sinsqtheta * cossqphi);
163 
164  }
165  else {
166 
167  // Transversity Basis: Input variables are costheta, cospsi and phi
168  double &costheta = x[1];
169  double &cospsi = x[2];
170  double &phi = x[3];
171 
172  double sinsqtheta = 1. - (costheta * costheta);
173  double sinsqpsi = 1. - (cospsi * cospsi);
174  double cossqpsi = cospsi * cospsi;
175  double sin2theta = 2. * std::sqrt(1. - costheta * costheta) * costheta;
176  double sin2psi = 2. * std::sqrt(1. - cospsi * cospsi) * cospsi;
177  double cosphi = std::cos(phi);
178  double cossqphi = cosphi * cosphi;
179  double sinphi = std::sin(phi);
180  double sinsqphi = sinphi * sinphi;
181  double sin2phi = std::sin(2. * phi);
182  double sinpsi = std::sqrt(1. - cospsi*cospsi);
183 
184  C[0] = 2. * cossqpsi * (1. - sinsqtheta * cossqphi);
185  C[1] = sinsqpsi * (1.-sinsqtheta * sinsqphi);
186  C[2] = sinsqpsi * sinsqtheta;
187  C[3] = 1. / sqrt(2.) * sin2psi * sinsqtheta * sin2phi;
188  C[4] = -1. * sinsqpsi * sin2theta * sinphi;
189  C[5] = 1. / sqrt(2.) * sin2psi * sin2theta * cosphi;
190  C[6] = 2. / 3. *(1. - sinsqtheta * cossqphi);
191  C[7] = 1. / 3. *sqrt(6.) *sinpsi * sinsqtheta * sin2phi;
192  C[8] = 1. / 3. *sqrt(6.) *sinpsi * sin2theta * cosphi;
193  C[9] = 4. / 3. *sqrt(3.) *cospsi * (1. - sinsqtheta * cossqphi);
194 
195  }
196 
197 
198 
199  // Sum the tabulated formula
200  double Wplus = 0;
201  double Wminus = 0;
202 
203 
204  for ( int i=0; i<10; ++i ) {
205 
206  Wplus += A[i] * ( B1[i] + B2[i] ) * C[i];
207  Wminus += A[i] * ( B1[i] - B2[i] ) * C[i];
208 
209  }
210 
211  double value = tagprob * Wplus + (1. - tagprob) * Wminus;
212  if (value < 0)
213  value = 0;
214  return value;
215 }

◆ convertVector()

CLHEP::HepLorentzVector convertVector ( const Pythia8::Vec4  v)

Definition at line 17 of file UserSelections.h.

17  {
18  CLHEP::HepLorentzVector vect;
19  vect.setPx(v.px());
20  vect.setPy(v.py());
21  vect.setPz(v.pz());
22  vect.setE(v.e());
23  return vect;
24 }
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
DMTest::C
C_v1 C
Definition: C.h:26
athena.value
value
Definition: athena.py:122
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
lumiFormat.i
int i
Definition: lumiFormat.py:92
python.PyAthena.v
v
Definition: PyAthena.py:157
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
fitman.k
k
Definition: fitman.py:528