Skip to content
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

Avoid Nans in primary vertex #5490

Merged
merged 7 commits into from Sep 26, 2014
Merged

Conversation

VinInn
Copy link
Contributor

@VinInn VinInn commented Sep 23, 2014

While investigating the irreproducibility of relvals I discovered that in some cases no PixelVertices were reconstructed. I trace this down to some Nans.
Here I try to trap Nans and conditions that will generate Nans.
The effect on OfflineVertices is essentially negligible while evident to PixelVertices.
This is also one of the reason that prompted #5476

Few more optimizations have been added to the algorithms.
AdaptiveVertexFitter and KalmanVertexFitter (and the infrastructure used in there) would benefit of a complete re-engineering in light of C++11 and vectorization.

@mtosi, could you please test this for HLT?

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @VinInn (Vincenzo Innocente) for CMSSW_7_3_X.

Avoid Nans in primary vertex

It involves the following packages:

RecoVertex/AdaptiveVertexFit
RecoVertex/PrimaryVertexProducer

@cmsbuild, @nclopezo, @StoyanStoynev, @slava77 can you please review it and eventually sign? Thanks.
@imarches, @acaudron, @GiacomoSguazzoni, @rovere, @ferencek, @cerati, @pvmulder this is something you requested to watch as well.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
@nclopezo, @ktf you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

};

if ( (**i).weight() >= theWeightThreshold ) ns_trks++;

if ( fabs ( nVertex.position().z() ) > 10000. ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably it's a silly point,
but could we get rid of such hard-coded numbers ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If somebody volunteers (the code was there already)

double t_z = ((*it).stateAtBeamLine().trackStateAtPCA()).position().z();
double phi=((*it).stateAtBeamLine().trackStateAtPCA()).momentum().phi();
double tantheta = std::tan( ((*it).stateAtBeamLine().trackStateAtPCA()).momentum().theta());
if (std::abs(t_z) > 1000.) continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version of "1000." in the middle of the code is new. I would write it as a const with a suggestive name.

@VinInn
Copy link
Contributor Author

VinInn commented Sep 24, 2014

@cmsbuild: tests, comparison?

@cmsbuild
Copy link
Contributor

Pull request #5490 was updated. @cmsbuild, @nclopezo, @StoyanStoynev, @slava77 can you please check and sign again.

@StoyanStoynev
Copy link
Contributor

As expected the main changes are to the pixel vertices, less for PV. I see some changes to CSV b-tagging (which was "more sensitive" I was told and not the main algo). I tested in wf202 (ttbar with PU) mainly for now. Below some results (red is this PR vs recent IB), please comment. Overall I see slight decrease in pixel vertices (and related objects), I thougt it had to be the opposite.

all_some_pull5490__vs__baserel_ttbarpuwf202p0c_recovertexs_pixelvertices__reco_objat_size

all_some_pull5490__vs__baserel_ttbarpuwf202p0c_recovertexs_pixelvertices__reco_obj_trackssize

all_some_pull5490__vs__baserel_ttbarpuwf202p0c_recovertexs_offlineprimaryverticeswithbs__reco_obj_trackssize

wf202_pixvert_pt

wf202_pixvert_eff_ntracks

wf202_pixvert_match_pu

wf202_vert_ntracks

wf202_pixseedeta_iter2

wf202_tracking_dca_phi

wf203_btag_csv_tracketa

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

@slava77
Copy link
Contributor

slava77 commented Sep 25, 2014

@VinInn @StoyanStoynev
... are we waiting for Vincenzo/tracking to confirm that the behavior is in the expected direction?

@VinInn
Copy link
Contributor Author

VinInn commented Sep 25, 2014

It is consistent with what I observe as well.

@StoyanStoynev
Copy link
Contributor

+1
Based on the observation and discussion above (nothing more to add). I thought we were also waiting for hight stat. HLT tests.
Tests were for 23ba733 on top of CMSSW_7_3_X_2014-09-22-0200. The features are described above and are as expected.

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_3_X IBs unless changes (tests are also fine). @nclopezo, @ktf can you please take care of it?

@VinInn
Copy link
Contributor Author

VinInn commented Sep 26, 2014

sorry, was wrong noise on my side.
HLT uses PixelVertexProducer not PrimaryVertexProducer

nclopezo added a commit that referenced this pull request Sep 26, 2014
RecoVertex -- Avoid Nans in primary vertex
@nclopezo nclopezo merged commit 05f20c4 into cms-sw:CMSSW_7_3_X Sep 26, 2014
void sortTracksByPt(std::vector<reco::TransientTrack> & cont) {
auto s = cont.size();
float pt2[s]; int ind[s]; int i=0;
for (auto const & tk : cont) { ind[i]=i; pt2[++i] = tk.impactPointState().globalMomentum().perp2();}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been i++, or, more straightforward and less error prone, pt2[i] = ...; ++i;
Valgrind reports errors here.
I suspect this is where our vertex/btag discrepancies originate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, is this in 72?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidlt @ktf
Did this get picked up by ASAN (I'm guessing we are running it) or by valgrind (which I guess doesn't run regularly) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is only in 73X

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slava77 currently I don't run ASAN builds. I discussed with @ktf recently of doing so in some future. Yet, I might do it manually in some days if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants