BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesSCMParameter.cc
Go to the documentation of this file.
1// BOOST --- BESIII Object_Oriented Simulation Tool //
2// Description:
3// Author: Caogf
4// Created: June, 2007
5// Modified:
6// Comment:
7//---------------------------------------------------------------------//
8//$ID: BesSCMParameter.cc
9
10#include "BesSCMParameter.hh"
11#include "SimUtil/ReadBoostRoot.hh"
12#include <fstream>
13#include <strstream>
14using namespace std;
15
19 G4String GeometryPath = getenv( "BESSIMROOT" );
20 if ( !GeometryPath )
21 {
22 G4cout << "BOOST environment not set!" << G4endl;
23 exit( -1 );
24 }
25 GeometryPath += "/dat/BesSCM.txt";
26
27 ifstream fin;
28 fin.open( GeometryPath );
29
30 const int maxCharOfOneLine = 255;
31 char temp[maxCharOfOneLine], *p;
32 int lineNo = 0, inputNo = 0;
33 while ( fin.peek() != EOF )
34 {
35 fin.getline( temp, maxCharOfOneLine );
36 p = temp;
37 lineNo++;
38 while ( *p != '\0' )
39 {
40 if ( *p == '#' )
41 {
42 *p = '\0'; // delete the comments.
43 break;
44 }
45 p++;
46 }
47 p = temp; // reset the pointer to the beginning of the string.
48 while ( *p == ' ' || *p == '\t' ) p++;
49 if ( *p == '\0' ) continue;
50 inputNo++;
51 switch ( inputNo )
52 {
53 case 1: istrstream( p ) >> innerCryo[0] >> innerCryo[1] >> innerCryo[2]; break;
54 case 2: istrstream( p ) >> l1Adia[0] >> l1Adia[1] >> l1Adia[2]; break;
55 case 3: istrstream( p ) >> innerShield[0] >> innerShield[1] >> innerShield[2]; break;
56 case 4: istrstream( p ) >> l2Adia[0] >> l2Adia[1] >> l2Adia[2]; break;
57 case 5: istrstream( p ) >> outerShield[0] >> outerShield[1] >> outerShield[2]; break;
58 case 6: istrstream( p ) >> l3Adia[0] >> l3Adia[1] >> l3Adia[2]; break;
59 case 7:
60 istrstream( p ) >> endShield[0] >> endShield[1] >> endShield[2] >> endShield[3] >>
61 endShield[4];
62 break;
63 case 8: istrstream( p ) >> l1insu[0] >> l1insu[1] >> l1insu[2]; break;
64 case 9: istrstream( p ) >> coil[0] >> coil[1] >> coil[2]; break;
65 case 10: istrstream( p ) >> l2insu[0] >> l2insu[1] >> l2insu[2]; break;
66 case 11: istrstream( p ) >> supp[0] >> supp[1] >> supp[2]; break;
67 case 12: istrstream( p ) >> l4Adia[0] >> l4Adia[1] >> l4Adia[2]; break;
68 case 13:
69 istrstream( p ) >> endCoil[0] >> endCoil[1] >> endCoil[2] >> endCoil[3] >> endCoil[4];
70 break;
71 case 14: istrstream( p ) >> outerCryo[0] >> outerCryo[1] >> outerCryo[2]; break;
72 case 15:
73 istrstream( p ) >> endCryo[0] >> endCryo[1] >> endCryo[2] >> endCryo[3] >> endCryo[4];
74 break;
75 case 16: istrstream( p ) >> rein[0] >> rein[1] >> rein[2] >> rein[3] >> rein[4]; break;
76 case 17:
77 istrstream( p ) >> pipe1[0] >> pipe1[1] >> pipe1[2] >> pipe1[3] >> pipe1[4] >> pipe1[5];
78 break;
79 case 18:
80 istrstream( p ) >> pipe2[0] >> pipe2[1] >> pipe2[2] >> pipe2[3] >> pipe2[4] >> pipe2[5];
81 break;
82 case 19:
83 istrstream( p ) >> pipe3[0] >> pipe3[1] >> pipe3[2] >> pipe3[3] >> pipe3[4] >> pipe3[5];
84 break;
85 case 20:
86 istrstream( p ) >> hole[0] >> hole[1] >> hole[2] >> hole[3] >> hole[4] >> hole[5] >>
87 hole[6] >> hole[7] >> hole[8] >> hole[9] >> hole[10] >> hole[11] >> hole[12];
88 }
89 }
90}