Skip to content

Commit

Permalink
DON T KNOW modification (done in the past, this is a backup
Browse files Browse the repository at this point in the history
  • Loading branch information
vberta committed Nov 5, 2020
1 parent 9a73f93 commit 86a8b6e
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 246 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions RecoTracker/TkSeedGenerator/plugins/BuildFile.xml
Expand Up @@ -6,6 +6,7 @@
<use name="RecoPixelVertexing/PixelTrackFitting"/>
<use name="RecoPixelVertexing/PixelLowPtUtilities"/>
<use name="PhysicsTools/TensorFlow"/>
<use name="SimDataFormats/TrackingAnalysis"/>
<library file="*.cc" name="RecoTrackerTkSeedGeneratorPlugins">
<flags EDM_PLUGIN="1"/>
<use name="DataFormats/TrackerRecHit2D"/>
Expand Down
Expand Up @@ -411,6 +411,7 @@ int jet_number = 0;
// std::cout << "Rejecting seed" << xx << " " << yy << " " << track_eta << " " << track_phi << " " << seedid << std::endl;
continue;
}
if(1){ //1 TO JET CORE; 0=NO JET CORE
ids.insert(seedid);
//nn std::cout << "Creating seed" << xx << " " << yy << " " << track_eta << " " << track_phi << " " << seedid << std::endl;

Expand All @@ -421,10 +422,10 @@ int jet_number = 0;
em[5]=0.5e-5;
em[9]=2e-5;
em[14]=2e-5;
/*[2]=1e-5;
em[5]=1e-5;
em[9]=2e-5;
em[14]=2e-5;*/
// [2]=1e-5;
// em[5]=1e-5;
// em[9]=2e-5;
// em[14]=2e-5;
long int detId=globDet->geographicalId();
LocalTrajectoryParameters localParam(localSeedPoint, localSeedDir, TrackCharge(1));
result->push_back(TrajectorySeed( PTrajectoryStateOnDet (localParam, pt, em, detId, /*surfaceSide*/ 0), edm::OwnVector< TrackingRecHit >() , PropagationDirection::alongMomentum));
Expand All @@ -434,7 +435,7 @@ int jet_number = 0;
GlobalPoint globalSeedPoint = globDet->surface().toGlobal(localSeedPoint);
reco::Track::CovarianceMatrix mm;
resultTracks->push_back(reco::Track(1,1,reco::Track::Point(globalSeedPoint.x(),globalSeedPoint.y(),globalSeedPoint.z()),reco::Track::Vector(globSeedDir.x(),globSeedDir.y(),globSeedDir.z()),1,mm));

}
}
}
}
Expand All @@ -454,6 +455,7 @@ int jet_number = 0;
} //bigcluster
} //jet > pt
} //jet
std::cout <<"numero di seed=" << result->size() <<", " << resultTracks->size() << std::endl;
iEvent.put(std::move(result));
iEvent.put(std::move(resultTracks));
}
Expand Down
350 changes: 146 additions & 204 deletions RecoTracker/TkSeedGenerator/plugins/JetCorePerfectSeedGenerator.cc

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions RecoTracker/TkSeedGenerator/plugins/JetCorePerfectSeedGenerator.h
Expand Up @@ -63,16 +63,17 @@
#include "CommonTools/UtilAlgos/interface/TFileService.h"

// #include "SimG4Core/Application/interface/G4SimTrack.h"
#include "SimDataFormats/Track/interface/SimTrack.h"
// #include "SimDataFormats/Track/interface/SimTrack.h"

#include "SimDataFormats/Vertex/interface/SimVertex.h"
// #include "SimDataFormats/Vertex/interface/SimVertex.h"
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"


#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"

#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"

#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
// #include "SimDataFormats/TrackingHit/interface/PSimHit.h"


#include "TTree.h"
Expand Down Expand Up @@ -148,10 +149,11 @@ class JetCorePerfectSeedGenerator : public edm::one::EDProducer<edm::one::Shared
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > inputPixelClusters;
edm::EDGetTokenT< edm::DetSetVector<PixelDigiSimLink> > pixeldigisimlinkToken;
edm::EDGetTokenT<edm::View<reco::Candidate> > cores_;
edm::EDGetTokenT<std::vector<SimTrack> > simtracksToken;
edm::EDGetTokenT<std::vector<SimVertex> > simvertexToken;
edm::EDGetTokenT<std::vector<PSimHit> > PSimHitToken;
edm::Handle<std::vector<PSimHit> > simhits;
// edm::EDGetTokenT<std::vector<SimTrack> > simtracksToken;
// edm::EDGetTokenT<std::vector<SimVertex> > simvertexToken;
// edm::EDGetTokenT<std::vector<PSimHit> > PSimHitToken;
edm::EDGetTokenT<std::vector<TrackingParticle> > trackingParticleToken;
// edm::Handle<std::vector<PSimHit> > simhits;

