[82db145] | 1 | #include "TrkUtil.h"
|
---|
| 2 | #include <iostream>
|
---|
[c5696dd] | 3 | #include <algorithm>
|
---|
[53f4746] | 4 | #include <TSpline.h>
|
---|
[82db145] | 5 |
|
---|
| 6 | // Constructor
|
---|
| 7 | TrkUtil::TrkUtil(Double_t Bz)
|
---|
| 8 | {
|
---|
| 9 | fBz = Bz;
|
---|
| 10 | fGasSel = 0; // Default is He-Isobuthane (90-10)
|
---|
| 11 | fRmin = 0.0; // Lower DCH radius
|
---|
| 12 | fRmax = 0.0; // Higher DCH radius
|
---|
| 13 | fZmin = 0.0; // Lower DCH z
|
---|
| 14 | fZmax = 0.0; // Higher DCH z
|
---|
| 15 | }
|
---|
| 16 | TrkUtil::TrkUtil()
|
---|
| 17 | {
|
---|
| 18 | fBz = 0.0;
|
---|
| 19 | fGasSel = 0; // Default is He-Isobuthane (90-10)
|
---|
| 20 | fRmin = 0.0; // Lower DCH radius
|
---|
| 21 | fRmax = 0.0; // Higher DCH radius
|
---|
| 22 | fZmin = 0.0; // Lower DCH z
|
---|
| 23 | fZmax = 0.0; // Higher DCH z
|
---|
| 24 | }
|
---|
| 25 | //
|
---|
| 26 | // Destructor
|
---|
| 27 | TrkUtil::~TrkUtil()
|
---|
| 28 | {
|
---|
| 29 | fBz = 0.0;
|
---|
| 30 | fGasSel = 0; // Default is He-Isobuthane (90-10)
|
---|
| 31 | fRmin = 0.0; // Lower DCH radius
|
---|
| 32 | fRmax = 0.0; // Higher DCH radius
|
---|
| 33 | fZmin = 0.0; // Lower DCH z
|
---|
| 34 | fZmax = 0.0; // Higher DCH z
|
---|
| 35 | }
|
---|
| 36 | //
|
---|
| 37 | // Helix parameters from position and momentum
|
---|
| 38 | // static
|
---|
| 39 | TVectorD TrkUtil::XPtoPar(TVector3 x, TVector3 p, Double_t Q, Double_t Bz)
|
---|
| 40 | {
|
---|
| 41 | //
|
---|
| 42 | TVectorD Par(5);
|
---|
| 43 | // Transverse parameters
|
---|
| 44 | Double_t a = -Q * Bz * cSpeed(); // Units are Tesla, GeV and meters
|
---|
| 45 | Double_t pt = p.Pt();
|
---|
| 46 | Double_t C = a / (2 * pt); // Half curvature
|
---|
| 47 | //std::cout << "ObsTrk::XPtoPar: fB = " << fB << ", a = " << a << ", pt = " << pt << ", C = " << C << std::endl;
|
---|
| 48 | Double_t r2 = x.Perp2();
|
---|
| 49 | Double_t cross = x(0) * p(1) - x(1) * p(0);
|
---|
[c5696dd] | 50 | Double_t T = sqrt(pt * pt - 2 * a * cross + a * a * r2);
|
---|
| 51 | Double_t phi0 = atan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi0
|
---|
[82db145] | 52 | Double_t D; // Impact parameter D
|
---|
| 53 | if (pt < 10.0) D = (T - pt) / a;
|
---|
| 54 | else D = (-2 * cross + a * r2) / (T + pt);
|
---|
| 55 | //
|
---|
| 56 | Par(0) = D; // Store D
|
---|
| 57 | Par(1) = phi0; // Store phi0
|
---|
| 58 | Par(2) = C; // Store C
|
---|
| 59 | //Longitudinal parameters
|
---|
[c5696dd] | 60 | Double_t B = C * sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D));
|
---|
| 61 | Double_t st = asin(B) / C;
|
---|
[82db145] | 62 | Double_t ct = p(2) / pt;
|
---|
| 63 | Double_t z0 = x(2) - ct * st;
|
---|
| 64 | //
|
---|
| 65 | Par(3) = z0; // Store z0
|
---|
| 66 | Par(4) = ct; // Store cot(theta)
|
---|
| 67 | //
|
---|
| 68 | return Par;
|
---|
| 69 | }
|
---|
| 70 | // non-static
|
---|
| 71 | TVectorD TrkUtil::XPtoPar(TVector3 x, TVector3 p, Double_t Q)
|
---|
| 72 | {
|
---|
| 73 | //
|
---|
| 74 | TVectorD Par(5);
|
---|
| 75 | Double_t Bz = fBz;
|
---|
| 76 | Par = XPtoPar(x, p, Q, Bz);
|
---|
| 77 | //
|
---|
| 78 | return Par;
|
---|
| 79 | }
|
---|
| 80 | //
|
---|
| 81 | TVector3 TrkUtil::ParToX(TVectorD Par)
|
---|
| 82 | {
|
---|
| 83 | Double_t D = Par(0);
|
---|
| 84 | Double_t phi0 = Par(1);
|
---|
| 85 | Double_t z0 = Par(3);
|
---|
| 86 | //
|
---|
| 87 | TVector3 Xval;
|
---|
[c5696dd] | 88 | Xval(0) = -D * sin(phi0);
|
---|
| 89 | Xval(1) = D * cos(phi0);
|
---|
[82db145] | 90 | Xval(2) = z0;
|
---|
| 91 | //
|
---|
| 92 | return Xval;
|
---|
| 93 | }
|
---|
| 94 | //
|
---|
| 95 | TVector3 TrkUtil::ParToP(TVectorD Par)
|
---|
| 96 | {
|
---|
| 97 | if (fBz == 0.0)std::cout << "TrkUtil::ParToP: Warning Bz not set" << std::endl;
|
---|
| 98 | //
|
---|
[53f4746] | 99 | return ParToP(Par, fBz);
|
---|
[82db145] | 100 | }
|
---|
| 101 | //
|
---|
| 102 | TVector3 TrkUtil::ParToP(TVectorD Par, Double_t Bz)
|
---|
| 103 | {
|
---|
| 104 | Double_t C = Par(2);
|
---|
| 105 | Double_t phi0 = Par(1);
|
---|
| 106 | Double_t ct = Par(4);
|
---|
| 107 | //
|
---|
| 108 | TVector3 Pval;
|
---|
| 109 | Double_t pt = Bz * cSpeed() / TMath::Abs(2 * C);
|
---|
[c5696dd] | 110 | Pval(0) = pt * cos(phi0);
|
---|
| 111 | Pval(1) = pt * sin(phi0);
|
---|
[82db145] | 112 | Pval(2) = pt * ct;
|
---|
| 113 | //
|
---|
| 114 | return Pval;
|
---|
| 115 | }
|
---|
| 116 | //
|
---|
| 117 | Double_t TrkUtil::ParToQ(TVectorD Par)
|
---|
| 118 | {
|
---|
| 119 | return TMath::Sign(1.0, -Par(2));
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | //
|
---|
| 123 | // Parameter conversion to ACTS format
|
---|
| 124 | TVectorD TrkUtil::ParToACTS(TVectorD Par)
|
---|
| 125 | {
|
---|
| 126 | TVectorD pACTS(6); // Return vector
|
---|
| 127 | //
|
---|
| 128 | Double_t b = -cSpeed() * fBz / 2.;
|
---|
| 129 | pACTS(0) = 1000 * Par(0); // D from m to mm
|
---|
| 130 | pACTS(1) = 1000 * Par(3); // z0 from m to mm
|
---|
| 131 | pACTS(2) = Par(1); // Phi0 is unchanged
|
---|
[c5696dd] | 132 | pACTS(3) = atan2(1.0, Par(4)); // Theta in [0, pi] range
|
---|
| 133 | pACTS(4) = Par(2) / (b * sqrt(1 + Par(4) * Par(4))); // q/p in GeV
|
---|
[82db145] | 134 | pACTS(5) = 0.0; // Time: currently undefined
|
---|
| 135 | //
|
---|
| 136 | return pACTS;
|
---|
| 137 | }
|
---|
| 138 | // Covariance conversion to ACTS format
|
---|
| 139 | TMatrixDSym TrkUtil::CovToACTS(TVectorD Par, TMatrixDSym Cov)
|
---|
| 140 | {
|
---|
| 141 | TMatrixDSym cACTS(6); cACTS.Zero();
|
---|
| 142 | Double_t b = -cSpeed() * fBz / 2.;
|
---|
| 143 | //
|
---|
| 144 | // Fill derivative matrix
|
---|
| 145 | TMatrixD A(5, 5); A.Zero();
|
---|
| 146 | Double_t ct = Par(4); // cot(theta)
|
---|
| 147 | Double_t C = Par(2); // half curvature
|
---|
| 148 | A(0, 0) = 1000.; // D-D conversion to mm
|
---|
| 149 | A(1, 2) = 1.0; // phi0-phi0
|
---|
[c5696dd] | 150 | A(2, 4) = 1.0 / (sqrt(1.0 + ct * ct) * b); // q/p-C
|
---|
[82db145] | 151 | A(3, 1) = 1000.; // z0-z0 conversion to mm
|
---|
| 152 | A(4, 3) = -1.0 / (1.0 + ct * ct); // theta - cot(theta)
|
---|
| 153 | A(4, 4) = -C * ct / (b * pow(1.0 + ct * ct, 3.0 / 2.0)); // q/p-cot(theta)
|
---|
| 154 | //
|
---|
| 155 | TMatrixDSym Cv = Cov;
|
---|
| 156 | TMatrixD At(5, 5);
|
---|
| 157 | At.Transpose(A);
|
---|
| 158 | Cv.Similarity(At);
|
---|
| 159 | TMatrixDSub(cACTS, 0, 4, 0, 4) = Cv;
|
---|
| 160 | cACTS(5, 5) = 0.1; // Currently undefined: set to arbitrary value to avoid crashes
|
---|
| 161 | //
|
---|
| 162 | return cACTS;
|
---|
| 163 | }
|
---|
| 164 | //
|
---|
| 165 | // Parameter conversion to ILC format
|
---|
| 166 | TVectorD TrkUtil::ParToILC(TVectorD Par)
|
---|
| 167 | {
|
---|
| 168 | TVectorD pILC(5); // Return vector
|
---|
| 169 | //
|
---|
| 170 | pILC(0) = Par(0) * 1.0e3; // d0 in mm
|
---|
| 171 | pILC(1) = Par(1); // phi0 is unchanged
|
---|
| 172 | pILC(2) = -2 * Par(2) * 1.0e-3; // w in mm^-1
|
---|
| 173 | pILC(3) = Par(3) * 1.0e3; // z0 in mm
|
---|
| 174 | pILC(4) = Par(4); // tan(lambda) = cot(theta)
|
---|
| 175 | //
|
---|
| 176 | return pILC;
|
---|
| 177 | }
|
---|
| 178 | // Covariance conversion to ILC format
|
---|
| 179 | TMatrixDSym TrkUtil::CovToILC(TMatrixDSym Cov)
|
---|
| 180 | {
|
---|
| 181 | TMatrixDSym cILC(5); cILC.Zero();
|
---|
| 182 | //
|
---|
| 183 | // Fill derivative matrix
|
---|
| 184 | TMatrixD A(5, 5); A.Zero();
|
---|
| 185 | //
|
---|
| 186 | A(0, 0) = 1.0e3; // D-d0 in mm
|
---|
| 187 | A(1, 1) = 1.0; // phi0-phi0
|
---|
| 188 | A(2, 2) = -2.0e-3; // w-C
|
---|
| 189 | A(3, 3) = 1.0e3; // z0-z0 conversion to mm
|
---|
| 190 | A(4, 4) = 1.0; // tan(lambda) - cot(theta)
|
---|
| 191 | //
|
---|
| 192 | TMatrixDSym Cv = Cov;
|
---|
| 193 | TMatrixD At(5, 5);
|
---|
| 194 | At.Transpose(A);
|
---|
| 195 | Cv.Similarity(At);
|
---|
| 196 | cILC = Cv;
|
---|
| 197 | //
|
---|
| 198 | return cILC;
|
---|
| 199 | }
|
---|
| 200 | //
|
---|
| 201 | // Conversion from meters to mm
|
---|
| 202 | TVectorD TrkUtil::ParToMm(TVectorD Par) // Parameter conversion
|
---|
| 203 | {
|
---|
| 204 | TVectorD Pmm(5); // Return vector
|
---|
| 205 | //
|
---|
| 206 | Pmm(0) = Par(0) * 1.0e3; // d0 in mm
|
---|
| 207 | Pmm(1) = Par(1); // phi0 is unchanged
|
---|
| 208 | Pmm(2) = Par(2) * 1.0e-3; // C in mm^-1
|
---|
| 209 | Pmm(3) = Par(3) * 1.0e3; // z0 in mm
|
---|
| 210 | Pmm(4) = Par(4); // tan(lambda) = cot(theta) unchanged
|
---|
| 211 | //
|
---|
| 212 | return Pmm;
|
---|
| 213 | }
|
---|
| 214 | TMatrixDSym TrkUtil::CovToMm(TMatrixDSym Cov) // Covariance conversion
|
---|
| 215 | {
|
---|
| 216 | TMatrixDSym Cmm(5); Cmm.Zero();
|
---|
| 217 | //
|
---|
| 218 | // Fill derivative matrix
|
---|
| 219 | TMatrixD A(5, 5); A.Zero();
|
---|
| 220 | //
|
---|
| 221 | A(0, 0) = 1.0e3; // D-d0 in mm
|
---|
| 222 | A(1, 1) = 1.0; // phi0-phi0
|
---|
| 223 | A(2, 2) = 1.0e-3; // C-C
|
---|
| 224 | A(3, 3) = 1.0e3; // z0-z0 conversion to mm
|
---|
| 225 | A(4, 4) = 1.0; // lambda - cot(theta)
|
---|
| 226 | //
|
---|
| 227 | TMatrixDSym Cv = Cov;
|
---|
| 228 | TMatrixD At(5, 5);
|
---|
| 229 | At.Transpose(A);
|
---|
| 230 | Cv.Similarity(At);
|
---|
| 231 | Cmm = Cv;
|
---|
| 232 | //
|
---|
| 233 | return Cmm;
|
---|
| 234 | }
|
---|
| 235 | //
|
---|
| 236 | // Setup chamber volume
|
---|
| 237 | void TrkUtil::SetDchBoundaries(Double_t Rmin, Double_t Rmax, Double_t Zmin, Double_t Zmax)
|
---|
| 238 | {
|
---|
| 239 | fRmin = Rmin; // Lower DCH radius
|
---|
| 240 | fRmax = Rmax; // Higher DCH radius
|
---|
| 241 | fZmin = Zmin; // Lower DCH z
|
---|
| 242 | fZmax = Zmax; // Higher DCH z
|
---|
| 243 | }
|
---|
| 244 | //
|
---|
| 245 | // Get Trakck length inside DCH volume
|
---|
| 246 | Double_t TrkUtil::TrkLen(TVectorD Par)
|
---|
| 247 | {
|
---|
| 248 | Double_t tLength = 0.0;
|
---|
| 249 | // Check if geometry is initialized
|
---|
| 250 | if (fZmin == 0.0 && fZmax == 0.0)
|
---|
| 251 | {
|
---|
| 252 | // No geometry set so send a warning and return 0
|
---|
| 253 | std::cout << "TrkUtil::TrkLen() called without a DCH volume defined" << std::endl;
|
---|
| 254 | }
|
---|
| 255 | else
|
---|
| 256 | {
|
---|
| 257 | //******************************************************************
|
---|
| 258 | // Determine the track length inside the chamber ****
|
---|
| 259 | //******************************************************************
|
---|
| 260 | //
|
---|
| 261 | // Track pararameters
|
---|
| 262 | Double_t D = Par(0); // Transverse impact parameter
|
---|
| 263 | Double_t phi0 = Par(1); // Transverse direction at minimum approach
|
---|
| 264 | Double_t C = Par(2); // Half curvature
|
---|
| 265 | Double_t z0 = Par(3); // Z at minimum approach
|
---|
| 266 | Double_t ct = Par(4); // cot(theta)
|
---|
| 267 | //std::cout << "TrkUtil:: parameters: D= " << D << ", phi0= " << phi0
|
---|
| 268 | // << ", C= " << C << ", z0= " << z0 << ", ct= " << ct << std::endl;
|
---|
| 269 | //
|
---|
[53f4746] | 270 | // Track length per unit phase change
|
---|
| 271 | Double_t Scale = sqrt(1.0 + ct * ct) / (2.0 * TMath::Abs(C));
|
---|
[82db145] | 272 | //
|
---|
| 273 | // Find intersections with chamber boundaries
|
---|
| 274 | //
|
---|
[53f4746] | 275 | Double_t phRin = 0.0; // phase of inner cylinder
|
---|
| 276 | Double_t phRin2 = 0.0; // phase of inner cylinder intersection (2nd branch)
|
---|
[82db145] | 277 | Double_t phRhi = 0.0; // phase of outer cylinder intersection
|
---|
| 278 | Double_t phZmn = 0.0; // phase of left wall intersection
|
---|
| 279 | Double_t phZmx = 0.0; // phase of right wall intersection
|
---|
| 280 | // ... with inner cylinder
|
---|
[53f4746] | 281 | Double_t Rtop = TMath::Abs((1.0 + C * D) / C);
|
---|
[82db145] | 282 |
|
---|
| 283 | if (Rtop > fRmin && TMath::Abs(D) < fRmin) // *** don't treat large D tracks for the moment ***
|
---|
| 284 | {
|
---|
[53f4746] | 285 | Double_t ph = 2 * asin(C * sqrt((fRmin * fRmin - D * D) / (1.0 + 2.0 * C * D)));
|
---|
| 286 | Double_t z = z0 + ct * ph / (2.0 * C);
|
---|
[82db145] | 287 |
|
---|
| 288 | //std::cout << "Rin intersection: ph = " << ph<<", z= "<<z << std::endl;
|
---|
| 289 |
|
---|
[53f4746] | 290 | if (z < fZmax && z > fZmin) phRin = TMath::Abs(ph); // Intersection inside chamber volume
|
---|
[82db145] | 291 | //
|
---|
| 292 | // Include second branch of loopers
|
---|
[59ba063] | 293 | Double_t Pi = 3.14159265358979323846;
|
---|
[53f4746] | 294 | Double_t ph2 = 2 * Pi - TMath::Abs(ph);
|
---|
[82db145] | 295 | if (ph < 0)ph2 = -ph2;
|
---|
| 296 | z = z0 + ct * ph2 / (2.0 * C);
|
---|
| 297 | if (z < fZmax && z > fZmin) phRin2 = TMath::Abs(ph2); // Intersection inside chamber volume
|
---|
| 298 | }
|
---|
| 299 | // ... with outer cylinder
|
---|
| 300 | if (Rtop > fRmax && TMath::Abs(D) < fRmax) // *** don't treat large D tracks for the moment ***
|
---|
| 301 | {
|
---|
[53f4746] | 302 | Double_t ph = 2 * asin(C * sqrt((fRmax * fRmax - D * D) / (1.0 + 2.0 * C * D)));
|
---|
| 303 | Double_t z = z0 + ct * ph / (2.0 * C);
|
---|
| 304 | if (z < fZmax && z > fZmin) phRhi = TMath::Abs(ph); // Intersection inside chamber volume
|
---|
[82db145] | 305 | }
|
---|
| 306 | // ... with left wall
|
---|
| 307 | Double_t Zdir = (fZmin - z0) / ct;
|
---|
| 308 | if (Zdir > 0.0)
|
---|
| 309 | {
|
---|
[53f4746] | 310 | Double_t ph = 2.0 * C * Zdir;
|
---|
| 311 | Double_t Rint = sqrt(D * D + (1.0 + 2.0 * C * D) * pow(sin(ph / 2), 2) / (C * C));
|
---|
| 312 | if (Rint < fRmax && Rint > fRmin) phZmn = TMath::Abs(ph); // Intersection inside chamber volume
|
---|
[82db145] | 313 | }
|
---|
| 314 | // ... with right wall
|
---|
| 315 | Zdir = (fZmax - z0) / ct;
|
---|
| 316 | if (Zdir > 0.0)
|
---|
| 317 | {
|
---|
[53f4746] | 318 | Double_t ph = 2.0 * C * Zdir;
|
---|
| 319 | Double_t Rint = sqrt(D * D + (1.0 + 2.0 * C * D) * pow(sin(ph / 2), 2) / (C * C));
|
---|
| 320 | if (Rint < fRmax && Rint > fRmin) phZmx = TMath::Abs(ph); // Intersection inside chamber volume
|
---|
[82db145] | 321 | }
|
---|
| 322 | //
|
---|
| 323 | // Order phases and keep the lowest two non-zero ones
|
---|
| 324 | //
|
---|
| 325 | const Int_t Nint = 5;
|
---|
| 326 | Double_t dPhase = 0.0; // Phase difference between two close intersections
|
---|
| 327 | Double_t ph_arr[Nint] = { phRin, phRin2, phRhi, phZmn, phZmx };
|
---|
[59ba063] | 328 | std::sort(ph_arr, ph_arr + Nint);
|
---|
[82db145] | 329 | Int_t iPos = -1; // First element > 0
|
---|
| 330 | for (Int_t i = 0; i < Nint; i++)
|
---|
| 331 | {
|
---|
[59ba063] | 332 | if (ph_arr[i] <= 0.0) iPos = i;
|
---|
[82db145] | 333 | }
|
---|
| 334 |
|
---|
| 335 | if (iPos < Nint - 2)
|
---|
| 336 | {
|
---|
[59ba063] | 337 | dPhase = ph_arr[iPos + 2] - ph_arr[iPos + 1];
|
---|
[53f4746] | 338 | tLength = dPhase * Scale;
|
---|
[82db145] | 339 | }
|
---|
| 340 | }
|
---|
| 341 | return tLength;
|
---|
| 342 | }
|
---|
| 343 | //
|
---|
| 344 | // Return number of ionization clusters
|
---|
[53f4746] | 345 | Bool_t TrkUtil::IonClusters(Double_t& Ncl, Double_t mass, TVectorD Par)
|
---|
[82db145] | 346 | {
|
---|
| 347 | //
|
---|
| 348 | // Units are meters/Tesla/GeV
|
---|
| 349 | //
|
---|
| 350 | Ncl = 0.0;
|
---|
| 351 | Bool_t Signal = kFALSE;
|
---|
| 352 | Double_t tLen = 0;
|
---|
| 353 | // Check if geometry is initialized
|
---|
| 354 | if (fZmin == 0.0 && fZmax == 0.0)
|
---|
| 355 | {
|
---|
| 356 | // No geometry set so send a warning and return 0
|
---|
| 357 | std::cout << "TrkUtil::IonClusters() called without a volume defined" << std::endl;
|
---|
| 358 | }
|
---|
| 359 | else tLen = TrkLen(Par);
|
---|
| 360 |
|
---|
| 361 | //******************************************************************
|
---|
| 362 | // Now get the number of clusters ****
|
---|
| 363 | //******************************************************************
|
---|
| 364 | //
|
---|
| 365 | Double_t muClu = 0.0; // mean number of clusters
|
---|
| 366 | Double_t bg = 0.0; // beta*gamma
|
---|
| 367 | Ncl = 0.0;
|
---|
| 368 | if (tLen > 0.0)
|
---|
| 369 | {
|
---|
| 370 | Signal = kTRUE;
|
---|
| 371 | //
|
---|
| 372 | // Find beta*gamma
|
---|
| 373 | if (fBz == 0.0)
|
---|
| 374 | {
|
---|
| 375 | Signal = kFALSE;
|
---|
| 376 | std::cout << "TrkUtil::IonClusters: Please set Bz!!!" << std::endl;
|
---|
| 377 | }
|
---|
| 378 | else
|
---|
| 379 | {
|
---|
| 380 | TVector3 p = ParToP(Par);
|
---|
| 381 | bg = p.Mag() / mass;
|
---|
[53f4746] | 382 | muClu = Nclusters(bg) * tLen; // Avg. number of clusters
|
---|
[82db145] | 383 |
|
---|
| 384 | Ncl = gRandom->PoissonD(muClu); // Actual number of clusters
|
---|
| 385 | }
|
---|
| 386 |
|
---|
| 387 | }
|
---|
[53f4746] | 388 | //
|
---|
[82db145] | 389 | return Signal;
|
---|
| 390 | }
|
---|
| 391 | //
|
---|
| 392 | //
|
---|
[a95da74] | 393 | Double_t TrkUtil::Nclusters(Double_t begam)
|
---|
[82db145] | 394 | {
|
---|
| 395 | Int_t Opt = fGasSel;
|
---|
| 396 | Double_t Nclu = Nclusters(begam, Opt);
|
---|
| 397 | //
|
---|
| 398 | return Nclu;
|
---|
| 399 | }
|
---|
| 400 | //
|
---|
| 401 | Double_t TrkUtil::Nclusters(Double_t begam, Int_t Opt) {
|
---|
| 402 | //
|
---|
| 403 | // Opt = 0: He 90 - Isobutane 10
|
---|
| 404 | // = 1: pure He
|
---|
| 405 | // = 2: Argon 50 - Ethane 50
|
---|
| 406 | // = 3: pure Argon
|
---|
| 407 | //
|
---|
| 408 | //
|
---|
[4df491e] | 409 | const Int_t Npt = 18;
|
---|
| 410 | Double_t bg[Npt] = { 0.5, 0.8, 1., 2., 3., 4., 5., 8., 10.,
|
---|
| 411 | 12., 15., 20., 50., 100., 200., 500., 1000., 10000. };
|
---|
| 412 | //
|
---|
| 413 | // He 90 - Isobutane 10
|
---|
| 414 | Double_t ncl_He_Iso[Npt] = { 42.94, 23.6,18.97,12.98,12.2,12.13,
|
---|
| 415 | 12.24,12.73,13.03,13.29,13.63,14.08,15.56,16.43,16.8,16.95,16.98, 16.98 };
|
---|
| 416 | //
|
---|
| 417 | // pure He
|
---|
| 418 | Double_t ncl_He[Npt] = { 11.79,6.5,5.23,3.59,3.38,3.37,3.4,3.54,3.63,
|
---|
| 419 | 3.7,3.8,3.92,4.33,4.61,4.78,4.87,4.89, 4.89 };
|
---|
| 420 | //
|
---|
| 421 | // Argon 50 - Ethane 50
|
---|
| 422 | Double_t ncl_Ar_Eth[Npt] = { 130.04,71.55,57.56,39.44,37.08,36.9,
|
---|
| 423 | 37.25,38.76,39.68,40.49,41.53,42.91,46.8,48.09,48.59,48.85,48.93,48.93 };
|
---|
| 424 | //
|
---|
| 425 | // pure Argon
|
---|
| 426 | Double_t ncl_Ar[Npt] = { 88.69,48.93,39.41,27.09,25.51,25.43,25.69,
|
---|
| 427 | 26.78,27.44,28.02,28.77,29.78,32.67,33.75,34.24,34.57,34.68, 34.68 };
|
---|
| 428 | //
|
---|
| 429 | Double_t ncl[Npt];
|
---|
[53f4746] | 430 | switch (Opt)
|
---|
| 431 | {
|
---|
| 432 | case 0: std::copy(ncl_He_Iso, ncl_He_Iso + Npt, ncl); // He-Isobutane
|
---|
[a95da74] | 433 | break;
|
---|
[53f4746] | 434 | case 1: std::copy(ncl_He, ncl_He + Npt, ncl); // pure He
|
---|
[4df491e] | 435 | break;
|
---|
[53f4746] | 436 | case 2: std::copy(ncl_Ar_Eth, ncl_Ar_Eth + Npt, ncl); // Argon - Ethane
|
---|
[4df491e] | 437 | break;
|
---|
[53f4746] | 438 | case 3: std::copy(ncl_Ar, ncl_Ar + Npt, ncl); // pure Argon
|
---|
[4df491e] | 439 | break;
|
---|
[53f4746] | 440 | }
|
---|
| 441 | //
|
---|
| 442 | Double_t interp = 0.0;
|
---|
| 443 | TSpline3* sp3 = new TSpline3("sp3", bg, ncl, Npt);
|
---|
| 444 | if (begam > bg[0] && begam < bg[Npt - 1]) interp = sp3->Eval(begam);
|
---|
| 445 | if(begam < bg[0]) interp = bg[0];
|
---|
| 446 | if(begam > bg[Npt-1]) interp = bg[Npt-1];
|
---|
| 447 | return 100 * interp;
|
---|
[82db145] | 448 | }
|
---|
| 449 | //
|
---|
[53f4746] | 450 | Double_t TrkUtil::funcNcl(Double_t* xp, Double_t* par) {
|
---|
[82db145] | 451 | Double_t bg = xp[0];
|
---|
| 452 | return Nclusters(bg);
|
---|
| 453 | }
|
---|
| 454 | //
|
---|
| 455 | void TrkUtil::SetGasMix(Int_t Opt)
|
---|
| 456 | {
|
---|
| 457 | if (Opt < 0 || Opt > 3)
|
---|
| 458 | {
|
---|
| 459 | std::cout << "TrkUtil::SetGasMix Gas option not allowed. No action."
|
---|
| 460 | << std::endl;
|
---|
| 461 | }
|
---|
| 462 | else fGasSel = Opt;
|
---|
[c5696dd] | 463 | }
|
---|