#include <BesMucEfficiency.hh>
Public Member Functions | |
BesMucEfficiency () | |
BesMucEfficiency () | |
void | CheckCalibSvc () |
void | CheckCalibSvc () |
G4double | GetEfficiency () |
G4double | GetEfficiency () |
G4int | GetPad () |
G4int | GetPad () |
void | GetPosLengthWidth (G4VPhysicalVolume *pvStrip) |
void | GetPosLengthWidth (G4VPhysicalVolume *pvStrip) |
void | Initialize (G4String filename) |
void | Initialize (G4String filename) |
void | SetHit (BesMucHit *hit) |
void | SetHit (BesMucHit *hit) |
~BesMucEfficiency () | |
~BesMucEfficiency () | |
Static Public Member Functions | |
BesMucEfficiency * | Instance (void) |
BesMucEfficiency * | Instance (void) |
Public Attributes | |
IMessageSvc * | msgSvc |
IMessageSvc * | msgSvc |
Private Attributes | |
G4double | IsAddEffi |
G4double | m_effi [part_Max][seg_Max][gap_Max][strip_Max][pad_Max] |
G4double | m_Length |
BesMucHit * | m_pHit |
BesMucHit * | m_pHit |
G4double | m_Pos_Hit |
G4double | m_Pos_Strip |
IMucCalibConstSvc * | m_ptrCalibSvc |
IMucCalibConstSvc * | m_ptrCalibSvc |
G4int | m_Strip |
G4double | m_Width |
Static Private Attributes | |
BesMucEfficiency * | fPointer |
BesMucEfficiency * | fPointer = 0 |
|
00028 { 00029 if(fPointer) 00030 {G4Exception("BesMucEfficiency constructed twice.");} 00031 fPointer=this; 00032 00033 }
|
|
00036 { 00037 }
|
|
|
|
|
|
|
|
00097 { 00098 00099 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00100 //IMucCalibConstSvc* m_ptrCalibSvc; 00101 StatusCode sc = svcLocator->service("MucCalibConstSvc", m_ptrCalibSvc, true); 00102 00103 if( sc != StatusCode::SUCCESS){ 00104 G4cout<< "Can not use MucCalibConstSvc!" << G4endl; 00105 } 00106 00107 }
|
|
|
|
00142 { 00143 MsgStream log(msgSvc, "BesMucEfficiency"); 00144 // look up table with (part;seg;gap;m_Strip) 00145 G4int part = m_pHit->GetPart(); 00146 G4int seg = m_pHit->GetSeg(); 00147 G4int gap = m_pHit->GetGap(); 00148 G4int strip = m_Strip; 00149 G4int pad = GetPad(); 00150 00151 G4double eff = 0; 00152 if( 0 != m_ptrCalibSvc ){ 00153 eff = m_ptrCalibSvc->getEff(part, seg, gap, strip); 00154 //G4cout << "Prt: " << part << "\tseg: " << seg << "\tlay: " << gap << "\tstr: " << m_Strip 00155 // << "\t:" << eff << endl; 00156 } 00157 else 00158 { 00159 //G4cout << "CalibSvc unavailable!" << G4endl; 00160 eff = 0.95; 00161 } 00162 00163 //G4cout<<part<<"\t"<<seg<<"\t"<<gap<<"\t"<<m_Strip<<"\t"<<eff<<G4endl; 00164 return eff; 00165 }
|
|
|
|
00130 {//it will be better to put this function into Class BesMucDigit 00131 G4double pad1 = (m_Pos_Hit+m_Length/2-m_Pos_Strip)/m_Width; 00132 G4int pad =G4int(pad1); 00133 //G4cout<<"---in Effi::GetPad()--- hit: "<<m_Pos_Hit<<" part: "<<m_pHit->GetPart()<<" gap: "<<m_pHit->GetGap()<<" L: "<<m_Length<<" strip: "<<m_Pos_Strip<<" width: "<<m_Width<<" pad: "<<pad<<G4endl; 00134 if(abs(m_Pos_Hit-m_Pos_Strip)<m_Length/2) 00135 return pad; 00136 else 00137 return -999; 00138 00139 }
|
|
|
|
00168 { 00169 m_Pos_Strip = 1.0e38; 00170 00171 G4int part = m_pHit->GetPart(); 00172 G4int gap = m_pHit->GetGap(); 00173 00174 m_Pos_Strip = pvStrip->GetObjectTranslation().y(); 00175 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) { 00176 m_Pos_Strip = pvStrip->GetObjectTranslation().x(); 00177 } 00178 00179 G4String striptype= pvStrip->GetLogicalVolume()->GetSolid()->GetEntityType(); 00180 // G4String striplenght= pvStrip->GetLogicalVolume()->GetName(); 00181 G4Box *temp; 00182 temp = (G4Box *)pvStrip->GetLogicalVolume()->GetSolid(); 00183 m_Width = temp->GetXHalfLength()*2; 00184 m_Length = temp->GetYHalfLength()*2; 00185 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) { 00186 m_Width =temp->GetYHalfLength()*2; 00187 m_Length=temp->GetXHalfLength()*2; 00188 } 00189 //G4cout<<"in Set "<<m_Length<<" "<<temp->GetXHalfLength()<<" "<<m_Width<<" "<<m_Pos_Strip<<G4endl; 00190 00191 }
|
|
|
|
00041 { G4int part,seg,gap,strip,pad; 00042 G4double effi; 00043 // for(G4int part=0;part<3;part++){ 00044 // for(G4int seg=0;seg<8;seg++){ 00045 // for(G4int gap=0;gap<gap_Max;gap++){ 00046 // for(G4int strip=0;strip<strip_Max;strip++){ 00047 // for(G4int pad=0;pad<pad_Max;pad++){ 00048 // m_effi[part][seg][gap][strip][pad]=1; 00049 // } 00050 // } 00051 // } 00052 // } 00053 //} 00054 // G4cout<<"in BesMucEfficiency::Initialize()"<<G4endl; 00055 00056 // TFile *f=new TFile("muc-effi.root"); 00057 // TTree *t1=(TTree*)f->Get("t1"); 00058 00059 00060 std::ifstream fin(filename); 00061 00062 char buffer[100]; 00063 G4int num=0; 00064 00065 fin.getline(buffer,100,'\n'); //get info whether add effi or not 00066 std::istringstream stringBuf(buffer); 00067 stringBuf>>IsAddEffi; 00068 //G4cout<<"IsAddEffi ="<<IsAddEffi<<G4endl; 00069 fin.getline(buffer,100,'\n'); 00070 00071 if(!fin){ 00072 G4cout<<"error opening effi data"<<G4endl; 00073 IsAddEffi = 1.0; // no effi data. set effi = 1.0 00074 } 00075 00076 // fin.getline(buffer,100,'\n'); 00077 // std::istringstream stringBuf2(buffer); 00078 // stringBuf2>>part>>seg>>gap>>strip>>pad; 00079 // G4cout<<"---------- "<<pad<<endl; 00080 00081 while(fin.getline(buffer,100,'\n')){ 00082 std::istringstream stringBuf2(buffer); 00083 stringBuf2>>part>>seg>>gap>>strip>>pad>>effi; 00084 m_effi[part][seg][gap][strip][pad] = effi; 00085 num++; 00086 } 00087 for(G4int seg=0;seg<8;seg++){ 00088 for(G4int strip=0;strip<strip_Max;strip++){ 00089 m_effi[1][seg][0][strip][105]=0; 00090 } 00091 } 00092 00093 //G4cout<<"------------in Effi::init()---- "<<num<<G4endl; 00094 }
|
|
|
|
00021 { 00022 if(!fPointer)fPointer = new BesMucEfficiency(); 00023 return fPointer; 00024 00025 }
|
|
|
|
00110 { 00111 m_pHit = hit; 00112 G4int part = m_pHit->GetPart(); 00113 G4int gap = m_pHit->GetGap(); 00114 m_Pos_Hit = m_pHit->GetPosLocal().y(); //different from BesMucdigit 00115 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) { 00116 m_Pos_Hit = m_pHit->GetPosLocal().x(); 00117 } 00118 00119 //set m_Strip, m_Pos_Strip, m_Length, m_Width 00120 BesMucDigit aDigit; 00121 aDigit.SetHit(m_pHit); 00122 m_Strip = aDigit.GetNearestStripNo(); 00123 // G4VPhysicalVolume* pvGasChamber = m_pHit->GetVolume(); 00124 GetPosLengthWidth(aDigit.GetNearestStrip()); 00125 00126 // G4cout<<"m_Pos_Hit = "<<m_Pos_Hit<<G4endl; 00127 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|