CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Electron.h
Go to the documentation of this file.
1 //
2 // $Id: Electron.h,v 1.46 2013/04/11 22:42:32 beaudett Exp $
3 //
4 
5 #ifndef DataFormats_PatCandidates_Electron_h
6 #define DataFormats_PatCandidates_Electron_h
7 
30 
34 
35 // Define typedefs for convenience
36 namespace pat {
37  class Electron;
38  typedef std::vector<Electron> ElectronCollection;
41 }
42 
43 namespace reco {
45  std::ostream& operator<<(std::ostream& out, const pat::Electron& obj);
46 }
47 
48 // Class definition
49 namespace pat {
50 
51 
52  class Electron : public Lepton<reco::GsfElectron> {
53 
54  public:
55 
56  typedef std::pair<std::string,float> IdPair;
57 
59  Electron();
61  Electron(const reco::GsfElectron & anElectron);
63  Electron(const edm::RefToBase<reco::GsfElectron> & anElectronRef);
65  Electron(const edm::Ptr<reco::GsfElectron> & anElectronRef);
67  virtual ~Electron();
68 
70  virtual Electron * clone() const { return new Electron(*this); }
71 
72  // ---- methods for content embedding ----
74  virtual reco::GsfElectronCoreRef core() const;
82  reco::TrackRef track() const;
86  reco::CaloClusterPtr seed() const;
87 
88  //method to access the basic clusters
89  const std::vector<reco::CaloCluster>& basicClusters() const { return basicClusters_ ; }
90  //method to access the preshower clusters
91  const std::vector<reco::CaloCluster>& preshowerClusters() const { return preshowerClusters_ ; }
92  //method to access the pflow basic clusters
93  const std::vector<reco::CaloCluster>& pflowBasicClusters() const { return pflowBasicClusters_ ; }
94  //method to access the pflow preshower clusters
95  const std::vector<reco::CaloCluster>& pflowPreshowerClusters() const { return pflowPreshowerClusters_ ; }
96 
97  using reco::RecoCandidate::track; // avoid hiding the base implementation
99  void embedGsfElectronCore();
101  void embedGsfTrack();
103  void embedSuperCluster();
105  void embedPflowSuperCluster();
107  void embedSeedCluster();
109  void embedBasicClusters();
111  void embedPreshowerClusters();
117  void embedTrack();
120 
121  // ---- methods for electron ID ----
123  // For cut-based IDs, the value map has the following meaning:
124  // 0: fails,
125  // 1: passes electron ID only,
126  // 2: passes electron Isolation only,
127  // 3: passes electron ID and Isolation only,
128  // 4: passes conversion rejection,
129  // 5: passes conversion rejection and ID,
130  // 6: passes conversion rejection and Isolation,
131  // 7: passes the whole selection.
132  // For more details have a look at:
133  // https://twiki.cern.ch/twiki/bin/view/CMS/SimpleCutBasedEleID
134  // https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCategoryBasedElectronID
135  // Note: an exception is thrown if the specified ID is not available
136  float electronID(const std::string& name) const;
137  float electronID(const char* name) const { return electronID( std::string(name) );}
139  bool isElectronIDAvailable(const std::string& name) const;
140  bool isElectronIDAvailable(const char* name) const {
141  return isElectronIDAvailable(std::string(name));
142  }
144  const std::vector<IdPair> & electronIDs() const { return electronIDs_; }
146  void setElectronIDs(const std::vector<IdPair> & ids) { electronIDs_ = ids; }
147 
148  // ---- overload of isolation functions ----
150  float trackIso() const { return dr04TkSumPt(); }
152  float ecalIso() const { return dr04EcalRecHitSumEt(); }
154  float hcalIso() const { return dr04HcalTowerSumEt(); }
156  float caloIso() const { return ecalIso()+hcalIso(); }
157 
158  // ---- PF specific methods ----
159  bool isPF() const{ return isPF_; }
160  void setIsPF(bool hasPFCandidate) { isPF_ = hasPFCandidate ; }
161 
166  pfCandidateRef_ = ref;
167  }
169  void embedPFCandidate();
172  return pfCandidateRef_.isNonnull() ? 1 : 0;
173  }
176 
177  // ---- embed various impact parameters with errors ----
178  typedef enum IPTYPE { None = 0, PV2D = 1, PV3D = 2, BS2D = 3, BS3D = 4 } IpType;
180  double dB(IpType type = None) const;
182  double edB(IpType type = None) const;
184  void setDB(double dB, double edB, IpType type = None);
185 
186  // ---- Momentum estimate specific methods ----
189 
191  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Electron& obj);
192 
195  double r9() const { return r9_; };
197  double sigmaIphiIphi() const { return sigmaIphiIphi_; };
199  double sigmaIetaIphi() const { return sigmaIetaIphi_; };
201  double ip3d() const { return ip3d_; }
203  void setMvaVariables( double r9, double sigmaIphiIphi, double sigmaIetaIphi, double ip3d );
204 
205  const EcalRecHitCollection * recHits() const { return &recHits_;}
206 
209  double ecalRegressionEnergy() const { return ecalRegressionEnergy_;}
210  double ecalRegressionError() const { return ecalRegressionError_;}
215  void setEcalRegressionEnergy(double val, double err) { ecalRegressionEnergy_ = val; ecalRegressionError_ = err; }
218 
220  void setEcalScale(double val) { ecalScale_= val ;}
221  void setEcalSmear(double val) { ecalSmear_= val;}
222  void setEcalRegressionScale(double val) { ecalRegressionScale_ = val ;}
223  void setEcalRegressionSmear(double val) { ecalRegressionSmear_ = val;}
226 
228  double ecalScale() const { return ecalScale_ ;}
229  double ecalSmear() const { return ecalSmear_;}
230  double ecalRegressionScale() const { return ecalRegressionScale_ ;}
231  double ecalRegressionSmear() const { return ecalRegressionSmear_ ;}
235  bool passConversionVeto() const { return passConversionVeto_; }
237 
238  protected:
240  void initImpactParameters();
241 
242  // ---- for content embedding ----
246  std::vector<reco::GsfElectronCore> gsfElectronCore_;
250  std::vector<reco::GsfTrack> gsfTrack_;
256  std::vector<reco::SuperCluster> superCluster_;
258  std::vector<reco::CaloCluster> basicClusters_;
260  std::vector<reco::CaloCluster> preshowerClusters_;
262  std::vector<reco::CaloCluster> pflowBasicClusters_;
264  std::vector<reco::CaloCluster> pflowPreshowerClusters_;
266  std::vector<reco::SuperCluster> pflowSuperCluster_;
270  std::vector<reco::Track> track_;
274  std::vector<reco::CaloCluster> seedCluster_;
279 
280  // ---- electron ID's holder ----
282  std::vector<IdPair> electronIDs_;
283 
284  // ---- PF specific members ----
285  bool isPF_;
292 
293  // ---- specific members : Momentum estimates ----
296 
297  // V+Jets group selection variables.
299  bool cachedDB_;
301  double dB_;
303  double edB_;
304 
306  double r9_;
309  double ip3d_;
310 
316 
318  double ecalScale_;
319  double ecalSmear_;
320 
323 
326 
327 
330 
331  // ---- cached impact parameters ----
333  std::vector<bool> cachedIP_;
335  std::vector<double> ip_;
337  std::vector<double> eip_;
338  };
339 }
340 
341 #endif
double edB(IpType type=None) const
Uncertainty on the corresponding impact parameter.
Definition: Electron.cc:405
reco::SuperClusterRef pflowSuperCluster() const
override the reco::GsfElectron::pflowSuperCluster method, to access the internal storage of the pflow...
Definition: Electron.cc:159
float trackIso() const
Overload of pat::Lepton::trackIso(); returns the value of the summed track pt in a cone of deltaR&lt;0...
Definition: Electron.h:150
type
Definition: HCALResponse.h:22
float dr04HcalTowerSumEt() const
Definition: GsfElectron.h:451
double ecalTrackRegressionSmear() const
Definition: Electron.h:233
double ecalTrackRegressionScale() const
Definition: Electron.h:232
int i
Definition: DBlmapReader.cc:9
virtual ~Electron()
destructor
Definition: Electron.cc:99
bool embeddedTrack_
True if electron&#39;s track is stored internally.
Definition: Electron.h:268
std::vector< reco::GsfTrack > gsfTrack_
Place to store electron&#39;s gsfTrack internally.
Definition: Electron.h:250
virtual Electron * clone() const
required reimplementation of the Candidate&#39;s clone method
Definition: Electron.h:70
double ecalRegressionEnergy_
output of regression
Definition: Electron.h:312
long int flag
Definition: mlp_lapack.h:47
void embedTrack()
method to store the electron&#39;s Track internally
Definition: Electron.cc:285
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
Definition: Electron.cc:228
void embedGsfElectronCore()
method to store the electron&#39;s core internally
Definition: Electron.cc:191
void setElectronIDs(const std::vector< IdPair > &ids)
Store multiple electron ID values, discarding existing ones. The first one in the list becomes the &#39;d...
Definition: Electron.h:146
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
Definition: Electron.cc:261
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
Definition: Electron.cc:177
double ecalScale() const
get scale corrections /smearings
Definition: Electron.h:228
size_t size_type
Definition: Candidate.h:31
double ecalScale_
scale corrections and smearing applied or to be be applied. Initialized to -99999.
Definition: Electron.h:318
void embedSuperCluster()
method to store the electron&#39;s SuperCluster internally
Definition: Electron.cc:210
double ip3d() const
ip3d
Definition: Electron.h:201
const LorentzVector & ecalDrivenMomentum() const
Definition: Electron.h:187
void embedPFCandidate()
embed the PFCandidate pointed to by pfCandidateRef_
Definition: Electron.cc:348
void setDB(double dB, double edB, IpType type=None)
Set impact parameter of a certain type and its uncertainty.
Definition: Electron.cc:424
float caloIso() const
Overload of pat::Lepton::caloIso(); returns the sum of ecalIso() and hcalIso.
Definition: Electron.h:156
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Electron.h:89
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Definition: Electron.cc:150
void setPFCandidateRef(const reco::PFCandidateRef &ref)
add a reference to the source IsolatedPFCandidate
Definition: Electron.h:165
reco::TrackRef track() const
returns nothing. Use either gsfTrack or closestCtfTrack
Definition: Electron.cc:186
void setPassConversionVeto(bool flag)
Definition: Electron.h:236
float dr04TkSumPt() const
Definition: GsfElectron.h:447
std::vector< reco::SuperCluster > superCluster_
Place to store electron&#39;s supercluster internally.
Definition: Electron.h:256
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Definition: Electron.cc:131
double ecalTrackRegressionSmear_
Definition: Electron.h:325
double dB_
Impact parameter at the primary vertex.
Definition: Electron.h:301
double ecalRegressionScale() const
Definition: Electron.h:230
std::vector< reco::Track > track_
Place to store electron&#39;s track internally.
Definition: Electron.h:270
void setEcalDrivenMomentum(const Candidate::LorentzVector &mom)
Definition: Electron.h:188
double sigmaIetaIphi() const
sigmaIEtaIPhi
Definition: Electron.h:199
bool embeddedGsfElectronCore_
True if electron&#39;s gsfElectronCore is stored internally.
Definition: Electron.h:244
void setMvaVariables(double r9, double sigmaIphiIphi, double sigmaIetaIphi, double ip3d)
set missing mva input variables
Definition: Electron.cc:436
double ecalRegressionSmear() const
Definition: Electron.h:231
const EcalRecHitCollection * recHits() const
Definition: Electron.h:205
const std::vector< reco::CaloCluster > & pflowBasicClusters() const
Definition: Electron.h:93
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
Definition: Electron.cc:249
std::vector< reco::CaloCluster > pflowBasicClusters_
Place to store electron&#39;s pflow basic clusters internally.
Definition: Electron.h:262
float electronID(const char *name) const
Definition: Electron.h:137
virtual reco::TrackRef track() const
reference to a Track
reco::CaloClusterPtr seed() const
direct access to the seed cluster
Definition: Electron.cc:168
void embedBasicClusters()
method to store the electron&#39;s basic clusters
Definition: Electron.cc:237
std::vector< reco::CaloCluster > basicClusters_
Place to store electron&#39;s basic clusters internally.
Definition: Electron.h:258
double r9_
additional missing mva variables : 14/04/2012
Definition: Electron.h:306
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
double ecalRegressionSmear_
Definition: Electron.h:322
edm::RefVector< ElectronCollection > ElectronRefVector
Definition: Electron.h:40
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
std::vector< reco::CaloCluster > preshowerClusters_
Place to store electron&#39;s preshower clusters internally.
Definition: Electron.h:260
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
float dr04EcalRecHitSumEt() const
Definition: GsfElectron.h:448
bool embeddedRecHits_
True if RecHits stored internally.
Definition: Electron.h:276
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
Definition: Electron.cc:294
double ecalTrackRegressionError_
Definition: Electron.h:315
enum pat::Electron::IPTYPE IpType
void setEcalTrackRegressionSmear(double val)
Definition: Electron.h:225
Analysis-level lepton class.
Definition: Lepton.h:32
bool passConversionVeto_
conversion veto
Definition: Electron.h:329
bool embeddedSeedCluster_
True if seed cluster is stored internally.
Definition: Electron.h:272
const std::vector< reco::CaloCluster > & pflowPreshowerClusters() const
Definition: Electron.h:95
const std::vector< IdPair > & electronIDs() const
Returns all the electron IDs in the form of &lt;name,value&gt; pairs. The &#39;default&#39; ID is the first in the li...
Definition: Electron.h:144
virtual reco::GsfElectronCoreRef core() const
override the virtual reco::GsfElectron::core method, so that the embedded core can be used by GsfElec...
Definition: Electron.cc:140
std::vector< reco::GsfElectronCore > gsfElectronCore_
Place to store electron&#39;s gsfElectronCore internally.
Definition: Electron.h:246
double ecalTrackRegressionEnergy() const
regression2
Definition: Electron.h:212
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron ...
Definition: Electron.cc:339
double ip3d_
Definition: Electron.h:309
Electron()
default constructor
Definition: Electron.cc:13
void initImpactParameters()
init impact parameter defaults (for use in a constructor)
Definition: Electron.cc:121
double ecalTrackRegressionEnergy_
Definition: Electron.h:313
void embedGsfTrack()
method to store the electron&#39;s GsfTrack internally
Definition: Electron.cc:200
double ecalRegressionError() const
Definition: Electron.h:210
bool isPF() const
Definition: Electron.h:159
double ecalTrackRegressionError() const
Definition: Electron.h:213
float ecalIso() const
Overload of pat::Lepton::ecalIso(); returns the value of the summed Et of all recHits in the ecal in ...
Definition: Electron.h:152
tuple out
Definition: dbtoconf.py:99
double ecalRegressionError_
Definition: Electron.h:314
EcalRecHitCollection recHits_
Place to store electron&#39;s RecHits internally (5x5 around seed+ all RecHits)
Definition: Electron.h:278
void setEcalTrackRegressionEnergy(double val, double err)
set regression2
Definition: Electron.h:217
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
reco::PFCandidateCollection pfCandidate_
A copy of the source IsolatedPFCandidate is stored in this vector if embeddedPFCandidate_ if True...
Definition: Electron.h:289
void setEcalScale(double val)
set scale corrections / smearings
Definition: Electron.h:220
double edB_
Impact paramater uncertainty at the primary vertex.
Definition: Electron.h:303
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
Definition: Electron.cc:315
void setEcalRegressionScale(double val)
Definition: Electron.h:222
bool embeddedGsfTrack_
True if electron&#39;s gsfTrack is stored internally.
Definition: Electron.h:248
double r9() const
Definition: Electron.h:195
edm::Ref< ElectronCollection > ElectronRef
Definition: Electron.h:39
void setIsPF(bool hasPFCandidate)
Definition: Electron.h:160
bool isElectronIDAvailable(const char *name) const
Definition: Electron.h:140
double ecalSmear() const
Definition: Electron.h:229
bool embeddedPflowSuperCluster_
True if electron&#39;s pflowsupercluster is stored internally.
Definition: Electron.h:254
void setEcalRegressionSmear(double val)
Definition: Electron.h:223
double sigmaIphiIphi_
Definition: Electron.h:307
double sigmaIphiIphi() const
sigmaIPhiPhi
Definition: Electron.h:197
void embedPflowSuperCluster()
method to store the electron&#39;s PflowSuperCluster internally
Definition: Electron.cc:219
Analysis-level electron class.
Definition: Electron.h:52
std::vector< IdPair > electronIDs_
Electron IDs.
Definition: Electron.h:282
void setEcalSmear(double val)
Definition: Electron.h:221
bool passConversionVeto() const
vertex fit combined with missing number of hits method
Definition: Electron.h:235
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
reco::PFCandidateRef pfCandidateRef_
reference to the IsolatedPFCandidate this has been built from; null if this has been built from a sta...
Definition: Electron.h:291
bool embeddedSuperCluster_
True if electron&#39;s supercluster is stored internally.
Definition: Electron.h:252
bool isElectronIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Electron.
Definition: Electron.cc:330
void setEcalTrackRegressionScale(double val)
Definition: Electron.h:224
double ecalRegressionScale_
Definition: Electron.h:321
std::vector< reco::CaloCluster > pflowPreshowerClusters_
Place to store electron&#39;s pflow preshower clusters internally.
Definition: Electron.h:264
double ecalSmear_
Definition: Electron.h:319
size_t numberOfSourceCandidatePtrs() const
get the number of non-null PFCandidates
Definition: Electron.h:171
std::pair< std::string, float > IdPair
Definition: Electron.h:56
bool cachedDB_
True if impact parameter has been cached.
Definition: Electron.h:299
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Electron.h:91
std::vector< double > ip_
Impact parameter at the primary vertex,.
Definition: Electron.h:335
double sigmaIetaIphi_
Definition: Electron.h:308
LorentzVector ecalDrivenMomentum_
ECAL-driven momentum.
Definition: Electron.h:295
std::vector< bool > cachedIP_
True if the IP (former dB) has been cached.
Definition: Electron.h:333
bool embeddedPFCandidate_
true if the IsolatedPFCandidate is embedded
Definition: Electron.h:287
double ecalTrackRegressionScale_
Definition: Electron.h:324
reco::CandidatePtr sourceCandidatePtr(size_type i) const
get the source candidate pointer with index i
Definition: Electron.cc:358
double ecalRegressionEnergy() const
Definition: Electron.h:209
double dB(IpType type=None) const
Impact parameter wrt primary vertex or beamspot.
Definition: Electron.cc:378
void embedPflowPreshowerClusters()
method to store the electron&#39;s pflow preshower clusters
Definition: Electron.cc:273
void setEcalRegressionEnergy(double val, double err)
set regression1
Definition: Electron.h:215
std::vector< double > eip_
Impact parameter uncertainty as recommended by the tracking group.
Definition: Electron.h:337
math::PtEtaPhiELorentzVectorF LorentzVector
std::vector< reco::SuperCluster > pflowSuperCluster_
Place to store electron&#39;s pflow supercluster internally.
Definition: Electron.h:266
float hcalIso() const
Overload of pat::Lepton::hcalIso(); returns the value of the summed Et of all caloTowers in the hcal ...
Definition: Electron.h:154
std::vector< reco::CaloCluster > seedCluster_
Place to store electron&#39;s seed cluster internally.
Definition: Electron.h:274