double ptMin_;
double deltaR_;
Expand Down Expand Up @@ -179,12 +181,14 @@ class JetCorePerfectSeedGenerator : public edm::one::EDProducer<edm::one::Shared

std::vector<GlobalVector> splittedClusterDirections(const reco::Candidate&, const TrackerTopology* const, auto pp, const reco::Vertex& jetVertex, int );

std::vector<PSimHit> coreHitsFilling(auto,const GeomDet*,GlobalVector,const reco::Vertex&);
std::pair<std::vector<SimTrack>,std::vector<SimVertex>> coreTracksFilling(std::vector<PSimHit>, const auto &, const auto &);
// std::vector<PSimHit> coreHitsFilling(auto,const GeomDet*,GlobalVector,const reco::Vertex&);
// std::pair<std::vector<SimTrack>,std::vector<SimVertex>> coreTracksFilling(std::vector<PSimHit>, const auto &, const auto &);

std::vector<std::array<double,5>> seedParFilling(std::pair<std::vector<SimTrack>,std::vector<SimVertex>>,const GeomDet*);
// std::vector<std::array<double,5>> seedParFilling(std::pair<std::vector<SimTrack>,std::vector<SimVertex>>,const GeomDet*);
std::vector<std::array<double,5>> seedParFilling(std::vector<TrackingParticle>,const GeomDet*);

