Skip to content

Commit

Permalink
Merge pull request #15194 from VinInn/HipMitigation2
Browse files Browse the repository at this point in the history
Make Hip mitigation configurable
  • Loading branch information
davidlange6 committed Jul 18, 2016
2 parents 8be85ba + 93dbb05 commit bb4c80e
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 63 deletions.
10 changes: 5 additions & 5 deletions RecoMuon/GlobalMuonProducer/python/globalMuons_cff.py
Expand Up @@ -12,11 +12,11 @@
from RecoTracker.TransientTrackingRecHit.TransientTrackingRecHitBuilderWithoutRefit_cfi import *
from TrackingTools.TrackRefitter.TracksToTrajectories_cff import *
from RecoMuon.GlobalMuonProducer.globalMuons_cfi import *
Chi2EstimatorForMuRefit = cms.ESProducer("Chi2MeasurementEstimatorESProducer",
ComponentName = cms.string('Chi2EstimatorForMuRefit'),
nSigma = cms.double(3.0),
MaxChi2 = cms.double(100000.0)
)
import TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi
Chi2EstimatorForMuRefit = TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi.Chi2MeasurementEstimator.clone()
Chi2EstimatorForMuRefit.ComponentName = cms.string('Chi2EstimatorForMuRefit')
Chi2EstimatorForMuRefit.nSigma = 3.0
Chi2EstimatorForMuRefit.MaxChi2 = 100000.0


from TrackingTools.TrackFitters.TrackFitters_cff import *
Expand Down
10 changes: 5 additions & 5 deletions RecoMuon/TrackingTools/python/MuonTrackLoader_cff.py
Expand Up @@ -3,11 +3,11 @@
from TrackingTools.KalmanUpdators.KFUpdatorESProducer_cfi import *
from TrackingTools.GeomPropagators.SmartPropagator_cff import *
from RecoMuon.TrackingTools.MuonUpdatorAtVertex_cff import *
Chi2EstimatorForMuonTrackLoader = cms.ESProducer("Chi2MeasurementEstimatorESProducer",
ComponentName = cms.string('Chi2EstimatorForMuonTrackLoader'),
nSigma = cms.double(3.0),
MaxChi2 = cms.double(100000.0)
)
import TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi
Chi2EstimatorForMuonTrackLoader = TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi.Chi2MeasurementEstimator.clone()
Chi2EstimatorForMuonTrackLoader.ComponentName = cms.string('Chi2EstimatorForMuonTrackLoader')
Chi2EstimatorForMuonTrackLoader.nSigma = 3.0
Chi2EstimatorForMuonTrackLoader.MaxChi2 = 100000.0

