BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TRungeFitter Class Reference

A class to fit a TTrackBase object to a 3D line. More...

#include <TRungeFitter.h>

Inheritance diagram for TRungeFitter:

Public Member Functions

 TRungeFitter (const std::string &name)
 Constructor.
 TRungeFitter (const std::string &name, bool m_sag, int m_prop, bool m_tof)
virtual ~TRungeFitter ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
virtual int fit (TTrackBase &) const
virtual int fit (TTrackBase &, float t0Offset, int layer) const
void innerwall (TRunge &trk, int l_mass, double y[6]) const
void sag (bool)
const RkFitMaterial getMaterial (int i) const
void propagation (int)
void tof (bool)
void setBesFromGdml (void)
 TRungeFitter (const std::string &name)
 Constructor.
 TRungeFitter (const std::string &name, bool m_sag, int m_prop, bool m_tof)
virtual ~TRungeFitter ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
virtual int fit (TTrackBase &) const
virtual int fit (TTrackBase &, float t0Offset, int layer) const
void innerwall (TRunge &trk, int l_mass, double y[6]) const
void sag (bool)
const RkFitMaterial getMaterial (int i) const
void propagation (int)
void tof (bool)
void setBesFromGdml (void)
 TRungeFitter (const std::string &name)
 Constructor.
 TRungeFitter (const std::string &name, bool m_sag, int m_prop, bool m_tof)
virtual ~TRungeFitter ()
 Destructor.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
virtual int fit (TTrackBase &) const
virtual int fit (TTrackBase &, float t0Offset, int layer) const
void innerwall (TRunge &trk, int l_mass, double y[6]) const
void sag (bool)
const RkFitMaterial getMaterial (int i) const
void propagation (int)
void tof (bool)
void setBesFromGdml (void)
Public Member Functions inherited from TMFitter
 TMFitter (const std::string &name)
 Constructor.
virtual ~TMFitter ()
 Destructor.
const std::string & name (void) const
 returns name.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 TMFitter (const std::string &name)
 Constructor.
virtual ~TMFitter ()
 Destructor.
const std::string & name (void) const
 returns name.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 TMFitter (const std::string &name)
 Constructor.
virtual ~TMFitter ()
 Destructor.
const std::string & name (void) const
 returns name.
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const

Public Attributes

std::vector< RkFitCylinder_BesBeamPipeWalls
std::vector< RkFitMaterial_BesBeamPipeMaterials

Additional Inherited Members

Protected Member Functions inherited from TMFitter
void fitDone (TTrackBase &) const
 sets the fitted flag. (Bad implementation)
void fitDone (TTrackBase &) const
 sets the fitted flag. (Bad implementation)
void fitDone (TTrackBase &) const
 sets the fitted flag. (Bad implementation)

Detailed Description

A class to fit a TTrackBase object to a 3D line.

Definition at line 34 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TRungeFitter.h.

Constructor & Destructor Documentation

◆ TRungeFitter() [1/6]

TRungeFitter::TRungeFitter ( const std::string & name)

Constructor.

Definition at line 73 of file TRungeFitter.cxx.

74 : TMFitter( name ), _sag( true ), _propagation( 1 ), _tof( false ), m_pmgnIMF( nullptr ) {
75 // StatusCode scmgn = Gaudi::svcLocator()->service( "MagneticFieldSvc", m_pmgnIMF );
76 // if ( scmgn != StatusCode::SUCCESS )
77 // { std::cout << __FILE__ << " Unable to open Magnetic field service" << std::endl; }
78}
const std::string & name(void) const
returns name.
TMFitter(const std::string &name)
Constructor.
Definition TMFitter.cxx:17

◆ TRungeFitter() [2/6]

TRungeFitter::TRungeFitter ( const std::string & name,
bool m_sag,
int m_prop,
bool m_tof )

Definition at line 79 of file TRungeFitter.cxx.

80 : TMFitter( name )
81 , _sag( m_sag )
82 , _propagation( m_prop )
83 , _tof( m_tof )
84 , m_pmgnIMF( nullptr ) {}
NTuple::Array< double > m_tof

◆ ~TRungeFitter() [1/3]

TRungeFitter::~TRungeFitter ( )
virtual

Destructor.

Definition at line 86 of file TRungeFitter.cxx.

86{}

◆ TRungeFitter() [3/6]

TRungeFitter::TRungeFitter ( const std::string & name)

Constructor.

◆ TRungeFitter() [4/6]

TRungeFitter::TRungeFitter ( const std::string & name,
bool m_sag,
int m_prop,
bool m_tof )

◆ ~TRungeFitter() [2/3]

virtual TRungeFitter::~TRungeFitter ( )
virtual

Destructor.

◆ TRungeFitter() [5/6]

TRungeFitter::TRungeFitter ( const std::string & name)

Constructor.

◆ TRungeFitter() [6/6]

