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

create and clear vector of vertex index per-muon, not per event. #20480

Merged
merged 3 commits into from Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions DataFormats/Scouting/interface/ScoutingMuon.h
Expand Up @@ -15,7 +15,7 @@ class ScoutingMuon
int nTrackerLayersWithMeasurement, int type, int nValidStripHits, float trk_qoverp,
float trk_lambda, float trk_pt,
float trk_phi, float trk_eta, float dxyError, float dzError, float trk_qoverpError,
float trk_lambdaError, float trk_phiError, float trk_dsz, float trk_dszError, std::vector<int> const& vtxIndx):
float trk_lambdaError, float trk_phiError, float trk_dsz, float trk_dszError, std::vector<int> vtxIndx):
pt_(pt), eta_(eta), phi_(phi), m_(m),
ecalIso_(ecalIso), hcalIso_(hcalIso), trackIso_(trackIso),
chi2_(chi2), ndof_(ndof), charge_(charge), dxy_(dxy), dz_(dz),
Expand All @@ -24,7 +24,7 @@ class ScoutingMuon
nTrackerLayersWithMeasurement_(nTrackerLayersWithMeasurement), type_(type), nValidStripHits_(nValidStripHits), trk_qoverp_(trk_qoverp),
trk_lambda_(trk_lambda), trk_pt_(trk_pt),
trk_phi_(trk_phi), trk_eta_(trk_eta), dxyError_(dxyError), dzError_(dzError), trk_qoverpError_(trk_qoverpError), trk_lambdaError_(trk_lambdaError),
trk_phiError_(trk_phiError), trk_dsz_(trk_dsz), trk_dszError_(trk_dszError), vtxIndx_(vtxIndx){}
trk_phiError_(trk_phiError), trk_dsz_(trk_dsz), trk_dszError_(trk_dszError), vtxIndx_(std::move(vtxIndx)){}
//default constructor
ScoutingMuon():pt_(0), eta_(0), phi_(0), m_(0), ecalIso_(0), hcalIso_(0), trackIso_(0),
chi2_(0), ndof_(0), charge_(0), dxy_(0), dz_(0), nValidMuonHits_(0),
Expand Down
6 changes: 3 additions & 3 deletions HLTrigger/Muon/interface/HLTScoutingMuonProducer.h
Expand Up @@ -47,13 +47,13 @@ class HLTScoutingMuonProducer : public edm::global::EDProducer<> {
unsigned int> > RecoChargedCandMap;
public:
explicit HLTScoutingMuonProducer(const edm::ParameterSet&);
~HLTScoutingMuonProducer();
~HLTScoutingMuonProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
virtual void produce(edm::StreamID sid, edm::Event & iEvent, edm::EventSetup const & setup)
const override final;
void produce(edm::StreamID sid, edm::Event & iEvent, edm::EventSetup const & setup)
const final;

const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> ChargedCandidateCollection_;
const edm::EDGetTokenT<reco::TrackCollection> TrackCollection_;
Expand Down
4 changes: 3 additions & 1 deletion HLTrigger/Muon/src/HLTScoutingMuonProducer.cc
Expand Up @@ -145,7 +145,8 @@ void HLTScoutingMuonProducer::produce(edm::StreamID sid, edm::Event & iEvent,

double hcalisopf=-1.0;
if ( HcalPFClusterIsoMap.isValid()) { hcalisopf = (*HcalPFClusterIsoMap)[muonRef]; }


vtxInd.reserve(vtxMuPair.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

hi @swagata87 - please move the vtxInd declaration to here - then the clear/reserve calls are not needed

for (unsigned int i=0; i<vtxMuPair.size(); i++) {
float dr2_1 = reco::deltaR2( ((vtxMuPair[i]).first),muon );
float dr2_2 = reco::deltaR2( ((vtxMuPair[i]).second),muon );
Expand Down Expand Up @@ -176,6 +177,7 @@ void HLTScoutingMuonProducer::produce(edm::StreamID sid, edm::Event & iEvent,
track->dszError(),
vtxInd
);
vtxInd.clear();
}

// Put output
Expand Down