BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMdcGeoParameter Class Reference

#include <BesMdcGeoParameter.hh>

Public Member Functions

 BesMdcGeoParameter (void)
 
 ~BesMdcGeoParameter (void)
 
void InitFromFile (void)
 
void InitFromSvc (void)
 
void Dump (void)
 
double SignalWireR ()
 
double FieldWireR ()
 
int Signal2Global (int x)
 
BesMdcWire Wire (int)
 
BesMdcWire SignalWire (int, int)
 
int LayerNo (void)
 
int SignalLayerNo (void)
 
const BesMdcLayerLayer (int) const
 
const BesMdcLayerSignalLayer (int) const
 
int SegmentNo (void)
 
BesMdcMember Segment (int x)
 
 BesMdcGeoParameter (void)
 
 ~BesMdcGeoParameter (void)
 
void InitFromFile (void)
 
void InitFromSvc (void)
 
void Dump (void)
 
double SignalWireR ()
 
double FieldWireR ()
 
int Signal2Global (int x)
 
BesMdcWire Wire (int)
 
BesMdcWire SignalWire (int, int)
 
int LayerNo (void)
 
int SignalLayerNo (void)
 
const BesMdcLayerLayer (int) const
 
const BesMdcLayerSignalLayer (int) const
 
int SegmentNo (void)
 
BesMdcMember Segment (int x)
 

Static Public Member Functions

static BesMdcGeoParameterGetGeo (void)
 
static BesMdcGeoParameterGetGeo (void)
 

Detailed Description

Constructor & Destructor Documentation

◆ BesMdcGeoParameter() [1/2]

BesMdcGeoParameter::BesMdcGeoParameter ( void  )

Definition at line 78 of file BesMdcGeoParameter.cc.

78 {
79 ISvcLocator* svcLocator = Gaudi::svcLocator();
80 IG4Svc* tmpSvc;
81 G4Svc* m_G4Svc;
82 StatusCode sc=svcLocator->service("G4Svc", tmpSvc);
83 m_G4Svc=dynamic_cast<G4Svc *>(tmpSvc);
84 if (!sc.isSuccess())
85 std::cout<<"BesMdcGeoParameter::Could not open G4 Service"<<std::endl;
86 if(m_G4Svc->GetMdcDataInput()== 0){
87 cout<<"------- get BesMdcGeoParameter from file --------"<<endl;
89 }
90 if(m_G4Svc->GetMdcDataInput()== 1) {
91 cout<<"=======get BesMdcGeoParameter from MdcGeomSvc======="<<endl;
92 InitFromSvc();
93 }
94
95 //Dump();
96 if(fPointer)
97 { G4Exception("BesMdcGeoParameter constructed twice."); }
98 fPointer=this;
99}

Referenced by GetGeo().

◆ ~BesMdcGeoParameter() [1/2]

BesMdcGeoParameter::~BesMdcGeoParameter ( void  )
inline

◆ BesMdcGeoParameter() [2/2]

BesMdcGeoParameter::BesMdcGeoParameter ( void  )

◆ ~BesMdcGeoParameter() [2/2]

BesMdcGeoParameter::~BesMdcGeoParameter ( void  )
inline

Member Function Documentation

◆ Dump() [1/2]

void BesMdcGeoParameter::Dump ( void  )

Definition at line 303 of file BesMdcGeoParameter.cc.

303 {
304 //cout<<"------BesMdcGeoParameter info :--------"<<endl;
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;
310
311 cout<<"fSingalLayer:"<<endl;
312 for(int i=0; i<fSignalLayerNo; i++){
313 cout<<fSignalLayer[i]+1<<' '; }
314 cout<<endl;
315
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;
324 }
325
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;
333 }
334
335}

◆ Dump() [2/2]

void BesMdcGeoParameter::Dump ( void  )

◆ FieldWireR() [1/2]

double BesMdcGeoParameter::FieldWireR ( )
inline

Definition at line 124 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

124{return fFieldWireR;}

Referenced by BesMdcConstruction::Construct().

◆ FieldWireR() [2/2]

double BesMdcGeoParameter::FieldWireR ( )
inline

Definition at line 124 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

124{return fFieldWireR;}

◆ GetGeo() [1/2]

BesMdcGeoParameter * BesMdcGeoParameter::GetGeo ( void  )
static

Definition at line 34 of file BesMdcGeoParameter.cc.

34 {
35 if (! fPointer) fPointer = new BesMdcGeoParameter();
36 return fPointer;
37}

