Skip to content

Commit

Permalink
Merge pull request #983 from JeffersonLab/FDCCDCMatchingFix
Browse files Browse the repository at this point in the history
Fdccdc matching fix
  • Loading branch information
aaust authored Nov 28, 2017
2 parents 6dca4bc + e0fc521 commit 7074d47
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
30 changes: 20 additions & 10 deletions src/libraries/TRACKING/DTrackCandidate_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inline bool cdc_fdc_match(double p_fdc,double p_cdc,double dist){
//double frac2=fabs(1.-p_fdc/p_cdc);
double p=p_fdc;
if (p_cdc <p ) p=p_cdc;
if (dist<10. && dist <3.25+1.75/p
if (dist<10. && dist <4.+1.75/p
//&& (frac<0.5 || frac2<0.5)
) return true;
return false;
Expand Down Expand Up @@ -193,8 +193,8 @@ jerror_t DTrackCandidate_factory::brun(JEventLoop* eventLoop,int32_t runnumber){

gPARMS->SetDefaultParameter("TRKFIND:MAX_NUM_TRACK_CANDIDATES", MAX_NUM_TRACK_CANDIDATES);

MIN_NUM_HITS=6;
gPARMS->SetDefaultParameter("TRKFIND:MIN_NUM_HITS", MIN_NUM_HITS);
// MIN_NUM_HITS=6;
//gPARMS->SetDefaultParameter("TRKFIND:MIN_NUM_HITS", MIN_NUM_HITS);

DEBUG_LEVEL=0;
gPARMS->SetDefaultParameter("TRKFIND:DEBUG_LEVEL", DEBUG_LEVEL);
Expand Down Expand Up @@ -670,7 +670,7 @@ jerror_t DTrackCandidate_factory::evnt(JEventLoop *loop, uint64_t eventnumber)
vector<unsigned int>cdc_hits_to_add;
for (unsigned int k=0;k<used_cdc_hits.size();k++){
if (!used_cdc_hits[k]){
double variance=1.0;
double variance=1.6;
// Use a helical approximation to the track to match both axial and
// stereo wires
double doca2=DocaToHelix(mycdchits[k],q,pos,mom);
Expand All @@ -680,9 +680,9 @@ jerror_t DTrackCandidate_factory::evnt(JEventLoop *loop, uint64_t eventnumber)
}
}
}
// It's probably not worth doing this unless there are at least few
// It's probably not worth doing this unless there are at least 2
// hits in the cdc that can be associated with the track...
if (cdc_hits_to_add.size()>2){
if (cdc_hits_to_add.size()>1){
// variables needed for average Bz
unsigned int num_hits=0;
double Bz=0;
Expand All @@ -708,7 +708,7 @@ jerror_t DTrackCandidate_factory::evnt(JEventLoop *loop, uint64_t eventnumber)
min_ring=mycdchits[ind]->wire->ring;
}
}
if (num_hits>2){
if (num_hits>=2){
for (unsigned int n=0;n<usedfdchits.size();n++){
const DFDCPseudo *fdchit=usedfdchits[n];
fit.AddHit(fdchit);
Expand Down Expand Up @@ -785,7 +785,7 @@ jerror_t DTrackCandidate_factory::evnt(JEventLoop *loop, uint64_t eventnumber)
vector<const DCDCTrackHit *>mycdchits;
candidate->GetT(mycdchits);

if (int(mycdchits.size()+myfdchits.size())>=MIN_NUM_HITS){
if (mycdchits.size()>=6 || myfdchits.size()>=3){
_data.push_back(candidate);
}
else delete candidate;
Expand Down Expand Up @@ -1405,10 +1405,20 @@ bool DTrackCandidate_factory::MatchMethod1(const DTrackCandidate *fdccan,
DVector3 mom=fdccan->momentum();
double q=fdccan->charge();

// Check to see if the outer hit in the CDC does not exceed the radius of
// the FDC position to try to avoid false matches...
unsigned int outer_index=cdchits.size()-1;
DVector3 origin=cdchits[outer_index]->wire->origin;
DVector3 dir=(1./cdchits[outer_index]->wire->udir.z())*cdchits[outer_index]->wire->udir;
DVector3 cdc_outer_wire_pos=origin+(167.-origin.z())*dir;
if (cdc_outer_wire_pos.Perp()>pos.Perp()) {
continue;
}

// loop over the cdc hits and count hits that agree with a projection of
// the helix into the cdc
for (unsigned int m=0;m<cdchits.size();m++){
double variance=1.0;
double variance=1.6;
// Use a helical approximation to the track to match both axial and
// stereo wires
double dr2=DocaToHelix(cdchits[m],q,pos,mom);
Expand Down Expand Up @@ -2518,7 +2528,7 @@ bool DTrackCandidate_factory::MatchMethod9(unsigned int src_index,
double dy=fit1.y0-fit2.y0;
double circle_center_diff2=dx*dx+dy*dy;
double got_match=false;
if (circle_center_diff2<4.0) got_match=true;
if (circle_center_diff2<9.0) got_match=true;
// try another matching method here if got_match==false
else{
// Sense of rotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ DFDCSegment *DTrackCandidate_factory_FDCCathodes::GetTrackMatch(DFDCSegment *seg

if (circle_center_diff2<circle_center_diff2_min){
circle_center_diff2_min=circle_center_diff2;
if (circle_center_diff2_min<4.0){
if (circle_center_diff2_min<9.0){
match=segment2;
match_id=j;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class DTrackCandidate_factory_FDCCathodes:public JFactory<DTrackCandidate>{
inline double DTrackCandidate_factory_FDCCathodes::Match(double p){
double cut=5.5/p;
if (cut>9.0) cut=9.0;
if (cut<1.) cut=1.0;
if (cut<5.) cut=5.0;
return cut;
}

Expand Down
1 change: 0 additions & 1 deletion src/libraries/TRACKING/DTrackFitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ DTrackFitter::DTrackFitter(JEventLoop *loop)
return;
}
bfield = dapp->GetBfield(run_number);
lorentz_def=dapp->GetLorentzDeflections(run_number);
geom = dapp->GetDGeometry(run_number);

RootGeom=NULL;
Expand Down
1 change: 0 additions & 1 deletion src/libraries/TRACKING/DTrackFitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ class DTrackFitter:public jana::JObject{
DTrackingData input_params; //< Starting parameters for the fit
fit_type_t fit_type; //< kWireBased or kTimeBased
const DMagneticFieldMap *bfield; //< Magnetic field map for current event (acquired through loop)
const DLorentzDeflections *lorentz_def;//< Correction to FDC cathodes due to Lorentz force
const DGeometry *geom; //< DGeometry pointer used to access materials through calibDB maps for eloss
const DRootGeom *RootGeom; //< ROOT geometry used for accessing material for MULS, energy loss
JEventLoop *loop; //< Pointer to JEventLoop object handling the current event
Expand Down
9 changes: 5 additions & 4 deletions src/libraries/TRACKING/DTrackFitterALT1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ void DTrackFitterALT1::GetHits(fit_type_t fit_type, DReferenceTrajectory *rt, hi
double tof = s/beta/1.0E-9; // in ns
hi.dist = 55E-4*(hit->time-tof);
hi.err = SIGMA_FDC_ANODE;

/*
if(USE_FDC_CATHODE){
// Find whether the track is on the "left" or "right" of the wire
DVector3 shift = wire->udir.Cross(mom_doca);
Expand All @@ -754,9 +754,10 @@ void DTrackFitterALT1::GetHits(fit_type_t fit_type, DReferenceTrajectory *rt, hi
hi.u_err = SIGMA_FDC_CATHODE;
}else{
// User specified not to use FDC cathode information in the fit.
hi.u_dist = 0.0;
hi.u_err = 0.0; // setting u_err to zero means it's excluded from chi-sq
}
*/
hi.u_dist = 0.0;
hi.u_err = 0.0; // setting u_err to zero means it's excluded from chi-sq
// }
}
hinfo.push_back(hi);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/TRACKING/DTrackFitterRiemann.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ jerror_t DTrackFitterRiemann::GetFDCPosition(DRiemannHit_t *hit){
double delta_x=sign*(hit->fdc->time-sperp*one_over_vcosl)*55E-4;

// Next find correction to y from table of deflections
double delta_y=lorentz_def->GetLorentzCorrection(XYp.X(),XYp.Y(),hit->z,theta,delta_x);
double delta_y=0.;

double u=hit->fdc->w+delta_x;
double v=hit->fdc->s-delta_y;
Expand Down

0 comments on commit 7074d47

Please sign in to comment.