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

porting 10_5_0_pre2->11_1_0_pre7 #6

Open
wants to merge 25 commits into
base: CMSSW_11_1_0_pre7_trackjet_merged
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1b5ad0b
Merged CMSSW_10_4_0_pre4_trackjet_DQM from repository vberta with cms…
arizzi Mar 4, 2019
53daf78
crashing version of jetCoreDirectSeedGenerator
vberta Nov 5, 2018
57b12b4
debug added to TkSeedGenerator
vberta Nov 11, 2018
ab2aa08
debug and change input
vberta Nov 12, 2018
3c9d363
bug in input and eta/phi output
vberta Nov 12, 2018
9ae6b41
polar bug solved
vberta Nov 12, 2018
30bc756
protect electrons from jetcore with NN. Various tuning in jetcore
arizzi Dec 7, 2018
6ac3652
relax some cuts because of hitless seeds
arizzi Dec 7, 2018
7072cf9
network with pt
arizzi Feb 27, 2019
7b2249b
forgotten .h file
arizzi Mar 4, 2019
0f0d9a0
Merged jetcoreNN_from10_5_0_pre2 from repository arizzi with cms-merg…
vberta Mar 4, 2019
8daa022
integrated, associatorchi2 and looseHits, perfectseed
vberta Mar 12, 2019
a1b1f35
backup of jetcore
vberta Mar 15, 2019
b85a5c1
DON T KNOW modification (done in the past, this is a backup
vberta Sep 23, 2019
aff3b6d
perfect seed noTrackingParticles, bugFix
vberta Feb 17, 2020
90239d3
perfect seed bug solving
vberta Feb 17, 2020
0253beb
Merge branch 'CMSSW_10_5_0_pre2_trackjet_integration_DONTKNOW-news_up…
vberta Mar 3, 2020
d1b1067
eta range 1.4 set
vberta Mar 3, 2020
1d02e30
Merge branch 'CMSSW_10_5_0_pre2_trackjet_integration_perfectseed' of …
vberta Mar 3, 2020
af9fee1
Merge pull request #4 from vberta/CMSSW_10_5_0_pre2_trackjet_integrat…
vberta Mar 3, 2020
8f2604c
activation of deepCore
vberta Mar 3, 2020
6955449
disabled rebuilding, changed name of jetcore collection, seed validat…
vberta Apr 30, 2020
5f10046
seed validation debugging, disabled(commented) here
vberta Apr 30, 2020
6fb4e0c
hit2DContraint lines
vberta Apr 30, 2020
700870e
disabling hit2dcontraint
vberta Apr 30, 2020
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 @@ -35,7 +35,7 @@

//////////////////////////////////////////////////////////////////////////////////////////
//
LowPtGsfElectronSeedProducer::LowPtGsfElectronSeedProducer( const edm::ParameterSet& conf,
LowPtGsfElectronSeedProducer::LowPtGsfElectronSeedProducer( const edm::ParameterSet& conf,
const lowptgsfeleseed::HeavyObjectCache* ) :
field_(),
fitterPtr_(),
Expand All @@ -57,7 +57,7 @@ LowPtGsfElectronSeedProducer::LowPtGsfElectronSeedProducer( const edm::Parameter
maxPtThreshold_(conf.getParameter<double>("MaxPtThreshold"))
{
if ( usePfTracks_ ) {
pfTracks_ = consumes<reco::PFRecTrackCollection>(conf.getParameter<edm::InputTag>("pfTracks"));
pfTracks_ = consumes<reco::PFRecTrackCollection>(conf.getParameter<edm::InputTag>("pfTracks"));
hcalClusters_ = consumes<reco::PFClusterCollection>(conf.getParameter<edm::InputTag>("hcalClusters"));
}
kfTracks_ = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("tracks"));
Expand All @@ -74,26 +74,26 @@ LowPtGsfElectronSeedProducer::~LowPtGsfElectronSeedProducer() {}

//////////////////////////////////////////////////////////////////////////////////////////
//
void LowPtGsfElectronSeedProducer::beginLuminosityBlock( edm::LuminosityBlock const&,
edm::EventSetup const& setup )
void LowPtGsfElectronSeedProducer::beginLuminosityBlock( edm::LuminosityBlock const&,
edm::EventSetup const& setup )
{
setup.get<IdealMagneticFieldRecord>().get(field_);
}

//////////////////////////////////////////////////////////////////////////////////////////
//
void LowPtGsfElectronSeedProducer::produce( edm::Event& event,
const edm::EventSetup& setup )
void LowPtGsfElectronSeedProducer::produce( edm::Event& event,
const edm::EventSetup& setup )
{

// Products
auto seeds = std::make_unique<reco::ElectronSeedCollection>();
auto ecalPreIds = std::make_unique<reco::PreIdCollection>();
auto hcalPreIds = std::make_unique<reco::PreIdCollection>();

const edm::RefProd<reco::PreIdCollection> preIdsRefProd =
event.getRefBeforePut<reco::PreIdCollection>();

// HCAL clusters (only used with PF tracks)
edm::Handle<reco::PFClusterCollection> hcalClusters;

Expand All @@ -102,14 +102,14 @@ void LowPtGsfElectronSeedProducer::produce( edm::Event& event,
event.getByToken(kfTracks_, kfTracks);

TrackIndxMap trksToPreIdIndx;
if ( usePfTracks_ ) {
if ( usePfTracks_ ) {

edm::Handle<reco::PFRecTrackCollection> pfTracks;
event.getByToken(pfTracks_, pfTracks);
event.getByToken(hcalClusters_,hcalClusters);

//check consistency between kfTracks and pfTracks collection
for(auto& trk : *pfTracks){
for(auto& trk : *pfTracks){
if(trk.trackRef().isNonnull()){
if(trk.trackRef().id() != kfTracks.id()){
throw cms::Exception("ConfigError") << "kfTracks is not the collection that pfTracks was built from, please fix this";
Expand All @@ -127,7 +127,7 @@ void LowPtGsfElectronSeedProducer::produce( edm::Event& event,
event,
setup);

} else {
} else {

loop(kfTracks, // KF tracks
hcalClusters,
Expand All @@ -149,13 +149,13 @@ void LowPtGsfElectronSeedProducer::produce( edm::Event& event,
fillPreIdRefValueMap(kfTracks,trksToPreIdIndx,ecalPreIdsHandle,mapFiller);
mapFiller.fill();
event.put(std::move(preIdVMOut));

}

//////////////////////////////////////////////////////////////////////////////////////////
// Return reco::Track from edm::Ref<T>

reco::TrackRef LowPtGsfElectronSeedProducer::getBaseRef( edm::Handle< std::vector<reco::Track> > handle, int idx ) const
reco::TrackRef LowPtGsfElectronSeedProducer::getBaseRef( edm::Handle< std::vector<reco::Track> > handle, int idx ) const
{
return reco::TrackRef(handle,idx);
}
Expand All @@ -166,22 +166,22 @@ reco::TrackRef LowPtGsfElectronSeedProducer::getBaseRef( edm::Handle< std::vecto
}

//////////////////////////////////////////////////////////////////////////////////////////
// Template function, instantiated for both reco::Tracks and reco::PFRecTracks
// Template function, instantiated for both reco::Tracks and reco::PFRecTracks
template <typename T>
void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& handle, // PF or KF tracks
edm::Handle<reco::PFClusterCollection>& hcalClusters,
reco::ElectronSeedCollection& seeds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& hcalPreIds,
TrackIndxMap& trksToPreIdIndx,
edm::Event& event,
const edm::EventSetup& setup )
{

// Pileup
edm::Handle<double> rho;
event.getByToken(rho_,rho);

// Beam spot
edm::Handle<reco::BeamSpot> spot;
event.getByToken(beamSpot_,spot);
Expand Down Expand Up @@ -209,7 +209,7 @@ void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& ha

// Utility to access to shower shape vars
noZS::EcalClusterLazyTools ecalTools(event,setup,ebRecHits_,eeRecHits_);

// Ensure each cluster is only matched once to a track
std::vector<int> matchedEcalClusters;
std::vector<int> matchedHcalClusters;
Expand All @@ -218,7 +218,7 @@ void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& ha
seeds.reserve(handle->size());
ecalPreIds.reserve(handle->size());
hcalPreIds.reserve(handle->size());

// Iterate through (PF or KF) tracks
for ( unsigned int itrk = 0; itrk < handle.product()->size(); itrk++ ) {

Expand All @@ -227,11 +227,11 @@ void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& ha

if ( !(trackRef->quality(reco::TrackBase::qualityByName("highPurity"))) ) { continue; }
if ( !passThrough_ && ( trackRef->pt() < minPtThreshold_ ) ) { continue; }

// Create ElectronSeed
if(trackRef->algo() == 11) continue; //Skip jetcore tracks because the seeds are hitless
// Create ElectronSeed
reco::ElectronSeed seed( *(trackRef->seedRef()) );
seed.setCtfTrack(trackRef);

// Create PreIds
unsigned int nModels = globalCache()->modelNames().size();
reco::PreId ecalPreId(nModels);
Expand All @@ -249,16 +249,16 @@ void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& ha
matchedHcalClusters,
ecalPreId,
hcalPreId );

// Add variables related to GSF tracks to PreId
lightGsfTracking(ecalPreId,trackRef,seed,setup);
lightGsfTracking(ecalPreId,trackRef,seed,setup);

// Decision based on BDT
// Decision based on BDT
bool result = decision(templatedRef,ecalPreId,hcalPreId,*rho,*spot,ecalTools);

// If fails BDT, do not store seed
if ( !result ) { continue; }

// Store PreId
ecalPreIds.push_back(ecalPreId);
hcalPreIds.push_back(hcalPreId);
Expand All @@ -273,23 +273,23 @@ void LowPtGsfElectronSeedProducer::loop( const edm::Handle< std::vector<T> >& ha

//////////////////////////////////////////////////////////////////////////////////////////
// Template instantiation for reco::Tracks
template
template
void LowPtGsfElectronSeedProducer::loop<reco::Track>( const edm::Handle< std::vector<reco::Track> >&,
edm::Handle<reco::PFClusterCollection>& hcalClusters,
reco::ElectronSeedCollection& seeds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& hcalPreIds,
TrackIndxMap& trksToPreIdIndx,
edm::Event&,
const edm::EventSetup& );

//////////////////////////////////////////////////////////////////////////////////////////
// Template instantiation for reco::PFRecTracks
template
template
void LowPtGsfElectronSeedProducer::loop<reco::PFRecTrack>( const edm::Handle< std::vector<reco::PFRecTrack> >&,
edm::Handle<reco::PFClusterCollection>& hcalClusters,
reco::ElectronSeedCollection& seeds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& hcalPreIds,
TrackIndxMap& trksToPreIdIndx,
edm::Event&,
Expand All @@ -302,8 +302,8 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::PFRecTrackR
const edm::Handle<reco::PFClusterCollection>& hcalClusters,
std::vector<int>& matchedEcalClusters,
std::vector<int>& matchedHcalClusters,
reco::PreId& ecalPreId,
reco::PreId& hcalPreId )
reco::PreId& ecalPreId,
reco::PreId& hcalPreId )
{
propagateTrackToCalo( pfTrackRef, ecalClusters, matchedEcalClusters, ecalPreId, true );
propagateTrackToCalo( pfTrackRef, hcalClusters, matchedHcalClusters, hcalPreId, false );
Expand All @@ -326,7 +326,7 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::PFRecTrackR
float dphi = 1.e6;
math::XYZPoint showerPos = math::XYZPoint(0.,0.,0.);
} info;

// Find closest "seed cluster" to KF track extrapolated to ECAL (or HCAL)
reco::PFTrajectoryPoint point;
if ( ecal ) { point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax); }
Expand All @@ -348,7 +348,7 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::PFRecTrackR
info.dr2min = dr2;
info.cluRef = cluRef;
info.deta = cluRef->positionREP().eta() - point.positionREP().eta();
info.dphi =
info.dphi =
reco::deltaPhi( cluRef->positionREP().phi(), point.positionREP().phi() ) *
pfTrackRef->trackRef()->charge();
info.showerPos = point.position();
Expand All @@ -358,11 +358,11 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::PFRecTrackR
}

// Set PreId content if match found
if ( info.dr2min < 1.e5 ) {
if ( info.dr2min < 1.e5 ) {
float ep = info.cluRef->correctedEnergy() / std::sqrt( pfTrackRef->trackRef()->innerMomentum().mag2() );
preId.setECALMatchingProperties( info.cluRef,
point.position(), // ECAL or HCAL surface
info.showerPos, //
info.showerPos, //
info.deta,
info.dphi,
0.f, // chieta
Expand All @@ -382,8 +382,8 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::TrackRef& k
const edm::Handle<reco::PFClusterCollection>& hcalClusters, // not used
std::vector<int>& matchedEcalClusters,
std::vector<int>& matchedHcalClusters, // not used
reco::PreId& ecalPreId,
reco::PreId& hcalPreId /* not used */ )
reco::PreId& ecalPreId,
reco::PreId& hcalPreId /* not used */ )
{

// Store info for PreId
Expand All @@ -410,24 +410,24 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::TrackRef& k
particle.setCharge(kfTrackRef->charge());
particle.propagateToEcalEntrance(false);
if ( particle.getSuccess() == 0 ) { return; }

// ECAL entry point for track
GlobalPoint ecal_pos(particle.vertex().x(),
particle.vertex().y(),
particle.vertex().z());

// Preshower limit
bool below_ps = pow(ecal_pos.z(),2.) > boundary_*ecal_pos.perp2();
// Iterate through ECAL clusters

// Iterate through ECAL clusters
for ( unsigned int iclu = 0; iclu < ecalClusters.product()->size(); iclu++ ) {
reco::PFClusterRef cluRef(ecalClusters,iclu);

// Correct ecal_pos for shower depth
// Correct ecal_pos for shower depth
double shower_depth = reco::PFCluster::getDepthCorrection(cluRef->correctedEnergy(),
below_ps,
false);
GlobalPoint showerPos = ecal_pos +
GlobalPoint showerPos = ecal_pos +
GlobalVector(particle.momentum().x(),
particle.momentum().y(),
particle.momentum().z()).unit() * shower_depth;
Expand All @@ -440,12 +440,12 @@ void LowPtGsfElectronSeedProducer::propagateTrackToCalo( const reco::TrackRef& k
info.dr2min = dr2;
info.cluRef = cluRef;
info.deta = std::abs( cluRef->positionREP().eta() - showerPos.eta() );
info.dphi =
std::abs( reco::deltaPhi( cluRef->positionREP().phi(), showerPos.phi() )) *
info.dphi =
std::abs( reco::deltaPhi( cluRef->positionREP().phi(), showerPos.phi() )) *
kfTrackRef->charge();
info.showerPos = showerPos;
}

}

// Populate PreId object
Expand Down Expand Up @@ -478,7 +478,7 @@ bool LowPtGsfElectronSeedProducer::lightGsfTracking( reco::PreId& preId,
for ( unsigned int ihit = 0; ihit < trackRef->recHitsSize(); ++ihit ) {
hits.push_back( trackRef->recHit(ihit)->cloneSH() );
}

GlobalVector gv( trackRef->innerMomentum().x(),
trackRef->innerMomentum().y(),
trackRef->innerMomentum().z() );
Expand Down Expand Up @@ -535,7 +535,7 @@ bool LowPtGsfElectronSeedProducer::decision( const reco::PFRecTrackRef& pfTrackR
}

//////////////////////////////////////////////////////////////////////////////////////////
//
//
bool LowPtGsfElectronSeedProducer::decision( const reco::TrackRef& kfTrackRef,
reco::PreId& ecalPreId,
reco::PreId& hcalPreId,
Expand All @@ -546,7 +546,7 @@ bool LowPtGsfElectronSeedProducer::decision( const reco::TrackRef& kfTrackRef,
// No implementation currently
return passThrough_;
}

template<typename CollType>
void LowPtGsfElectronSeedProducer::fillPreIdRefValueMap( edm::Handle<CollType> tracksHandle,
const TrackIndxMap& trksToPreIdIndx,
Expand Down
2 changes: 1 addition & 1 deletion RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup)
for(unsigned int i=0;i<Tk.size();++i){
if (useQuality_ &&
(!(Tk[i].quality(trackQuality_)))) continue;

if(Tk[i].algo() == 11) continue; //Skip jetcore tracks because the seeds are hitless
reco::PreId myPreId;
bool GoodPreId=false;

Expand Down
1 change: 1 addition & 0 deletions RecoTracker/CkfPattern/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<use name="TrackingTools/TrajectoryCleaning"/>
<use name="TrackingTools/TrajectoryFiltering"/>
<use name="TrackingTools/TrackFitters"/>
<use name="TrackPropagation/SteppingHelixPropagator"/>
<use name="boost"/>
<use name="root"/>
Loading