- Timestamp:
- Feb 25, 2020, 8:57:59 PM (5 years ago)
- Branches:
- ImprovedOutputFile, master
- Children:
- 3e5f05c
- Parents:
- 7d790c1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/TrackCovariance/SolGeom.cc
r7d790c1 r31f3bca 1 1 #include <iostream> 2 #include <sstream> 2 3 3 4 #include <TString.h> … … 41 42 void SolGeom::Read(const char *data) 42 43 { 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 44 Int_t tyLay; 52 char LyLabl[20];53 float xMin;54 float xMax;55 float rPos;56 float thLay;57 float rlLay;45 string LyLabl; 46 Double_t xMin; 47 Double_t xMax; 48 Double_t rPos; 49 Double_t thLay; 50 Double_t rlLay; 58 51 Int_t nmLay; 59 float stLayU;60 float stLayL;61 float sgLayU;62 float sgLayL;52 Double_t stLayU; 53 Double_t stLayL; 54 Double_t sgLayU; 55 Double_t sgLayL; 63 56 Int_t flLay; 64 57 58 stringstream data_stream(data); 59 string line; 60 65 61 fNlay = 0; 66 while (fgets(strng, nbytes, fdata) != NULL)62 while(getline(data_stream, line)) 67 63 { 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); 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 72 70 ftyLay[fNlay] = tyLay; 73 71 fLyLabl[fNlay] = LyLabl; … … 88 86 if (tyLay == 2) fFlay++; 89 87 if (flLay == 1) fNm++; 90 91 88 } 92 93 cout << "SolGeom::GeoRead completed with " << fNlay << " layers input" << endl;94 89 } 95 90
Note:
See TracChangeset
for help on using the changeset viewer.