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

Run3-alca216Y To make the response study work without HLT information if needed #36912

Merged
merged 6 commits into from
Feb 11, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions Calibration/IsolatedParticles/plugins/StudyCaloResponse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ void StudyCaloResponse::analyze(edm::Event const& iEvent, edm::EventSetup const&
bool ok(false);
std::string triggerUse("None");
if (!triggerEventHandle.isValid()) {
edm::LogWarning("IsoTrack") << "Error! Can't get the product " << triggerEvent_.label();
if (trigNames_.empty()) {
ok = true;
} else {
edm::LogWarning("IsoTrack") << "Error! Can't get the product " << triggerEvent_.label();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
edm::LogWarning("IsoTrack") << "Error! Can't get the product " << triggerEvent_.label();
edm::LogWarning("StudyCaloResponse") << "Error! Can't get the product " << triggerEvent_.label();

Sorry, I just noticed this, the whole file is using edm::LogWarning("IsoTrack") but the plugin name is StudyCaloResponse, so it should be that passed to the LogWarning

}
} else {
triggerEvent = *(triggerEventHandle.product());

Expand Down Expand Up @@ -407,6 +411,21 @@ void StudyCaloResponse::analyze(edm::Event const& iEvent, edm::EventSetup const&
edm::LogVerbatim("IsoTrack") << "Trigger check gives " << ok << " with " << triggerUse;

//Look at the tracks
edm::Handle<reco::TrackCollection> trkCollection;
iEvent.getByToken(tok_genTrack_, trkCollection);

edm::Handle<reco::MuonCollection> muonEventHandle;
iEvent.getByToken(tok_Muon_, muonEventHandle);

edm::Handle<reco::VertexCollection> recVtxs;
iEvent.getByToken(tok_recVtx_, recVtxs);

if ((!trkCollection.isValid()) || (!muonEventHandle.isValid()) || (!recVtxs.isValid())) {
edm::LogError("IsoTrack") << "Track collection " << trkCollection.isValid() << " Muon collection "
<< muonEventHandle.isValid() << " Vertex Collecttion " << recVtxs.isValid();
ok = false;
}

if (ok) {
h_goodRun->Fill(RunNo);
tr_goodRun = RunNo;
Expand All @@ -417,10 +436,8 @@ void StudyCaloResponse::analyze(edm::Event const& iEvent, edm::EventSetup const&
const MagneticField* bField = &iSetup.getData(tok_magField_);
const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_ecalChStatus_);

edm::Handle<reco::VertexCollection> recVtxs;
iEvent.getByToken(tok_recVtx_, recVtxs);
int ntrk(0), ngoodPV(0), nPV(-1);
int nvtxs = (int)(recVtxs->size());
int ntrk(0), ngoodPV(0), nPV(-1), nvtxs(0);
nvtxs = (int)(recVtxs->size());
for (int ind = 0; ind < nvtxs; ind++) {
if (!((*recVtxs)[ind].isFake()) && (*recVtxs)[ind].ndof() > 4)
ngoodPV++;
Expand Down Expand Up @@ -453,12 +470,6 @@ void StudyCaloResponse::analyze(edm::Event const& iEvent, edm::EventSetup const&
tr_eventWeight = 0;
}

edm::Handle<reco::TrackCollection> trkCollection;
iEvent.getByToken(tok_genTrack_, trkCollection);

edm::Handle<reco::MuonCollection> muonEventHandle;
iEvent.getByToken(tok_Muon_, muonEventHandle);

//=== genParticle information
edm::Handle<reco::GenParticleCollection> genParticles;
iEvent.getByToken(tok_parts_, genParticles);
Expand Down