12#include "BesTofGeoParameter.hh"
17#include "ReadBoostRoot.hh"
33 m_dataPath = getenv(
"TOFSIMROOT");
35 G4Exception(
"BOOST environment not set!");
47void BesTofGeoParameter::ReadBrData()
50 const G4String pmtDataPath = m_dataPath +
"/dat/TofBr.txt";
52 std::ifstream fin(pmtDataPath);
54 std::cerr <<
"cannot open " << pmtDataPath <<
" for initialization.";
61 string::size_type pre_position = 0;
62 string::size_type post_position = 0;
63 vector<string> stringVector;
64 while (getline(fin, tempString,
'\n')){
67 pre_position = tempString.find_first_of(
"#");
68 if (pre_position != string::npos){
69 tempString.erase(tempString.begin() + pre_position, tempString.end());
76 while (tempString.find_first_of(
" ", pre_position) != string::npos){
77 pre_position = tempString.find_first_of(
" ", pre_position);
78 post_position = tempString.find_first_not_of(
" ", pre_position);
79 size = post_position - pre_position;
80 tempString.replace(pre_position, size,
" ");
81 pre_position = post_position - size + 1;
85 if (tempString.size() > 10){
86 stringVector.push_back(tempString);
97 vector<string>::iterator it = stringVector.begin();
98 for (it; it != stringVector.end(); it++){
100 std::istrstream buff((*it).c_str(), strlen((*it).c_str()));
101 buff >> scinNb >> tempEPMTgain >> tempERiseTime >> tempWPMTgain >> tempWRiseTime >> tempAtten;
103 m_BrEPMTgain[scinNb] = tempEPMTgain;
104 m_BrERiseTime[scinNb] = tempERiseTime;
105 m_BrWPMTgain[scinNb] = tempWPMTgain;
106 m_BrWRiseTime[scinNb] = tempWRiseTime;
107 m_atten[scinNb] = tempAtten;
115void BesTofGeoParameter::ReadData()
118 const G4String GeometryPath = m_dataPath +
"/dat/BesTof.txt";
121 fin.open(GeometryPath);
123 const int maxCharOfOneLine=255;
124 char temp[maxCharOfOneLine],*p;
125 int lineNo=0,inputNo=0;
126 while (fin.peek()!=EOF)
128 fin.getline(temp,maxCharOfOneLine);
141 while (*p==
' '||*p==
'\t')p++;
142 if (*p==
'\0')
continue;
147 std::istrstream(p)>>nScinBr>>br1L>>br1TrapW1>>br1TrapW2>>br1TrapH>>br1R1>>AlThickness>>PVFThickness;
150 std::istrstream(p)>>br2L>>br2TrapW1>>br2TrapW2>>br2TrapH>>br2R1;
153 std::istrstream(p)>>bucketDBr>>bucketLBr;
156 std::istrstream(p)>>nScinEc>>ecL>>ecTrapW1>>ecTrapW2>>ecTrapH>>ecTrapH1
157 >>zPosEastEc>>zPosWestEc>>ecR1>>ecR2;
160 std::istrstream(p)>>bucketDEc>>bucketLEc>>bucketPosR;
163 std::istrstream(p)>>m_tau1>>m_tau2>>m_tau3>>m_tauRatio>>m_refIndex>>m_phNConst>>m_Cpe2pmt>>m_rAngle>>m_QE>>m_CE>>m_peCorFac;
165 std::istrstream(p)>>m_ttsMean>>m_ttsSigma>>m_PMTgain>>m_Ce>>m_riseTime>>m_LLthresh>>m_HLthresh>>m_preGain>>m_noiseSigma;
167 std::istrstream(p)>>m_tau1Ec>>m_tau2Ec>>m_tau3Ec>>m_tauRatioEc>>m_refIndexEc>>m_phNConstEc>>m_Cpe2pmtEc>>m_rAngleEc>>m_QEEc>>m_CEEc>>m_peCorFacEc>>m_attenEc;
169 std::istrstream(p)>>m_ttsMeanEc>>m_ttsSigmaEc>>m_PMTgainEc>>m_CeEc>>m_riseTimeEc>>m_LLthreshEc>>m_HLthreshEc>>m_preGainEc>>m_noiseSigmaEc;
static BesTofGeoParameter * GetInstance()