Referenced by BesMdcConstruction::BesMdcConstruction(), BesMdcDigitizer::BesMdcDigitizer(), BesMdcSD::BesMdcSD(), and BesRawDataWriter::BesRawDataWriter().

◆ GetGeo() [2/2]

static BesMdcGeoParameter * BesMdcGeoParameter::GetGeo ( void  )
static

◆ InitFromFile() [1/2]

void BesMdcGeoParameter::InitFromFile ( void  )

Definition at line 148 of file BesMdcGeoParameter.cc.

148 {
149 int wireNo, firstWire;
150 double length, phi, r, rotateCell,rotateAngle;
151 double innerR, outR, z;
152 string name, line;
153
154 G4String geoPath = ReadBoostRoot::GetBoostRoot();
155 if(!geoPath){
156 G4Exception("BOOST environment not set!");
157 }
158 geoPath += "/dat/Mdc.txt";
159
160 ifstream inFile(geoPath);
161 if(!inFile.good()){
162 cout<<"Error, mdc parameters file not exist"<<endl;
163 return;
164 }
165
166 getline(inFile, line);
167 inFile>>fLayerNo>>fWireNo>>fSignalLayerNo>>fSignalWireR>>fFieldWireR;
168
169 inFile.seekg(1,ios::cur);
170 getline(inFile, line);
171 int i,signalLayer;
172 for(i=0; i<fSignalLayerNo; i++){
173 inFile>>signalLayer;
174 fSignalLayer[i]=signalLayer-1;
175 }
176
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);
183
184 rotateAngle=2*pi*rotateCell/wireNo;
185
186 fLayer[i].SetName(name);fLayer[i].SetRadius(r);
187 fLayer[i].SetLength(length); fLayer[i].SetRotateCell(rotateCell);
188 fLayer[i].SetRotateAngle(rotateAngle); fLayer[i].SetWireNo(wireNo);
189 fLayer[i].SetShiftPhi(twopi/wireNo); fLayer[i].SetFirstWire(firstWire);
190
191 phi*=(pi/180);
192 if(phi<0)phi += fLayer[i].ShiftPhi();
193 fLayer[i].SetPhi(phi);
194
195 if(i==0){
196 fLayer[i].SetSumWireNo(wireNo); fLayer[i].SetBeginWireNo(0);
197 }else{
198 fLayer[i].SetBeginWireNo(fLayer[i-1].SumWireNo());
199 fLayer[i].SetSumWireNo(fLayer[i-1].SumWireNo()+wireNo);
200 }
201
202 for(int j=0; j<wireNo; j++){
203 fWirePhi[fLayer[i].BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
204 }
205 }
206
207 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
208 cout<<"Total wire number is not consistant!"<<endl;
209 }
210
211 getline(inFile, line);
212 inFile>>fSegmentNo;
213 inFile.seekg(1,ios::cur);
214 getline(inFile, line);
215 getline(inFile, line);
216
217 for(i=0; i<fSegmentNo; i++){
218 inFile>>length>>innerR>>outR>>z>>name;
219 getline(inFile,line);
220
221 fMdcSegment[i].SetLength(length); fMdcSegment[i].SetInnerR(innerR);
222 fMdcSegment[i].SetOutR(outR); fMdcSegment[i].SetZ(z);
223 fMdcSegment[i].SetName(name);
224 }
225
226}
const int wireNo

Referenced by BesMdcGeoParameter().

◆ InitFromFile() [2/2]

void BesMdcGeoParameter::InitFromFile ( void  )

◆ InitFromSvc() [1/2]

void BesMdcGeoParameter::InitFromSvc ( void  )

Definition at line 229 of file BesMdcGeoParameter.cc.

