6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/Bootstrap.h"
9#include "BesMucEfficiency.hh"
30 {G4Exception(
"BesMucEfficiency constructed twice.");}
41{ G4int part,seg,gap,strip,pad;
60 std::ifstream fin(filename);
65 fin.getline(buffer,100,
'\n');
66 std::istringstream stringBuf(buffer);
69 fin.getline(buffer,100,
'\n');
72 G4cout<<
"error opening effi data"<<G4endl;
81 while(fin.getline(buffer,100,
'\n')){
82 std::istringstream stringBuf2(buffer);
83 stringBuf2>>part>>seg>>gap>>strip>>pad>>effi;
84 m_effi[part][seg][gap][strip][pad] = effi;
87 for(G4int seg=0;seg<8;seg++){
88 for(G4int strip=0;strip<
strip_Max;strip++){
89 m_effi[1][seg][0][strip][105]=0;
99 ISvcLocator* svcLocator = Gaudi::svcLocator();
101 StatusCode sc = svcLocator->service(
"MucCalibConstSvc", m_ptrCalibSvc,
true);
103 if( sc != StatusCode::SUCCESS){
104 G4cout<<
"Can not use MucCalibConstSvc!" << G4endl;
112 G4int part = m_pHit->
GetPart();
113 G4int gap = m_pHit->
GetGap();
115 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) {
131 G4double pad1 = (m_Pos_Hit+m_Length/2-m_Pos_Strip)/m_Width;
132 G4int pad =G4int(pad1);
134 if(
abs(m_Pos_Hit-m_Pos_Strip)<m_Length/2)
144 G4int part = m_pHit->
GetPart();
145 G4int seg = m_pHit->
GetSeg();
146 G4int gap = m_pHit->
GetGap();
147 G4int strip = m_Strip;
151 if( 0 != m_ptrCalibSvc ){
152 eff = m_ptrCalibSvc->
getEff(part, seg, gap, strip);
167 m_Pos_Strip = 1.0e38;
169 G4int part = m_pHit->
GetPart();
170 G4int gap = m_pHit->
GetGap();
172 m_Pos_Strip = pvStrip->GetObjectTranslation().y();
173 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) {
174 m_Pos_Strip = pvStrip->GetObjectTranslation().x();
177 G4String striptype= pvStrip->GetLogicalVolume()->GetSolid()->GetEntityType();
180 temp = (G4Box *)pvStrip->GetLogicalVolume()->GetSolid();
181 m_Width = temp->GetXHalfLength()*2;
182 m_Length = temp->GetYHalfLength()*2;
183 if ( (part == 1 && gap%2 != 0) || (part != 1 && gap%2 == 0) ) {
184 m_Width =temp->GetYHalfLength()*2;
185 m_Length=temp->GetXHalfLength()*2;
G4int GetNearestStripNo()
G4VPhysicalVolume * GetNearestStrip()
void SetHit(BesMucHit *hit)
void SetHit(BesMucHit *hit)
void Initialize(G4String filename)
static BesMucEfficiency * Instance(void)
void GetPosLengthWidth(G4VPhysicalVolume *pvStrip)
G4ThreeVector GetPosLocal()
virtual double getEff(int part, int segment, int layer, int strip) const =0