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

Fix problem with fromTrackerSeeds parameter in ElectronSeedProducer and improve LayerMeasurements class #28039

Merged
merged 7 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions FastSimulation/Muons/plugins/FastTSGFromPropagation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ FastTSGFromPropagation::FastTSGFromPropagation(const edm::ParameterSet& iConfig,
const MuonServiceProxy* service,
edm::ConsumesCollector& iC)
: theCategory("FastSimulation|Muons|FastTSGFromPropagation"),
theTkLayerMeasurements(),
theTracker(),
theNavigation(),
theService(service),
Expand Down Expand Up @@ -104,7 +103,7 @@ void FastTSGFromPropagation::trackerSeeds(const TrackCand& staMuon,
if ((*inl == nullptr))
break;
// if ( (inl != nls.end()-1 ) && ( (*inl)->subDetector() == GeomDetEnumerators::TEC ) && ( (*(inl+1))->subDetector() == GeomDetEnumerators::TOB ) ) continue;
alltm = findMeasurements_new(*inl, staState);
alltm = findMeasurements(*inl, staState);
if ((!alltm.empty())) {
LogTrace(theCategory) << "final compatible layer: " << ndesLayer;
break;
Expand Down Expand Up @@ -373,7 +372,6 @@ void FastTSGFromPropagation::setEvent(const edm::Event& iEvent) {

if (theUpdateStateFlag) {
iEvent.getByToken(theMeasurementTrackerEventToken_, theMeasTrackerEvent);
theTkLayerMeasurements = LayerMeasurements(*theMeasTracker, *theMeasTrackerEvent);
}

bool trackerGeomChanged = false;
Expand Down Expand Up @@ -447,7 +445,7 @@ void FastTSGFromPropagation::validMeasurements(std::vector<TrajectoryMeasurement
return;
}

std::vector<TrajectoryMeasurement> FastTSGFromPropagation::findMeasurements_new(
std::vector<TrajectoryMeasurement> FastTSGFromPropagation::findMeasurements(
const DetLayer* nl, const TrajectoryStateOnSurface& staState) const {
std::vector<TrajectoryMeasurement> result;

Expand All @@ -474,14 +472,6 @@ std::vector<TrajectoryMeasurement> FastTSGFromPropagation::findMeasurements_new(
return result;
}

std::vector<TrajectoryMeasurement> FastTSGFromPropagation::findMeasurements(
const DetLayer* nl, const TrajectoryStateOnSurface& staState) const {
std::vector<TrajectoryMeasurement> result =
tkLayerMeasurements()->measurements((*nl), staState, *propagator(), *estimator());
validMeasurements(result);
return result;
}

bool FastTSGFromPropagation::passSelection(const TrajectoryStateOnSurface& tsos) const {
if (!theSelectStateFlag)
return true;
Expand Down
7 changes: 0 additions & 7 deletions FastSimulation/Muons/plugins/FastTSGFromPropagation.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class FastTSGFromPropagation : public TrackerSeedGenerator {

TrajectoryStateOnSurface outerTkState(const TrackCand&) const;

const LayerMeasurements* tkLayerMeasurements() const { return &theTkLayerMeasurements; }

const TrajectoryStateUpdator* updator() const { return theUpdator.get(); }

const Chi2MeasurementEstimator* estimator() const { return theEstimator.get(); }
Expand All @@ -94,9 +92,6 @@ class FastTSGFromPropagation : public TrackerSeedGenerator {
/// select valid measurements
void validMeasurements(std::vector<TrajectoryMeasurement>&) const;

/// look for measurements on the first compatible layer (faster way)
std::vector<TrajectoryMeasurement> findMeasurements_new(const DetLayer*, const TrajectoryStateOnSurface&) const;

/// look for measurements on the first compatible layer
std::vector<TrajectoryMeasurement> findMeasurements(const DetLayer*, const TrajectoryStateOnSurface&) const;

Expand Down Expand Up @@ -133,8 +128,6 @@ class FastTSGFromPropagation : public TrackerSeedGenerator {

std::string theCategory;

LayerMeasurements theTkLayerMeasurements;

edm::ESHandle<GeometricSearchTracker> theTracker;

edm::ESHandle<MeasurementTracker> theMeasTracker;
Expand Down
90 changes: 46 additions & 44 deletions RecoEgamma/EgammaElectronAlgos/interface/ElectronSeedGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "DataFormats/EgammaReco/interface/ElectronSeed.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
//#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
Expand All @@ -38,9 +37,11 @@
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EDConsumerBase.h"

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

class PropagatorWithMaterial;
class KFUpdator;
class PixelHitMatcher;
class PixelHitMatcher_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's an artefact of find-replace. Actually all the forward declarations can be removed.

class MeasurementTracker;
class NavigationSchool;
class TrackerTopology;
Expand All @@ -59,7 +60,6 @@ class ElectronSeedGenerator {
typedef TransientTrackingRecHit::RecHitContainer RecHitContainer;

ElectronSeedGenerator(const edm::ParameterSet&, const Tokens&);
~ElectronSeedGenerator();

void setupES(const edm::EventSetup& setup);
void run(edm::Event&,
Expand Down Expand Up @@ -91,61 +91,63 @@ class ElectronSeedGenerator {
void addSeed(reco::ElectronSeed& seed, const SeedWithInfo* info, bool positron, reco::ElectronSeedCollection& out);
bool prepareElTrackSeed(ConstRecHitPointer outerhit, ConstRecHitPointer innerhit, const GlobalPoint& vertexPos);

bool dynamicphiroad_;
bool fromTrackerSeeds_;
// edm::EDGetTokenT<SomeClass> initialSeeds_;
bool useRecoVertex_;
edm::Handle<std::vector<reco::Vertex> > theVertices;
edm::EDGetTokenT<std::vector<reco::Vertex> > verticesTag_;
const bool dynamicPhiRoad_;
edm::Handle<std::vector<reco::Vertex> > vertices_;
const edm::EDGetTokenT<std::vector<reco::Vertex> > verticesTag_;

edm::Handle<reco::BeamSpot> theBeamSpot;
edm::EDGetTokenT<reco::BeamSpot> beamSpotTag_;
edm::Handle<reco::BeamSpot> beamSpot_;
const edm::EDGetTokenT<reco::BeamSpot> beamSpotTag_;

float lowPtThreshold_;
float highPtThreshold_;
float nSigmasDeltaZ1_; // first z window size if not using the reco vertex
float deltaZ1WithVertex_; // first z window size when using the reco vertex
float sizeWindowENeg_;
float phiMin2B_;
float phiMax2B_;
float phiMin2F_;
float phiMax2F_;
float deltaPhi1Low_, deltaPhi1High_;
float deltaPhi2B_;
float deltaPhi2F_;
const float lowPtThresh_;
const float highPtThresh_;
const float nSigmasDeltaZ1_; // first z window size if not using the reco vertex
const float deltaZ1WithVertex_; // first z window size when using the reco vertex
const float sizeWindowENeg_;

// so that deltaPhi1 = deltaPhi1Coef1_ + deltaPhi1Coef2_/clusterEnergyT
double deltaPhi1Coef1_;
double deltaPhi1Coef2_;
const float deltaPhi1Low_;
const float deltaPhi1High_;

PixelHitMatcher* myMatchEle;
PixelHitMatcher* myMatchPos;
// so that deltaPhi1 = dPhi1Coef1_ + dPhi1Coef2_/clusterEnergyT
const double dPhi1Coef2_;
const double dPhi1Coef1_;

const std::vector<const TrajectorySeedCollection*>* theInitialSeedCollV = nullptr;
const std::vector<const TrajectorySeedCollection*>* initialSeedCollectionVector_ = nullptr;

edm::ESHandle<MagneticField> theMagField;
edm::ESHandle<TrackerGeometry> theTrackerGeometry;
//edm::ESHandle<GeometricSearchTracker> theGeomSearchTracker;
KFUpdator* theUpdator;
PropagatorWithMaterial* thePropagator;
edm::ESHandle<MagneticField> magField_;
edm::ESHandle<TrackerGeometry> trackerGeometry_;
KFUpdator updator_;
std::unique_ptr<PropagatorWithMaterial> propagator_;

std::string theMeasurementTrackerName;
const MeasurementTracker* theMeasurementTracker;
edm::EDGetTokenT<MeasurementTrackerEvent> theMeasurementTrackerEventTag;
const MeasurementTracker* measurementTracker_;
const edm::EDGetTokenT<MeasurementTrackerEvent> measurementTrackerEventTag_;

const NavigationSchool* theNavigationSchool;
const NavigationSchool* navigationSchool_;

const edm::EventSetup* theSetup;
const edm::EventSetup* setup_;

PRecHitContainer recHits_;
PTrajectoryStateOnDet pts_;

// keep cacheIds to get records only when necessary
unsigned long long cacheIDMagField_;
// unsigned long long cacheIDGeom_;
unsigned long long cacheIDNavSchool_;
unsigned long long cacheIDCkfComp_;
unsigned long long cacheIDTrkGeom_;
unsigned long long cacheIDMagField_ = 0;
unsigned long long cacheIDNavSchool_ = 0;
unsigned long long cacheIDCkfComp_ = 0;
unsigned long long cacheIDTrkGeom_ = 0;

const std::string measurementTrackerName_;

const bool useRecoVertex_;

const float deltaPhi2B_;
const float deltaPhi2F_;

const float phiMin2B_;
const float phiMin2F_;
const float phiMax2B_;
const float phiMax2F_;

PixelHitMatcher electronMatcher_;
PixelHitMatcher positronMatcher_;
};

#endif // ElectronSeedGenerator_H
2 changes: 1 addition & 1 deletion RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class PixelHitMatcher {
const GeometricSearchTracker* theGeometricSearchTracker;
const MeasurementTrackerEvent* theTrackerEvent;
const MeasurementTracker* theTracker;
LayerMeasurements theLayerMeasurements;
std::unique_ptr<LayerMeasurements> theLayerMeasurements;
const MagneticField* theMagField;
const TrackerGeometry* theTrackerGeometry;

Expand Down