17#include <CLHEP/Units/PhysicalConstants.h>
19#include "GaudiKernel/Bootstrap.h"
20#include "GaudiKernel/IService.h"
21#include "GaudiKernel/Service.h"
22#include "GaudiKernel/ISvcLocator.h"
49 fRotateAngle=rotateAngle;
59 double OC = OB*z*2./fLength;
79 ISvcLocator* svcLocator = Gaudi::svcLocator();
82 StatusCode sc=svcLocator->service(
"G4Svc", tmpSvc);
83 m_G4Svc=
dynamic_cast<G4Svc *
>(tmpSvc);
85 std::cout<<
"BesMdcGeoParameter::Could not open G4 Service"<<std::endl;
87 cout<<
"------- get BesMdcGeoParameter from file --------"<<endl;
91 cout<<
"=======get BesMdcGeoParameter from MdcGeomSvc======="<<endl;
97 { G4cout<<
"BesMdcGeoParameter constructed twice."<<G4endl; exit(-1); }
105 for(i=0; i<fLayerNo; i++){
106 if(fLayer[i].BeginWireNo()<=
wireNo &&
wireNo<fLayer[i].SumWireNo()){
112 BesMdcWire temp(fLayer[i].Length(), fWirePhi[
wireNo], fLayer[i].R(), fLayer[i].RotateAngle());
121 int i=fSignalLayer[signalLayerNo];
123 double phi=fLayer[i].
Phi();
124 double shiftPhi=fLayer[i].
ShiftPhi();
126 wirePhi= wireNoInLayer*shiftPhi+phi;
128 BesMdcWire temp(fLayer[i].Length(), fWirePhi[fLayer[i].BeginWireNo()+wireNoInLayer], fLayer[i].R(),fLayer[i].RotateAngle());
134 if(layerNumber<0 || layerNumber>89){
135 cout<<
"Error: Wrong layerNo: "<<layerNumber<<endl;
137 return fLayer[layerNumber];
141 if(layerNumber<0 || layerNumber>42){
142 cout<<
"Error: Wrong SignallayerNo: "<<layerNumber<<endl;
144 return fLayer[fSignalLayer[layerNumber]];
150 double length, phi, r, rotateCell,rotateAngle;
151 double innerR, outR, z;
156 G4cout<<
"BOOST environment not set!"<<G4endl; exit(-1);
158 geoPath +=
"/dat/Mdc.txt";
160 ifstream inFile(geoPath);
162 cout<<
"Error, mdc parameters file not exist"<<endl;
166 getline(inFile, line);
167 inFile>>fLayerNo>>fWireNo>>fSignalLayerNo>>fSignalWireR>>fFieldWireR;
169 inFile.seekg(1,ios::cur);
170 getline(inFile, line);
172 for(i=0; i<fSignalLayerNo; i++){
174 fSignalLayer[i]=signalLayer-1;
177 inFile.seekg(1,ios::cur);
178 getline(inFile, line);
179 getline(inFile, line);
180 for( i=0; i<fLayerNo; i++){
181 inFile>>name>>
wireNo>>length>>r>>phi>>firstWire>>rotateCell;
182 getline(inFile, line);
192 if(phi<0)phi += fLayer[i].
ShiftPhi();
202 for(
int j=0; j<
wireNo; j++){
203 fWirePhi[fLayer[i].
BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
207 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
208 cout<<
"Total wire number is not consistant!"<<endl;
211 getline(inFile, line);
213 inFile.seekg(1,ios::cur);
214 getline(inFile, line);
215 getline(inFile, line);
217 for(i=0; i<fSegmentNo; i++){
218 inFile>>length>>innerR>>outR>>z>>name;
219 getline(inFile,line);
222 fMdcSegment[i].
SetOutR(outR); fMdcSegment[i].
SetZ(z);
230 ISvcLocator* svcLocator = Gaudi::svcLocator();
233 StatusCode sc=svcLocator->service(
"MdcGeomSvc", ISvc);
236 std::cout<<
"BesMdcGeoParameter::Could not open Geometry Service"<<std::endl;
245 for(i=0; i<fSignalLayerNo; i++){
247 fSignalLayer[i]=signalLayer-1;
252 double length, r, phi,rotateCell,rotateAngle;
253 for(i=0;i<fLayerNo;i++){
277 for(
int j=0; j<
wireNo; j++){
278 fWirePhi[fLayer[i].
BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
282 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
283 cout<<
"Total wire number is not consistant!"<<endl;
287 double innerR,outR,z;
289 for(i=0;i<fSegmentNo;i++){
292 outR=mdcGeomSvc->
End(i)->
OutR();
293 z=mdcGeomSvc->
End(i)->
Z();
294 name=mdcGeomSvc->
End(i)->
Name();
297 fMdcSegment[i].
SetOutR(outR); fMdcSegment[i].
SetZ(z);
305 cout<<
" fLayerNo: "<<fLayerNo<<endl;
306 cout<<
" fWireNo: "<<fWireNo<<endl;
307 cout<<
" fSignalLayerNo: "<<fSignalLayerNo<<endl;
308 cout<<
" fSignalWireR: "<<fSignalWireR<<endl;
309 cout<<
" fFieldWireR: "<<fFieldWireR<<endl;
311 cout<<
"fSingalLayer:"<<endl;
312 for(
int i=0; i<fSignalLayerNo; i++){
313 cout<<fSignalLayer[i]+1<<
' '; }
316 for(
int i=0;i<fLayerNo;i++){
317 cout<<
"Layer["<<i<<
"]: "
318 <<
" name:"<<fLayer[i].
Name() <<
" wireNo:"<<fLayer[i].
WireNo()
319 <<
" length: "<<fLayer[i].
Length() <<
" r: "<<fLayer[i].
R();
320 if (i<75) cout<<
" phi:"<<fLayer[i].
Phi()*180/
pi;
321 else cout<<
" phi:"<<(fLayer[i].
Phi()-fLayer[i].
ShiftPhi())*180/
pi;
322 cout<<
" firstWire: "<<fLayer[i].
FirstWire()
323 <<
" rotateCell: "<<fLayer[i].
RotateCell()<<endl;
326 cout<<
"fSegmentNo:"<<fSegmentNo<<endl;
327 for(
int j=0;j<fSegmentNo;j++){
328 cout<<
"length:"<<fMdcSegment[j].
Length()
329 <<
" innerR:"<<fMdcSegment[j].
InnerR()
330 <<
" outR:"<<fMdcSegment[j].
OutR()
331 <<
" z:"<<fMdcSegment[j].
Z()
332 <<
" name:"<<fMdcSegment[j].
Name()<<endl;
double sin(const BesAngle a)
double cos(const BesAngle a)
static BesMdcGeoParameter * GetGeo(void)
const BesMdcLayer & SignalLayer(int) const
const BesMdcLayer & Layer(int) const
BesMdcWire SignalWire(int, int)
int BeginWireNo(void) const
int FirstWire(void) const
double ShiftPhi(void) const
void SetShiftPhi(double x)
void SetBeginWireNo(int x)
double RotateCell(void) const
const string Name(void) const
double Length(void) const
void SetRotateCell(double x)
void SetRotateAngle(double x)
double RotateAngle(void) const
double Length(void) const
double InnerR(void) const
double Length(void) const
double nomShift(void) const
double nomPhi(void) const
string LayerName(void) const
double Radius(void) const
double FWireR(void) const
double SWireR(void) const
const MdcGeoGeneral *const GeneralLayer(unsigned id)
const MdcGeoEnd *const End(unsigned id)
const MdcGeoLayer *const Layer(unsigned id)
const MdcGeoMisc *const Misc(void)
static G4String GetBoostRoot()