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 //
3 
4 #ifndef DataFormats_PatCandidates_Electron_h
5 #define DataFormats_PatCandidates_Electron_h
6 
28 
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  class PATElectronSlimmer;
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(); }
158  float ecalPFClusterIso() const { return ecalPFClusIso_; };
159  float hcalPFClusterIso() const { return hcalPFClusIso_; };
160  void setEcalPFClusterIso(float ecalPFClus) { ecalPFClusIso_ = ecalPFClus; };
161  void setHcalPFClusterIso(float hcalPFClus) { hcalPFClusIso_ = hcalPFClus; };
162 
163  // ---- PF specific methods ----
164  bool isPF() const{ return isPF_; }
165  void setIsPF(bool hasPFCandidate) { isPF_ = hasPFCandidate ; }
166 
171  pfCandidateRef_ = ref;
172  }
174  void embedPFCandidate();
178  }
181 
182  // ---- embed various impact parameters with errors ----
183  typedef enum IPTYPE { PV2D = 0, PV3D = 1, BS2D = 2, BS3D = 3, IpTypeSize = 4 } IpType;
185  double dB(IPTYPE type) const;
187  double edB(IPTYPE type) const;
189  double dB() const { return std::abs(dB(PV2D)); }
191  double edB() const { return std::abs(edB(PV2D)); }
193  void setDB(double dB, double edB, IPTYPE type);
194 
195  // ---- Momentum estimate specific methods ----
198 
200  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Electron& obj);
201 
204  float sigmaIetaIphi() const { return sigmaIetaIphi_; }
208  double ip3d() const { return ip3d_; }
210  void setMvaVariables( double sigmaIetaIphi, double ip3d );
212 
213  const EcalRecHitCollection * recHits() const { return &recHits_;}
214 
217  double ecalRegressionEnergy() const { return ecalRegressionEnergy_;}
218  double ecalRegressionError() const { return ecalRegressionError_;}
223  void setEcalRegressionEnergy(double val, double err) { ecalRegressionEnergy_ = val; ecalRegressionError_ = err; }
226 
228  void setEcalScale(double val) { ecalScale_= val ;}
229  void setEcalSmear(double val) { ecalSmear_= val;}
230  void setEcalRegressionScale(double val) { ecalRegressionScale_ = val ;}
231  void setEcalRegressionSmear(double val) { ecalRegressionSmear_ = val;}
234 
236  double ecalScale() const { return ecalScale_ ;}
237  double ecalSmear() const { return ecalSmear_;}
238  double ecalRegressionScale() const { return ecalRegressionScale_ ;}
239  double ecalRegressionSmear() const { return ecalRegressionSmear_ ;}
243  bool passConversionVeto() const { return passConversionVeto_; }
244  void setPassConversionVeto( bool flag ) { passConversionVeto_ = flag; }
245 
249  template<typename T>
251  T beginIndexItr,
252  T endIndexItr) {
253  packedPFCandidates_ = refprod;
256  beginIndexItr,
257  endIndexItr);
258  }
259 
260  friend class PATElectronSlimmer;
261 
262  protected:
264  void initImpactParameters();
265 
266  // ---- for content embedding ----
270  std::vector<reco::GsfElectronCore> gsfElectronCore_;
274  std::vector<reco::GsfTrack> gsfTrack_;
280  std::vector<reco::SuperCluster> superCluster_;
284  std::vector<reco::CaloCluster> basicClusters_;
286  std::vector<reco::CaloCluster> preshowerClusters_;
288  std::vector<reco::CaloCluster> pflowBasicClusters_;
290  std::vector<reco::CaloCluster> pflowPreshowerClusters_;
292  std::vector<reco::SuperCluster> pflowSuperCluster_;
296  std::vector<reco::Track> track_;
300  std::vector<reco::CaloCluster> seedCluster_;
305 
306  // ---- electron ID's holder ----
308  std::vector<IdPair> electronIDs_;
309 
310  // ---- PF specific members ----
311  bool isPF_;
318 
319  // ---- specific members : Momentum estimates ----
322 
325  double ip3d_;
326 
332 
334  double ecalScale_;
335  double ecalSmear_;
336 
339 
342 
346 
349 
350  // ---- cached impact parameters ----
352  uint8_t cachedIP_;
354  float ip_[IpTypeSize];
356  float eip_[IpTypeSize];
357 
358  // ---- link to PackedPFCandidates
360  std::vector<uint16_t> associatedPackedFCandidateIndices_;
361  };
362 }
363 
364 #endif
void setMvaVariables(double sigmaIetaIphi, double ip3d)
set missing mva input variables
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:21
float dr04HcalTowerSumEt() const
Definition: GsfElectron.h:506
double ecalTrackRegressionSmear() const
Definition: Electron.h:241
double ecalTrackRegressionScale() const
Definition: Electron.h:240
int i
Definition: DBlmapReader.cc:9
uint8_t cachedIP_
True if the IP (former dB) has been cached.
Definition: Electron.h:352
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
bool embeddedTrack_
True if electron&#39;s track is stored internally.
Definition: Electron.h:294
std::vector< reco::GsfTrack > gsfTrack_
Place to store electron&#39;s gsfTrack internally.
Definition: Electron.h:274
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:328
bool isElectronIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Electron.
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
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
double dB() const
the version without arguments returns PD2D, but with an absolute value (for backwards compatibility) ...
Definition: Electron.h:189
double ecalScale() const
get scale corrections /smearings
Definition: Electron.h:236
size_t size_type
Definition: Candidate.h:30
double ecalScale_
scale corrections and smearing applied or to be be applied. Initialized to -99999.
Definition: Electron.h:334
double ip3d() const
ip3d
Definition: Electron.h:208
const LorentzVector & ecalDrivenMomentum() const
Definition: Electron.h:196
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
void embedSuperCluster()
method to store the electron&#39;s SuperCluster internally
float hcalPFClusterIso() const
Definition: Electron.h:159
void setPFCandidateRef(const reco::PFCandidateRef &ref)
add a reference to the source IsolatedPFCandidate
Definition: Electron.h:170
void full5x5_setSigmaIetaIphi(float sigmaIetaIphi)
Definition: Electron.h:211
void embedGsfElectronCore()
method to store the electron&#39;s core internally
void setPassConversionVeto(bool flag)
Definition: Electron.h:244
float dr04TkSumPt() const
Definition: GsfElectron.h:502
std::vector< reco::SuperCluster > superCluster_
Place to store electron&#39;s supercluster internally.
Definition: Electron.h:280
Slimmer of PAT Electrons.
void setHcalPFClusterIso(float hcalPFClus)
Definition: Electron.h:161
double ecalTrackRegressionSmear_
Definition: Electron.h:341
double ecalRegressionScale() const
Definition: Electron.h:238
std::vector< reco::Track > track_
Place to store electron&#39;s track internally.
Definition: Electron.h:296
void setEcalDrivenMomentum(const Candidate::LorentzVector &mom)
Definition: Electron.h:197
bool embeddedGsfElectronCore_
True if electron&#39;s gsfElectronCore is stored internally.
Definition: Electron.h:268
double ecalRegressionSmear() const
Definition: Electron.h:239
const EcalRecHitCollection * recHits() const
Definition: Electron.h:213
const std::vector< reco::CaloCluster > & pflowBasicClusters() const
Definition: Electron.h:93
float ecalPFClusterIso() const
get and set PFCluster Isolation
Definition: Electron.h:158
std::vector< reco::CaloCluster > pflowBasicClusters_
Place to store electron&#39;s pflow basic clusters internally.
Definition: Electron.h:288
void embedPflowSuperCluster()
method to store the electron&#39;s PflowSuperCluster internally
float electronID(const char *name) const
Definition: Electron.h:137
virtual reco::TrackRef track() const
reference to a Track
edm::RefProd< pat::PackedCandidateCollection > packedPFCandidates_
Definition: Electron.h:359
std::vector< reco::CaloCluster > basicClusters_
Place to store electron&#39;s basic clusters internally.
Definition: Electron.h:284
std::vector< uint16_t > associatedPackedFCandidateIndices_
Definition: Electron.h:360
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
double ecalRegressionSmear_
Definition: Electron.h:338
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
edm::RefVector< ElectronCollection > ElectronRefVector
Definition: Electron.h:40
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
std::vector< reco::CaloCluster > preshowerClusters_
Place to store electron&#39;s preshower clusters internally.
Definition: Electron.h:286
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
float dr04EcalRecHitSumEt() const
Definition: GsfElectron.h:503
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron ...
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
bool embeddedRecHits_
True if RecHits stored internally.
Definition: Electron.h:302
double edB() const
the version without arguments returns PD2D, but with an absolute value (for backwards compatibility) ...
Definition: Electron.h:191
double ecalTrackRegressionError_
Definition: Electron.h:331
enum pat::Electron::IPTYPE IpType
void setEcalTrackRegressionSmear(double val)
Definition: Electron.h:233
Analysis-level lepton class.
Definition: Lepton.h:30
bool passConversionVeto_
conversion veto
Definition: Electron.h:348
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
bool embeddedSeedCluster_
True if seed cluster is stored internally.
Definition: Electron.h:298
edm::AtomicPtrCache< std::vector< reco::SuperCluster > > superClusterRelinked_
Place to temporarily store the electron&#39;s supercluster after relinking the seed to it...
Definition: Electron.h:282
const std::vector< reco::CaloCluster > & pflowPreshowerClusters() const
Definition: Electron.h:95
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
std::vector< reco::GsfElectronCore > gsfElectronCore_
Place to store electron&#39;s gsfElectronCore internally.
Definition: Electron.h:270
double ecalTrackRegressionEnergy() const
regression2
Definition: Electron.h:220
float eip_[IpTypeSize]
Impact parameter uncertainty as recommended by the tracking group.
Definition: Electron.h:356
double ip3d_
Definition: Electron.h:325
reco::SuperClusterRef parentSuperCluster() const
override the reco::GsfElectron::pflowSuperCluster method, to access the internal storage of the pflow...
virtual reco::GsfElectronCoreRef core() const
override the virtual reco::GsfElectron::core method, so that the embedded core can be used by GsfElec...
void embedPflowBasicClusters()
method to store the electron&#39;s pflow basic clusters
void embedBasicClusters()
method to store the electron&#39;s basic clusters
float full5x5_sigmaIetaIphi() const
sigmaIEtaIPhi (from full 5x5 non-ZS clusters without fractions, a la 5.3.X)
Definition: Electron.h:206
double ecalTrackRegressionEnergy_
Definition: Electron.h:329
void embedGsfTrack()
method to store the electron&#39;s GsfTrack internally
float ecalPFClusIso_
PFCluster Isolation (a la HLT)
Definition: Electron.h:344
float hcalPFClusIso_
Definition: Electron.h:345
double ecalRegressionError() const
Definition: Electron.h:218
bool isPF() const
Definition: Electron.h:164
double ecalTrackRegressionError() const
Definition: Electron.h:221
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:330
EcalRecHitCollection recHits_
Place to store electron&#39;s RecHits internally (5x5 around seed+ all RecHits)
Definition: Electron.h:304
float full5x5_sigmaIetaIphi_
Definition: Electron.h:324
void setEcalTrackRegressionEnergy(double val, double err)
set regression2
Definition: Electron.h:225
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:315
void setEcalScale(double val)
set scale corrections / smearings
Definition: Electron.h:228
reco::TrackRef track() const
returns nothing. Use either gsfTrack or closestCtfTrack
void setEcalRegressionScale(double val)
Definition: Electron.h:230
bool embeddedGsfTrack_
True if electron&#39;s gsfTrack is stored internally.
Definition: Electron.h:272
void setEcalPFClusterIso(float ecalPFClus)
Definition: Electron.h:160
edm::Ref< ElectronCollection > ElectronRef
Definition: Electron.h:39
void setIsPF(bool hasPFCandidate)
Definition: Electron.h:165
bool isElectronIDAvailable(const char *name) const
Definition: Electron.h:140
double ecalSmear() const
Definition: Electron.h:237
bool embeddedPflowSuperCluster_
True if electron&#39;s pflowsupercluster is stored internally.
Definition: Electron.h:278
void setEcalRegressionSmear(double val)
Definition: Electron.h:231
Analysis-level electron class.
Definition: Electron.h:52
std::vector< IdPair > electronIDs_
Electron IDs.
Definition: Electron.h:308
void setEcalSmear(double val)
Definition: Electron.h:229
bool passConversionVeto() const
vertex fit combined with missing number of hits method
Definition: Electron.h:243
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
reco::PFCandidateRef pfCandidateRef_
reference to the IsolatedPFCandidate this has been built from; null if this has been built from a sta...
Definition: Electron.h:317
float ip_[IpTypeSize]
Impact parameter at the primary vertex,.
Definition: Electron.h:354
bool embeddedSuperCluster_
True if electron&#39;s supercluster is stored internally.
Definition: Electron.h:276
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
reco::CandidatePtr sourceCandidatePtr(size_type i) const
get the source candidate pointer with index i
void setEcalTrackRegressionScale(double val)
Definition: Electron.h:232
double ecalRegressionScale_
Definition: Electron.h:337
std::vector< reco::CaloCluster > pflowPreshowerClusters_
Place to store electron&#39;s pflow preshower clusters internally.
Definition: Electron.h:290
double ecalSmear_
Definition: Electron.h:335
size_t numberOfSourceCandidatePtrs() const
get the number of non-null PFCandidates
Definition: Electron.h:176
std::pair< std::string, float > IdPair
Definition: Electron.h:56
float sigmaIetaIphi() const
Definition: Electron.h:204
reco::CaloClusterPtr seed() const
direct access to the seed cluster
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Electron.h:91
void setAssociatedPackedPFCandidates(const edm::RefProd< pat::PackedCandidateCollection > &refprod, T beginIndexItr, T endIndexItr)
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
Definition: Electron.h:250
void initImpactParameters()
init impact parameter defaults (for use in a constructor)
LorentzVector ecalDrivenMomentum_
ECAL-driven momentum.
Definition: Electron.h:321
void embedPflowPreshowerClusters()
method to store the electron&#39;s pflow preshower clusters
Electron()
default constructor
bool embeddedPFCandidate_
true if the IsolatedPFCandidate is embedded
Definition: Electron.h:313
virtual ~Electron()
destructor
void embedTrack()
method to store the electron&#39;s Track internally
long double T
double ecalTrackRegressionScale_
Definition: Electron.h:340
double ecalRegressionEnergy() const
Definition: Electron.h:217
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
void setEcalRegressionEnergy(double val, double err)
set regression1
Definition: Electron.h:223
void embedPFCandidate()
embed the PFCandidate pointed to by pfCandidateRef_
math::PtEtaPhiELorentzVectorF LorentzVector
std::vector< reco::SuperCluster > pflowSuperCluster_
Place to store electron&#39;s pflow supercluster internally.
Definition: Electron.h:292
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
float sigmaIetaIphi_
additional missing mva variables : 14/04/2012
Definition: Electron.h:324
std::vector< reco::CaloCluster > seedCluster_
Place to store electron&#39;s seed cluster internally.
Definition: Electron.h:300