Fork me on GitHub

source: git/external/TrackCovariance/SolGeom.cc@ 7bca620

Last change on this file since 7bca620 was ebf40fd, checked in by Franco BEDESCHI <bed@…>, 3 years ago

Major update to handle highly displaced tracks

  • Property mode set to 100644
File size: 3.3 KB
Line 
1#include <iostream>
2#include <sstream>
3
4#include <TString.h>
5
6#include "SolGeom.h"
7#include "SolTrack.h"
8
9using namespace std;
10
11SolGeom::SolGeom()
12{
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
39 fNm = 0; // Nr. of measuring layers
40}
41
42void 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;
57
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++;
85 if (tyLay == 1) fBlay++;
86 if (tyLay == 2) fFlay++;
87 if (flLay == 1) fNm++;
88 }
89//
90// Define inner box for fast tracking
91//
92 SetMinBoundaries();
93}
94
95SolGeom::~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}
110
111//
112// Get inner boundaries of cylindrical box for fast simulation
113//
114void 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}
Note: See TracBrowser for help on using the repository browser.