229 {
230 ISvcLocator* svcLocator = Gaudi::svcLocator();
231 IMdcGeomSvc* ISvc;
232 MdcGeomSvc* mdcGeomSvc;
233 StatusCode sc=svcLocator->service("MdcGeomSvc", ISvc);
234 mdcGeomSvc=dynamic_cast<MdcGeomSvc *>(ISvc);
235 if (!sc.isSuccess())
236 std::cout<<"BesMdcGeoParameter::Could not open Geometry Service"<<std::endl;
237
238 fLayerNo= mdcGeomSvc->Misc()->LayerNo();
239 fWireNo=mdcGeomSvc->Misc()->WireNo();
240 fSignalLayerNo=mdcGeomSvc->Misc()->SLayerNo();
241 fSignalWireR=mdcGeomSvc->Misc()->SWireR();
242 fFieldWireR=mdcGeomSvc->Misc()->FWireR();
243
244 int i,signalLayer;
245 for(i=0; i<fSignalLayerNo; i++){
246 signalLayer=mdcGeomSvc->Layer(i)->SLayer();
247 fSignalLayer[i]=signalLayer-1;
248 }
249
250 string name;
251 int wireNo,firstWire;
252 double length, r, phi,rotateCell,rotateAngle;
253 for(i=0;i<fLayerNo;i++){
254 name=mdcGeomSvc->GeneralLayer(i)->LayerName();
255 wireNo=mdcGeomSvc->GeneralLayer(i)->NCell()*2;
256 length= mdcGeomSvc->GeneralLayer(i)->Length();
257 r= mdcGeomSvc->GeneralLayer(i)->Radius();
258 phi=mdcGeomSvc->GeneralLayer(i)->nomPhi();
259 firstWire=mdcGeomSvc->GeneralLayer(i)->First();
260 rotateCell= mdcGeomSvc->GeneralLayer(i)->nomShift();
261
262 rotateAngle=2*pi*rotateCell/wireNo;
263
264 fLayer[i].SetName(name);fLayer[i].SetRadius(r);
265 fLayer[i].SetLength(length); fLayer[i].SetRotateCell(rotateCell);
266 fLayer[i].SetRotateAngle(rotateAngle); fLayer[i].SetWireNo(wireNo);
267 fLayer[i].SetShiftPhi(twopi/wireNo); fLayer[i].SetFirstWire(firstWire);
268 fLayer[i].SetPhi(phi);
269
270 if(i==0){
271 fLayer[i].SetSumWireNo(wireNo); fLayer[i].SetBeginWireNo(0);
272 }else{
273 fLayer[i].SetBeginWireNo(fLayer[i-1].SumWireNo());
274 fLayer[i].SetSumWireNo(fLayer[i-1].SumWireNo()+wireNo);
275 }
276
277 for(int j=0; j<wireNo; j++){
278 fWirePhi[fLayer[i].BeginWireNo()+j]=j*fLayer[i].ShiftPhi()+phi;
279 }
280 }
281
282 if(fLayer[fLayerNo-1].SumWireNo()!= fWireNo){
283 cout<<"Total wire number is not consistant!"<<endl;
284 }
285
286
287 double innerR,outR,z;
288 fSegmentNo=mdcGeomSvc->getSegmentNo();
289 for(i=0;i<fSegmentNo;i++){
290 length=mdcGeomSvc->End(i)->Length();
291 innerR=mdcGeomSvc->End(i)->InnerR();
292 outR=mdcGeomSvc->End(i)->OutR();
293 z=mdcGeomSvc->End(i)->Z();
294 name=mdcGeomSvc->End(i)->Name();
295
296 fMdcSegment[i].SetLength(length); fMdcSegment[i].SetInnerR(innerR);
297 fMdcSegment[i].SetOutR(outR); fMdcSegment[i].SetZ(z);
298 fMdcSegment[i].SetName(name);
299 }
300
301}
const MdcGeoGeneral *const GeneralLayer(unsigned id)
Definition: MdcGeomSvc.cxx:800
const MdcGeoEnd *const End(unsigned id)
Definition: MdcGeomSvc.cxx:813
const MdcGeoLayer *const Layer(unsigned id)
Definition: MdcGeomSvc.cxx:784
const int getSegmentNo()
Definition: MdcGeomSvc.cxx:689
const MdcGeoMisc *const Misc(void)
Definition: MdcGeomSvc.cxx:808

Referenced by BesMdcGeoParameter().

◆ InitFromSvc() [2/2]

void BesMdcGeoParameter::InitFromSvc ( void  )

◆ Layer() [1/2]

const BesMdcLayer & BesMdcGeoParameter::Layer ( int  layerNumber) const

Definition at line 133 of file BesMdcGeoParameter.cc.

133 {
134 if(layerNumber<0 || layerNumber>89){
135 cout<<"Error: Wrong layerNo: "<<layerNumber<<endl;
136 }
137 return fLayer[layerNumber];
138}

Referenced by BesMdcConstruction::Construct().

◆ Layer() [2/2]

const BesMdcLayer & BesMdcGeoParameter::Layer ( int  ) const

◆ LayerNo() [1/2]

int BesMdcGeoParameter::LayerNo ( void  )
inline

Definition at line 130 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

130{return fLayerNo;}

◆ LayerNo() [2/2]

int BesMdcGeoParameter::LayerNo ( void  )
inline

Definition at line 130 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

130{return fLayerNo;}

◆ Segment() [1/2]

