Fork me on GitHub

source: git/external/TrackCovariance/SolGeom.cc@ 6c73aea

ImprovedOutputFile
Last change on this file since 6c73aea was ff9fb2d9, checked in by Pavel Demin <pavel.demin@…>, 5 years ago

add TrackCovariance

  • Property mode set to 100644
File size: 2.9 KB
Line 
1#include <iostream>
2
3#include <TString.h>
4
5#include "SolGeom.h"
6#include "SolTrack.h"
7
8using namespace std;
9
10SolGeom::SolGeom()
11{
12 //
13 // Magnetic field
14 //
15 fB = 2.0;
16 //
17 // Create arrays
18 //
19 ftyLay = new Int_t[fNlMax]; // Layer type 1 = R (barrel) or 2 = z (forward/backward)
20 fLyLabl = new TString[fNlMax]; // Layer label
21 fxMin = new Double_t[fNlMax]; // Minimum dimension z for barrel or R for forward
22 fxMax = new Double_t[fNlMax]; // Maximum dimension z for barrel or R for forward
23 frPos = new Double_t[fNlMax]; // R/z location of layer
24 fthLay = new Double_t[fNlMax]; // Thickness (meters)
25 frlLay = new Double_t[fNlMax]; // Radiation length (meters)
26 fnmLay = new Int_t[fNlMax]; // Number of measurements in layers (1D or 2D)
27 fstLayU = new Double_t[fNlMax]; // Stereo angle (rad) - 0(pi/2) = axial(z) layer - Upper side
28 fstLayL = new Double_t[fNlMax]; // Stereo angle (rad) - 0(pi/2) = axial(z) layer - Lower side
29 fsgLayU = new Double_t[fNlMax]; // Resolution Upper side (meters) - 0 = no measurement
30 fsgLayL = new Double_t[fNlMax]; // Resolution Lower side (meters) - 0 = no measurement
31 fflLay = new Bool_t[fNlMax]; // measurement flag = T, scattering only = F
32 //
33 // Load geometry info in SolGeom.h
34 //
35 fNlay = 0; // Actual number of layers
36 fBlay = 0; // Nr. of barrel layers
37 fFlay = 0; // Nr. of forward/backward layers
38 fNm = 0; // Nr. of measuring layers
39}
40
41void SolGeom::Read(const char *data)
42{
43 char strng[200];
44 int nbytes = 200;
45 FILE *fdata = fopen(data, "r");
46 if (!fdata)
47 {
48 cout << "SolGeom::GeoRead - can't open input file" << endl;
49 return;
50 }
51 Int_t tyLay;
52 char LyLabl[20];
53 float xMin;
54 float xMax;
55 float rPos;
56 float thLay;
57 float rlLay;
58 Int_t nmLay;
59 float stLayU;
60 float stLayL;
61 float sgLayU;
62 float sgLayL;
63 Int_t flLay;
64
65 fNlay = 0;
66 while (fgets(strng, nbytes, fdata) != NULL)
67 {
68 cout << strng;
69 int status = sscanf(strng, "%d %s %g %g %g %g %g %d %g %g %g %g %d",
70 &tyLay, LyLabl, &xMin, &xMax, &rPos, &thLay,
71 &rlLay, &nmLay, &stLayU, &stLayL, &sgLayU, &sgLayL, &flLay);
72 ftyLay[fNlay] = tyLay;
73 fLyLabl[fNlay] = LyLabl;
74 fxMin[fNlay] = xMin;
75 fxMax[fNlay] = xMax;
76 frPos[fNlay] = rPos;
77 fthLay[fNlay] = thLay;
78 frlLay[fNlay] = rlLay;
79 fnmLay[fNlay] = nmLay;
80 fstLayU[fNlay] = stLayU;
81 fstLayL[fNlay] = stLayL;
82 fsgLayU[fNlay] = sgLayU;
83 fsgLayL[fNlay] = sgLayL;
84 fflLay[fNlay] = flLay;
85
86 fNlay++;
87 if (tyLay == 1) fBlay++;
88 if (tyLay == 2) fFlay++;
89 if (flLay == 1) fNm++;
90
91 }
92
93 cout << "SolGeom::GeoRead completed with " << fNlay << " layers input" << endl;
94}
95
96SolGeom::~SolGeom()
97{
98 delete[] ftyLay;
99 delete[] fxMin;
100 delete[] fxMax;
101 delete[] frPos;
102 delete[] fthLay;
103 delete[] frlLay;
104 delete[] fnmLay;
105 delete[] fstLayU;
106 delete[] fstLayL;
107 delete[] fsgLayU;
108 delete[] fsgLayL;
109 delete[] fflLay;
110}
Note: See TracBrowser for help on using the repository browser.