#include <BesMdcGeoParameter.hh>
|
00072 { 00073 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00074 IG4Svc* tmpSvc; 00075 G4Svc* m_G4Svc; 00076 StatusCode sc=svcLocator->service("G4Svc", tmpSvc); 00077 m_G4Svc=dynamic_cast<G4Svc *>(tmpSvc); 00078 if (!sc.isSuccess()) 00079 std::cout<<"BesMdcGeoParameter::Could not open G4 Service"<<std::endl; 00080 if(m_G4Svc->GetMdcDataInput()== 0){ 00081 cout<<"------- get BesMdcGeoParameter from file --------"<<endl; 00082 InitFromFile(); 00083 } 00084 if(m_G4Svc->GetMdcDataInput()== 1) { 00085 cout<<"=======get BesMdcGeoParameter from MdcGeomSvc======="<<endl; 00086 InitFromSvc(); 00087 } 00088 00089 //Dump(); 00090 if(fPointer) 00091 { G4Exception("BesMdcGeoParameter constructed twice."); } 00092 fPointer=this; 00093 }
|
|
00116 {};
|
|
|
|
00116 {};
|
|
|
|
00297 { 00298 //cout<<"------BesMdcGeoParameter info :--------"<<endl; 00299 cout<<" fLayerNo: "<<fLayerNo<<endl; 00300 cout<<" fWireNo: "<<fWireNo<<endl; 00301 cout<<" fSignalLayerNo: "<<fSignalLayerNo<<endl; 00302 cout<<" fSignalWireR: "<<fSignalWireR<<endl; 00303 cout<<" fFieldWireR: "<<fFieldWireR<<endl; 00304 00305 cout<<"fSingalLayer:"<<endl; 00306 for(int i=0; i<fSignalLayerNo; i++){ 00307 cout<<fSignalLayer[i]+1<<' '; } 00308 cout<<endl; 00309 00310 for(int i=0;i<fLayerNo;i++){ 00311 cout<<"Layer["<<i<<"]: " 00312 <<" name:"<<fLayer[i].Name() <<" wireNo:"<<fLayer[i].WireNo() 00313 <<" length: "<<fLayer[i].Length() <<" r: "<<fLayer[i].R(); 00314 if (i<75) cout<<" phi:"<<fLayer[i].Phi()*180/pi; 00315 else cout<<" phi:"<<(fLayer[i].Phi()-fLayer[i].ShiftPhi())*180/pi; 00316 cout<<" firstWire: "<<fLayer[i].FirstWire() 00317 <<" rotateCell: "<<fLayer[i].RotateCell()<<endl; 00318 } 00319 00320 cout<<"fSegmentNo:"<<fSegmentNo<<endl; 00321 for(int j=0;j<fSegmentNo;j++){ 00322 cout<<"length:"<<fMdcSegment[j].Length() 00323 <<" innerR:"<<fMdcSegment[j].InnerR() 00324 <<" outR:"<<fMdcSegment[j].OutR() 00325 <<" z:"<<fMdcSegment[j].Z() 00326 <<" name:"<<fMdcSegment[j].Name()<<endl; 00327 } 00328 00329 }
|
|
00124 {return fFieldWireR;}
|
|
00124 {return fFieldWireR;}
|
|
|
|
00034 { 00035 if (! fPointer) fPointer = new BesMdcGeoParameter(); 00036 return fPointer; 00037 }
|
|
|
|
00142 { 00143 int wireNo, firstWire; 00144 double length, phi, r, rotateCell,rotateAngle; 00145 double innerR, outR, z; 00146 string name, line; 00147 00148 G4String geoPath = ReadBoostRoot::GetBoostRoot(); 00149 if(!geoPath){ 00150 G4Exception("BOOST environment not set!"); 00151 } 00152 geoPath += "/dat/Mdc.txt"; 00153 00154 ifstream inFile(geoPath); 00155 if(!inFile.good()){ 00156 cout<<"Error, mdc parameters file not exist"<<endl; 00157 return; 00158 } 00159 00160 getline(inFile, line); 00161 inFile>>fLayerNo>>fWireNo>>fSignalLayerNo>>fSignalWireR>>fFieldWireR; 00162 00163 inFile.seekg(1,ios::cur); 00164 getline(inFile, line); 00165 int i,signalLayer; 00166 for(i=0; i<fSignalLayerNo; i++){ 00167 inFile>>signalLayer; 00168 fSignalLayer[i]=signalLayer-1; 00169 } 00170 00171 inFile.seekg(1,ios::cur); 00172 getline(inFile, line); 00173 getline(inFile, line); 00174 for( i=0; i<fLayerNo; i++){ 00175 inFile>>name>>wireNo>>length>>r>>phi>>firstWire>>rotateCell; 00176 getline(inFile, line); 00177 00178 rotateAngle=2*pi*rotateCell/wireNo; 00179 00180 fLayer[i].SetName(name);fLayer[i].SetRadius(r); 00181 fLayer[i].SetLength(length); fLayer[i].SetRotateCell(rotateCell); 00182 fLayer[i].SetRotateAngle(rotateAngle); fLayer[i].SetWireNo(wireNo); 00183 fLayer[i].SetShiftPhi(twopi/wireNo); fLayer[i].SetFirstWire(firstWire); 00184 00185 phi*=(pi/180); 00186 if(phi<0)phi += fLayer[i].ShiftPhi(); 00187 fLayer[i].SetPhi(phi); 00188 00189 if(i==0){ 00190 fLayer[i].SetSumWireNo(wireNo); fLayer[i].SetBeginWireNo(0); 00191 }else{ 00192 fLayer[i].SetBeginWireNo(fLayer[i-1].SumWireNo()); 00193 fLayer[i].SetSumWireNo(fLayer[i-1].SumWireNo()+wireNo); 00194 } 00195 00196 for(int j=0; j<wireNo; j++){ 00197 fWirePhi[fLayer[i].BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi; 00198 } 00199 } 00200 00201 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){ 00202 cout<<"Total wire number is not consistant!"<<endl; 00203 } 00204 00205 getline(inFile, line); 00206 inFile>>fSegmentNo; 00207 inFile.seekg(1,ios::cur); 00208 getline(inFile, line); 00209 getline(inFile, line); 00210 00211 for(i=0; i<fSegmentNo; i++){ 00212 inFile>>length>>innerR>>outR>>z>>name; 00213 getline(inFile,line); 00214 00215 fMdcSegment[i].SetLength(length); fMdcSegment[i].SetInnerR(innerR); 00216 fMdcSegment[i].SetOutR(outR); fMdcSegment[i].SetZ(z); 00217 fMdcSegment[i].SetName(name); 00218 } 00219 00220 }
|
|
|
|
00223 { 00224 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00225 IMdcGeomSvc* ISvc; 00226 MdcGeomSvc* mdcGeomSvc; 00227 StatusCode sc=svcLocator->service("MdcGeomSvc", ISvc); 00228 mdcGeomSvc=dynamic_cast<MdcGeomSvc *>(ISvc); 00229 if (!sc.isSuccess()) 00230 std::cout<<"BesMdcGeoParameter::Could not open Geometry Service"<<std::endl; 00231 00232 fLayerNo= mdcGeomSvc->Misc()->LayerNo(); 00233 fWireNo=mdcGeomSvc->Misc()->WireNo(); 00234 fSignalLayerNo=mdcGeomSvc->Misc()->SLayerNo(); 00235 fSignalWireR=mdcGeomSvc->Misc()->SWireR(); 00236 fFieldWireR=mdcGeomSvc->Misc()->FWireR(); 00237 00238 int i,signalLayer; 00239 for(i=0; i<fSignalLayerNo; i++){ 00240 signalLayer=mdcGeomSvc->Layer(i)->SLayer(); 00241 fSignalLayer[i]=signalLayer-1; 00242 } 00243 00244 string name; 00245 int wireNo,firstWire; 00246 double length, r, phi,rotateCell,rotateAngle; 00247 for(i=0;i<fLayerNo;i++){ 00248 name=mdcGeomSvc->GeneralLayer(i)->LayerName(); 00249 wireNo=mdcGeomSvc->GeneralLayer(i)->NCell()*2; 00250 length= mdcGeomSvc->GeneralLayer(i)->Length(); 00251 r= mdcGeomSvc->GeneralLayer(i)->Radius(); 00252 phi=mdcGeomSvc->GeneralLayer(i)->nomPhi(); 00253 firstWire=mdcGeomSvc->GeneralLayer(i)->First(); 00254 rotateCell= mdcGeomSvc->GeneralLayer(i)->nomShift(); 00255 00256 rotateAngle=2*pi*rotateCell/wireNo; 00257 00258 fLayer[i].SetName(name);fLayer[i].SetRadius(r); 00259 fLayer[i].SetLength(length); fLayer[i].SetRotateCell(rotateCell); 00260 fLayer[i].SetRotateAngle(rotateAngle); fLayer[i].SetWireNo(wireNo); 00261 fLayer[i].SetShiftPhi(twopi/wireNo); fLayer[i].SetFirstWire(firstWire); 00262 fLayer[i].SetPhi(phi); 00263 00264 if(i==0){ 00265 fLayer[i].SetSumWireNo(wireNo); fLayer[i].SetBeginWireNo(0); 00266 }else{ 00267 fLayer[i].SetBeginWireNo(fLayer[i-1].SumWireNo()); 00268 fLayer[i].SetSumWireNo(fLayer[i-1].SumWireNo()+wireNo); 00269 } 00270 00271 for(int j=0; j<wireNo; j++){ 00272 fWirePhi[fLayer[i].BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi; 00273 } 00274 } 00275 00276 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){ 00277 cout<<"Total wire number is not consistant!"<<endl; 00278 } 00279 00280 00281 double innerR,outR,z; 00282 fSegmentNo=mdcGeomSvc->getSegmentNo(); 00283 for(i=0;i<fSegmentNo;i++){ 00284 length=mdcGeomSvc->End(i)->Length(); 00285 innerR=mdcGeomSvc->End(i)->InnerR(); 00286 outR=mdcGeomSvc->End(i)->OutR(); 00287 z=mdcGeomSvc->End(i)->Z(); 00288 name=mdcGeomSvc->End(i)->Name(); 00289 00290 fMdcSegment[i].SetLength(length); fMdcSegment[i].SetInnerR(innerR); 00291 fMdcSegment[i].SetOutR(outR); fMdcSegment[i].SetZ(z); 00292 fMdcSegment[i].SetName(name); 00293 } 00294 00295 }
|
|
|
|
00127 { 00128 if(layerNumber<0 || layerNumber>89){ 00129 cout<<"Error: Wrong layerNo: "<<layerNumber<<endl; 00130 } 00131 return fLayer[layerNumber]; 00132 }
|
|
00130 {return fLayerNo;}
|
|
00130 {return fLayerNo;}
|
|
00136 {return fMdcSegment[x];}
|
|
00136 {return fMdcSegment[x];}
|
|
00135 {return fSegmentNo;}
|
|
00135 {return fSegmentNo;}
|
|
00125 {return fSignalLayer[x];}
|
|
00125 {return fSignalLayer[x];}
|
|
|
|
00134 { 00135 if(layerNumber<0 || layerNumber>42){ 00136 cout<<"Error: Wrong SignallayerNo: "<<layerNumber<<endl; 00137 } 00138 return fLayer[fSignalLayer[layerNumber]]; 00139 }
|
|
00131 {return fSignalLayerNo;}
|
|
00131 {return fSignalLayerNo;}
|
|
|
|
00113 { 00114 00115 int i=fSignalLayer[signalLayerNo]; 00116 int wireNoInLayer=2*wireNo+1-fLayer[i].FirstWire();//FirstWire():0,field;1,signal 00117 double phi=fLayer[i].Phi(); 00118 double shiftPhi=fLayer[i].ShiftPhi(); 00119 double wirePhi; 00120 wirePhi= wireNoInLayer*shiftPhi+phi; 00121 00122 BesMdcWire temp(fLayer[i].Length(), fWirePhi[fLayer[i].BeginWireNo()+wireNoInLayer], fLayer[i].R(),fLayer[i].RotateAngle()); 00123 return temp; 00124 }
|
|
00123 {return fSignalWireR;}
|
|
00123 {return fSignalWireR;}
|
|
|
|
00096 { 00097 00098 int i; 00099 for(i=0; i<fLayerNo; i++){ 00100 if(fLayer[i].BeginWireNo()<=wireNo && wireNo<fLayer[i].SumWireNo()){ 00101 00102 break; 00103 } 00104 } 00105 00106 BesMdcWire temp(fLayer[i].Length(), fWirePhi[wireNo], fLayer[i].R(), fLayer[i].RotateAngle()); 00107 return temp; 00108 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|