Skip to content

Commit

Permalink
Merge pull request #19742 from Sam-Harper/NewPMInterface922
Browse files Browse the repository at this point in the history
New Interface for E/gamma 2017 Pixel Matching : V2
  • Loading branch information
cmsbuild committed Jul 19, 2017
2 parents 1cc7f14 + a3fffda commit 691f1ae
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 93 deletions.
118 changes: 86 additions & 32 deletions RecoEgamma/EgammaElectronAlgos/interface/TrajSeedMatcher.h
Expand Up @@ -76,50 +76,74 @@ namespace std{

class TrajSeedMatcher {
public:
class HitInfo {
class SCHitMatch {
public:
HitInfo():detId_(0),
SCHitMatch():detId_(0),
dRZ_(std::numeric_limits<float>::max()),
dPhi_(std::numeric_limits<float>::max()),
hit_(nullptr){}

HitInfo(const GlobalPoint& vtxPos,
hit_(nullptr),
et_(0),eta_(0),phi_(0),charge_(0),nrClus_(0){}

//does not set charge,et,nrclus
SCHitMatch(const GlobalPoint& vtxPos,
const TrajectoryStateOnSurface& trajState,
const TrackingRecHit& hit);
~HitInfo()=default;
const TrackingRecHit& hit
);
~SCHitMatch()=default;

void setExtra(float et, float eta, float phi, int charge, int nrClus){
et_=et;
eta_=eta;
phi_=phi;
charge_=charge;
nrClus_=nrClus;
}

int subdetId()const{return detId_.subdetId();}
DetId detId()const{return detId_;}
float dRZ()const{return dRZ_;}
float dPhi()const{return dPhi_;}
const GlobalPoint& pos()const{return pos_;}
const GlobalPoint& hitPos()const{return hitPos_;}
float et()const{return et_;}
float eta()const{return eta_;}
float phi()const{return phi_;}
int charge()const{return charge_;}
int nrClus()const{return nrClus_;}
const TrackingRecHit* hit()const{return hit_;}
private:
DetId detId_;
GlobalPoint pos_;
GlobalPoint hitPos_;
float dRZ_;
float dPhi_;
const TrackingRecHit* hit_; //we do not own this
//extra quanities which are set later
float et_;
float eta_;
float phi_;
int charge_;
int nrClus_;
};



struct MatchInfo {
public:
DetId detId;
float dRZPos,dRZNeg;
float dPhiPos,dPhiNeg;

MatchInfo(const DetId& iDetId,
float iDRZPos,float iDRZNeg,
float iDPhiPos,float iDPhiNeg):
float iDRZPos, float iDRZNeg,
float iDPhiPos, float iDPhiNeg):
detId(iDetId),dRZPos(iDRZPos),dRZNeg(iDRZNeg),
dPhiPos(iDPhiPos),dPhiNeg(iDPhiNeg){}
};

class SeedWithInfo {
public:
SeedWithInfo(const TrajectorySeed& seed,
const std::vector<HitInfo>& posCharge,
const std::vector<HitInfo>& negCharge,
const std::vector<SCHitMatch>& posCharge,
const std::vector<SCHitMatch>& negCharge,
int nrValidLayers);
~SeedWithInfo()=default;

Expand All @@ -145,10 +169,17 @@ class TrajSeedMatcher {

class MatchingCuts {
public:
explicit MatchingCuts(const edm::ParameterSet& pset);
bool operator()(const HitInfo& hit,const float scEt,const float scEta)const;
MatchingCuts(){}
virtual ~MatchingCuts(){}
virtual bool operator()(const SCHitMatch& scHitMatch)const=0;
};

class MatchingCutsV1 : public MatchingCuts {
public:
explicit MatchingCutsV1(const edm::ParameterSet& pset);
bool operator()(const SCHitMatch& scHitMatch)const;
private:
float getDRZCutValue(const float scEt,const float scEta)const;
float getDRZCutValue(const float scEt, const float scEta)const;
private:
const double dPhiMax_;
const double dRZMax_;
Expand All @@ -157,6 +188,22 @@ class TrajSeedMatcher {
const std::vector<double> dRZMaxLowEt_;
};

class MatchingCutsV2 : public MatchingCuts {
public:
explicit MatchingCutsV2(const edm::ParameterSet& pset);
bool operator()(const SCHitMatch& scHitMatch)const;
private:
size_t getBinNr(float eta)const;
float getCutValue(float et, float highEt, float highEtThres, float lowEtGrad)const{
return highEt + std::min(0.f,et-highEtThres)*lowEtGrad;
}
private:
std::vector<double> dPhiHighEt_,dPhiHighEtThres_,dPhiLowEtGrad_;
std::vector<double> dRZHighEt_,dRZHighEtThres_,dRZLowEtGrad_;
std::vector<double> etaBins_;
};


public:
explicit TrajSeedMatcher(const edm::ParameterSet& pset);
~TrajSeedMatcher()=default;
Expand All @@ -173,33 +220,40 @@ class TrajSeedMatcher {

private:

std::vector<HitInfo> processSeed(const TrajectorySeed& seed, const GlobalPoint& candPos,
std::vector<SCHitMatch> processSeed(const TrajectorySeed& seed, const GlobalPoint& candPos,
const GlobalPoint & vprim, const float energy, const int charge );

static float getZVtxFromExtrapolation(const GlobalPoint& primeVtxPos,const GlobalPoint& hitPos,
static float getZVtxFromExtrapolation(const GlobalPoint& primeVtxPos, const GlobalPoint& hitPos,
const GlobalPoint& candPos);

bool passTrajPreSel(const GlobalPoint& hitPos,const GlobalPoint& candPos)const;

TrajSeedMatcher::HitInfo matchFirstHit(const TrajectorySeed& seed,
const TrajectoryStateOnSurface& trajState,
const GlobalPoint& vtxPos,
const PropagatorWithMaterial& propagator);

TrajSeedMatcher::HitInfo match2ndToNthHit(const TrajectorySeed& seed,
const FreeTrajectoryState& trajState,
const size_t hitNr,
const GlobalPoint& prevHitPos,
TrajSeedMatcher::SCHitMatch matchFirstHit(const TrajectorySeed& seed,
const TrajectoryStateOnSurface& trajState,
const GlobalPoint& vtxPos,
const PropagatorWithMaterial& propagator);

TrajSeedMatcher::SCHitMatch match2ndToNthHit(const TrajectorySeed& seed,
const FreeTrajectoryState& trajState,
const size_t hitNr,
const GlobalPoint& prevHitPos,
const GlobalPoint& vtxPos,
const PropagatorWithMaterial& propagator);

const TrajectoryStateOnSurface& getTrajStateFromVtx(const TrackingRecHit& hit,const TrajectoryStateOnSurface& initialState,const PropagatorWithMaterial& propagator);
const TrajectoryStateOnSurface& getTrajStateFromPoint(const TrackingRecHit& hit,const FreeTrajectoryState& initialState,const GlobalPoint& point,const PropagatorWithMaterial& propagator);
const TrajectoryStateOnSurface& getTrajStateFromVtx(const TrackingRecHit& hit,
const TrajectoryStateOnSurface& initialState,
const PropagatorWithMaterial& propagator);

const TrajectoryStateOnSurface& getTrajStateFromPoint(const TrackingRecHit& hit,
const FreeTrajectoryState& initialState,
const GlobalPoint& point,
const PropagatorWithMaterial& propagator);

void clearCache();

bool passesMatchSel(const HitInfo& hit,const size_t hitNr,const float scEt,const float scEta)const;
int getNrValidLayersAlongTraj(const HitInfo& hit1,const HitInfo& hit2,
bool passesMatchSel(const SCHitMatch& hit, const size_t hitNr)const;

int getNrValidLayersAlongTraj(const SCHitMatch& hit1, const SCHitMatch& hit2,
const GlobalPoint& candPos,
const GlobalPoint & vprim,
const float energy, const int charge);
Expand All @@ -226,7 +280,7 @@ class TrajSeedMatcher {
std::string detLayerGeomLabel_;

bool useRecoVertex_;
std::vector<MatchingCuts> matchingCuts_;
std::vector<std::unique_ptr<MatchingCuts> > matchingCuts_;

//these two varibles determine how hits we require
//based on how many valid layers we had
Expand Down

0 comments on commit 691f1ae

Please sign in to comment.