/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrkExtAlg/TrkExtAlg-00-00-64/src/ExtBesEmcParameter.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //      BOOST --- BESIII Object_Oriented Simulation Tool                     //
00003 //---------------------------------------------------------------------------//
00005 //Author: He Miao
00006 //Created: Nov,12 2004
00007 //Modified:
00008 //Comment:
00009 //---------------------------------------------------------------------------//
00010 //$ID: ExtBesEmcParameter.cxx
00011 
00012 #include "TrkExtAlg/ExtBesEmcParameter.h"
00013 #include <fstream>
00014 #include <strstream>
00015 #include "ReadBoostRoot.hh"
00016 #include <assert.h>
00017 
00018 using namespace std;
00019 
00020 //Initialize static data member
00021 ExtBesEmcParameter* ExtBesEmcParameter::fpInstance=0;
00022 
00023 ExtBesEmcParameter::ExtBesEmcParameter()
00024 {}
00025 
00026 
00027 ExtBesEmcParameter::~ExtBesEmcParameter()
00028 {}
00029 
00030 // static method
00031 //Access to an instance
00032 ExtBesEmcParameter& ExtBesEmcParameter::GetInstance()
00033 {
00034   if(!Exist()) {
00035     fpInstance=new ExtBesEmcParameter;
00036     fpInstance->ReadData();
00037   }
00038   return *fpInstance;
00039 }
00040 
00041 bool ExtBesEmcParameter::Exist()
00042 {
00043   return fpInstance!=0;
00044 }
00045 
00046 void ExtBesEmcParameter::Kill()
00047 {
00048   if(Exist()) {
00049     delete fpInstance;
00050     fpInstance=0;
00051   }
00052 }
00053 
00054 void ExtBesEmcParameter::ReadData()
00055 {
00056   //G4String ParaPath = ReadBoostRoot::GetBoostRoot();
00057   G4String ParaPath = getenv("SIMUTILROOT");
00058 
00059   if(!ParaPath){
00060     G4Exception("BOOST environment not set!");
00061   }
00062   ParaPath += "/dat/BesEmc.txt";
00063   G4cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<G4endl;
00064   G4cout<<ParaPath<<G4endl;
00065   ifstream fin;
00066   fin.open(ParaPath);
00067   assert(fin);
00068   
00069   const int maxCharOfOneLine=255;
00070   char temp[maxCharOfOneLine],*p;
00071   int lineNo=0,inputNo=0;
00072   
00073   while(fin.peek()!=EOF)
00074   {
00075     fin.getline(temp,maxCharOfOneLine);
00076     p=temp;
00077     lineNo++;
00078     while(*p!='\0')
00079     {
00080       if(*p=='#')
00081       {
00082         *p='\0';  //delete the comments.
00083         break;
00084       }
00085       p++;
00086     }
00087     p=temp; //reset the pointer to the beginning of the string.
00088     while(*p==' '||*p=='\t')p++;
00089     if(*p=='\0')continue;
00090     inputNo++;
00091     switch(inputNo)
00092     {
00093       case 1:
00094         istrstream(p)>>array_size>>m_tau>>m_highRange>>m_midRange>>m_lowRange>>m_sampleTime>>m_bitNb>>m_photonsPerMeV>>m_nonuniformity>>m_peakTime>>m_timeOffset;
00095         break;
00096       case 2:
00097         istrstream(p)>>WorldRmin1>>WorldRmax1>>WorldRmin2>>WorldRmax2>>WorldDz>>WorldZPosition>>CrystalLength;
00098         break;
00099       case 3:
00100         istrstream(p)>>cryNumInOneLayer[0]>>cryNumInOneLayer[1]>>cryNumInOneLayer[2]>>cryNumInOneLayer[3]>>cryNumInOneLayer[4]>>cryNumInOneLayer[5];
00101         break;
00102       case 4:
00103         istrstream(p)>>pentaInOneSector[0]>>pentaInOneSector[1]>>pentaInOneSector[2]>>pentaInOneSector[3]>>pentaInOneSector[4];
00104         break;
00105       case 5:
00106         istrstream(p)>>fTyvekThickness>>fAlThickness>>fMylarThickness;
00107         break;
00108       case 6:
00109         istrstream(p)>>BSCRmin>>BSCDz>>BSCRmin1>>BSCRmax1>>BSCRmin2>>BSCRmax2>>BSCDz1;
00110         break;
00111       case 7:
00112         istrstream(p)>>BSCAngleRotat>>BSCNbPhi>>BSCNbTheta;
00113         break;
00114       case 8:
00115         istrstream(p)>>BSCYFront0>>BSCYFront>>BSCYFront1>>BSCPosition0>>BSCPosition1;
00116         break;
00117       case 9:
00118         istrstream(p)>>TaperRingDz>>TaperRingThickness1>>TaperRingThickness2>>TaperRingThickness3
00119           >>TaperRingTheta>>TaperRingInnerLength>>TaperRingOuterLength;
00120       case 10:
00121         istrstream(p)>>rearBoxLength>>rearBoxDz>>HangingPlateDz>>OCGirderAngle>>rearCasingThickness;
00122       case 11:
00123         istrstream(p)>>orgGlassLengthX>>orgGlassLengthY>>orgGlassLengthZ
00124           >>PDLengthX>>PDLengthY>>PDLengthZ>>AlPlateDz>>PABoxDz>>PABoxThickness;
00125       case 12:
00126         istrstream(p)>>cableDr>>waterPipeDr>>waterPipeThickness
00127           >>SPBarThickness>>SPBarThickness1>>SPBarwidth>>EndRingDz>>EndRingDr>>EndRingRmin;
00128       default:
00129         ;
00130     }
00131   }
00132 }

Generated on Tue Nov 29 23:14:12 2016 for BOSS_7.0.2 by  doxygen 1.4.7