BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
ExtBesEmcParameter.cxx
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4///Description:
5//Author: He Miao
6//Created: Nov,12 2004
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10//$ID: ExtBesEmcParameter.cxx
11
12#include "TrkExtAlg/ExtBesEmcParameter.h"
13#include <fstream>
14#include <strstream>
15#include "ReadBoostRoot.hh"
16#include <assert.h>
17
18using namespace std;
19
20//Initialize static data member
21ExtBesEmcParameter* ExtBesEmcParameter::fpInstance=0;
22
24{}
25
26
28{}
29
30// static method
31//Access to an instance
33{
34 if(!Exist()) {
35 fpInstance=new ExtBesEmcParameter;
36 fpInstance->ReadData();
37 }
38 return *fpInstance;
39}
40
42{
43 return fpInstance!=0;
44}
45
47{
48 if(Exist()) {
49 delete fpInstance;
50 fpInstance=0;
51 }
52}
53
55{
56 //G4String ParaPath = ReadBoostRoot::GetBoostRoot();
57 G4String ParaPath = getenv("SIMUTILROOT");
58
59 if(!ParaPath){
60 G4Exception("BOOST environment not set!");
61 }
62 ParaPath += "/dat/BesEmc.txt";
63 G4cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<G4endl;
64 G4cout<<ParaPath<<G4endl;
65 ifstream fin;
66 fin.open(ParaPath);
67 assert(fin);
68
69 const int maxCharOfOneLine=255;
70 char temp[maxCharOfOneLine],*p;
71 int lineNo=0,inputNo=0;
72
73 while(fin.peek()!=EOF)
74 {
75 fin.getline(temp,maxCharOfOneLine);
76 p=temp;
77 lineNo++;
78 while(*p!='\0')
79 {
80 if(*p=='#')
81 {
82 *p='\0'; //delete the comments.
83 break;
84 }
85 p++;
86 }
87 p=temp; //reset the pointer to the beginning of the string.
88 while(*p==' '||*p=='\t')p++;
89 if(*p=='\0')continue;
90 inputNo++;
91 switch(inputNo)
92 {
93 case 1:
94 istrstream(p)>>array_size>>m_tau>>m_highRange>>m_midRange>>m_lowRange>>m_sampleTime>>m_bitNb>>m_photonsPerMeV>>m_nonuniformity>>m_peakTime>>m_timeOffset;
95 break;
96 case 2:
97 istrstream(p)>>WorldRmin1>>WorldRmax1>>WorldRmin2>>WorldRmax2>>WorldDz>>WorldZPosition>>CrystalLength;
98 break;
99 case 3:
100 istrstream(p)>>cryNumInOneLayer[0]>>cryNumInOneLayer[1]>>cryNumInOneLayer[2]>>cryNumInOneLayer[3]>>cryNumInOneLayer[4]>>cryNumInOneLayer[5];
101 break;
102 case 4:
103 istrstream(p)>>pentaInOneSector[0]>>pentaInOneSector[1]>>pentaInOneSector[2]>>pentaInOneSector[3]>>pentaInOneSector[4];
104 break;
105 case 5:
106 istrstream(p)>>fTyvekThickness>>fAlThickness>>fMylarThickness;
107 break;
108 case 6:
109 istrstream(p)>>BSCRmin>>BSCDz>>BSCRmin1>>BSCRmax1>>BSCRmin2>>BSCRmax2>>BSCDz1;
110 break;
111 case 7:
112 istrstream(p)>>BSCAngleRotat>>BSCNbPhi>>BSCNbTheta;
113 break;
114 case 8:
115 istrstream(p)>>BSCYFront0>>BSCYFront>>BSCYFront1>>BSCPosition0>>BSCPosition1;
116 break;
117 case 9:
118 istrstream(p)>>TaperRingDz>>TaperRingThickness1>>TaperRingThickness2>>TaperRingThickness3
119 >>TaperRingTheta>>TaperRingInnerLength>>TaperRingOuterLength;
120 case 10:
121 istrstream(p)>>rearBoxLength>>rearBoxDz>>HangingPlateDz>>OCGirderAngle>>rearCasingThickness;
122 case 11:
123 istrstream(p)>>orgGlassLengthX>>orgGlassLengthY>>orgGlassLengthZ
124 >>PDLengthX>>PDLengthY>>PDLengthZ>>AlPlateDz>>PABoxDz>>PABoxThickness;
125 case 12:
126 istrstream(p)>>cableDr>>waterPipeDr>>waterPipeThickness
127 >>SPBarThickness>>SPBarThickness1>>SPBarwidth>>EndRingDz>>EndRingDr>>EndRingRmin;
128 default:
129 ;
130 }
131 }
132}
static ExtBesEmcParameter & GetInstance()