[1294bba] | 1 | #include <iostream>
|
---|
[31f3bca] | 2 | #include <sstream>
|
---|
[1294bba] | 3 |
|
---|
[ff9fb2d9] | 4 | #include <TString.h>
|
---|
[1294bba] | 5 |
|
---|
| 6 | #include "SolGeom.h"
|
---|
| 7 | #include "SolTrack.h"
|
---|
| 8 |
|
---|
| 9 | using namespace std;
|
---|
| 10 |
|
---|
| 11 | SolGeom::SolGeom()
|
---|
| 12 | {
|
---|
[ff9fb2d9] | 13 | //
|
---|
| 14 | // Magnetic field
|
---|
| 15 | //
|
---|
| 16 | fB = 2.0;
|
---|
| 17 | //
|
---|
| 18 | // Create arrays
|
---|
| 19 | //
|
---|
| 20 | ftyLay = new Int_t[fNlMax]; // Layer type 1 = R (barrel) or 2 = z (forward/backward)
|
---|
| 21 | fLyLabl = new TString[fNlMax]; // Layer label
|
---|
| 22 | fxMin = new Double_t[fNlMax]; // Minimum dimension z for barrel or R for forward
|
---|
| 23 | fxMax = new Double_t[fNlMax]; // Maximum dimension z for barrel or R for forward
|
---|
| 24 | frPos = new Double_t[fNlMax]; // R/z location of layer
|
---|
| 25 | fthLay = new Double_t[fNlMax]; // Thickness (meters)
|
---|
| 26 | frlLay = new Double_t[fNlMax]; // Radiation length (meters)
|
---|
| 27 | fnmLay = new Int_t[fNlMax]; // Number of measurements in layers (1D or 2D)
|
---|
| 28 | fstLayU = new Double_t[fNlMax]; // Stereo angle (rad) - 0(pi/2) = axial(z) layer - Upper side
|
---|
| 29 | fstLayL = new Double_t[fNlMax]; // Stereo angle (rad) - 0(pi/2) = axial(z) layer - Lower side
|
---|
| 30 | fsgLayU = new Double_t[fNlMax]; // Resolution Upper side (meters) - 0 = no measurement
|
---|
| 31 | fsgLayL = new Double_t[fNlMax]; // Resolution Lower side (meters) - 0 = no measurement
|
---|
| 32 | fflLay = new Bool_t[fNlMax]; // measurement flag = T, scattering only = F
|
---|
| 33 | //
|
---|
| 34 | // Load geometry info in SolGeom.h
|
---|
| 35 | //
|
---|
| 36 | fNlay = 0; // Actual number of layers
|
---|
| 37 | fBlay = 0; // Nr. of barrel layers
|
---|
| 38 | fFlay = 0; // Nr. of forward/backward layers
|
---|
[1294bba] | 39 | fNm = 0; // Nr. of measuring layers
|
---|
[ff9fb2d9] | 40 | }
|
---|
[1294bba] | 41 |
|
---|
[31f3bca] | 42 | void SolGeom::Read(const char *data)
|
---|
| 43 | {
|
---|
| 44 | Int_t tyLay;
|
---|
| 45 | string LyLabl;
|
---|
| 46 | Double_t xMin;
|
---|
| 47 | Double_t xMax;
|
---|
| 48 | Double_t rPos;
|
---|
| 49 | Double_t thLay;
|
---|
| 50 | Double_t rlLay;
|
---|
| 51 | Int_t nmLay;
|
---|
| 52 | Double_t stLayU;
|
---|
| 53 | Double_t stLayL;
|
---|
| 54 | Double_t sgLayU;
|
---|
| 55 | Double_t sgLayL;
|
---|
| 56 | Int_t flLay;
|
---|
[ff9fb2d9] | 57 |
|
---|
[31f3bca] | 58 | stringstream data_stream(data);
|
---|
| 59 | string line;
|
---|
| 60 |
|
---|
| 61 | fNlay = 0;
|
---|
| 62 | while(getline(data_stream, line))
|
---|
| 63 | {
|
---|
| 64 | stringstream line_stream(line);
|
---|
| 65 |
|
---|
| 66 | line_stream >> tyLay >> LyLabl >> xMin >> xMax >> rPos >> thLay >> rlLay >> nmLay >> stLayU >> stLayL >> sgLayU >> sgLayL >> flLay;
|
---|
| 67 |
|
---|
| 68 | if(line_stream.fail()) continue;
|
---|
| 69 |
|
---|
| 70 | ftyLay[fNlay] = tyLay;
|
---|
| 71 | fLyLabl[fNlay] = LyLabl;
|
---|
| 72 | fxMin[fNlay] = xMin;
|
---|
| 73 | fxMax[fNlay] = xMax;
|
---|
| 74 | frPos[fNlay] = rPos;
|
---|
| 75 | fthLay[fNlay] = thLay;
|
---|
| 76 | frlLay[fNlay] = rlLay;
|
---|
| 77 | fnmLay[fNlay] = nmLay;
|
---|
| 78 | fstLayU[fNlay] = stLayU;
|
---|
| 79 | fstLayL[fNlay] = stLayL;
|
---|
| 80 | fsgLayU[fNlay] = sgLayU;
|
---|
| 81 | fsgLayL[fNlay] = sgLayL;
|
---|
| 82 | fflLay[fNlay] = flLay;
|
---|
| 83 |
|
---|
| 84 | fNlay++;
|
---|
[ff9fb2d9] | 85 | if (tyLay == 1) fBlay++;
|
---|
| 86 | if (tyLay == 2) fFlay++;
|
---|
[31f3bca] | 87 | if (flLay == 1) fNm++;
|
---|
| 88 | }
|
---|
[ebf40fd] | 89 | //
|
---|
| 90 | // Define inner box for fast tracking
|
---|
| 91 | //
|
---|
| 92 | SetMinBoundaries();
|
---|
[1294bba] | 93 | }
|
---|
| 94 |
|
---|
| 95 | SolGeom::~SolGeom()
|
---|
| 96 | {
|
---|
| 97 | delete[] ftyLay;
|
---|
| 98 | delete[] fxMin;
|
---|
| 99 | delete[] fxMax;
|
---|
| 100 | delete[] frPos;
|
---|
| 101 | delete[] fthLay;
|
---|
| 102 | delete[] frlLay;
|
---|
| 103 | delete[] fnmLay;
|
---|
| 104 | delete[] fstLayU;
|
---|
| 105 | delete[] fstLayL;
|
---|
| 106 | delete[] fsgLayU;
|
---|
| 107 | delete[] fsgLayL;
|
---|
| 108 | delete[] fflLay;
|
---|
| 109 | }
|
---|
[ebf40fd] | 110 |
|
---|
| 111 | //
|
---|
| 112 | // Get inner boundaries of cylindrical box for fast simulation
|
---|
| 113 | //
|
---|
| 114 | void SolGeom::SetMinBoundaries()
|
---|
| 115 | {
|
---|
| 116 | // Get radius of first barrel layer
|
---|
| 117 | fRmin = 1000000.0;
|
---|
| 118 | fZminPos = 1000000.0;
|
---|
| 119 | fZminNeg = -1000000.0;
|
---|
| 120 | for (Int_t i = 0; i < fNlay; i++){
|
---|
| 121 | if (ftyLay[i] == 1) { // Cylinders
|
---|
| 122 | if (frPos[i] < fRmin) fRmin = frPos[i];
|
---|
| 123 | }
|
---|
| 124 | if (ftyLay[i] == 2) { // Disks
|
---|
| 125 | if (frPos[i] > 0.0 && frPos[i] < fZminPos) fZminPos = frPos[i]; // Positive direction
|
---|
| 126 | if (frPos[i] < 0.0 && frPos[i] > fZminNeg) fZminNeg = frPos[i]; // Negative direction
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 | }
|
---|