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