std::pair<std::vector<SimTrack>,std::vector<SimVertex>> coreTracksFillingDeltaR( const auto &, const auto &,const GeomDet* , const reco::Candidate& );
// std::pair<std::vector<SimTrack>,std::vector<SimVertex>> coreTracksFillingDeltaR( const auto &, const auto &,const GeomDet* , const reco::Candidate& );
std::vector<TrackingParticle> coreTracksFillingDeltaR( const auto &,const GeomDet* , const reco::Candidate& );


};
Expand Down
Expand Up @@ -116,7 +116,7 @@ double TrackAssociatorByPositionImpl::quality(const TrajectoryStateOnSurface& tr

RecoToSimCollection TrackAssociatorByPositionImpl::associateRecoToSim(
const edm::RefToBaseVector<reco::Track>& tCH, const edm::RefVector<TrackingParticleCollection>& tPCH) const {
RecoToSimCollection outputCollection;
RecoToSimCollection outputCollection(productGetter_);;
//for each reco track find a matching tracking particle
std::pair<unsigned int, unsigned int> minPair;
const double dQmin_default = 1542543;
Expand Down Expand Up @@ -168,7 +168,7 @@ RecoToSimCollection TrackAssociatorByPositionImpl::associateRecoToSim(

SimToRecoCollection TrackAssociatorByPositionImpl::associateSimToReco(
const edm::RefToBaseVector<reco::Track>& tCH, const edm::RefVector<TrackingParticleCollection>& tPCH) const {
SimToRecoCollection outputCollection;
SimToRecoCollection outputCollection(productGetter_);;
//for each tracking particle, find matching tracks.

std::pair<unsigned int, unsigned int> minPair;
Expand Down
Expand Up @@ -24,6 +24,10 @@

#include <map>

namespace edm {
class EDProductGetter;
}

//Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
//the track with the lowest association chi2 will be the first in the output map.

Expand All @@ -33,7 +37,8 @@ class TrackAssociatorByPositionImpl : public reco::TrackToTrackingParticleAssoci
typedef std::vector<SimHitTPPair> SimHitTPAssociationList;
enum class Method { chi2, dist, momdr, posdr };

TrackAssociatorByPositionImpl(const TrackingGeometry* geo,
TrackAssociatorByPositionImpl(edm::EDProductGetter const& productGetter,
const TrackingGeometry* geo,
const Propagator* prop,
const SimHitTPAssociationList* assocList,
double qMinCut,
Expand All @@ -42,7 +47,8 @@ class TrackAssociatorByPositionImpl : public reco::TrackToTrackingParticleAssoci
Method method,
bool minIfNoMatch,
bool considerAllSimHits)
: theGeometry(geo),
: productGetter_(&productGetter),
theGeometry(geo),
thePropagator(prop),
theSimHitsTPAssoc(assocList),
theQminCut(qMinCut),
Expand All @@ -64,7 +70,8 @@ class TrackAssociatorByPositionImpl : public reco::TrackToTrackingParticleAssoci

private:
double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface&) const;


edm::EDProductGetter const* productGetter_;
const TrackingGeometry* theGeometry;
const Propagator* thePropagator;
const SimHitTPAssociationList* theSimHitsTPAssoc;
Expand Down
Expand Up @@ -121,7 +121,8 @@ void TrackAssociatorByPositionProducer::produce(edm::StreamID,
iSetup.get<GlobalTrackingGeometryRecord>().get(theG);

std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl> impl{
new TrackAssociatorByPositionImpl(theG.product(),
new TrackAssociatorByPositionImpl(iEvent.productGetter(),
theG.product(),
theP.product(),
assocList.product(),
theQminCut,
Expand Down
1 change: 1 addition & 0 deletions Validation/RecoTrack/python/MultiTrackValidator_cfi.py
Expand Up @@ -102,6 +102,7 @@
doResolutionPlotsForLabels = cms.VInputTag(),

cores = cms.InputTag("highPtJetsForTrk"), #ak4CaloJets with pt>1 TeV

)

from Configuration.Eras.Modifier_fastSim_cff import fastSim
Expand Down
46 changes: 26 additions & 20 deletions Validation/RecoTrack/python/TrackValidation_cff.py
Expand Up @@ -2,6 +2,7 @@
import FWCore.ParameterSet.Config as cms

from SimTracker.TrackAssociatorProducers.trackAssociatorByChi2_cfi import *
from SimTracker.TrackAssociatorProducers.trackAssociatorByPosition_cfi import *
from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import *
from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import *
import Validation.RecoTrack.MultiTrackValidator_cfi
Expand Down Expand Up @@ -359,7 +360,7 @@ def _getMVASelectors(postfix):
)

# Select jets for JetCore tracking
highPtJets = cms.EDFilter("CandPtrSelector", src = cms.InputTag("ak4CaloJets"), cut = cms.string("pt()>1000"))
highPtJets = cms.EDFilter("CandPtrSelector", src = cms.InputTag("ak4CaloJets"), cut = cms.string("pt()>1000 && eta()<1.4 && eta()>-1.4"))
highPtJetsForTrk = highPtJetsForTrk = highPtJets.clone(src = "ak4CaloJetsForTrk")

# Select B-hadron TPs
Expand All @@ -372,25 +373,28 @@ def _getMVASelectors(postfix):
# UseAssociators = cms.bool(True)
)

# associatorByHitLoose = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone(
associatorByHitLoose = quickTrackAssociatorByHits.clone(
# AbsoluteNumberOfHits = cms.bool(False),
Cut_RecoToSim = cms.double(0.5),
# SimToRecoDenominator = cms.string('reco'), # either "sim" or "reco"
Quality_SimToReco = cms.double(0.3),
Purity_SimToReco = cms.double(0.5),
# ThreeHitTracksAreSpecial = cms.bool(True),
# PixelHitWeight = cms.double(1.0),
# useClusterTPAssociation = cms.bool(True),
# cluster2TPSrc = cms.InputTag("tpClusterProducer")
usePixels = cms.bool(False)
)
# associatorByHitLoose = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone()
# associatorByHitLoose = quickTrackAssociatorByHits.clone(
# Cut_RecoToSim = cms.double(0.5),
# Quality_SimToReco = cms.double(0.3),
# Purity_SimToReco = cms.double(0.5),
# ThreeHitTracksAreSpecial =cms.bool(False),
# usePixels = cms.bool(False)
# )

# MTVTrackAssociationByHitsLoose = trackingParticleRecoTrackAsssociation.clone(
# associator = cms.InputTag('associatorByHitLoose'),
# )

MTVTrackAssociationByHitsLoose = trackingParticleRecoTrackAsssociation.clone(
associator = cms.InputTag('associatorByHitLoose'),
# UseAssociators = cms.bool(True)
)
# associatorByDeltaR = trackAssociatorByPosition.clone(
# QCut = cms.double(0.01),
# method = cms.string('momdr'),
# ConsiderAllSimHits = cms.bool(False)
# )
# MTVTrackAssociationByDeltaR = trackingParticleRecoTrackAsssociation.clone(
# associator = cms.InputTag('associatorByDeltaR'),
# # UseAssociators = cms.bool(True)
# )


## MTV instances
Expand Down Expand Up @@ -688,8 +692,10 @@ def _uniqueFirstLayers(layerList):
tpClusterProducerPreSplitting,
# trackAssociatorByChi2, #uncomment for byChi2 assoc. for jetcore studies (4/5)
# MTVTrackAssociationByChi2, #uncomment for byChi2 assoc. for jetcore studies (5/5)
associatorByHitLoose,
MTVTrackAssociationByHitsLoose,
# associatorByHitLoose,
# associatorByDeltaR,
# MTVTrackAssociationByHitsLoose,
# MTVTrackAssociationByDeltaR,
quickTrackAssociatorByHits,
quickTrackAssociatorByHitsPreSplitting,
trackingParticleRecoTrackAsssociation,
Expand Down

0 comments on commit 86a8b6e

Please sign in to comment.