BesMdcMember BesMdcGeoParameter::Segment ( int  x)
inline

Definition at line 136 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

136{return fMdcSegment[x];}
Double_t x[10]

Referenced by BesMdcConstruction::Construct().

◆ Segment() [2/2]

BesMdcMember BesMdcGeoParameter::Segment ( int  x)
inline

Definition at line 136 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

136{return fMdcSegment[x];}

◆ SegmentNo() [1/2]

int BesMdcGeoParameter::SegmentNo ( void  )
inline

Definition at line 135 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

135{return fSegmentNo;}

Referenced by BesMdcConstruction::Construct().

◆ SegmentNo() [2/2]

int BesMdcGeoParameter::SegmentNo ( void  )
inline

Definition at line 135 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

135{return fSegmentNo;}

◆ Signal2Global() [1/2]

int BesMdcGeoParameter::Signal2Global ( int  x)
inline

Definition at line 125 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

125{return fSignalLayer[x];}

Referenced by BesMdcConstruction::Construct().

◆ Signal2Global() [2/2]

int BesMdcGeoParameter::Signal2Global ( int  x)
inline

Definition at line 125 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

125{return fSignalLayer[x];}

◆ SignalLayer() [1/2]

const BesMdcLayer & BesMdcGeoParameter::SignalLayer ( int  layerNumber) const

Definition at line 140 of file BesMdcGeoParameter.cc.

140 {
141 if(layerNumber<0 || layerNumber>42){
142 cout<<"Error: Wrong SignallayerNo: "<<layerNumber<<endl;
143 }
144 return fLayer[fSignalLayer[layerNumber]];
145}

◆ SignalLayer() [2/2]

const BesMdcLayer & BesMdcGeoParameter::SignalLayer ( int  ) const

◆ SignalLayerNo() [1/2]

int BesMdcGeoParameter::SignalLayerNo ( void  )
inline

Definition at line 131 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

131{return fSignalLayerNo;}

Referenced by BesMdcDigitizer::Digitize().

◆ SignalLayerNo() [2/2]

int BesMdcGeoParameter::SignalLayerNo ( void  )
inline

Definition at line 131 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

131{return fSignalLayerNo;}

◆ SignalWire() [1/2]

BesMdcWire BesMdcGeoParameter::SignalWire ( int  signalLayerNo,
int  wireNo 
)

Definition at line 118 of file BesMdcGeoParameter.cc.

119{
120
121 int i=fSignalLayer[signalLayerNo];
122 int wireNoInLayer=2*wireNo+1-fLayer[i].FirstWire();//FirstWire():0,field;1,signal
123 double phi=fLayer[i].Phi();
124 double shiftPhi=fLayer[i].ShiftPhi();
125 double wirePhi;
126 wirePhi= wireNoInLayer*shiftPhi+phi;
127
128 BesMdcWire temp(fLayer[i].Length(), fWirePhi[fLayer[i].BeginWireNo()+wireNoInLayer], fLayer[i].R(),fLayer[i].RotateAngle());
129 return temp;
130}
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition: TUtil.h:27

Referenced by BesMdcSD::ProcessHits().

◆ SignalWire() [2/2]

BesMdcWire BesMdcGeoParameter::SignalWire ( int  ,
int   
)

◆ SignalWireR() [1/2]

double BesMdcGeoParameter::SignalWireR ( )
inline

Definition at line 123 of file InstallArea/include/MdcSim/MdcSim/BesMdcGeoParameter.hh.

123{return fSignalWireR;}

Referenced by BesMdcConstruction::Construct().

◆ SignalWireR() [2/2]

double BesMdcGeoParameter::SignalWireR ( )
inline

Definition at line 123 of file Simulation/BOOST/MdcSim/MdcSim-00-00-73/MdcSim/BesMdcGeoParameter.hh.

123{return fSignalWireR;}

◆ Wire() [1/2]

BesMdcWire BesMdcGeoParameter::Wire ( int  wireNo)

Definition at line 102 of file BesMdcGeoParameter.cc.

102 {
103
104 int i;
105 for(i=0; i<fLayerNo; i++){
106 if(fLayer[i].BeginWireNo()<=wireNo && wireNo<fLayer[i].SumWireNo()){
107
108 break;
109 }
110 }
111
112 BesMdcWire temp(fLayer[i].Length(), fWirePhi[wireNo], fLayer[i].R(), fLayer[i].RotateAngle());
113 return temp;
114}

◆ Wire() [2/2]

BesMdcWire BesMdcGeoParameter::Wire ( int  )

The documentation for this class was generated from the following files: