Skip to content

Commit

Permalink
Merge pull request #13594 from VinInn/GSFfixes
Browse files Browse the repository at this point in the history
Gsf cleanup and debug
  • Loading branch information
cmsbuild committed Mar 8, 2016
2 parents 355ecfc + d99ca5b commit 105ac8d
Show file tree
Hide file tree
Showing 28 changed files with 631 additions and 599 deletions.
11 changes: 11 additions & 0 deletions DataFormats/Math/interface/invertPosDefMatrix.h
Expand Up @@ -17,6 +17,17 @@ inline bool invertPosDefMatrix(ROOT::Math::SMatrix<T,N,N,ROOT::Math::MatRepSym<T

}

template<>
inline bool invertPosDefMatrix<double,1>(ROOT::Math::SMatrix<double,1,1,ROOT::Math::MatRepSym<double,1> > & m) {
m(0,0) = 1./m(0,0);
return true;
}
template<>
inline bool invertPosDefMatrix<float,1>(ROOT::Math::SMatrix<float,1,1,ROOT::Math::MatRepSym<float,1> > & m) {
m(0,0) = 1.f/m(0,0);
return true;
}

template<typename T,unsigned int N>
inline bool invertPosDefMatrix(ROOT::Math::SMatrix<T,N,N,ROOT::Math::MatRepSym<T,N> > const & mIn,
ROOT::Math::SMatrix<T,N,N,ROOT::Math::MatRepSym<T,N> > & mOut) {
Expand Down
9 changes: 6 additions & 3 deletions RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc
Expand Up @@ -200,7 +200,7 @@ GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup)
auto const & Tj=*(tjCollection.product());

LogDebug("GoodSeedProducer")<<"Number of tracks in collection "
<<tracksContainers_[istr] <<" to be analyzed "
<<"tracksContainers_[" << istr << "] to be analyzed "
<<Tj.size();

//loop over the track collection
Expand Down Expand Up @@ -423,7 +423,8 @@ GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup)
GoodPreId= GoodTkId | GoodMatching;

myPreId.setFinalDecision(GoodPreId);


#ifdef EDM_ML_DEBUG
if(GoodPreId)
LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<<
"GeV/c, eta= "<<Tk[i].eta() <<
Expand All @@ -432,8 +433,10 @@ GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup)
LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<<
"GeV/c, eta= "<<Tk[i].eta() <<
") preidentified only for track properties";

#endif

} // end of !disablePreId_


if (GoodPreId){
//NEW SEED with n hits
Expand Down
2 changes: 1 addition & 1 deletion RecoParticleFlow/PFTracking/plugins/PFV0Producer.cc
Expand Up @@ -47,7 +47,7 @@ PFV0Producer::produce(Event& iEvent, const EventSetup& iSetup)
for (unsigned int il=0; il<V0list_.size(); il++){
Handle<VertexCompositeCandidateCollection> V0coll;
iEvent.getByToken(V0list_[il],V0coll);
LogDebug("PFV0Producer")<<V0list_[il]<<" contains "<<V0coll->size()<<" V0 candidates ";
LogDebug("PFV0Producer")<< "V0list_[" << il <<"] contains "<<V0coll->size()<<" V0 candidates ";
for (unsigned int iv=0;iv<V0coll->size();iv++){
VertexCompositeCandidateRef V0(V0coll, iv);
vector<TrackRef> Tracks;
Expand Down
59 changes: 32 additions & 27 deletions RecoTracker/TrackProducer/src/TrackProducerAlgorithm.cc
Expand Up @@ -30,8 +30,10 @@
#include "TrackingTools/TrackFitters/interface/RecHitSorter.h"
#include "DataFormats/TrackReco/interface/TrackBase.h"

#include<sstream>

// #define VI_DEBUG
#define STAT_TSB
// #define STAT_TSB

#ifdef VI_DEBUG
#define DPRINT(x) std::cout << x << ": "
Expand Down Expand Up @@ -257,33 +259,36 @@ TrackProducerAlgorithm<reco::GsfTrack>::buildTrack (const TrajectoryFitter * the

auto theTraj = new Trajectory( std::move(trajTmp) );
theTraj->setSeedRef(seedRef);

// TrajectoryStateOnSurface innertsos;
// TrajectoryStateOnSurface outertsos;

// if (theTraj->direction() == alongMomentum) {
// innertsos = theTraj->firstMeasurement().updatedState();
// outertsos = theTraj->lastMeasurement().updatedState();
// } else {
// innertsos = theTraj->lastMeasurement().updatedState();
// outertsos = theTraj->firstMeasurement().updatedState();
// }
// std::cout
// << "Nr. of first / last states = "
// << innertsos.components().size() << " "
// << outertsos.components().size() << std::endl;
// std::vector<TrajectoryStateOnSurface> components =
// innertsos.components();
// double sinTheta =
// sin(innertsos.globalMomentum().theta());
// for ( std::vector<TrajectoryStateOnSurface>::const_iterator ic=components.begin();
// ic!=components.end(); ic++ ) {
// std::cout << " comp " << ic-components.begin() << " "
// << (*ic).weight() << " "
// << (*ic).localParameters().vector()[0]/sinTheta << " "
// << sqrt((*ic).localError().matrix()[0][0])/sinTheta << std::endl;
// }

#ifdef EDM_ML_DEBUG
TrajectoryStateOnSurface innertsos;
TrajectoryStateOnSurface outertsos;

if (theTraj->direction() == alongMomentum) {
innertsos = theTraj->firstMeasurement().updatedState();
outertsos = theTraj->lastMeasurement().updatedState();
} else {
innertsos = theTraj->lastMeasurement().updatedState();
outertsos = theTraj->firstMeasurement().updatedState();
}
std::ostringstream ss;
auto dc = [&](TrajectoryStateOnSurface const & tsos){
std::vector<TrajectoryStateOnSurface> const & components = tsos.components();
auto sinTheta = std::sin(tsos.globalMomentum().theta());
for (auto const & ic : components) ss << ic.weight() << "/"; ss << "\n";
for (auto const & ic : components) ss << ic.localParameters().vector()[0]/sinTheta << "/"; ss << "\n";
for (auto const & ic : components) ss << std::sqrt(ic.localError().matrix()(0,0))/sinTheta << "/";
};
ss << "\ninner comps\n";
dc(innertsos);
ss << "\nouter comps\n";
dc(outertsos);
LogDebug("TrackProducer")
<< "Nr. of first / last states = "
<< innertsos.components().size() << " "
<< outertsos.components().size() << ss.str();
#endif

ndof = 0;
for (auto const & tm : theTraj->measurements()) {
auto const & h = tm.recHitR();
Expand Down
99 changes: 30 additions & 69 deletions RecoTracker/TrackProducer/test/TrackRefit.py
@@ -1,80 +1,41 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("Refitting")

### standard MessageLoggerConfiguration
process.load("FWCore.MessageService.MessageLogger_cfi")
process = cms.Process("Refitting")

### Standard Configurations
process.load("Configuration.StandardSequences.Services_cff")
process.load('Configuration/StandardSequences/GeometryIdeal_cff')
process.load('Configuration/StandardSequences/Reconstruction_cff')
process.load('Configuration/StandardSequences/MagneticField_AutoFromDBCurrent_cff')


## Fitter-smoother: loosen outlier rejection as for first data-taking with LHC "collisions"
process.KFFittingSmootherWithOutliersRejectionAndRK.BreakTrajWith2ConsecutiveMissing = False
process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut = 1000
#process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
#process.load("Configuration.StandardSequences.MagneticField_cff")
#process.load('Configuration.Geometry.GeometryRecoDB_cff')
#process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")

process.load('Configuration.StandardSequences.Services_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.RawToDigi_cff')
process.load('Configuration.StandardSequences.L1Reco_cff')
process.load('Configuration.StandardSequences.Reconstruction_cff')

process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
# choose!
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data_GRun', '')
# process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc_GRun', '')



### Conditions
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
#process.GlobalTag.globaltag = "IDEAL_V5::All"
process.GlobalTag.globaltag = 'GR09_P_V6::All'

### Track refitter specific stuff
process.load("RecoTracker.TrackProducer.TrackRefitters_cff") #the correct one
#process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff") #the one for backward compatibility


process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)
)

process.source = cms.Source("PoolSource",
### tracks from collisions
fileNames = cms.untracked.vstring(
'rfio:/castor/cern.ch/user/c/chiochia/09_beam_commissioning/BSCskim_123151_Express.root')
#'/store/relval/CMSSW_2_1_10/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/IDEAL_V9_v1/0001/1E04FC31-F99A-DD11-94EE-0018F3D096DE.root')

### tracks from cosmics
# fileNames = cms.untracked.vstring(
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/005F51E5-0373-DD11-B6FA-001731AF6B7D.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/005F51E5-0373-DD11-B6FA-001731AF6B7D.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/006F3A6A-0373-DD11-A8E7-00304876A0FF.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02CF5B1E-6476-DD11-A034-003048769E65.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02DF31C3-A775-DD11-91C2-001A92971BB8.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02F71F56-CE74-DD11-9DD0-001A92810AE4.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0446C89C-E072-DD11-A341-0018F3D0960C.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/04750FC3-3E73-DD11-B054-00304876A147.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/04DFD531-0473-DD11-964E-0018F3D096AE.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/067111FB-3873-DD11-AD86-00304875A9C5.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/067982F4-E175-DD11-99F7-001731AF6AC5.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0680EB9B-4F73-DD11-83F8-0018F3D0962E.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/06BF1AF3-E175-DD11-B467-00304876A147.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A3843F3-E175-DD11-8419-003048767EE7.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A5AAABA-3973-DD11-B949-003048767FA1.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A911B18-0273-DD11-A5A6-001731A283E1.root')

### tracks from beam halo muons
)

process.TRACKS = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *_*_*_*',
'keep recoTracks_*_*_*',
'keep recoTrackExtras_*_*_*',
'keep TrackingRecHitsOwned_*_*_*'),

fileName = cms.untracked.string('refitting.root')
)
process.load("RecoTracker.TrackProducer.TrackRefitter_cfi")
process.TrackRefitter.NavigationSchool = ''
process.TrackRefitter.Fitter = 'FlexibleKFFittingSmoother'

process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
process.source = cms.Source ("PoolSource",
fileNames=cms.untracked.vstring('file:pickevents_1.root',
),
skipEvents=cms.untracked.uint32(0)
)

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))

process.p1 = cms.Path(process.TrackRefitter
#process.TrackRefitterP5
#process.TrackRefitterBHM
)
process.outpath = cms.EndPath(process.TRACKS)
process.Path = cms.Path(process.TrackRefitter)


80 changes: 80 additions & 0 deletions RecoTracker/TrackProducer/test/TrackRefitOld.py
@@ -0,0 +1,80 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("Refitting")

### standard MessageLoggerConfiguration
process.load("FWCore.MessageService.MessageLogger_cfi")

### Standard Configurations
process.load("Configuration.StandardSequences.Services_cff")
process.load('Configuration/StandardSequences/GeometryIdeal_cff')
process.load('Configuration/StandardSequences/Reconstruction_cff')
process.load('Configuration/StandardSequences/MagneticField_AutoFromDBCurrent_cff')


## Fitter-smoother: loosen outlier rejection as for first data-taking with LHC "collisions"
process.KFFittingSmootherWithOutliersRejectionAndRK.BreakTrajWith2ConsecutiveMissing = False
process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut = 1000



### Conditions
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
#process.GlobalTag.globaltag = "IDEAL_V5::All"
process.GlobalTag.globaltag = 'GR09_P_V6::All'

### Track refitter specific stuff
process.load("RecoTracker.TrackProducer.TrackRefitters_cff") #the correct one
#process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff") #the one for backward compatibility


process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)
)

process.source = cms.Source("PoolSource",
### tracks from collisions
fileNames = cms.untracked.vstring(
'rfio:/castor/cern.ch/user/c/chiochia/09_beam_commissioning/BSCskim_123151_Express.root')
#'/store/relval/CMSSW_2_1_10/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG-RECO/IDEAL_V9_v1/0001/1E04FC31-F99A-DD11-94EE-0018F3D096DE.root')

### tracks from cosmics
# fileNames = cms.untracked.vstring(
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/005F51E5-0373-DD11-B6FA-001731AF6B7D.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/005F51E5-0373-DD11-B6FA-001731AF6B7D.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/006F3A6A-0373-DD11-A8E7-00304876A0FF.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02CF5B1E-6476-DD11-A034-003048769E65.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02DF31C3-A775-DD11-91C2-001A92971BB8.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/02F71F56-CE74-DD11-9DD0-001A92810AE4.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0446C89C-E072-DD11-A341-0018F3D0960C.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/04750FC3-3E73-DD11-B054-00304876A147.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/04DFD531-0473-DD11-964E-0018F3D096AE.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/067111FB-3873-DD11-AD86-00304875A9C5.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/067982F4-E175-DD11-99F7-001731AF6AC5.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0680EB9B-4F73-DD11-83F8-0018F3D0962E.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/06BF1AF3-E175-DD11-B467-00304876A147.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A3843F3-E175-DD11-8419-003048767EE7.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A5AAABA-3973-DD11-B949-003048767FA1.root',
# '/store/data/CRUZET4_v1/Cosmics/RECO/CRZT210_V1_SuperPointing_v1/0000/0A911B18-0273-DD11-A5A6-001731A283E1.root')

### tracks from beam halo muons
)

process.TRACKS = cms.OutputModule("PoolOutputModule",
outputCommands = cms.untracked.vstring('drop *_*_*_*',
'keep recoTracks_*_*_*',
'keep recoTrackExtras_*_*_*',
'keep TrackingRecHitsOwned_*_*_*'),

fileName = cms.untracked.string('refitting.root')
)

process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )


process.p1 = cms.Path(process.TrackRefitter
#process.TrackRefitterP5
#process.TrackRefitterBHM
)
process.outpath = cms.EndPath(process.TRACKS)


0 comments on commit 105ac8d

Please sign in to comment.