TRungeFitter::TRungeFitter ( const std::string & name,
bool m_sag,
int m_prop,
bool m_tof )

◆ ~TRungeFitter() [3/3]

virtual TRungeFitter::~TRungeFitter ( )
virtual

Destructor.

Member Function Documentation

◆ dump() [1/3]

void TRungeFitter::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const

dumps debug information.

◆ dump() [2/3]

void TRungeFitter::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const

dumps debug information.

◆ dump() [3/3]

void TRungeFitter::dump ( const std::string & message = std::string(""),
const std::string & prefix = std::string("") ) const

dumps debug information.

◆ fit() [1/6]

int TRungeFitter::fit ( TTrackBase & tb) const
virtual

Implements TMFitter.

Definition at line 91 of file TRungeFitter.cxx.

91{ return fit( tb, 0, -1 ); }
virtual int fit(TTrackBase &) const

Referenced by fit().

◆ fit() [2/6]

virtual int TRungeFitter::fit ( TTrackBase & ) const
virtual

Implements TMFitter.

◆ fit() [3/6]

virtual int TRungeFitter::fit ( TTrackBase & ) const
virtual

Implements TMFitter.

◆ fit() [4/6]

int TRungeFitter::fit ( TTrackBase & tb,
float t0Offset,
int layer ) const
virtual

Definition at line 93 of file TRungeFitter.cxx.

93 {
94 // Argument layer is used for calibration interface in which doca is calculated without
95 // measured hit. liucy
96 IMdcCalibFunSvc* l_mdcCalFunSvc;
97 Gaudi::svcLocator()->service( "MdcCalibFunSvc", l_mdcCalFunSvc );
98 // std::cout<<"TRungeFitter::fit start"<<std::endl;
99 //...Type check...
100 if ( tb.objectType() != Runge ) return TFitUnavailable;
101 TRunge& t = (TRunge&)tb;
102 //...Already fitted ?...
103 if ( t.fitted() && layer == -1 ) return TFitAlreadyFitted;
104 //...Count # of hits...
105 const AList<TMLink>& cores = t.cores();
106 unsigned nCores = cores.length();
107 unsigned nStereoCores = NStereoHits( cores );
108 TMLink* last = NULL;
109 int lyr = 0;
110 int layerid = 0;
111 for ( int i = 0; i < nCores; i++ )
112 {
113 layerid = ( *cores[i]->hit() ).wire()->layerId();
114 if ( layerid >= lyr )
115 {
116 lyr = layerid;
117 last = cores[i];
118 }
119 }
120
121 //...Check # of hits...
122 // if ((nStereoCores < 2) || (nCores - nStereoCores < 3))
123 // return TFitErrorFewHits;
124
125 //...Move pivot to ORIGIN...
126 const HepPoint3D pivot_bak = t.pivot();
127 t.pivot( ORIGIN );
128
129 //...Setup...
130 Vector a( 5 ), da( 5 );
131 a = t.a();
132 Vector ainitial( a );
133 Vector dDda( 5 );
134 Vector dchi2da( 5 );
135 SymMatrix d2chi2d2a( 5, 0 );
136 const SymMatrix zero5( 5, 0 );
137 double chi2;
138 double chi2Old = 0;
139 for ( int i = 0; i < t.links().length(); i++ ) { chi2Old = chi2Old + t.links()[i]->pull(); }
140 chi2Old = DBL_MAX;
141 int err = 0;
142
143 double factor = 0.1;
144 Vector beta( 5 );
145 SymMatrix alpha( 5, 0 );
146 SymMatrix alpha2( 5, 0 );
147
148 double( *d )[5] = new double[nCores][5];
149 // double (*d2)[5]=new double[nCores][5];
150 Vector ea( 5 );
151
152 float tof;
153 HepVector3D p;
154 unsigned i;
155
156 double distance;
157 double eDistance;
158
159 // ea... init
160 const double ea_init = 0.000001;
161 ea[0] = ea_init; // dr
162 ea[1] = ea_init; // phi0
163 ea[2] = ea_init; // kappa
164 ea[3] = ea_init; // dz
165 ea[4] = ea_init; // tanl
166
167 // std::cout<<"TRF ::"<<a[0]<<","<<a[1]<<","<<a[2]<<","<<a[3]<<","<<a[4]<<std::endl;
168
169 // long int lclock0=clock()/1000;
170 // long int lclock=lclock0;
171
172 Vector def_a( t.a() );
173 Vector ta( def_a );
174
175 //...Fitting loop...
176 unsigned nTrial = 0;
177 while ( nTrial < 100 )
178 {
179
180 //...Set up...
181 chi2 = 0;
182 for ( unsigned j = 0; j < 5; j++ ) dchi2da[j] = 0;
183 d2chi2d2a = zero5;
184
185 def_a = t.a();
186
187 // #### loop for shifted helix parameter set ####
188 for ( unsigned j = 0; j < 5; j++ )
189 {
190 ta = def_a;
191 ta[j] += ea[j];
192 t.a( ta );
193 //...Loop with hits...
194 i = 0;
195 // std::cout<<"TRF:: cores="<<cores.length()<<std::endl;
196 while ( TMLink* l = cores[i++] )
197 {
198 //...Cal. closest points...
199 t.approach( *l, tof, p, _BesBeamPipeMaterials[0], _sag );
200 const HepPoint3D& onTrack = l->positionOnTrack();
201 const HepPoint3D& onWire = l->positionOnWire();
202 d[i - 1][j] = ( onTrack - onWire ).mag();
203 // std::cout<<"TRF:: i="<<i<<std::endl;
204 } // end of loop with hits
205 // lclock=clock()/1000;
206 // std::cout<<"TRF clock="<<lclock-lclock0<<std::endl;
207 // lclock0=lclock;
208 }
209 /*
210 for(int j=0;j<5;j++){
211 ta=def_a;
212 ta[j]-=ea[j];
213 t.a(ta);
214 //...Loop with hits...
215 float tof_dummy;
216 Vector3 p_dummy;
217 unsigned i=0;
218 while(TMLink* l = cores[i++]){
219 //...Cal. closest points...
220 t.approach(*l,tof_dummy,p_dummy,_sag);
221 const HepPoint3D& onTrack=l->positionOnTrack();
222 const HepPoint3D& onWire=l->positionOnWire();
223 d2[i-1][j]=(onTrack-onWire).mag();
224 }//end of loop with hits
225 }
226 */
227 t.a( def_a );
228
229 // #### original parameter set and calc. chi2 ####
230 //...Loop with hits...
231 i = 0;
232 while ( TMLink* l = cores[i++] )
233 {
234 const TMDCWireHit& h = *l->hit();
235 //...Cal. closest points...
236 if ( t.approach( *l, tof, p, _BesBeamPipeMaterials[0], _sag ) < 0 )
237 {
238 std::cout << "TrkReco:TRF:: bad wire" << std::endl;
239 continue;
240 }
241 int layerId = h.wire()->layerId();
242 const HepPoint3D& onTrack = l->positionOnTrack();
243 const HepPoint3D& onWire = l->positionOnWire();
244 unsigned leftRight = WireHitRight;
245 if ( onWire.cross( onTrack ).z() < 0. ) leftRight = WireHitLeft;
246
247 //...Obtain drift distance and its error...
248 if ( ( t0Offset == 0. ) && ( _propagation == 0 ) && ( !_tof ) )
249 {
250 //...No correction...
251 distance = l->drift( leftRight );
252 eDistance = h.dDrift( leftRight );
253 }
254 else
255 {
256 //...T0 and propagation corrections...
257 int wire = h.wire()->id();
258 int wirelocal = h.wire()->localId();
259 int side = leftRight;
260 if ( side == 0 ) side = 0;
261 // maqm float tp[3] = {p.x(),p.y(),p.z()};
262 double tp[3] = { p.x(), p.y(), p.z() };
263 // maqm float x[3] = {onWire.x(), onWire.y(), onWire.z()};
264 double x[3] = { onWire.x(), onWire.y(), onWire.z() };
265 double tprop = l_mdcCalFunSvc->getTprop( layerId, onWire.z() * 10. );
266 double timeWalk = l_mdcCalFunSvc->getTimeWalk( layerId, h.reccdc()->adc );
267 double T0 = l_mdcCalFunSvc->getT0( layerId, wirelocal );
268 double drifttime = h.reccdc()->tdc - tof - tprop - timeWalk - T0;
269 l->setDriftTime( drifttime );
270 float dist;
271 float edist;
272 int prop = _propagation;
273 const double x0 = t.helix().pivot().x();
274 const double y0 = t.helix().pivot().y();
275 Hep3Vector pivot_helix( x0, y0, 0 );
276 const double dr = t.helix().a()[0];
277 const double phi0 = t.helix().a()[1];
278 const double kappa = t.helix().a()[2];
279 const double dz = t.helix().a()[3];
280 const double tanl = t.helix().a()[4];
281
282 const double Bz = -1000 * ( getPmgnIMF()->getReferField() );
283 const double alpha = 333.564095 / Bz;
284
285 const double cox = x0 + dr * cos( phi0 ) - alpha * cos( phi0 ) / kappa;
286 const double coy = y0 + dr * sin( phi0 ) - alpha * sin( phi0 ) / kappa;
287 HepPoint3D dir( onTrack.y() - coy, cox - onTrack.x(), 0 );
288 double pos_phi = onWire.phi();
289 double dir_phi = dir.phi();
290 while ( pos_phi > pi ) { pos_phi -= pi; }
291 while ( pos_phi < 0 ) { pos_phi += pi; }
292 while ( dir_phi > pi ) { dir_phi -= pi; }
293 while ( dir_phi < 0 ) { dir_phi += pi; }
294 double entrangle = dir_phi - pos_phi;
295 while ( entrangle > pi / 2 ) entrangle -= pi;
296 while ( entrangle < ( -1 ) * pi / 2 ) entrangle += pi;
297 dist =
298 l_mdcCalFunSvc->driftTimeToDist( drifttime, layerId, wirelocal, side, entrangle );
299 dist = dist / 10; // mm->cmo
300 if ( layer == -1 || layerId != layer )
301 {
302 edist = l_mdcCalFunSvc->getSigma( layerId, side, dist, entrangle, tanl,
303 onWire.z() * 10, h.reccdc()->adc );
304 }
305 else if ( layerId == layer ) { edist = 99999999; }
306 edist = edist / 10;
307 distance = (double)dist;
308 eDistance = (double)edist;
309 }
310 double eDistance2 = eDistance * eDistance;
311
312 //...Residual...
313 const double d0 = ( onTrack - onWire ).mag();
314 // if(d0>2) std::cout<<"TRF:: strange dist. d0="<<d0<<" x="<<distance
315 // <<" ex="<<eDistance<<std::endl;
316 double dDistance = d0 - distance;
317
318 //...dDda...
319 for ( int j = 0; j < 5; j++ )
320 {
321 dDda[j] = ( d[i - 1][j] - d0 ) / ea[j];
322 // if(dDda[j]==0) std::cout<<"TRF:: dDda=0 j="<<j<<" ea="<<ea[j]<<std::endl;
323 }
324 // for(int j=0;j<5;j++) dDda[j]=(d[i-1][j]-d2[i-1][j])/ea[j]/2.;
325 //...Chi2 related...
326 dchi2da += ( dDistance / eDistance2 ) * dDda;
327 d2chi2d2a += vT_times_v( dDda ) / eDistance2;
328 double pChi2 = dDistance * dDistance / eDistance2;
329 chi2 += pChi2;
330 // if(!(pChi2<0 || pChi2>=0)){
331 // std::cout<<"TRF:: pChi2="<<pChi2<<" X="<<d0<<" fx="<<distance
332 // <<" ex="<<eDistance<<std::endl;
333 // }
334
335 //...Store results...
336 if ( layer == -1 )
337 {
338 l->update( onTrack, onWire, leftRight, pChi2 );
339 l->drift( distance, 0 );
340 l->drift( distance, 1 );
341 l->dDrift( eDistance, 0 );
342 l->dDrift( eDistance, 1 );
343 }
344
345 else if ( layerId == layer ) { l->distance( ( onTrack - onWire ).mag() ); }
346 } // end of loop with hits
347
348 //...Check condition...
349 double change = chi2Old - chi2;
350 if ( 0 <= change && change < 0.01 ) break;
351 if ( change < 0. )
352 {
353 factor *= 100;
354 a += da; // recover
355 if ( -0.01 < change )
356 {
357 d2chi2d2a = alpha;
358 chi2 = chi2Old;
359 break;
360 }
361 }
362 else if ( change > 0. )
363 {
364 chi2Old = chi2;
365 factor *= 0.1;
366 alpha = d2chi2d2a;
367 beta = dchi2da;
368 }
369 else if ( nTrial == 0 )
370 {
371 chi2Old = chi2;
372 factor *= 0.1;
373 alpha = d2chi2d2a;
374 beta = dchi2da;
375 }
376 else
377 {
378 std::cout << "TrkReco:TRF:: bad chi2 = " << chi2 << std::endl;
379 err = TFitFailed;
380 // break; // protection for nan
381 return err;
382 }
383 alpha2 = alpha;
384 for ( unsigned j = 0; j < 5; j++ ) alpha2[j][j] *= ( 1 + factor );
385 //...Cal. helix parameters for next loop...
386 da = solve( alpha2, beta );
387
388 // lclock=clock()/1000;
389 // std::cout<<"TRF "<<nTrial<<": "
390 // <<"cl="<<lclock-lclock0<<": "
391 // <<a[0]<<","<<a[1]<<","<<a[2]<<","<<a[3]<<","<<a[4]<<" "
392 // <<chi2<<"/"<<nCores<<":"<<factor
393 // <<" :da "<<da[0]<<","<<da[1]<<","<<da[2]<<","<<da[3]<<","<<da[4]<<std::endl;
394 // lclock0=lclock;
395
396 a -= da;
397 t.a( a );
398 // ea = 0.0001*da;
399 for ( i = 0; i < 5; i++ )
400 {
401 ea[i] = 0.0001 * abs( da[i] );
402 if ( ea[i] > ea_init ) ea[i] = ea_init;
403 if ( ea[i] < 1.0e-10 ) ea[i] = 1.0e-10;
404 }
405 ++nTrial;
406 }
407 // std::cout<<"TRungeFitter:: nTrial="<<nTrial<<std::endl;
408
409 //...Cal. error matrix...
410 SymMatrix Ea( 5, 0 );
411 unsigned dim;
412 dim = 5;
413 Ea = d2chi2d2a.inverse( err );
414 if ( nCores ) { t.approach( *last, tof, p, _BesBeamPipeMaterials[0], _sag ); }
415 // consider the material effect beam pipe.
416 double y_[6] = { 0, 0, 0, 0, 0, 0 };
417 t.SetFirst( y_ ); // obtain the momentum of the first layer
418 int lmass = 0;
419 innerwall( t, lmass, y_ ); // consider the material layer by layer
420 int nsign = a[2] / abs( a[2] );
421 // Update the helix parameter (momentum part.)
422 a[4] = y_[5] / sqrt( y_[4] * y_[4] + y_[3] * y_[3] );
423 a[2] = nsign * 1 / sqrt( y_[4] * y_[4] + y_[3] * y_[3] );
424 //...Store information...
425 if ( !err && layer == -1 )
426 {
427 t.a( a );
428 t.Ea( Ea );
429 t._fitted = true;
430 }
431 else if ( !err && layer != -1 )
432 {
433 t.a( ainitial );
434 // t.Ea(Ea);
435 t._fitted = true;
436 }
437 else { err = TFitFailed; }
438
439 t._ndf = nCores - dim;
440 t._chi2 = chi2;
441
442 //...Recover pivot...
443 t.pivot( pivot_bak );
444
445 delete[] d;
446 // delete [] d2;
447
448 return err;
449}
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
Double_t x[10]
double alpha
double pi
const HepPoint3D ORIGIN
Constants.
Definition TMDCUtil.cxx:47
virtual double driftTimeToDist(double drifttime, int layid, int cellid, int lr, double entrance=0.0) const =0
virtual double getSigma(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const =0
virtual double getTprop(int lay, double z) const =0
virtual double getT0(int layid, int cellid) const =0
virtual double getTimeWalk(int layid, double Q) const =0
struct MdcRec_wirhit * reccdc(void) const
returns a pointer to RECMDC_WIRHIT.
float dDrift(unsigned) const
returns drift distance error.
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
void innerwall(TRunge &trk, int l_mass, double y[6]) const
void tof(bool)
virtual unsigned objectType(void) const
returns object type.
int t()
Definition t.c:1

◆ fit() [5/6]

virtual int TRungeFitter::fit ( TTrackBase & ,
float t0Offset,
int layer ) const
virtual

◆ fit() [6/6]

virtual int TRungeFitter::fit ( TTrackBase & ,
float t0Offset,
int layer ) const
virtual

◆ getMaterial() [1/3]

const RkFitMaterial TRungeFitter::getMaterial ( int i) const

◆ getMaterial() [2/3]

const RkFitMaterial TRungeFitter::getMaterial ( int i) const

◆ getMaterial() [3/3]

const RkFitMaterial TRungeFitter::getMaterial ( int i) const

◆ innerwall() [1/3]

void TRungeFitter::innerwall ( TRunge & trk,
int l_mass,
double y[6] ) const

Definition at line 691 of file TRungeFitter.cxx.

691 {
692 for ( int i = 0; i < _BesBeamPipeWalls.size(); i++ )
693 { _BesBeamPipeWalls[i].updateTrack( track, y ); }
694}

Referenced by fit().

◆ innerwall() [2/3]

void TRungeFitter::innerwall ( TRunge & trk,
int l_mass,
double y[6] ) const

◆ innerwall() [3/3]

void TRungeFitter::innerwall ( TRunge & trk,
int l_mass,
double y[6] ) const

◆ propagation() [1/3]

void TRungeFitter::propagation ( int _in)

Definition at line 89 of file TRungeFitter.cxx.

89{ _propagation = _in; }

◆ propagation() [2/3]

void TRungeFitter::propagation ( int )

◆ propagation() [3/3]

void TRungeFitter::propagation ( int )

◆ sag() [1/3]

void TRungeFitter::sag ( bool _in)

Definition at line 88 of file TRungeFitter.cxx.

88{ _sag = _in; }

◆ sag() [2/3]

void TRungeFitter::sag ( bool )

◆ sag() [3/3]

void TRungeFitter::sag ( bool )

◆ setBesFromGdml() [1/3]

void TRungeFitter::setBesFromGdml ( void )

mdcgas

inner wall aluminium

air

outer beryllium pipe

cooling oil

inner beryllium pipe

gold

now construct the cylinders

innerwall of inner drift chamber

outer air, be attention the calculation of the radius and thick of the air cylinder is special

outer Beryllium layer

oil layer

inner Beryllium layer

gold layer

Definition at line 450 of file TRungeFitter.cxx.

450 {
451 int i( 0 );
452 double Z( 0. ), A( 0. ), Ionization( 0. ), Density( 0. ), Radlen( 0. );
453
454 G4LogicalVolume* logicalMdc = 0;
455 MdcG4Geo* aMdcG4Geo = new MdcG4Geo();
456 logicalMdc = aMdcG4Geo->GetTopVolume();
457
458 /// mdcgas
459 G4Material* mdcMaterial = logicalMdc->GetMaterial();
460
461 for ( i = 0; i < mdcMaterial->GetElementVector()->size(); i++ )
462 {
463 Z += ( mdcMaterial->GetElement( i )->GetZ() ) * ( mdcMaterial->GetFractionVector()[i] );
464 A += ( mdcMaterial->GetElement( i )->GetA() ) * ( mdcMaterial->GetFractionVector()[i] );
465 }
466 Ionization = mdcMaterial->GetIonisation()->GetMeanExcitationEnergy();
467 Density = mdcMaterial->GetDensity() / ( g / cm3 );
468 Radlen = mdcMaterial->GetRadlen();
469 RkFitMaterial FitMdcMaterial( Z, A / g / mole, Ionization / eV, Density, Radlen / 10. );
470 cout << "mdcgas: Z: " << Z << " A: " << ( A / ( g / mole ) )
471 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
472 << " Radlen: " << Radlen << endl;
473 _BesBeamPipeMaterials.push_back( FitMdcMaterial );
474 // RkFitTrack::mdcGasRadlen_ = Radlen/10.;
475
476 /// inner wall aluminium
477 G4LogicalVolume* innerwallVolume = const_cast<G4LogicalVolume*>(
478 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicalMdcSegment2" ) );
479 G4Material* innerwallMaterial = innerwallVolume->GetMaterial();
480 G4Tubs* innerwallTub = dynamic_cast<G4Tubs*>( innerwallVolume->GetSolid() );
481
482 Z = 0.;
483 A = 0.;
484 for ( i = 0; i < innerwallMaterial->GetElementVector()->size(); i++ )
485 {
486 Z += ( innerwallMaterial->GetElement( i )->GetZ() ) *
487 ( innerwallMaterial->GetFractionVector()[i] );
488 A += ( innerwallMaterial->GetElement( i )->GetA() ) *
489 ( innerwallMaterial->GetFractionVector()[i] );
490 }
491
492 Ionization = innerwallMaterial->GetIonisation()->GetMeanExcitationEnergy();
493 Density = innerwallMaterial->GetDensity() / ( g / cm3 );
494 Radlen = innerwallMaterial->GetRadlen();
495 cout << "Mdc innerwall, Al: Z: " << Z << " A: " << ( A / ( g / mole ) )
496 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
497 << " Radlen: " << Radlen << endl;
498 RkFitMaterial FitInnerwallMaterial( Z, A / g / mole, Ionization / eV, Density,
499 Radlen / 10. );
500 _BesBeamPipeMaterials.push_back( FitInnerwallMaterial );
501
502 ///////////////////////////////////////////////////////////////////////////////////////////////////
503 G4LogicalVolume* logicalBes = 0;
504 BesG4Geo* aBesG4Geo = new BesG4Geo();
505 logicalBes = aBesG4Geo->GetTopVolume();
506
507 /// air
508 G4LogicalVolume* logicalAirVolume = const_cast<G4LogicalVolume*>(
509 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicalWorld" ) );
510 G4Material* airMaterial = logicalAirVolume->GetMaterial();
511 Z = 0.;
512 A = 0.;
513 for ( i = 0; i < airMaterial->GetElementVector()->size(); i++ )
514 {
515 Z += ( airMaterial->GetElement( i )->GetZ() ) * ( airMaterial->GetFractionVector()[i] );
516 A += ( airMaterial->GetElement( i )->GetA() ) * ( airMaterial->GetFractionVector()[i] );
517 }
518 Ionization = airMaterial->GetIonisation()->GetMeanExcitationEnergy();
519 Density = airMaterial->GetDensity() / ( g / cm3 );
520 Radlen = airMaterial->GetRadlen();
521 cout << "air: Z: " << Z << " A: " << ( A / ( g / mole ) )
522 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
523 << " Radlen: " << Radlen << endl;
524 RkFitMaterial FitAirMaterial( Z, A / g / mole, Ionization / eV, Density, Radlen / 10. );
525 _BesBeamPipeMaterials.push_back( FitAirMaterial );
526
527 /// outer beryllium pipe
528 G4LogicalVolume* logicalOuterBeVolume = const_cast<G4LogicalVolume*>(
529 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicalouterBe" ) );
530 G4Material* outerBeMaterial = logicalOuterBeVolume->GetMaterial();
531
532 G4Tubs* outerBeTub = dynamic_cast<G4Tubs*>( logicalOuterBeVolume->GetSolid() );
533 Z = 0.;
534 A = 0.;
535 for ( i = 0; i < outerBeMaterial->GetElementVector()->size(); i++ )
536 {
537 Z += ( outerBeMaterial->GetElement( i )->GetZ() ) *
538 ( outerBeMaterial->GetFractionVector()[i] );
539 A += ( outerBeMaterial->GetElement( i )->GetA() ) *
540 ( outerBeMaterial->GetFractionVector()[i] );
541 }
542 Ionization = outerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
543 Density = outerBeMaterial->GetDensity() / ( g / cm3 );
544 Radlen = outerBeMaterial->GetRadlen();
545 cout << "outer beryllium: Z: " << Z << " A: " << ( A / ( g / mole ) )
546 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
547 << " Radlen: " << Radlen << endl;
548 RkFitMaterial FitOuterBeMaterial( Z, A / g / mole, Ionization / eV, Density, Radlen / 10. );
549 _BesBeamPipeMaterials.push_back( FitOuterBeMaterial );
550
551 /// cooling oil
552 G4LogicalVolume* logicalOilLayerVolume = const_cast<G4LogicalVolume*>(
553 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicaloilLayer" ) );
554 G4Material* oilLayerMaterial = logicalOilLayerVolume->GetMaterial();
555 G4Tubs* oilLayerTub = dynamic_cast<G4Tubs*>( logicalOilLayerVolume->GetSolid() );
556
557 Z = 0.;
558 A = 0.;
559 for ( i = 0; i < oilLayerMaterial->GetElementVector()->size(); i++ )
560 {
561 Z += ( oilLayerMaterial->GetElement( i )->GetZ() ) *
562 ( oilLayerMaterial->GetFractionVector()[i] );
563 A += ( oilLayerMaterial->GetElement( i )->GetA() ) *
564 ( oilLayerMaterial->GetFractionVector()[i] );
565 }
566 Ionization = oilLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
567 Density = oilLayerMaterial->GetDensity() / ( g / cm3 );
568 Radlen = oilLayerMaterial->GetRadlen();
569 cout << "cooling oil: Z: " << Z << " A: " << ( A / ( g / mole ) )
570 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
571 << " Radlen: " << Radlen << endl;
572 RkFitMaterial FitOilLayerMaterial( Z, A / g / mole, Ionization / eV, Density, Radlen / 10. );
573 _BesBeamPipeMaterials.push_back( FitOilLayerMaterial );
574
575 /// inner beryllium pipe
576 G4LogicalVolume* logicalInnerBeVolume = const_cast<G4LogicalVolume*>(
577 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicalinnerBe" ) );
578
579 G4Material* innerBeMaterial = logicalInnerBeVolume->GetMaterial();
580 G4Tubs* innerBeTub = dynamic_cast<G4Tubs*>( logicalInnerBeVolume->GetSolid() );
581 Z = 0.;
582 A = 0.;
583 for ( i = 0; i < innerBeMaterial->GetElementVector()->size(); i++ )
584 {
585 Z += ( innerBeMaterial->GetElement( i )->GetZ() ) *
586 ( innerBeMaterial->GetFractionVector()[i] );
587 A += ( innerBeMaterial->GetElement( i )->GetA() ) *
588 ( innerBeMaterial->GetFractionVector()[i] );
589 }
590 Ionization = innerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
591 Density = innerBeMaterial->GetDensity() / ( g / cm3 );
592 Radlen = innerBeMaterial->GetRadlen();
593 cout << "inner beryllium: Z: " << Z << " A: " << ( A / ( g / mole ) )
594 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
595 << " Radlen: " << Radlen << endl;
596 RkFitMaterial FitInnerBeMaterial( Z, A / g / mole, Ionization / eV, Density, Radlen / 10. );
597 _BesBeamPipeMaterials.push_back( FitInnerBeMaterial );
598
599 /// gold
600 G4LogicalVolume* logicalGoldLayerVolume = const_cast<G4LogicalVolume*>(
601 GDMLProcessor::GetInstance()->GetLogicalVolume( "logicalgoldLayer" ) );
602 G4Material* goldLayerMaterial = logicalGoldLayerVolume->GetMaterial();
603 G4Tubs* goldLayerTub = dynamic_cast<G4Tubs*>( logicalGoldLayerVolume->GetSolid() );
604
605 Z = 0.;
606 A = 0.;
607 for ( i = 0; i < goldLayerMaterial->GetElementVector()->size(); i++ )
608 {
609 Z += ( goldLayerMaterial->GetElement( i )->GetZ() ) *
610 ( goldLayerMaterial->GetFractionVector()[i] );
611 A += ( goldLayerMaterial->GetElement( i )->GetA() ) *
612 ( goldLayerMaterial->GetFractionVector()[i] );
613 }
614 Ionization = goldLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
615 Density = goldLayerMaterial->GetDensity() / ( g / cm3 );
616 Radlen = goldLayerMaterial->GetRadlen();
617 cout << "gold layer: Z: " << Z << " A: " << ( A / ( g / mole ) )
618 << " Ionization: " << ( Ionization / eV ) << " Density: " << Density
619 << " Radlen: " << Radlen << endl;
620 RkFitMaterial FitGoldLayerMaterial( Z, A / g / mole, Ionization / eV, Density,
621 Radlen / 10. );
622 _BesBeamPipeMaterials.push_back( FitGoldLayerMaterial );
623
624 /// now construct the cylinders
625 double radius, thick, length, z0;
626
627 /// innerwall of inner drift chamber
628 radius = innerwallTub->GetInnerRadius() / ( cm );
629 thick = innerwallTub->GetOuterRadius() / (cm)-innerwallTub->GetInnerRadius() / ( cm );
630 length = 2.0 * innerwallTub->GetZHalfLength() / ( cm );
631 z0 = 0.0;
632 cout << "innerwall: "
633 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
634 RkFitCylinder innerwallCylinder( &_BesBeamPipeMaterials[1], radius, thick, length, z0 );
635 _BesBeamPipeWalls.push_back( innerwallCylinder );
636
637 /// outer air, be attention the calculation of the radius and thick of the air cylinder is
638 /// special
639 radius = outerBeTub->GetOuterRadius() / ( cm );
640 thick = innerwallTub->GetInnerRadius() / (cm)-outerBeTub->GetOuterRadius() / ( cm );
641 length = 2.0 * innerwallTub->GetZHalfLength() / ( cm );
642 z0 = 0.0;
643 cout << "outer air: "
644 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
645 RkFitCylinder outerAirCylinder( &_BesBeamPipeMaterials[2], radius, thick, length, z0 );
646 _BesBeamPipeWalls.push_back( outerAirCylinder );
647
648 /// outer Beryllium layer
649 radius = outerBeTub->GetInnerRadius() / ( cm );
650 thick = outerBeTub->GetOuterRadius() / (cm)-outerBeTub->GetInnerRadius() / ( cm );
651 length = 2.0 * outerBeTub->GetZHalfLength() / ( cm );
652 z0 = 0.0;
653 cout << "outer Be: "
654 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
655 RkFitCylinder outerBeCylinder( &_BesBeamPipeMaterials[3], radius, thick, length, z0 );
656 _BesBeamPipeWalls.push_back( outerBeCylinder );
657
658 /// oil layer
659 radius = oilLayerTub->GetInnerRadius() / ( cm );
660 thick = oilLayerTub->GetOuterRadius() / (cm)-oilLayerTub->GetInnerRadius() / ( cm );
661 length = 2.0 * oilLayerTub->GetZHalfLength() / ( cm );
662 z0 = 0.0;
663 cout << "oil layer: "
664 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
665 RkFitCylinder oilLayerCylinder( &_BesBeamPipeMaterials[4], radius, thick, length, z0 );
666 _BesBeamPipeWalls.push_back( oilLayerCylinder );
667
668 /// inner Beryllium layer
669 radius = innerBeTub->GetInnerRadius() / ( cm );
670 thick = innerBeTub->GetOuterRadius() / (cm)-innerBeTub->GetInnerRadius() / ( cm );
671 length = 2.0 * innerBeTub->GetZHalfLength() / ( cm );
672 z0 = 0.0;
673 cout << "inner Be: "
674 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
675 RkFitCylinder innerBeCylinder( &_BesBeamPipeMaterials[5], radius, thick, length, z0 );
676 _BesBeamPipeWalls.push_back( innerBeCylinder );
677
678 /// gold layer
679 radius = goldLayerTub->GetInnerRadius() / ( cm );
680 thick = goldLayerTub->GetOuterRadius() / (cm)-goldLayerTub->GetInnerRadius() / ( cm );
681 length = 2.0 * goldLayerTub->GetZHalfLength() / ( cm );
682 z0 = 0.0;
683 cout << "gold layer: "
684 << " radius: " << radius << " thick:" << thick << " length: " << length << endl;
685 RkFitCylinder goldLayerCylinder( &_BesBeamPipeMaterials[6], radius, thick, length, z0 );
686 _BesBeamPipeWalls.push_back( goldLayerCylinder );
687 delete aMdcG4Geo;
688 delete aBesG4Geo;
689} // end of setBesFromGdml
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.

◆ setBesFromGdml() [2/3]

void TRungeFitter::setBesFromGdml ( void )

◆ setBesFromGdml() [3/3]

void TRungeFitter::setBesFromGdml ( void )

◆ tof() [1/3]

void TRungeFitter::tof ( bool _in)

Definition at line 90 of file TRungeFitter.cxx.

90{ _tof = _in; }

Referenced by fit().

◆ tof() [2/3]

void TRungeFitter::tof ( bool )

◆ tof() [3/3]

void TRungeFitter::tof ( bool )

Member Data Documentation

◆ _BesBeamPipeMaterials

std::vector< RkFitMaterial > TRungeFitter::_BesBeamPipeMaterials

◆ _BesBeamPipeWalls

std::vector< RkFitCylinder > TRungeFitter::_BesBeamPipeWalls

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