CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Photon.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef DataFormats_PatCandidates_Photon_h
5 #define DataFormats_PatCandidates_Photon_h
6 
28 
29 
30 // Define typedefs for convenience
31 namespace pat {
32  class Photon;
33  typedef std::vector<Photon> PhotonCollection;
36 }
37 
38 namespace reco {
40  std::ostream& operator<<(std::ostream& out, const pat::Photon& obj);
41 }
42 
43 // Class definition
44 namespace pat {
45  class PATPhotonSlimmer;
46 
47  class Photon : public PATObject<reco::Photon> {
48 
49  public:
50 
51  typedef std::pair<std::string,Bool_t> IdPair;
52 
54  Photon();
56  Photon(const reco::Photon & aPhoton);
58  Photon(const edm::RefToBase<reco::Photon> & aPhotonRef);
60  Photon(const edm::Ptr<reco::Photon> & aPhotonRef);
62  virtual ~Photon();
63 
65  virtual Photon * clone() const { return new Photon(*this); }
66 
67  // ---- methods for content embedding ----
71  reco::CaloClusterPtr seed() const;
72 
73  //method to access the basic clusters
74  const std::vector<reco::CaloCluster>& basicClusters() const { return basicClusters_ ; }
75  //method to access the preshower clusters
76  const std::vector<reco::CaloCluster>& preshowerClusters() const { return preshowerClusters_ ; }
77 
78  //method to access embedded ecal RecHits
79  const EcalRecHitCollection * recHits() const { return &recHits_;}
80 
82  void embedSuperCluster();
84  void embedSeedCluster();
86  void embedBasicClusters();
91 
92 
93  // ---- methods for access the generated photon ----
95  const reco::Candidate * genPhoton() const { return genParticle(); }
97  void setGenPhoton(const reco::GenParticleRef & gp, bool embed=false) { setGenParticleRef(gp, embed); }
98 
99  // ---- methods for photon ID ----
102  Bool_t photonID(const std::string & name) const;
104  bool isPhotonIDAvailable(const std::string & name) const;
107  const std::vector<IdPair> & photonIDs() const { return photonIDs_; }
110  void setPhotonIDs(const std::vector<IdPair> & ids) { photonIDs_ = ids; }
111 
112 
113  // ---- methods for photon isolation ----
116  float trackIso() const { return trkSumPtSolidConeDR04(); }
119  float ecalIso() const { return ecalRecHitSumEtConeDR04(); }
122  float hcalIso() const { return hcalTowerSumEtConeDR04(); }
125  float caloIso() const { return ecalIso()+hcalIso(); }
126 
138  float photonIso() const { return reco::Photon::photonIso(); }
143  float ecalPFClusterIso() const { return ecalPFClusIso_; };
144  float hcalPFClusterIso() const { return hcalPFClusIso_; };
145  void setEcalPFClusterIso(float ecalPFClus) { ecalPFClusIso_ = ecalPFClus; };
146  void setHcalPFClusterIso(float hcalPFClus) { hcalPFClusIso_ = hcalPFClus; };
147 
149  float userIso(uint8_t index=0) const { return userIsolation(IsolationKeys(UserBaseIso + index)); }
153  if (key >= 0) {
154  //if (key >= isolations_.size()) throw cms::Excepton("Missing Data")
155  //<< "Isolation corresponding to key " << key
156  //<< " was not stored for this particle.";
157  if (size_t(key) >= isolations_.size()) return -1.0;
158  return isolations_[key];
159  } else switch (key) {
160  case pat::CaloIso:
161  //if (isolations_.size() <= pat::HcalIso) throw cms::Excepton("Missing Data")
162  //<< "CalIsoo Isolation was not stored for this particle.";
163  if (isolations_.size() <= pat::HcalIso) return -1.0;
165  default:
166  return -1.0;
167  //throw cms::Excepton("Missing Data") << "Isolation corresponding to key "
168  //<< key << " was not stored for this particle.";
169  }
170  }
174  if (key >= 0) {
175  if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
176  isolations_[key] = value;
177  } else {
178  throw cms::Exception("Illegal Argument") <<
179  "The key for which you're setting isolation does not correspond " <<
180  "to an individual isolation but to the sum of more independent isolations " <<
181  "(e.g. Calo = Ecal + Hcal), so you can't SET the value, just GET it.\n" <<
182  "Please set up each component independly.\n";
183  }
184  }
186  void setTrackIso(float trackIso) { setIsolation(TrackIso, trackIso); }
188  void setEcalIso(float caloIso) { setIsolation(EcalIso, caloIso); }
190  void setHcalIso(float caloIso) { setIsolation(HcalIso, caloIso); }
192  void setUserIso(float value, uint8_t index=0) { setIsolation(IsolationKeys(UserBaseIso + index), value); }
193 
194  // ---- methods for photon isolation deposits ----
197  for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
198  it != ed; ++it)
199  {
200  if (it->first == key) return & it->second;
201  }
202  return 0;
203  }
205  const IsoDeposit * trackIsoDeposit() const { return isoDeposit(pat::TrackIso); }
207  const IsoDeposit * ecalIsoDeposit() const { return isoDeposit(pat::EcalIso ); }
209  const IsoDeposit * hcalIsoDeposit() const { return isoDeposit(pat::HcalIso ); }
211  const IsoDeposit * userIsoDeposit(uint8_t index=0) const { return isoDeposit(IsolationKeys(UserBaseIso + index)); }
214  IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
215  for (; it != ed; ++it) {
216  if (it->first == key) { it->second = dep; return; }
217  }
218  isoDeposits_.push_back(std::make_pair(key,dep));
219  }
227  void userIsoDeposit(const IsoDeposit &dep, uint8_t index=0) { setIsoDeposit(IsolationKeys(UserBaseIso + index), dep); }
229  bool passElectronVeto() const { return passElectronVeto_; }
231  //pixel seed to veto electron (not recommended by EGM POG but it seems very efficient)
232  bool hasPixelSeed() const { return hasPixelSeed_; }
234 
236  float seedEnergy() const { return seedEnergy_;}
237  void setSeedEnergy( float e ){ seedEnergy_ = e; }
238 
239  float eMax() const { return eMax_;}
240  void setEMax( float e ){ eMax_ = e;}
241  float e2nd() const { return e2nd_;}
242  void setE2nd( float e ){ e2nd_ = e;}
243  float e3x3() const { return e3x3_;}
244  void setE3x3( float e ){ e3x3_ = e;}
245  float eTop() const { return eTop_;}
246  void setETop( float e ){ eTop_ = e;}
247  float eBottom() const { return eBottom_;}
248  void setEBottom( float e ){ eBottom_ = e;}
249  float eLeft() const { return eLeft_;}
250  void setELeft( float e ){ eLeft_ = e;}
251  float eRight() const { return eRight_;}
252  void setERight( float e ){ eRight_ = e;}
253 
254  float see() const { return see_;}
255  void setSee( float s ){ see_ = s;}
256  float spp() const { return spp_;}
257  void setSpp( float s ){ spp_ = s;}
258  float sep() const { return sep_;}
259  void setSep( float s ){ sep_ = s;}
260 
261  float maxDR() const { return maxDR_;}
262  void setMaxDR( float m ){ maxDR_ = m;}
263  float maxDRDPhi() const { return maxDRDPhi_;}
264  void setMaxDRDPhi( float m ){ maxDRDPhi_ = m;}
265  float maxDRDEta() const { return maxDRDEta_;}
266  void setMaxDRDEta( float m ){ maxDRDEta_ = m;}
267  float maxDRRawEnergy() const { return maxDRRawEnergy_;}
269 
270  float subClusRawE1() const { return subClusRawE1_;}
271  void setSubClusRawE1( float s ){ subClusRawE1_ = s;}
272  float subClusRawE2() const { return subClusRawE2_;}
273  void setSubClusRawE2( float s ){ subClusRawE2_ = s;}
274  float subClusRawE3() const { return subClusRawE3_;}
275  void setSubClusRawE3( float s ){ subClusRawE3_ = s;}
276 
277  float subClusDPhi1() const { return subClusDPhi1_;}
278  void setSubClusDPhi1( float s ){ subClusDPhi1_ = s;}
279  float subClusDPhi2() const { return subClusDPhi2_;}
280  void setSubClusDPhi2( float s ){ subClusDPhi2_ = s;}
281  float subClusDPhi3() const { return subClusDPhi3_;}
282  void setSubClusDPhi3( float s ){ subClusDPhi3_ = s;}
283 
284  float subClusDEta1() const { return subClusDEta1_;}
285  void setSubClusDEta1( float s ){ subClusDEta1_ = s;}
286  float subClusDEta2() const { return subClusDEta2_;}
287  void setSubClusDEta2( float s ){ subClusDEta2_ = s;}
288  float subClusDEta3() const { return subClusDEta3_;}
289  void setSubClusDEta3( float s ){ subClusDEta3_ = s;}
290 
291  float cryPhi() const { return cryPhi_;}
292  void setCryPhi( float c ){ cryPhi_ = c;}
293  float cryEta() const { return cryEta_;}
294  void setCryEta( float c ){ cryEta_ = c;}
295 
296  float iPhi() const { return iPhi_;}
297  void setIPhi( float i ){ iPhi_ = i;}
298  float iEta() const { return iEta_;}
299  void setIEta( float i ){ iEta_ = i;}
300 
302  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Photon& obj);
303 
307  template<typename T>
309  T beginIndexItr,
310  T endIndexItr) {
311  packedPFCandidates_ = refprod;
314  beginIndexItr,
315  endIndexItr);
316  }
317 
322 
323  friend class PATPhotonSlimmer;
324 
325  protected:
326 
327  // ---- for content embedding ----
329  std::vector<reco::SuperCluster> superCluster_;
333  std::vector<reco::CaloCluster> basicClusters_;
335  std::vector<reco::CaloCluster> preshowerClusters_;
339  std::vector<reco::CaloCluster> seedCluster_;
344  // ---- photon ID's holder ----
345  std::vector<IdPair> photonIDs_;
346  // ---- Isolation and IsoDeposit related datamebers ----
347  typedef std::vector<std::pair<IsolationKeys, pat::IsoDeposit> > IsoDepositPairs;
349  std::vector<float> isolations_;
350 
354 
356  float seedEnergy_;
357  float eMax_;
358  float e2nd_;
359  float e3x3_;
360  float eTop_;
361  float eBottom_;
362  float eLeft_;
363  float eRight_;
364 
365  float see_;
366  float spp_;
367  float sep_;
368 
369  float maxDR_;
370  float maxDRDPhi_;
371  float maxDRDEta_;
373 
377 
381 
385 
386  float cryEta_;
387  float cryPhi_;
388  float iEta_;
389  float iPhi_;
390 
393 
394  // ---- link to PackedPFCandidates
396  std::vector<uint16_t> associatedPackedFCandidateIndices_;
397  };
398 
399 
400 }
401 
402 #endif
float subClusDPhi2() const
Definition: Photon.h:279
float subClusDEta3_
Definition: Photon.h:384
float subClusDPhi1_
Definition: Photon.h:378
void setSpp(float s)
Definition: Photon.h:257
int i
Definition: DBlmapReader.cc:9
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:359
Analysis-level Photon class.
Definition: Photon.h:47
edm::RefVector< PhotonCollection > PhotonRefVector
Definition: Photon.h:35
reco::SuperClusterRef superCluster() const
override the superCluster method from CaloJet, to access the internal storage of the supercluster ...
void setIEta(float i)
Definition: Photon.h:299
float cryEta_
Definition: Photon.h:386
float trackIso() const
Definition: Photon.h:116
float eLeft_
Definition: Photon.h:362
void setEcalIso(float caloIso)
Sets ecal isolation variable.
Definition: Photon.h:188
float ecalPFClusterIso() const
get and set PFCluster Isolation
Definition: Photon.h:143
float neutralHadronIso() const
Definition: Photon.h:135
void setSubClusDPhi3(float s)
Definition: Photon.h:282
void setTrackIso(float trackIso)
Sets tracker isolation variable.
Definition: Photon.h:186
float chargedHadronIso() const
Accessors for Particle Flow Isolation variables.
Definition: Photon.h:437
size_t size_type
Definition: Candidate.h:30
float neutralHadronIso() const
Definition: Photon.h:439
void setE2nd(float e)
Definition: Photon.h:242
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:236
void setSee(float s)
Definition: Photon.h:255
bool passElectronVeto_
-— conversion veto -—
Definition: Photon.h:352
void trackIsoDeposit(const IsoDeposit &dep)
Sets tracker IsoDeposit.
Definition: Photon.h:221
virtual Photon * clone() const
required reimplementation of the Candidate&#39;s clone method
Definition: Photon.h:65
edm::Ref< PhotonCollection > PhotonRef
Definition: Photon.h:34
void setMaxDRRawEnergy(float m)
Definition: Photon.h:268
float subClusDEta3() const
Definition: Photon.h:288
float subClusDEta2() const
Definition: Photon.h:286
float trkSumPtSolidConeDR04() const
Definition: Photon.h:371
float puChargedHadronIso() const
Definition: Photon.h:141
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
float sep_
Definition: Photon.h:367
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: Photon.h:308
edm::RefVector< pat::PackedCandidateCollection > associatedPackedPFCandidates() const
References to PFCandidates linked to this object (e.g. for isolation vetos or masking before jet recl...
void ecalIsoDeposit(const IsoDeposit &dep)
Sets ecal IsoDeposit.
Definition: Photon.h:223
void setSubClusDPhi2(float s)
Definition: Photon.h:280
float eMax() const
Definition: Photon.h:239
float spp_
Definition: Photon.h:366
float eRight_
Definition: Photon.h:363
float eBottom() const
Definition: Photon.h:247
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:357
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
float maxDRDPhi() const
Definition: Photon.h:263
bool hasPixelSeed_
Definition: Photon.h:353
float subClusDPhi1() const
Definition: Photon.h:277
float see_
Definition: Photon.h:365
float subClusDPhi3_
Definition: Photon.h:380
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Photon.h:74
std::vector< reco::SuperCluster > superCluster_
Definition: Photon.h:329
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
float hcalIso() const
Definition: Photon.h:122
float iEta() const
Definition: Photon.h:298
std::vector< reco::CaloCluster > preshowerClusters_
Place to store electron&#39;s preshower clusters internally.
Definition: Photon.h:335
void setUserIso(float value, uint8_t index=0)
Sets user isolation variable index.
Definition: Photon.h:192
void setIPhi(float i)
Definition: Photon.h:297
float eLeft() const
Definition: Photon.h:249
void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false)
Set the generator level particle reference.
float subClusRawE2_
Definition: Photon.h:375
float photonIso() const
Definition: Photon.h:440
std::vector< reco::CaloCluster > seedCluster_
Place to store electron&#39;s seed cluster internally.
Definition: Photon.h:339
float e2nd() const
Definition: Photon.h:241
#define embed
Definition: AMPTWrapper.h:178
void setHcalIso(float caloIso)
Sets hcal isolation variable.
Definition: Photon.h:190
void setIsolation(IsolationKeys key, float value)
Definition: Photon.h:173
float chargedHadronIso() const
Definition: Photon.h:132
float subClusRawE1_
Definition: Photon.h:374
void setELeft(float e)
Definition: Photon.h:250
float subClusRawE3_
Definition: Photon.h:376
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Photon.h:213
void userIsoDeposit(const IsoDeposit &dep, uint8_t index=0)
Sets user-level IsoDeposit.
Definition: Photon.h:227
void setEMax(float e)
Definition: Photon.h:240
slimmer of PAT Taus
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
const EcalRecHitCollection * recHits() const
Definition: Photon.h:79
reco::CandidatePtr sourceCandidatePtr(size_type i) const
get the source candidate pointer with index i
float seedEnergy() const
input variables for regression energy corrections
Definition: Photon.h:236
const reco::Candidate * genPhoton() const
return the match to the generated photon
Definition: Photon.h:95
void setERight(float e)
Definition: Photon.h:252
reco::CaloClusterPtr seed() const
direct access to the seed cluster
void setMaxDRDEta(float m)
Definition: Photon.h:266
float eMax_
Definition: Photon.h:357
float subClusRawE1() const
Definition: Photon.h:270
void setPhotonIDs(const std::vector< IdPair > &ids)
Definition: Photon.h:110
float eTop() const
Definition: Photon.h:245
float e3x3() const
Definition: Photon.h:243
void embedBasicClusters()
method to store the electron&#39;s basic clusters
edm::RefProd< pat::PackedCandidateCollection > packedPFCandidates_
Definition: Photon.h:395
const IsoDeposit * hcalIsoDeposit() const
Return the hcal IsoDeposit.
Definition: Photon.h:209
float subClusRawE3() const
Definition: Photon.h:274
void setPassElectronVeto(bool flag)
Definition: Photon.h:230
void setETop(float e)
Definition: Photon.h:246
float subClusDPhi3() const
Definition: Photon.h:281
float userIso(uint8_t index=0) const
Returns a user defined isolation value.
Definition: Photon.h:149
void setSeedEnergy(float e)
Definition: Photon.h:237
void setSubClusDPhi1(float s)
Definition: Photon.h:278
void hcalIsoDeposit(const IsoDeposit &dep)
Sets hcal IsoDeposit.
Definition: Photon.h:225
float maxDR() const
Definition: Photon.h:261
void setSubClusDEta1(float s)
Definition: Photon.h:285
float see() const
Definition: Photon.h:254
std::vector< IdPair > photonIDs_
Definition: Photon.h:345
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
bool embeddedSuperCluster_
Definition: Photon.h:328
void setCryEta(float c)
Definition: Photon.h:294
const IsoDeposit * ecalIsoDeposit() const
Return the ecal IsoDeposit.
Definition: Photon.h:207
tuple out
Definition: dbtoconf.py:99
edm::AtomicPtrCache< std::vector< reco::SuperCluster > > superClusterRelinked_
Place to temporarily store the electron&#39;s supercluster after relinking the seed to it...
Definition: Photon.h:331
float e2nd_
Definition: Photon.h:358
void embedSuperCluster()
method to store the photon&#39;s supercluster internally
float iEta_
Definition: Photon.h:388
EcalRecHitCollection recHits_
Place to store electron&#39;s RecHits internally (5x5 around seed+ all RecHits)
Definition: Photon.h:343
bool embeddedRecHits_
True if RecHits stored internally.
Definition: Photon.h:341
float hcalPFClusIso_
Definition: Photon.h:392
unsigned int index
index type
Definition: Candidate.h:51
bool hasPixelSeed() const
Definition: Photon.h:232
void setCryPhi(float c)
Definition: Photon.h:292
float e3x3_
Definition: Photon.h:359
Bool_t photonID(const std::string &name) const
std::pair< std::string, Bool_t > IdPair
Definition: Photon.h:51
void setHasPixelSeed(bool flag)
Definition: Photon.h:233
float ecalIso() const
Definition: Photon.h:119
const std::vector< IdPair > & photonIDs() const
Definition: Photon.h:107
float cryPhi_
Definition: Photon.h:387
float subClusDEta2_
Definition: Photon.h:383
void setSubClusDEta2(float s)
Definition: Photon.h:287
void setMaxDR(float m)
Definition: Photon.h:262
size_t numberOfSourceCandidatePtrs() const
get the number of non-null PFCandidates
Definition: Photon.h:319
float subClusDEta1_
Definition: Photon.h:382
virtual ~Photon()
destructor
float particleIso() const
Definition: Photon.h:129
float hcalPFClusterIso() const
Definition: Photon.h:144
IsoDepositPairs isoDeposits_
Definition: Photon.h:348
float eBottom_
Definition: Photon.h:361
void setSubClusRawE2(float s)
Definition: Photon.h:273
float iPhi() const
Definition: Photon.h:296
bool passElectronVeto() const
vertex fit method
Definition: Photon.h:229
void setEBottom(float e)
Definition: Photon.h:248
float maxDRRawEnergy() const
Definition: Photon.h:267
float caloIso() const
Definition: Photon.h:125
float photonIso() const
Definition: Photon.h:138
const IsoDeposit * trackIsoDeposit() const
Return the tracker IsoDeposit.
Definition: Photon.h:205
float seedEnergy_
-— input variables for regression energy corrections -—
Definition: Photon.h:356
void setMaxDRDPhi(float m)
Definition: Photon.h:264
float maxDRDEta() const
Definition: Photon.h:265
float spp() const
Definition: Photon.h:256
void setSubClusDEta3(float s)
Definition: Photon.h:289
float cryEta() const
Definition: Photon.h:293
float subClusDPhi2_
Definition: Photon.h:379
bool embeddedSeedCluster_
True if seed cluster is stored internally.
Definition: Photon.h:337
void setSubClusRawE1(float s)
Definition: Photon.h:271
Templated PAT object container.
Definition: PATObject.h:41
float userIsolation(IsolationKeys key) const
Definition: Photon.h:152
float iPhi_
Definition: Photon.h:389
float sep() const
Definition: Photon.h:258
bool isPhotonIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Photon.
const IsoDeposit * userIsoDeposit(uint8_t index=0) const
Return a specified user-level IsoDeposit.
Definition: Photon.h:211
void setSubClusRawE3(float s)
Definition: Photon.h:275
std::vector< uint16_t > associatedPackedFCandidateIndices_
Definition: Photon.h:396
float maxDRDEta_
Definition: Photon.h:371
float ecalPFClusIso_
Definition: Photon.h:391
float subClusDEta1() const
Definition: Photon.h:284
long double T
float maxDRRawEnergy_
Definition: Photon.h:372
const IsoDeposit * isoDeposit(IsolationKeys key) const
Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
Definition: Photon.h:196
float eTop_
Definition: Photon.h:360
float eRight() const
Definition: Photon.h:251
float maxDRDPhi_
Definition: Photon.h:370
float subClusRawE2() const
Definition: Photon.h:272
float maxDR_
Definition: Photon.h:369
std::vector< std::pair< IsolationKeys, pat::IsoDeposit > > IsoDepositPairs
Definition: Photon.h:347
void setGenPhoton(const reco::GenParticleRef &gp, bool embed=false)
method to set the generated photon
Definition: Photon.h:97
std::vector< Photon > PhotonCollection
Definition: Photon.h:32
void setHcalPFClusterIso(float hcalPFClus)
Definition: Photon.h:146
float cryPhi() const
Definition: Photon.h:291
Photon()
default constructor
void setE3x3(float e)
Definition: Photon.h:244
std::vector< reco::CaloCluster > basicClusters_
Place to store electron&#39;s basic clusters internally.
Definition: Photon.h:333
std::vector< float > isolations_
Definition: Photon.h:349
void setSep(float s)
Definition: Photon.h:259
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Photon.h:76
void setEcalPFClusterIso(float ecalPFClus)
Definition: Photon.h:145