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

parameters I am remotely ok with #39

Merged
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "FWCore/Utilities/interface/EDGetToken.h"
#include <set>
#include "DataFormats/Math/interface/deltaR.h"

//this is now just for HGCAL
#include "RecoHGCal/GraphReco/interface/HGCalTrackPropagator.h"
Expand Down Expand Up @@ -118,7 +119,7 @@ class PFTruthParticleProducer : public edm::stream::EDProducer<> {
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeoToken_;
hgcal::RecHitTools hgcrechittools_;

float pfMatchThreshold_;
float pfMatchThreshold_,pfMatchDRThreshold_;

};

Expand All @@ -141,7 +142,8 @@ PFTruthParticleProducer::PFTruthParticleProducer(const edm::ParameterSet &pset)
produces<edm::Association<PFTruthParticleCollection>>("caloRecHitToPFTruth");
produces<edm::Association<PFTruthParticleCollection>>("trackToPFTruth");

pfMatchThreshold_=0.95;//to be configured
pfMatchThreshold_=0.9;//to be configured
pfMatchDRThreshold_=0.04;
}

PFTruthParticleProducer::~PFTruthParticleProducer() {}
Expand Down Expand Up @@ -173,6 +175,28 @@ std::vector<size_t> PFTruthParticleProducer::matchedSCtoTrackIdxs(const SimClust
return out;

//check which G4 track is most likely to be representing the reco track
auto proptrack = trackprop_.propagateObject(track,track.charge());

//proptrack.momentum;
//proptrack.pos;

//now do a simple matching at front face (truth assisted since the SC refs are anyway by primary)
double totmom = 0 ;
for(const auto& scref: simClusters){
auto bpos4v= scref->g4Tracks().at(0).getPositionAtBoundary();
LocalVector boundaryPos(bpos4v.x(),bpos4v.y(),bpos4v.z());

double drsq = reco::deltaR2(boundaryPos.eta(), boundaryPos.phi(), proptrack.pos.eta(), proptrack.pos.phi());
if(drsq > pfMatchDRThreshold_*pfMatchDRThreshold_)
continue;
out.push_back(scref.key());
totmom += scref->impactMomentum().P();
}
if(totmom < tp.p4().P()*pfMatchThreshold_)
return std::vector<size_t>(); //discard
return out;

//old ----------------------------------------------------------------------

std::vector<std::vector<size_t> > mergeIdxs;
std::vector<const SimCluster* > tomerge;
Expand Down