16 #include <CLHEP/Matrix/Matrix.h>
17 #include <CLHEP/Matrix/Vector.h>
34 #define TARGET_POSITION 65.0
35 #define THETA_FORWARD_CUT 1.178097
36 #define THETA_BACKWARD_CUT 1.963495
37 #define THREEPIOVER4 2.356194
38 #define MAX_TRAJS 1000
39 #define MAX_POINTS 10000
40 #define MAX_TRACKS 200
41 #define PI 3.141592653589793238
79 _DBG_<<
"Cannot get DApplication from JEventLoop! (are you using a JApplication based program?)"<<endl;
83 JFactory_base *base = loop->GetFactory(
"DFDCSegment");
92 cout <<
"DTrackLSFitter destructor called\n";
101 if(chisq_ptr)*chisq_ptr=0.0;
102 if(dof_ptr)*dof_ptr=0.0;
121 vector<const DCDCTrackHit*> &trackhits =
cdchits;
122 vector<const DFDCPseudo*> &pseudopoints =
fdchits;
143 HepVector ppStart(5), paramTrue(5);
174 trajectory.
swim(ppStart);
181 for (
double df = 0.0;
df < 1.0001;
df += 1.0) {
213 cout <<
"==========fit error = " << code <<
"===========" << endl;
215 cout <<
"= at event " <<
loop->GetJEvent().GetEventNumber() << endl;
217 cout <<
"= trajectory" << endl;
237 double r0 =
ppEnd(1);
238 double z0 =
ppEnd(2);
239 double theta =
ppEnd(3);
240 double phi =
ppEnd(4);
241 double ptot = fabs(1.0/
ppEnd(5)/
sin(theta));
243 double x0 = r0*cos(phi);
244 double y0 = r0*
sin(phi);
247 mom.SetMagThetaPhi(ptot, theta, phi);
297 double xfirst, yfirst, zfirst, xlast, ylast, zlast;
298 xfirst = (pseudopoints[0])->
x;
299 yfirst = (pseudopoints[0])->
y;
300 zfirst = (pseudopoints[0])->wire->origin(2);
303 zlast = (pseudopoints[
size_fdc - 1])->wire->origin(2);
304 double rfirst =
sqrt(xfirst*xfirst + yfirst*yfirst);
305 double delta_z = zlast - zfirst;
306 double rPerp =
sqrt((xlast - xfirst)*(xlast - xfirst) + (ylast - yfirst)*(ylast - yfirst));
308 phiInitial = atan2(ylast - yfirst, xlast - xfirst);
313 float thetaInitialTrue = thrown[0]->momentum().Theta();
314 if (thetaInitialTrue <
PIOVER2) {
324 double deltaX = wire_n->
origin.X() - wire_0->
origin.X();
325 double deltaY = wire_n->
origin.Y() - wire_0->
origin.Y();
void setMomentum(const DVector3 &aMomentum)
#define DTRACKLSFITTER_NOMINAL
The DTrackFitter class is a base class for different charged track fitting algorithms. It does not actually fit the track itself, but provides the interface and some common support features most algorthims will need to implement.
fit_status_t FitTrack(void)
double radialDist2(const DCDCTrackHit *trkhit)
const DVector3 & position(void) const
double ChiSq(fit_type_t fit_type, DReferenceTrajectory *rt, double *chisq_ptr=NULL, int *dof_ptr=NULL, vector< pull_t > *pulls_ptr=NULL)
DLorentzDeflections * GetLorentzDeflections(unsigned int run_number=1)
vector< const DFDCPseudo * > fdchits_used_in_fit
void swim(const HepVector ¶m)
void setStoreDetails(bool storeDetailsValue)
DTrackLSFitter(JEventLoop *loop)
const DMagneticFieldMap * bfield
const DLorentzDeflections * lorentz_def
int operator()(const DCDCTrackHit *const &hit1, const DCDCTrackHit *const &hit2) const
vector< const DCDCTrackHit * > cdchits
vector< const DCDCTrackHit * > cdchits_used_in_fit
vector< const DFDCPseudo * > fdchits
void setInnerResidFrac(double innerResidFracIn)
#define DTRACKLSFITTER_UNDEFINED
Example program for a Hall-D analyzer which uses DANA.
const DVector3 & momentum(void) const
DTrackingData input_params
void setStartParams(HepVector &x)
#define DTRACKLSFITTER_EXCEPTION_THROWN
static int getInstanceCount()
class DFDCSegment_factory: definition for a JFactory that produces space points from pseudopoints...
void setPosition(const DVector3 &aPosition)
void setFitterStartParams()
DFDCSegment_factory * segment_factory
void getParams(HepVector &x)
static int getInstanceCount()