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 { G4Exception(
"BesMdcGeoParameter constructed twice."); }
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 G4Exception(
"BOOST environment not set!");
159 geoPath +=
"/dat/Mdc_cgem.txt";
160 G4cout <<
"use CGEM" << endl;
162 geoPath +=
"/dat/Mdc.txt";
164 G4cout <<
"Read Mdc geometry file: " << geoPath << endl;
166 ifstream inFile(geoPath);
168 cout<<
"Error, mdc parameters file not exist"<<endl;
172 getline(inFile, line);
173 inFile>>fLayerNo>>fWireNo>>fSignalLayerNo>>fSignalWireR>>fFieldWireR;
175 inFile.seekg(1,ios::cur);
176 getline(inFile, line);
178 for(i=0; i<fSignalLayerNo; i++){
180 fSignalLayer[i]=signalLayer-1;
183 inFile.seekg(1,ios::cur);
184 getline(inFile, line);
185 getline(inFile, line);
186 for( i=0; i<fLayerNo; i++){
187 inFile>>name>>
wireNo>>
length>>r>>phi>>firstWire>>rotateCell;
188 getline(inFile, line);
198 if(phi<0)phi += fLayer[i].
ShiftPhi();
208 for(
int j=0; j<
wireNo; j++){
209 fWirePhi[fLayer[i].
BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
213 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
214 cout<<
"Total wire number is not consistant!"<<endl;
217 getline(inFile, line);
219 inFile.seekg(1,ios::cur);
220 getline(inFile, line);
221 getline(inFile, line);
223 for(i=0; i<fSegmentNo; i++){
224 inFile>>
length>>innerR>>outR>>z>>name;
225 getline(inFile,line);
228 fMdcSegment[i].
SetOutR(outR); fMdcSegment[i].
SetZ(z);
236 ISvcLocator* svcLocator = Gaudi::svcLocator();
239 StatusCode sc=svcLocator->service(
"MdcGeomSvc", ISvc);
242 std::cout<<
"BesMdcGeoParameter::Could not open Geometry Service"<<std::endl;
251 for(i=0; i<fSignalLayerNo; i++){
253 fSignalLayer[i]=signalLayer-1;
258 double length, r, phi,rotateCell,rotateAngle;
259 for(i=0;i<fLayerNo;i++){
283 for(
int j=0; j<
wireNo; j++){
284 fWirePhi[fLayer[i].
BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
288 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
289 cout<<
"Total wire number is not consistant!"<<endl;
293 double innerR,outR,z;
295 for(i=0;i<fSegmentNo;i++){
298 outR=mdcGeomSvc->
End(i)->
OutR();
299 z=mdcGeomSvc->
End(i)->
Z();
300 name=mdcGeomSvc->
End(i)->
Name();
303 fMdcSegment[i].
SetOutR(outR); fMdcSegment[i].
SetZ(z);
311 cout<<
" fLayerNo: "<<fLayerNo<<endl;
312 cout<<
" fWireNo: "<<fWireNo<<endl;
313 cout<<
" fSignalLayerNo: "<<fSignalLayerNo<<endl;
314 cout<<
" fSignalWireR: "<<fSignalWireR<<endl;
315 cout<<
" fFieldWireR: "<<fFieldWireR<<endl;
317 cout<<
"fSingalLayer:"<<endl;
318 for(
int i=0; i<fSignalLayerNo; i++){
319 cout<<fSignalLayer[i]+1<<
' '; }
322 for(
int i=0;i<fLayerNo;i++){
323 cout<<
"Layer["<<i<<
"]: "
324 <<
" name:"<<fLayer[i].
Name() <<
" wireNo:"<<fLayer[i].
WireNo()
325 <<
" length: "<<fLayer[i].
Length() <<
" r: "<<fLayer[i].
R();
326 if (i<75) cout<<
" phi:"<<fLayer[i].
Phi()*180/
pi;
327 else cout<<
" phi:"<<(fLayer[i].
Phi()-fLayer[i].
ShiftPhi())*180/
pi;
328 cout<<
" firstWire: "<<fLayer[i].
FirstWire()
329 <<
" rotateCell: "<<fLayer[i].
RotateCell()<<endl;
332 cout<<
"fSegmentNo:"<<fSegmentNo<<endl;
333 for(
int j=0;j<fSegmentNo;j++){
334 cout<<
"length:"<<fMdcSegment[j].
Length()
335 <<
" innerR:"<<fMdcSegment[j].
InnerR()
336 <<
" outR:"<<fMdcSegment[j].
OutR()
337 <<
" z:"<<fMdcSegment[j].
Z()
338 <<
" 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()