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

The use of the innerTrack is now protected with an if, also a cout ha… #23015

Merged
merged 2 commits into from Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions DQMOffline/Muon/src/EfficiencyAnalyzer.cc
Expand Up @@ -270,10 +270,11 @@ void EfficiencyAnalyzer::analyze(const edm::Event & iEvent,const edm::EventSetup
h_allProbes_pt->Fill(muon2->pt());
h_allProbes_eta->Fill(muon2->eta());
h_allProbes_phi->Fill(muon2->phi());
h_allProbes_inner_pt->Fill(muon2->innerTrack()->innerMomentum().Rho());
h_allProbes_inner_eta->Fill(muon2->innerTrack()->innerPosition().Eta());
h_allProbes_inner_phi->Fill(muon2->innerTrack()->innerPosition().Phi());

if(muon2->innerTrack().isNonnull()) {
h_allProbes_inner_pt->Fill(muon2->innerTrack()->innerMomentum().Rho());
Copy link
Contributor

Choose a reason for hiding this comment

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

this will not help.
Did you check that the crash is gone?

innerTrack().extra().isAvailable() looks like a more correct approach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,

I couldn't check it was working, because I was unable to run the workflow that was failing. I tried your recommendations and more things but for this particular workflow I just didn't manage to run (it was crashing for unrelated reasons). I can update this right away, but I'm afraid that I won't be able to check it. I'm happy to try any other suggestion you have.

Copy link
Contributor

Choose a reason for hiding this comment

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

@parbol we need to use innerTrack().extra().isAvailable(). isNonnull() doesn't mean that data is available (I know it's confusing if you don't use it each day, but it covers different use cases).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have corrected this now. Thanks for the hint!

h_allProbes_inner_eta->Fill(muon2->innerTrack()->innerPosition().Eta());
h_allProbes_inner_phi->Fill(muon2->innerTrack()->innerPosition().Phi());
}
if (isMB) h_allProbes_EB_pt->Fill(muon2->pt());
if (isME) h_allProbes_EE_pt->Fill(muon2->pt());
if(muon2->pt() > 20 ) h_allProbes_hp_eta->Fill(muon2->eta());
Expand All @@ -288,9 +289,11 @@ void EfficiencyAnalyzer::analyze(const edm::Event & iEvent,const edm::EventSetup
h_passProbes_ID_pt->Fill(muon2->pt());
h_passProbes_ID_eta->Fill(muon2->eta());
h_passProbes_ID_phi->Fill(muon2->phi());
h_passProbes_ID_inner_pt->Fill(muon2->innerTrack()->innerMomentum().Rho());
h_passProbes_ID_inner_eta->Fill(muon2->innerTrack()->innerPosition().Eta());
h_passProbes_ID_inner_phi->Fill(muon2->innerTrack()->innerPosition().Phi());
if(muon2->innerTrack().isNonnull()) {
h_passProbes_ID_inner_pt->Fill(muon2->innerTrack()->innerMomentum().Rho());
h_passProbes_ID_inner_eta->Fill(muon2->innerTrack()->innerPosition().Eta());
h_passProbes_ID_inner_phi->Fill(muon2->innerTrack()->innerPosition().Phi());
}

if (isMB) h_passProbes_ID_EB_pt->Fill(muon2->pt());
if (isME) h_passProbes_ID_EE_pt->Fill(muon2->pt());
Expand Down
4 changes: 2 additions & 2 deletions DQMOffline/Muon/src/MuonRecoAnalyzer.cc
Expand Up @@ -455,10 +455,10 @@ void MuonRecoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup&
if (pvIndex > -1) {
refPoint = vertex->at(pvIndex).position();
} else {
if (&(*beamSpot)==NULL) {
if(beamSpot.isValid()) {
refPoint = beamSpot->position();
} else {
cout << "ERROR: No beam sport found!" << endl;
edm::LogInfo("MuonRecoAnalyzer") << "ERROR: No beam sport found!" << endl;
}
}
}
Expand Down