18#include "AIDA/IAxis.h"
19#include "AIDA/IHistogram1D.h"
20#include "AIDA/IHistogram2D.h"
21#include "AIDA/IHistogram3D.h"
22#include "AIDA/IHistogramFactory.h"
40 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
42 MsgStream log(
msgSvc,
"FTFinder");
49 for (
int i = 0; i^
n; i++){
52 for (
int j = 0; j^m; j++){
66 log << MSG::DEBUG <<
" chi2/_la cut(1): " << chi2 <<
" / " <<
_la->
nc()
68 <<
" a3(" << 1.05/
param->
_minPt <<
"):" << a(3) <<endreq;
69 if (chi2/
_la->
nc() > 1.)
return 0;
73 log << MSG::DEBUG <<
" passed chi2/_la, a(3) and a(1) cut" <<endreq;
75 for (
int i = 0; i^
n; i++){
79 for (
int j = 0; j^m; j++){
81 const float x = h.
x();
82 const float y = h.
y();
83 double d0 =
_la->
d((
double)
x,(
double)y);
85 if (fabs(d0) > 0.7*h.
layer().
csize())
continue;
98 const float xc = center(1);
99 const float yc = center(2);
100 const float rc = a(1)+(-1. / 2.99792458 /m_pmgnIMF->
getReferField())/a(3);
101 int nn = salvage.
length();
102 for (
int i = 0; i^nn; i++){
106 for (
int j = 0; j^m; j++){
111 if ((y*xc-
x*yc)/(r*rc)<0.707)
break;
112 double d0 =
_la->
d((
double)
x,(
double)y);
114 if (fabs(d0) > 0.7*h.
layer().
csize())
continue;
149 for (
int i = 0; i^
n; i++){
152 for (
int j = 0; j^m; j++){
154 const float x = h.
x();
155 const float y = h.
y();
156 double d0 =
_la->
d((
double)
x,(
double)y);
160 if(
time<-100)
continue;
165 if (fabs(d0) > 0.5*cellsize)
continue;
198 for (
int i = 0; i^
n; i++){
201 for (
int j = 0; j^m; j++){
204 const float x = h.
x();
205 const float y = h.
y();
206 double d0 =
_la->
d((
double)
x,(
double)y);
210 if(
time<-100)
continue;
215 if (fabs(d0) > 0.5*cellsize)
continue;
255 for (
int i = 0; i^
n; i++){
258 for (
int j = 0; j^m; j++){
261 const float x = h.
x();
262 const float y = h.
y();
263 double d0 =
_la->
d((
double)
x,(
double)y);
267 if(
time<-100)
continue;
272 if (fabs(d0) > 0.5*cellsize)
continue;
300 for (
int i = 0; i^
n; i++){
303 for (
int j = 0; j^m; j++){
305 const float x = h.
x();
306 const float y = h.
y();
307 double d0 =
_la->
d((
double)
x,(
double)y);
311 if(
time<-100)
continue;
316 if (fabs(d0) > 0.5*cellsize)
continue;
345 for (
int i = 0; i^
n; i++){
347 int m = segments.
length();
348 float min_D_z = 9998.;
352 for (
int j = 0; j^m; j++){
354 float s_tmp =
s->s();
355 float z_tmp =
s->z();
356 double D_z = fabs(
d_z(s_tmp,z_tmp));
380 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
382 MsgStream log(
msgSvc,
"FTFinder");
386 log<<MSG::DEBUG<<
"number of stereo segments: "<<
n << endreq;
391 log<<MSG::DEBUG<<
"cut by _nseg" <<
param->
_nseg << endreq;
397 for (
int i = 0; i^
n; i++){
400 for (
int j = 0; j^m; j++){
403 if (!(h.
z(*
_la,z)))
continue;
406 log<<MSG::DEBUG<<
"cellsize: " << cellsize << endreq;
410 if(
time<-100)
continue;
413 log<<MSG::DEBUG<<
"m_ftFinder->evtTiming: "<< m_ftFinder->
evtTiming <<
" TDC time: " << h.
time() <<
" distance: "<< distance << endreq;
416 double par = h.
distance()/(0.25*cellsize);
427 log << MSG::DEBUG <<
"cut by _nlength: " <<
param->
_nlength << endreq;
433 for (
int i = 0; i^
n; i++){
434 double d =
_za->
d(sList[i],zList[i]);
435 float z_distance = hList[i]->distance_z();
437 log<<MSG::DEBUG<<
"cut by _z_cut1: "<<
param->
_z_cut1 << endreq;
443 _za->
add(sList[i], (d>0) ? zList[i]-z_distance : zList[i]+z_distance, 1.);
450 log<<MSG::DEBUG<<
"cut by _nc: " <<
param->
_nc << endreq;
455 for (
int i = 0; i^
n; i++){
456 double d =
_za->
d(sList[i],zList[i]);
457 float z_distance = hList[i]->distance_z();
458 hList[i]->setChi2(fabs(d)-z_distance);
461 g_sigmaz->fill(fabs(d)-z_distance, 1.0);
463 if (fabs(fabs(d)-z_distance) > (
param->
_z_cut2))
continue;
464 _za->
add(sList[i], (d>0) ? zList[i]-z_distance : zList[i]+z_distance, 1.);
471 log<<MSG::DEBUG<<
"cut by _nc" <<
param->
_nc << endreq;
488 for (
int i = 0; i^
n; i++) {
492 for (
int j = 0; j^
n; j++) {
493 nhits += (*_stereo_segments)[j]->wireHits().length();
EvtComplex exp(const EvtComplex &c)
#define FTWireFittingInvalid
FTSuperLayer * superLayer(int id) const
returns superlayer
float t2x(const FTLayer &l, const float t) const
convert t to x
const float r(void) const
returns r form origin
double csize(void) const
returns cell size
void deleteAll(void)
delete all object and clear(allocated memory remains same)
void remove2(int)
remove objects by index
int remove(int &)
remove objects by index and returns decremented index and length
int length(void) const
returns the length of the list
int append(const T &x)
append an object into the end of the list
FTList< FTSegment * > & complecated_segments(void)
returns complecated segments
int r_phiReFit(float vx, float xy, int vtx_flag)
do r-phi refit
int get_nhits(void)
calculate the wire hits number
FTList< FTList< FTSegment * > * > * _stereo_segments_by_superLayer
FTList< FTSegment * > & axial_segments(void) const
returns axial segments
int r_phi4Fit(float vx, float xy, int vtx_flag)
FTList< FTSegment * > & _axial_segments
FTList< FTSegment * > * _stereo_segments
int r_phiFit(void)
do r-phi circle fit
static MdcParameter * param
FTList< FTSegment * > & stereo_segments(void) const
returns stereo_segments
int r_phi3Fit(int l, float vx, float xy, int vtx_flag)
FTList< FTSegment * > * _stereo_segments_cache
int r_phi2Fit(float vx, float xy, int vtx_flag)
float d_z(float s, float z) const
int s_zFit(void)
do s-z linear fit
int linkStereoSegments(void)
link stereo segments by tanLambda
const float y(void) const
returns position y
int z(const Lpav &la, double &z) const
returns z for track la
float distance(void) const
returns drift distance
unsigned stateAND(const unsigned mask) const
returns state bit
const FTLayer & layer(void) const
returns layer
const float x(void) const
returns position x
void stateOR(const unsigned mask)
set state bit
float time(void) const
rerurns TDC time(after t0 subtraction)
void setChi2(float chi2)
set residual fit chi2
virtual double getReferField()=0
double d(double x, double y) const
HepVector Hpar(const HepPoint3D &pivot) const
double s(double x, double y) const
void add_point(double x, double y, double w=1)
static MdcParameter * instance()
void add(double, double, double)
double d(double s, double z) const