CMS 3D CMS Logo

ElectronSeed.h
Go to the documentation of this file.
1 #ifndef DataFormats_EgammaReco_ElectronSeed_h
2 #define DataFormats_EgammaReco_ElectronSeed_h
3 
4 //********************************************************************
5 //
6 // A verson of reco::ElectronSeed which can have N hits as part of the
7 // 2017 upgrade of E/gamma pixel matching for the phaseI pixels
8 //
9 // author: S. Harper (RAL), 2017
10 //
11 //notes:
12 // While it is technically named ElectronSeed, it is effectively a new class
13 // However to simplify things, the name ElectronSeed was kept
14 // (trust me it was simplier...)
15 //
16 // Noticed that h/e values never seem to used anywhere and they are a
17 // mild pain to propagate in the new framework so they were removed
18 //
19 // infinities are used to mark invalid unset values to maintain
20 // compatibilty with the orginal ElectronSeed class
21 //
22 //description:
23 // An ElectronSeed is a TrajectorySeed with E/gamma specific information
24 // A TrajectorySeed has a series of hits associated with it
25 // (accessed by TrajectorySeed::nHits(), TrajectorySeed::recHits())
26 // and ElectronSeed stores which of those hits match well to a supercluster
27 // together with the matching parameters (this is known as EcalDriven).
28 // ElectronSeeds can be TrackerDriven in which case the matching is not done.
29 // It used to be fixed to two matched hits, now this is an arbitary number
30 // Its designed with pixel matching with mind but tries to be generally
31 // applicable to strips as well.
32 // It is worth noting that due to different ways ElectronSeeds can be created
33 // they do not always have all parameters filled
34 //
35 //********************************************************************
36 
45 
46 #include <vector>
47 #include <limits>
48 
49 namespace reco {
50 
51  class ElectronSeed : public TrajectorySeed {
52  public:
53  struct PMVars {
54  float dRZPos;
55  float dRZNeg;
56  float dPhiPos;
57  float dPhiNeg;
58  int detId; //this is already stored as the hit is stored in traj seed but a useful sanity check
59  int layerOrDiskNr; //redundant as stored in detId but its a huge pain to hence why its saved here
60 
61  PMVars();
62 
63  void setDPhi(float pos, float neg);
64  void setDRZ(float pos, float neg);
65  void setDet(int iDetId, int iLayerOrDiskNr);
66  };
67 
70 
71  static std::string const& name() {
72  static std::string const name_("ElectronSeed");
73  return name_;
74  }
75 
77  ElectronSeed();
80  ElectronSeed* clone() const override { return new ElectronSeed(*this); }
81  ~ElectronSeed() override;
82 
84  void setCtfTrack(const CtfTrackRef&);
85  void setCaloCluster(const CaloClusterRef& clus) {
86  caloCluster_ = clus;
87  isEcalDriven_ = true;
88  }
89  void addHitInfo(const PMVars& hitVars) { hitInfo_.push_back(hitVars); }
92  const CtfTrackRef& ctfTrack() const { return ctfTrack_; }
93  const CaloClusterRef& caloCluster() const { return caloCluster_; }
94 
97 
98  bool isEcalDriven() const { return isEcalDriven_; }
99  bool isTrackerDriven() const { return isTrackerDriven_; }
100 
101  const std::vector<PMVars>& hitInfo() const { return hitInfo_; }
102  float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); }
103  float dPhiPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiPos); }
104  float dPhiBest(size_t hitNr) const { return bestVal(dPhiNeg(hitNr), dPhiPos(hitNr)); }
105  float dRZPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZPos); }
106  float dRZNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZNeg); }
107  float dRZBest(size_t hitNr) const { return bestVal(dRZNeg(hitNr), dRZPos(hitNr)); }
108  int detId(size_t hitNr) const { return hitNr < hitInfo_.size() ? hitInfo_[hitNr].detId : 0; }
109  int subDet(size_t hitNr) const { return DetId(detId(hitNr)).subdetId(); }
110  int layerOrDiskNr(size_t hitNr) const { return getVal(hitNr, &PMVars::layerOrDiskNr); }
111  int nrLayersAlongTraj() const { return nrLayersAlongTraj_; }
112 
113  unsigned int hitsMask() const;
114  void initTwoHitSeed(const unsigned char hitMask);
115  void setNegAttributes(const float dRZ2 = std::numeric_limits<float>::infinity(),
116  const float dPhi2 = std::numeric_limits<float>::infinity(),
117  const float dRZ1 = std::numeric_limits<float>::infinity(),
118  const float dPhi1 = std::numeric_limits<float>::infinity());
119  void setPosAttributes(const float dRZ2 = std::numeric_limits<float>::infinity(),
120  const float dPhi2 = std::numeric_limits<float>::infinity(),
121  const float dRZ1 = std::numeric_limits<float>::infinity(),
122  const float dPhi1 = std::numeric_limits<float>::infinity());
123 
124  //this is a backwards compatible function designed to
125  //convert old format ElectronSeeds to the new format
126  //only public due to root io rules, not intended for any other use
127  //also in theory not necessary to part of this class
128  static std::vector<PMVars> createHitInfo(const float dPhi1Pos,
129  const float dPhi1Neg,
130  const float dRZ1Pos,
131  const float dRZ1Neg,
132  const float dPhi2Pos,
133  const float dPhi2Neg,
134  const float dRZ2Pos,
135  const float dRZ2Neg,
136  const char hitMask,
138 
139  private:
140  static float bestVal(float val1, float val2) { return std::abs(val1) < std::abs(val2) ? val1 : val2; }
141  template <typename T>
142  T getVal(unsigned int hitNr, T PMVars::*val) const {
143  return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits<T>::infinity();
144  }
145  static std::vector<unsigned int> hitNrsFromMask(unsigned int hitMask);
146 
147  private:
150  std::vector<PMVars> hitInfo_;
152 
155  };
156 } // namespace reco
157 
158 #endif
reco::ElectronSeed::ctfTrack
const CtfTrackRef & ctfTrack() const
Accessors.
Definition: ElectronSeed.h:92
reco::ElectronSeed::CaloClusterRef
edm::RefToBase< CaloCluster > CaloClusterRef
Definition: ElectronSeed.h:68
reco::ElectronSeed::ElectronSeed
ElectronSeed()
Construction of base attributes.
Definition: ElectronSeed.cc:8
reco::ElectronSeed::createHitInfo
static std::vector< PMVars > createHitInfo(const float dPhi1Pos, const float dPhi1Neg, const float dRZ1Pos, const float dRZ1Neg, const float dPhi2Pos, const float dPhi2Neg, const float dRZ2Pos, const float dRZ2Neg, const char hitMask, TrajectorySeed::RecHitRange const &recHits)
Definition: ElectronSeed.cc:122
reco::ElectronSeed::setCaloCluster
void setCaloCluster(const CaloClusterRef &clus)
Definition: ElectronSeed.h:85
TrackCharge
int TrackCharge
Definition: TrackCharge.h:4
reco::ElectronSeed::bestVal
static float bestVal(float val1, float val2)
Definition: ElectronSeed.h:140
reco::ElectronSeed::setNegAttributes
void setNegAttributes(const float dRZ2=std::numeric_limits< float >::infinity(), const float dPhi2=std::numeric_limits< float >::infinity(), const float dRZ1=std::numeric_limits< float >::infinity(), const float dPhi1=std::numeric_limits< float >::infinity())
Definition: ElectronSeed.cc:86
reco::ElectronSeed::isEcalDriven_
bool isEcalDriven_
Definition: ElectronSeed.h:153
pos
Definition: PixelAliasList.h:18
reco::ElectronSeed::PMVars::setDPhi
void setDPhi(float pos, float neg)
Definition: ElectronSeed.cc:174
reco::ElectronSeed::caloCluster_
CaloClusterRef caloCluster_
Definition: ElectronSeed.h:149
reco::ElectronSeed::nrLayersAlongTraj_
int nrLayersAlongTraj_
Definition: ElectronSeed.h:151
TrajectorySeed::RecHitContainer
edm::OwnVector< TrackingRecHit > RecHitContainer
Definition: TrajectorySeed.h:20
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
reco::ElectronSeed::~ElectronSeed
~ElectronSeed() override
reco::ElectronSeed::PMVars::dPhiPos
float dPhiPos
Definition: ElectronSeed.h:56
reco::ElectronSeed::initTwoHitSeed
void initTwoHitSeed(const unsigned char hitMask)
Definition: ElectronSeed.cc:60
reco::ElectronSeed::PMVars::layerOrDiskNr
int layerOrDiskNr
Definition: ElectronSeed.h:59
reco::ElectronSeed::setPosAttributes
void setPosAttributes(const float dRZ2=std::numeric_limits< float >::infinity(), const float dPhi2=std::numeric_limits< float >::infinity(), const float dRZ1=std::numeric_limits< float >::infinity(), const float dPhi1=std::numeric_limits< float >::infinity())
Definition: ElectronSeed.cc:99
ElectronSeedFwd.h
edm::Ref< TrackCollection >
reco::ElectronSeed::layerOrDiskNr
int layerOrDiskNr(size_t hitNr) const
Definition: ElectronSeed.h:110
reco::ElectronSeed::hitsMask
unsigned int hitsMask() const
Definition: ElectronSeed.cc:47
DetId
Definition: DetId.h:17
edm::Range
Definition: Range.h:11
TrackingRecHit.h
reco::ElectronSeed::hitNrsFromMask
static std::vector< unsigned int > hitNrsFromMask(unsigned int hitMask)
Definition: ElectronSeed.cc:112
reco::ElectronSeed
Definition: ElectronSeed.h:51
TrackFwd.h
reco::ElectronSeed::isEcalDriven
bool isEcalDriven() const
Definition: ElectronSeed.h:98
reco::ElectronSeed::PMVars::dRZPos
float dRZPos
Definition: ElectronSeed.h:54
reco::ElectronSeed::clone
ElectronSeed * clone() const override
Definition: ElectronSeed.h:80
reco::ElectronSeed::PMVars::detId
int detId
Definition: ElectronSeed.h:58
TrackCharge.h
reco::ElectronSeed::PMVars::setDet
void setDet(int iDetId, int iLayerOrDiskNr)
Definition: ElectronSeed.cc:184
reco::ElectronSeed::PMVars::dPhiNeg
float dPhiNeg
Definition: ElectronSeed.h:57
reco::ElectronSeed::detId
int detId(size_t hitNr) const
Definition: ElectronSeed.h:108
CaloClusterFwd.h
reco::ElectronSeed::getCharge
TrackCharge getCharge() const
Utility.
Definition: ElectronSeed.h:96
reco::ElectronSeed::isTrackerDriven
bool isTrackerDriven() const
Definition: ElectronSeed.h:99
reco::ElectronSeed::subDet
int subDet(size_t hitNr) const
Definition: ElectronSeed.h:109
LocalTrajectoryParameters::charge
TrackCharge charge() const
Charge (-1, 0 or 1)
Definition: LocalTrajectoryParameters.h:110
TrajectorySeed.h
RefToBase.h
reco::ElectronSeed::hitInfo
const std::vector< PMVars > & hitInfo() const
Definition: ElectronSeed.h:101
reco::ElectronSeed::addHitInfo
void addHitInfo(const PMVars &hitVars)
Definition: ElectronSeed.h:89
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::ElectronSeed::nrLayersAlongTraj
int nrLayersAlongTraj() const
Definition: ElectronSeed.h:111
reco::ElectronSeed::setCtfTrack
void setCtfTrack(const CtfTrackRef &)
Set additional info.
Definition: ElectronSeed.cc:39
reco::ElectronSeed::name
static std::string const & name()
Definition: ElectronSeed.h:71
reco::ElectronSeed::ctfTrack_
CtfTrackRef ctfTrack_
Definition: ElectronSeed.h:148
reco::ElectronSeed::dPhiBest
float dPhiBest(size_t hitNr) const
Definition: ElectronSeed.h:104
TrajectorySeed::recHits
RecHitRange recHits() const
Definition: TrajectorySeed.h:52
RPCpg::pts
static const double pts[33]
Definition: Constants.h:30
reco::ElectronSeed::dRZPos
float dRZPos(size_t hitNr) const
Definition: ElectronSeed.h:105
reco::ElectronSeed::hitInfo_
std::vector< PMVars > hitInfo_
Definition: ElectronSeed.h:150
reco::ElectronSeed::dPhiNeg
float dPhiNeg(size_t hitNr) const
Definition: ElectronSeed.h:102
reco::ElectronSeed::setNrLayersAlongTraj
void setNrLayersAlongTraj(int val)
Definition: ElectronSeed.h:90
heppy_batch.val
val
Definition: heppy_batch.py:351
Ref.h
PTrajectoryStateOnDet::parameters
const LocalTrajectoryParameters & parameters() const
Definition: PTrajectoryStateOnDet.h:60
reco::ElectronSeed::PMVars::dRZNeg
float dRZNeg
Definition: ElectronSeed.h:55
T
long double T
Definition: Basic3DVectorLD.h:48
reco::ElectronSeed::dRZNeg
float dRZNeg(size_t hitNr) const
Definition: ElectronSeed.h:106
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
TrajectorySeed
Definition: TrajectorySeed.h:18
reco::ElectronSeed::CtfTrackRef
edm::Ref< TrackCollection > CtfTrackRef
Definition: ElectronSeed.h:69
reco::ElectronSeed::isTrackerDriven_
bool isTrackerDriven_
Definition: ElectronSeed.h:154
edm::RefToBase< CaloCluster >
reco::ElectronSeed::dRZBest
float dRZBest(size_t hitNr) const
Definition: ElectronSeed.h:107
reco::ElectronSeed::dPhiPos
float dPhiPos(size_t hitNr) const
Definition: ElectronSeed.h:103
TrajectorySeed::startingState
PTrajectoryStateOnDet const & startingState() const
Definition: TrajectorySeed.h:55
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::ElectronSeed::PMVars::PMVars
PMVars()
Definition: ElectronSeed.cc:166
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
reco::ElectronSeed::PMVars
Definition: ElectronSeed.h:53
reco::ElectronSeed::PMVars::setDRZ
void setDRZ(float pos, float neg)
Definition: ElectronSeed.cc:179
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
reco::ElectronSeed::caloCluster
const CaloClusterRef & caloCluster() const
Definition: ElectronSeed.h:93
reco::ElectronSeed::getVal
T getVal(unsigned int hitNr, T PMVars::*val) const
Definition: ElectronSeed.h:142