import TrackingTools.TrackFitters.KFTrajectorySmoother_cfi
KFSmootherForMuonTrackLoader = TrackingTools.TrackFitters.KFTrajectorySmoother_cfi.KFTrajectorySmoother.clone(
Expand Down
Expand Up @@ -14,7 +14,7 @@
Chi2MeasurementEstimatorForP5.nSigma = 4.
Chi2MeasurementEstimatorForP5.MaxDisplacement = 100
Chi2MeasurementEstimatorForP5.MaxSagitta=-1

Chi2MeasurementEstimatorForP5.MinPtForHitRecoveryInGluedDet=100000
# PropagatorWithMaterialESProducer
from TrackingTools.MaterialEffects.MaterialPropagator_cfi import *
# PropagatorWithMaterialESProducer
Expand Down
@@ -0,0 +1,11 @@
import FWCore.ParameterSet.Config as cms
def esproducers_by_type(process, *types):
return (module for module in process._Process__esproducers.values() if module._TypedParameterizable__type in types)
def customizeMinPtForHitRecoveryInGluedDet(process,value):
for esp in esproducers_by_type(process, "Chi2MeasurementEstimatorESProducer", "Chi2ChargeMeasurementEstimatorESProducer"):
esp.MinPtForHitRecoveryInGluedDet = cms.double(value)
return process
def customizeHitRecoveryInGluedDetOff(process):
return customizeMinPtForHitRecoveryInGluedDet(process,1000000)


Expand Up @@ -98,8 +98,7 @@ bool Chi2ChargeMeasurementEstimator::preFilter(const TrajectoryStateOnSurface& t
#include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
#include <memory>

#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorParams.h"


namespace {
Expand All @@ -120,13 +119,7 @@ class Chi2ChargeMeasurementEstimatorESProducer: public edm::ESProducer{
void
Chi2ChargeMeasurementEstimatorESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {

// edm::ParameterSetDescription desc = Chi2MeasurementEstimatorESProducer::getFilledConfigurationDescription();
edm::ParameterSetDescription desc;
desc.add<double>("MaxChi2",30);
desc.add<double>("nSigma",3);
desc.add<double>("MaxDisplacement",0.5);
desc.add<double>("MaxSagitta",2.);
desc.add<double>("MinimalTolerance",0.5);
auto desc = chi2MeasurementEstimatorParams::getFilledConfigurationDescription();
desc.add<std::string>("ComponentName","Chi2Charge");
desc.add<double>("pTChargeCutThreshold",-1.);
edm::ParameterSetDescription descCCC = getFilledConfigurationDescription4CCC();
Expand All @@ -153,13 +146,14 @@ Chi2ChargeMeasurementEstimatorESProducer::produce(const TrackingComponentsRecord
auto maxDis = m_pset.getParameter<double>("MaxDisplacement");
auto maxSag = m_pset.getParameter<double>("MaxSagitta");
auto minTol = m_pset.getParameter<double>("MinimalTolerance");
auto minpt = m_pset.getParameter<double>("MinPtForHitRecoveryInGluedDet");
auto minGoodPixelCharge = 0;
auto minGoodStripCharge = clusterChargeCut(m_pset);
auto pTChargeCutThreshold= m_pset.getParameter<double>("pTChargeCutThreshold");

m_estimator = std::make_shared<Chi2ChargeMeasurementEstimator>(
minGoodPixelCharge, minGoodStripCharge, pTChargeCutThreshold,
maxChi2,nSigma, maxDis, maxSag, minTol);
maxChi2,nSigma, maxDis, maxSag, minTol,minpt);

return m_estimator;
}
Expand Down
Expand Up @@ -136,7 +136,7 @@ bool TkGluedMeasurementDet::measurements( const TrajectoryStateOnSurface& stateO
auto id = geomDet().geographicalId().subdetId()-3;
auto l = TOBDetId(geomDet().geographicalId()).layer();
bool killHIP = (1==l) && (2==id); //TOB1
killHIP &= stateOnThisDet.globalMomentum().perp2()>0.81f;
killHIP &= stateOnThisDet.globalMomentum().perp2()>est.minPt2ForHitRecoveryInGluedDet();
if (killHIP) {
result.add(theInactiveHit, 0.F);
return true;
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/MeasurementDet/plugins/doubleMatch.icc
Expand Up @@ -149,7 +149,7 @@ void TkGluedMeasurementDet::doubleMatch(const TrajectoryStateOnSurface& ts, cons
gluedDet, trdir, chelper);
}

if (ts.globalMomentum().perp2()>0.81f) {
if (ts.globalMomentum().perp2()> collector.estimator().minPt2ForHitRecoveryInGluedDet()) {
// if no match found try add mon than try to add stereo...
if (0==collector.size())
projectOnGluedDet( collector, monoHits, glbDir);
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/TrackProducer/interface/TrackProducerBase.icc
Expand Up @@ -162,7 +162,7 @@ TrackProducerBase<T>::setSecondHitPattern(Trajectory* traj, T& track,
std::unique_ptr<Propagator> localProp(prop->clone());

//use negative sigma=-3.0 in order to use a more conservative definition of isInside() for Bounds classes.
Chi2MeasurementEstimator estimator(30.,-3.0,0.5,2.0,0.5); // same as defauts....
Chi2MeasurementEstimator estimator(30.,-3.0,0.5,2.0,0.5,0.9); // same as defauts....

// WARNING: At the moment the trajectories has the measurements with reversed sorting after the track smoothing.
// Therefore the lastMeasurement is the inner one (for LHC-like tracks)
Expand Down
18 changes: 13 additions & 5 deletions TrackingTools/DetLayers/interface/MeasurementEstimator.h
Expand Up @@ -3,7 +3,7 @@

#include "DataFormats/GeometryVector/interface/Vector2DBase.h"
#include "DataFormats/GeometryVector/interface/LocalTag.h"
#include <utility>
#include<limits>

class Plane;
class TrajectoryStateOnSurface;
Expand All @@ -26,9 +26,11 @@ class MeasurementEstimator {


MeasurementEstimator() {}
MeasurementEstimator(float maxSag, float minToll) :
MeasurementEstimator(float maxSag, float minToll, float mpt) :
m_maxSagitta(maxSag),
m_minTolerance2(minToll*minToll){}
m_minTolerance2(minToll*minToll),
m_minPt2ForHitRecoveryInGluedDet(mpt*mpt)
{}

virtual ~MeasurementEstimator() {}

Expand Down Expand Up @@ -75,12 +77,18 @@ class MeasurementEstimator {

float maxSagitta() const { return m_maxSagitta;}
float minTolerance2() const { return m_minTolerance2;}

float minPt2ForHitRecoveryInGluedDet() const { return m_minPt2ForHitRecoveryInGluedDet;}

private:
/*
* why here?
* MeasurementEstimator is the only configurable item that percolates down to geometry event by event (actually hit by hit) and not at initialization time
* It is therefore the natural candidate to collect all parameters that affect pattern-recongnition
* and require to be controlled with higher granularity than job level (such as iteration by iteration)
*/
float m_maxSagitta=-1.; // maximal sagitta for linear approximation
float m_minTolerance2=100.; // square of minimum tolerance ot be considered inside a detector

float m_minPt2ForHitRecoveryInGluedDet=0.81; // FIXME std::numeric_limits<float>::max();
};

#endif // Tracker_MeasurementEstimator_H
Expand Up @@ -4,10 +4,10 @@
# Looser chi2 estimator for electron trajectory building
# (definition should be moved?)
#
electronChi2 = cms.ESProducer("Chi2MeasurementEstimatorESProducer",
ComponentName = cms.string('electronChi2'),
nSigma = cms.double(3.0),
MaxChi2 = cms.double(100.0)
)
import TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi
electronChi2 = TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi.Chi2MeasurementEstimator.clone()
electronChi2.ComponentName = cms.string('electronChi2')
electronChi2.nSigma = 3.0
electronChi2.MaxChi2 = 100.0


Expand Up @@ -22,9 +22,10 @@ class Chi2MeasurementEstimatorBase : public MeasurementEstimator {
explicit Chi2MeasurementEstimatorBase(double maxChi2, double nSigma = 3., float maxDisp=std::numeric_limits<float>::max()) :
theMaxChi2(maxChi2), theNSigma(nSigma), theMaxDisplacement(maxDisp) {}

template<typename... Args>
Chi2MeasurementEstimatorBase(double maxChi2, double nSigma, float maxDisp,
float maxSag, float minToll) :
MeasurementEstimator(maxSag,minToll),
Args && ...args) :
MeasurementEstimator(args...),
theMaxChi2(maxChi2), theNSigma(nSigma), theMaxDisplacement(maxDisp) {}


Expand Down
@@ -0,0 +1,18 @@
#ifndef TrackingToolsKalmanUpdatorsChi2MeasurementEstimatorParams_H
#define TrackingToolsKalmanUpdatorsChi2MeasurementEstimatorParams_H
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
namespace chi2MeasurementEstimatorParams {
inline
edm::ParameterSetDescription getFilledConfigurationDescription() {
edm::ParameterSetDescription desc;
desc.add<double>("MaxChi2",30);
desc.add<double>("nSigma",3);
desc.add<double>("MaxDisplacement",0.5);
desc.add<double>("MaxSagitta",2.);
desc.add<double>("MinimalTolerance",0.5);
desc.add<double>("MinPtForHitRecoveryInGluedDet",0.9);
return desc;
}
}
#endif
Expand Up @@ -3,9 +3,7 @@
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"

#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"

#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorParams.h"

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand All @@ -22,7 +20,6 @@ class Chi2MeasurementEstimatorESProducer: public edm::ESProducer{
std::shared_ptr<Chi2MeasurementEstimatorBase> produce(const TrackingComponentsRecord &);

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
// static edm::ParameterSetDescription getFilledConfigurationDescription();

private:
std::shared_ptr<Chi2MeasurementEstimatorBase> m_estimator;
Expand All @@ -44,36 +41,17 @@ Chi2MeasurementEstimatorESProducer::produce(const TrackingComponentsRecord & iRe
auto maxDis = m_pset.getParameter<double>("MaxDisplacement");
auto maxSag = m_pset.getParameter<double>("MaxSagitta");
auto minTol = m_pset.getParameter<double>("MinimalTolerance");
auto minpt = m_pset.getParameter<double>("MinPtForHitRecoveryInGluedDet");

m_estimator = std::make_shared<Chi2MeasurementEstimator>(maxChi2,nSigma, maxDis, maxSag, minTol);
m_estimator = std::make_shared<Chi2MeasurementEstimator>(maxChi2,nSigma, maxDis, maxSag, minTol,minpt);
return m_estimator;
}


/*
edm::ParameterSetDescription
Chi2MeasurementEstimatorESProducer::getFilledConfigurationDescription() {
edm::ParameterSetDescription desc;
desc.add<double>("MaxChi2",30);
desc.add<double>("nSigma",3);
desc.add<double>("MaxDisplacement",0.5);
desc.add<double>("MaxSagitta",2.);
desc.add<double>("MinimalTolerance",0.5);
return desc;
}
*/

void
Chi2MeasurementEstimatorESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {

// edm::ParameterSetDescription desc = Chi2MeasurementEstimatorESProducer::getFilledConfigurationDescription();
edm::ParameterSetDescription desc;
desc.add<double>("MaxChi2",30);
desc.add<double>("nSigma",3);
desc.add<double>("MaxDisplacement",0.5);
desc.add<double>("MaxSagitta",2.);
desc.add<double>("MinimalTolerance",0.5);
auto desc = chi2MeasurementEstimatorParams::getFilledConfigurationDescription();
desc.add<std::string>("ComponentName","Chi2");
descriptions.add("Chi2MeasurementEstimator", desc);
}
Expand Down
Expand Up @@ -28,7 +28,6 @@
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
#include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
#include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
#include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
Expand Down

0 comments on commit bb4c80e

Please sign in to comment.