From 74e4fbd2359adbe454f01ce29f852a31ca8c6fbe Mon Sep 17 00:00:00 2001 From: Jessica Date: Fri, 3 Oct 2014 10:10:23 +0200 Subject: [PATCH 1/5] testing --- RecoTracker/DeDx/plugins/HLTDeDxFilter.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc index 1f8964ad92462..77978a9c809d0 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc @@ -113,6 +113,7 @@ bool } } + // this is a test // put filter object into the Event if(saveTags()){ edm::OrphanHandle chargedCandidatesHandle = iEvent.put(chargedCandidates); From 9a558df357414fefb4035bc75320cd6a93af3df0 Mon Sep 17 00:00:00 2001 From: Jessica Date: Fri, 3 Oct 2014 11:43:58 +0200 Subject: [PATCH 2/5] added configurable parameters for nValidHits, nMissIn, nMissMid, and relTrkIsoDelaRp3 --- RecoTracker/DeDx/plugins/HLTDeDxFilter.cc | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc index 77978a9c809d0..236994c69c567 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc @@ -21,6 +21,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/TrackReco/interface/DeDxData.h" //#include "DataFormats/Math/interface/deltaPhi.h" +#include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Common/interface/ValueMap.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -38,6 +39,10 @@ HLTDeDxFilter::HLTDeDxFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConf minPT_ = iConfig.getParameter ("minPT"); minNOM_ = iConfig.getParameter ("minNOM"); maxETA_ = iConfig.getParameter ("maxETA"); + minNumValidHits_ = iConfig.getParameter ("minNumValidHits"); + maxNHitMissIn_ = iConfig.getParameter ("maxNHitMissIn"); + maxNHitMissMid_ = iConfig.getParameter ("maxNHitMissMid"); + maxRelTrkIsoDeltaRp3_ = iConfig.getParameter ("maxRelTrkIsoDeltaRp3"); inputTracksTag_ = iConfig.getParameter< edm::InputTag > ("inputTracksTag"); inputdedxTag_ = iConfig.getParameter< edm::InputTag > ("inputDeDxTag"); inputTracksToken_ = consumes(iConfig.getParameter< edm::InputTag > ("inputTracksTag")); @@ -58,6 +63,10 @@ void HLTDeDxFilter::fillDescriptions(edm::ConfigurationDescriptions& description desc.add("minPT",0.0); desc.add("minNOM",0.0); desc.add("maxETA",5.5); + desc.add("minNumValidHits",0); + desc.add("maxNHitMissIn",99); + desc.add("maxNHitMissMid",99); + desc.add("maxRelTrkIsoDeltaRp3", -1); desc.add("inputTracksTag",edm::InputTag("hltL3Mouns")); desc.add("inputDeDxTag",edm::InputTag("HLTdedxHarm2")); descriptions.add("hltDeDxFilter",desc); @@ -98,6 +107,9 @@ bool reco::TrackRef track = reco::TrackRef( trackCollectionHandle, i ); if(track->pt()>minPT_ && fabs(track->eta())minNOM_ && dEdxTrack[track].dEdx()>minDEDx_){ NTracks++; + if(track->numberOfValidHits() < minNumValidHits_) continue; + if(track->hitPattern().trackerLayersWithoutMeasurement( reco::HitPattern::MISSING_INNER_HITS) > maxNHitMissIn_) continue; + if(track->hitPattern().trackerLayersWithoutMeasurement( reco::HitPattern::TRACK_HITS) > maxNHitMissMid_) continue; if (saveTags()){ Particle::Charge q = track->charge(); //SAVE DEDX INFORMATION AS IF IT WAS THE MASS OF THE PARTICLE @@ -109,11 +121,25 @@ bool cand.setTrack(track); chargedCandidates->push_back(cand); } + + //calculate relative trk isolation only if parameter maxRelTrkIsoDeltaRp3 is different from default value of 99 + if(maxRelTrkIsoDeltaRp3_ >= 0){ + double ptCone = track->pt(); + for(unsigned int j=0; jeta() == track2->eta() && track->phi() == track2->phi()) continue; // do not compare track to itself + double trkDeltaR = deltaR(track->eta(), track->phi(), track2->eta(), track2->phi()); + if (trkDeltaR < 0.3){ + ptCone+=track2->pt(); + } + } + double relTrkIso = (ptCone - track->pt())/(track->pt()); + if (relTrkIso > maxRelTrkIsoDeltaRp3_) continue; + } accept=true; } } - // this is a test // put filter object into the Event if(saveTags()){ edm::OrphanHandle chargedCandidatesHandle = iEvent.put(chargedCandidates); From f136e85efd7e02e6bc96b3361647741bb56624b0 Mon Sep 17 00:00:00 2001 From: Jessica Date: Fri, 3 Oct 2014 11:44:09 +0200 Subject: [PATCH 3/5] added configurable parameters for nValidHits, nMissIn, nMissMid, and relTrkIsoDelaRp3 --- RecoTracker/DeDx/plugins/HLTDeDxFilter.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h index 74d80ff2558b9..7bb27e02309f7 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h @@ -33,6 +33,10 @@ class HLTDeDxFilter : public HLTFilter { double minPT_; double minNOM_; double maxETA_; + double minNumValidHits_; + double maxNHitMissIn_; + double maxNHitMissMid_; + double maxRelTrkIsoDeltaRp3_; edm::EDGetToken inputTracksToken_; edm::EDGetToken inputdedxToken_; edm::InputTag inputTracksTag_; From 49b37e2a2cd588d670e137fd850008adc648f972 Mon Sep 17 00:00:00 2001 From: Jessica Date: Mon, 6 Oct 2014 13:12:00 +0200 Subject: [PATCH 4/5] added parameter relTrkIsoDeltaRSize; use local arrays for rel trk iso calculation --- RecoTracker/DeDx/plugins/HLTDeDxFilter.cc | 37 ++++++++++++++--------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc index 236994c69c567..b5eeb178b999e 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc @@ -43,6 +43,7 @@ HLTDeDxFilter::HLTDeDxFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConf maxNHitMissIn_ = iConfig.getParameter ("maxNHitMissIn"); maxNHitMissMid_ = iConfig.getParameter ("maxNHitMissMid"); maxRelTrkIsoDeltaRp3_ = iConfig.getParameter ("maxRelTrkIsoDeltaRp3"); + relTrkIsoDeltaRSize_ = iConfig.getParameter ("relTrkIsoDeltaRSize"); inputTracksTag_ = iConfig.getParameter< edm::InputTag > ("inputTracksTag"); inputdedxTag_ = iConfig.getParameter< edm::InputTag > ("inputDeDxTag"); inputTracksToken_ = consumes(iConfig.getParameter< edm::InputTag > ("inputTracksTag")); @@ -67,6 +68,7 @@ void HLTDeDxFilter::fillDescriptions(edm::ConfigurationDescriptions& description desc.add("maxNHitMissIn",99); desc.add("maxNHitMissMid",99); desc.add("maxRelTrkIsoDeltaRp3", -1); + desc.add("relTrkIsoDeltaRSize", 0.3); desc.add("inputTracksTag",edm::InputTag("hltL3Mouns")); desc.add("inputDeDxTag",edm::InputTag("HLTdedxHarm2")); descriptions.add("hltDeDxFilter",desc); @@ -103,15 +105,22 @@ bool bool accept=false; int NTracks = 0; + //fill local arrays for eta, phi, and pt + float eta[trackCollection.size()], phi[trackCollection.size()], pt[trackCollection.size()]; for(unsigned int i=0; ipt()>minPT_ && fabs(track->eta())minNOM_ && dEdxTrack[track].dEdx()>minDEDx_){ - NTracks++; + eta[i] = trackCollection[i].eta(); + phi[i] = trackCollection[i].phi(); + pt[i] = trackCollection[i].pt(); + } + for(unsigned int i=0; iminPT_ && fabs(eta[i])minNOM_ && dEdxTrack[track].dEdx()>minDEDx_){ + NTracks++; if(track->numberOfValidHits() < minNumValidHits_) continue; if(track->hitPattern().trackerLayersWithoutMeasurement( reco::HitPattern::MISSING_INNER_HITS) > maxNHitMissIn_) continue; if(track->hitPattern().trackerLayersWithoutMeasurement( reco::HitPattern::TRACK_HITS) > maxNHitMissMid_) continue; if (saveTags()){ - Particle::Charge q = track->charge(); + Particle::Charge q = track->charge(); //SAVE DEDX INFORMATION AS IF IT WAS THE MASS OF THE PARTICLE Particle::LorentzVector p4(track->px(), track->py(), track->pz(), sqrt(pow(track->p(),2) + pow(dEdxTrack[track].dEdx(),2))); Particle::Point vtx(track->vx(),track->vy(), track->vz()); @@ -121,19 +130,19 @@ bool cand.setTrack(track); chargedCandidates->push_back(cand); } - - //calculate relative trk isolation only if parameter maxRelTrkIsoDeltaRp3 is different from default value of 99 + + //calculate relative trk isolation only if parameter maxRelTrkIsoDeltaRp3 is less than 0 if(maxRelTrkIsoDeltaRp3_ >= 0){ - double ptCone = track->pt(); - for(unsigned int j=0; jeta() == track2->eta() && track->phi() == track2->phi()) continue; // do not compare track to itself - double trkDeltaR = deltaR(track->eta(), track->phi(), track2->eta(), track2->phi()); - if (trkDeltaR < 0.3){ - ptCone+=track2->pt(); - } + if (i==j) continue; // do not compare track to itself + auto trkDeltaR2 = deltaR2(eta[i], phi[i], eta[j], phi[j]); + if (trkDeltaR2 < relTrkIsoDeltaRSize_ * relTrkIsoDeltaRSize_){ + ptCone+=pt[j]; + } } - double relTrkIso = (ptCone - track->pt())/(track->pt()); + double relTrkIso = (ptCone - pt[i])/(pt[i]); if (relTrkIso > maxRelTrkIsoDeltaRp3_) continue; } accept=true; From 3455dc5e191587fd81839d7710df0ea0b38af792 Mon Sep 17 00:00:00 2001 From: Jessica Date: Mon, 6 Oct 2014 13:13:03 +0200 Subject: [PATCH 5/5] added parameter relTrkIsoDeltaRSize; use local arrays for rel trk iso calculation --- RecoTracker/DeDx/plugins/HLTDeDxFilter.h | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h index 7bb27e02309f7..ae70848e4cb7c 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.h +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.h @@ -37,6 +37,7 @@ class HLTDeDxFilter : public HLTFilter { double maxNHitMissIn_; double maxNHitMissMid_; double maxRelTrkIsoDeltaRp3_; + double relTrkIsoDeltaRSize_; edm::EDGetToken inputTracksToken_; edm::EDGetToken inputdedxToken_; edm::InputTag inputTracksTag_;