-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add beam constraint to extended tracking #75
Changes from 2 commits
a0f54c6
7bb3ebb
672fa91
2552848
9fe542b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,55 +195,108 @@ void HybridFit::Fit(Tracklet* tracklet, std::vector<const Stub*>& trackstublist) | |
<< ", phi0 = " << trk.phi0() << ", eta = " << trk.eta() << ", z0 = " << trk.z0() | ||
<< ", chi2 = " << trk.chi2() << ", accepted = " << trk.accepted(); | ||
|
||
// Tracklet wants phi0 with respect to lower edge of sector, not global phi0. | ||
double phi0fit = reco::reduceRange(trk.phi0() - iSector_ * 2 * M_PI / N_SECTOR + 0.5 * settings_.dphisectorHG()); | ||
|
||
double rinvfit = 0.01 * settings_.c() * settings_.bfield() * trk.qOverPt(); | ||
|
||
int irinvfit = rinvfit / settings_.krinvpars(); | ||
int iphi0fit = phi0fit / settings_.kphi0pars(); | ||
int itanlfit = trk.tanLambda() / settings_.ktpars(); | ||
int iz0fit = trk.z0() / settings_.kz0pars(); | ||
int id0fit = trk.d0() / settings_.kd0pars(); | ||
int ichi2rphifit = trk.chi2rphi() / 16; | ||
int ichi2rzfit = trk.chi2rz() / 16; | ||
|
||
const vector<const tmtt::Stub*>& stubsFromFit = trk.stubs(); | ||
vector<const L1TStub*> l1stubsFromFit; | ||
for (const tmtt::Stub* s : stubsFromFit) { | ||
unsigned int IDf = s->index(); | ||
const L1TStub* l1s = L1StubIndices.at(IDf); | ||
l1stubsFromFit.push_back(l1s); | ||
} | ||
if (trk.done_bcon()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you eliminate all the duplicate code between the done_bcon and not done_bcon options? e.g. How about defining float phi0fit, rinvfit, d0fit & chi2rphi, and setting them to bcon or non-bcon values, according to the value of done_bcon. Then these variables can be passed to setFitPars(). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have made changes to reflect this, let me know if this is what you were invisioning. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, almost. Though you should be able to eliminate also duplicate code at https://github.com/cgsavard/cmssw/blob/add_beam_constr/L1Trigger/TrackFindingTracklet/src/HybridFit.cc#L206 and https://github.com/cgsavard/cmssw/blob/add_beam_constr/L1Trigger/TrackFindingTracklet/src/HybridFit.cc#L215 . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both of these lines rely on the trk phi0 which has a bcon version so this will be different with the beam spot constraint turned on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't you do: if (trk.done_bcon()) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. In this care then I should also do this to rinvfit I would presume? It would be the same thing with if (trk.done_bcon()) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made these changes |
||
// Tracklet wants phi0 with respect to lower edge of sector, not global phi0. | ||
double phi0fit = reco::reduceRange(trk.phi0_bcon() - iSector_ * 2 * M_PI / N_SECTOR + 0.5 * settings_.dphisectorHG()); | ||
|
||
double rinvfit = 0.01 * settings_.c() * settings_.bfield() * trk.qOverPt_bcon(); | ||
|
||
int irinvfit = rinvfit / settings_.krinvpars(); | ||
int iphi0fit = phi0fit / settings_.kphi0pars(); | ||
int itanlfit = trk.tanLambda() / settings_.ktpars(); | ||
int iz0fit = trk.z0() / settings_.kz0pars(); | ||
int id0fit = trk.d0_bcon() / settings_.kd0pars(); | ||
int ichi2rphifit = trk.chi2rphi_bcon() / 16; | ||
int ichi2rzfit = trk.chi2rz() / 16; | ||
|
||
const vector<const tmtt::Stub*>& stubsFromFit = trk.stubs(); | ||
vector<const L1TStub*> l1stubsFromFit; | ||
for (const tmtt::Stub* s : stubsFromFit) { | ||
unsigned int IDf = s->index(); | ||
const L1TStub* l1s = L1StubIndices.at(IDf); | ||
l1stubsFromFit.push_back(l1s); | ||
} | ||
|
||
if (settings_.printDebugKF()) { | ||
edm::LogVerbatim("L1track") << "#stubs before/after KF fit = " << TMTTstubs.size() << "/" | ||
<< l1stubsFromFit.size(); | ||
} | ||
if (settings_.printDebugKF()) { | ||
edm::LogVerbatim("L1track") << "#stubs before/after KF fit = " << TMTTstubs.size() << "/" | ||
<< l1stubsFromFit.size(); | ||
} | ||
|
||
tracklet->setFitPars(rinvfit, | ||
phi0fit, | ||
trk.d0(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi(), | ||
trk.chi2rz(), | ||
rinvfit, | ||
phi0fit, | ||
trk.d0(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi(), | ||
trk.chi2rz(), | ||
irinvfit, | ||
iphi0fit, | ||
id0fit, | ||
itanlfit, | ||
iz0fit, | ||
ichi2rphifit, | ||
ichi2rzfit, | ||
trk.hitPattern(), | ||
l1stubsFromFit); | ||
tracklet->setFitPars(rinvfit, | ||
phi0fit, | ||
trk.d0_bcon(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi_bcon(), | ||
trk.chi2rz(), | ||
rinvfit, | ||
phi0fit, | ||
trk.d0_bcon(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi_bcon(), | ||
trk.chi2rz(), | ||
irinvfit, | ||
iphi0fit, | ||
id0fit, | ||
itanlfit, | ||
iz0fit, | ||
ichi2rphifit, | ||
ichi2rzfit, | ||
trk.hitPattern(), | ||
l1stubsFromFit); | ||
} else if (!trk.done_bcon()) { | ||
|
||
// Tracklet wants phi0 with respect to lower edge of sector, not global phi0. | ||
double phi0fit = reco::reduceRange(trk.phi0() - iSector_ * 2 * M_PI / N_SECTOR + 0.5 * settings_.dphisectorHG()); | ||
|
||
double rinvfit = 0.01 * settings_.c() * settings_.bfield() * trk.qOverPt(); | ||
|
||
int irinvfit = rinvfit / settings_.krinvpars(); | ||
int iphi0fit = phi0fit / settings_.kphi0pars(); | ||
int itanlfit = trk.tanLambda() / settings_.ktpars(); | ||
int iz0fit = trk.z0() / settings_.kz0pars(); | ||
int id0fit = trk.d0() / settings_.kd0pars(); | ||
int ichi2rphifit = trk.chi2rphi() / 16; | ||
int ichi2rzfit = trk.chi2rz() / 16; | ||
|
||
const vector<const tmtt::Stub*>& stubsFromFit = trk.stubs(); | ||
vector<const L1TStub*> l1stubsFromFit; | ||
for (const tmtt::Stub* s : stubsFromFit) { | ||
unsigned int IDf = s->index(); | ||
const L1TStub* l1s = L1StubIndices.at(IDf); | ||
l1stubsFromFit.push_back(l1s); | ||
} | ||
|
||
if (settings_.printDebugKF()) { | ||
edm::LogVerbatim("L1track") << "#stubs before/after KF fit = " << TMTTstubs.size() << "/" | ||
<< l1stubsFromFit.size(); | ||
} | ||
|
||
tracklet->setFitPars(rinvfit, | ||
phi0fit, | ||
trk.d0(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi(), | ||
trk.chi2rz(), | ||
rinvfit, | ||
phi0fit, | ||
trk.d0(), | ||
trk.tanLambda(), | ||
trk.z0(), | ||
trk.chi2rphi(), | ||
trk.chi2rz(), | ||
irinvfit, | ||
iphi0fit, | ||
id0fit, | ||
itanlfit, | ||
iz0fit, | ||
ichi2rphifit, | ||
ichi2rzfit, | ||
trk.hitPattern(), | ||
l1stubsFromFit); | ||
} | ||
} else { | ||
if (settings_.printDebugKF()) { | ||
edm::LogVerbatim("L1track") << "FitTrack:KF rejected track"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we choose to add the "bcon" arguments to the KFTrackletTrack constructor, then the setBeamConst() function is no longer needed. Or if we choose to keep the setBeamConstr() function, then the "bcon" arguments don't need adding to the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you prefer? If in the future we just have extended tracking and a longer track word with both the bcon and non-bcon variables, what makes that transition easiest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either solution is fine. Choose whichever is easiest for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took out the setBeamConstr() function