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 
128  float ecalPFClusterIso() const { return ecalPFClusIso_;}
129  float hcalPFClusterIso() const { return hcalPFClusIso_;}
130  void setEcalPFClusterIso(float ecalPFClus) { ecalPFClusIso_=ecalPFClus;}
131  void setHcalPFClusterIso(float hcalPFClus) { hcalPFClusIso_=hcalPFClus;}
132 
144  float photonIso() const { return reco::Photon::photonIso(); }
148 
150  float userIso(uint8_t index=0) const { return userIsolation(IsolationKeys(UserBaseIso + index)); }
154  if (key >= 0) {
155  //if (key >= isolations_.size()) throw cms::Excepton("Missing Data")
156  //<< "Isolation corresponding to key " << key
157  //<< " was not stored for this particle.";
158  if (size_t(key) >= isolations_.size()) return -1.0;
159  return isolations_[key];
160  } else switch (key) {
161  case pat::CaloIso:
162  //if (isolations_.size() <= pat::HcalIso) throw cms::Excepton("Missing Data")
163  //<< "CalIsoo Isolation was not stored for this particle.";
164  if (isolations_.size() <= pat::HcalIso) return -1.0;
166  default:
167  return -1.0;
168  //throw cms::Excepton("Missing Data") << "Isolation corresponding to key "
169  //<< key << " was not stored for this particle.";
170  }
171  }
175  if (key >= 0) {
176  if (size_t(key) >= isolations_.size()) isolations_.resize(key+1, -1.0);
177  isolations_[key] = value;
178  } else {
179  throw cms::Exception("Illegal Argument") <<
180  "The key for which you're setting isolation does not correspond " <<
181  "to an individual isolation but to the sum of more independent isolations " <<
182  "(e.g. Calo = Ecal + Hcal), so you can't SET the value, just GET it.\n" <<
183  "Please set up each component independly.\n";
184  }
185  }
187  void setTrackIso(float trackIso) { setIsolation(TrackIso, trackIso); }
189  void setEcalIso(float caloIso) { setIsolation(EcalIso, caloIso); }
191  void setHcalIso(float caloIso) { setIsolation(HcalIso, caloIso); }
193  void setUserIso(float value, uint8_t index=0) { setIsolation(IsolationKeys(UserBaseIso + index), value); }
194 
195  // ---- methods for photon isolation deposits ----
198  for (IsoDepositPairs::const_iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
199  it != ed; ++it)
200  {
201  if (it->first == key) return & it->second;
202  }
203  return 0;
204  }
206  const IsoDeposit * trackIsoDeposit() const { return isoDeposit(pat::TrackIso); }
208  const IsoDeposit * ecalIsoDeposit() const { return isoDeposit(pat::EcalIso ); }
210  const IsoDeposit * hcalIsoDeposit() const { return isoDeposit(pat::HcalIso ); }
212  const IsoDeposit * userIsoDeposit(uint8_t index=0) const { return isoDeposit(IsolationKeys(UserBaseIso + index)); }
215  IsoDepositPairs::iterator it = isoDeposits_.begin(), ed = isoDeposits_.end();
216  for (; it != ed; ++it) {
217  if (it->first == key) { it->second = dep; return; }
218  }
219  isoDeposits_.push_back(std::make_pair(key,dep));
220  }
228  void userIsoDeposit(const IsoDeposit &dep, uint8_t index=0) { setIsoDeposit(IsolationKeys(UserBaseIso + index), dep); }
230  bool passElectronVeto() const { return passElectronVeto_; }
231  void setPassElectronVeto( bool flag ) { passElectronVeto_ = flag; }
232  //pixel seed to veto electron (not recommended by EGM POG but it seems very efficient)
233  bool hasPixelSeed() const { return hasPixelSeed_; }
234  void setHasPixelSeed( bool flag ) { hasPixelSeed_ = flag; }
235 
237  float seedEnergy() const { return seedEnergy_;}
238  void setSeedEnergy( float e ){ seedEnergy_ = e; }
239 
240  float eMax() const { return eMax_;}
241  void setEMax( float e ){ eMax_ = e;}
242  float e2nd() const { return e2nd_;}
243  void setE2nd( float e ){ e2nd_ = e;}
244  float e3x3() const { return e3x3_;}
245  void setE3x3( float e ){ e3x3_ = e;}
246  float eTop() const { return eTop_;}
247  void setETop( float e ){ eTop_ = e;}
248  float eBottom() const { return eBottom_;}
249  void setEBottom( float e ){ eBottom_ = e;}
250  float eLeft() const { return eLeft_;}
251  void setELeft( float e ){ eLeft_ = e;}
252  float eRight() const { return eRight_;}
253  void setERight( float e ){ eRight_ = e;}
254 
255  float see() const { return see_;}
256  void setSee( float s ){ see_ = s;}
257  float spp() const { return spp_;}
258  void setSpp( float s ){ spp_ = s;}
259  float sep() const { return sep_;}
260  void setSep( float s ){ sep_ = s;}
261 
262  float maxDR() const { return maxDR_;}
263  void setMaxDR( float m ){ maxDR_ = m;}
264  float maxDRDPhi() const { return maxDRDPhi_;}
265  void setMaxDRDPhi( float m ){ maxDRDPhi_ = m;}
266  float maxDRDEta() const { return maxDRDEta_;}
267  void setMaxDRDEta( float m ){ maxDRDEta_ = m;}
268  float maxDRRawEnergy() const { return maxDRRawEnergy_;}
270 
271  float subClusRawE1() const { return subClusRawE1_;}
272  void setSubClusRawE1( float s ){ subClusRawE1_ = s;}
273  float subClusRawE2() const { return subClusRawE2_;}
274  void setSubClusRawE2( float s ){ subClusRawE2_ = s;}
275  float subClusRawE3() const { return subClusRawE3_;}
276  void setSubClusRawE3( float s ){ subClusRawE3_ = s;}
277 
278  float subClusDPhi1() const { return subClusDPhi1_;}
279  void setSubClusDPhi1( float s ){ subClusDPhi1_ = s;}
280  float subClusDPhi2() const { return subClusDPhi2_;}
281  void setSubClusDPhi2( float s ){ subClusDPhi2_ = s;}
282  float subClusDPhi3() const { return subClusDPhi3_;}
283  void setSubClusDPhi3( float s ){ subClusDPhi3_ = s;}
284 
285  float subClusDEta1() const { return subClusDEta1_;}
286  void setSubClusDEta1( float s ){ subClusDEta1_ = s;}
287  float subClusDEta2() const { return subClusDEta2_;}
288  void setSubClusDEta2( float s ){ subClusDEta2_ = s;}
289  float subClusDEta3() const { return subClusDEta3_;}
290  void setSubClusDEta3( float s ){ subClusDEta3_ = s;}
291 
292  float cryPhi() const { return cryPhi_;}
293  void setCryPhi( float c ){ cryPhi_ = c;}
294  float cryEta() const { return cryEta_;}
295  void setCryEta( float c ){ cryEta_ = c;}
296 
297  float iPhi() const { return iPhi_;}
298  void setIPhi( float i ){ iPhi_ = i;}
299  float iEta() const { return iEta_;}
300  void setIEta( float i ){ iEta_ = i;}
301 
303  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Photon& obj);
304 
308  template<typename T>
310  T beginIndexItr,
311  T endIndexItr) {
312  packedPFCandidates_ = refprod;
315  beginIndexItr,
316  endIndexItr);
317  }
318 
323 
324  friend class PATPhotonSlimmer;
325 
326  protected:
327 
328  // ---- for content embedding ----
330  std::vector<reco::SuperCluster> superCluster_;
334  std::vector<reco::CaloCluster> basicClusters_;
336  std::vector<reco::CaloCluster> preshowerClusters_;
340  std::vector<reco::CaloCluster> seedCluster_;
345  // ---- photon ID's holder ----
346  std::vector<IdPair> photonIDs_;
347  // ---- Isolation and IsoDeposit related datamebers ----
348  typedef std::vector<std::pair<IsolationKeys, pat::IsoDeposit> > IsoDepositPairs;
350  std::vector<float> isolations_;
351 
355 
357  float seedEnergy_;
358  float eMax_;
359  float e2nd_;
360  float e3x3_;
361  float eTop_;
362  float eBottom_;
363  float eLeft_;
364  float eRight_;
365 
366  float see_;
367  float spp_;
368  float sep_;
369 
370  float maxDR_;
371  float maxDRDPhi_;
372  float maxDRDEta_;
374 
378 
382 
386 
387  float cryEta_;
388  float cryPhi_;
389  float iEta_;
390  float iPhi_;
391 
394 
395  // ---- link to PackedPFCandidates
397  std::vector<uint16_t> associatedPackedFCandidateIndices_;
398  };
399 
400 
401 }
402 
403 #endif
float subClusDPhi2() const
Definition: Photon.h:280
float subClusDEta3_
Definition: Photon.h:385
float subClusDPhi1_
Definition: Photon.h:379
void setSpp(float s)
Definition: Photon.h:258
int i
Definition: DBlmapReader.cc:9
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:388
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:300
float cryEta_
Definition: Photon.h:387
float trackIso() const
Definition: Photon.h:116
float eLeft_
Definition: Photon.h:363
void setEcalIso(float caloIso)
Sets ecal isolation variable.
Definition: Photon.h:189
float ecalPFClusterIso() const
get and set PFCluster isolation
Definition: Photon.h:128
float neutralHadronIso() const
Definition: Photon.h:141
void setSubClusDPhi3(float s)
Definition: Photon.h:283
void setTrackIso(float trackIso)
Sets tracker isolation variable.
Definition: Photon.h:187
float chargedHadronIso() const
Accessors for Particle Flow Isolation variables.
Definition: Photon.h:466
size_t size_type
Definition: Candidate.h:30
float neutralHadronIso() const
Definition: Photon.h:468
void setE2nd(float e)
Definition: Photon.h:243
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:244
void setSee(float s)
Definition: Photon.h:256
bool passElectronVeto_
-— conversion veto -—
Definition: Photon.h:353
void trackIsoDeposit(const IsoDeposit &dep)
Sets tracker IsoDeposit.
Definition: Photon.h:222
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:269
float subClusDEta3() const
Definition: Photon.h:289
float subClusDEta2() const
Definition: Photon.h:287
float trkSumPtSolidConeDR04() const
Definition: Photon.h:400
float puChargedHadronIso() const
Definition: Photon.h:147
void embedSeedCluster()
method to store the electron&#39;s seedcluster internally
float sep_
Definition: Photon.h:368
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:309
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:224
void setSubClusDPhi2(float s)
Definition: Photon.h:281
float eMax() const
Definition: Photon.h:240
float spp_
Definition: Photon.h:367
float eRight_
Definition: Photon.h:364
float eBottom() const
Definition: Photon.h:248
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:386
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer ...
float maxDRDPhi() const
Definition: Photon.h:264
bool hasPixelSeed_
Definition: Photon.h:354
float subClusDPhi1() const
Definition: Photon.h:278
float see_
Definition: Photon.h:366
float subClusDPhi3_
Definition: Photon.h:381
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Photon.h:74
std::vector< reco::SuperCluster > superCluster_
Definition: Photon.h:330
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
float hcalIso() const
Definition: Photon.h:122
float iEta() const
Definition: Photon.h:299
std::vector< reco::CaloCluster > preshowerClusters_
Place to store electron&#39;s preshower clusters internally.
Definition: Photon.h:336
void setUserIso(float value, uint8_t index=0)
Sets user isolation variable index.
Definition: Photon.h:193
void setIPhi(float i)
Definition: Photon.h:298
float eLeft() const
Definition: Photon.h:250
void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false)
Set the generator level particle reference.
float subClusRawE2_
Definition: Photon.h:376
float photonIso() const
Definition: Photon.h:469
std::vector< reco::CaloCluster > seedCluster_
Place to store electron&#39;s seed cluster internally.
Definition: Photon.h:340
float e2nd() const
Definition: Photon.h:242
#define embed
Definition: AMPTWrapper.h:178
void setHcalIso(float caloIso)
Sets hcal isolation variable.
Definition: Photon.h:191
void setIsolation(IsolationKeys key, float value)
Definition: Photon.h:174
float chargedHadronIso() const
Definition: Photon.h:138
float subClusRawE1_
Definition: Photon.h:375
void setELeft(float e)
Definition: Photon.h:251
float subClusRawE3_
Definition: Photon.h:377
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:214
void userIsoDeposit(const IsoDeposit &dep, uint8_t index=0)
Sets user-level IsoDeposit.
Definition: Photon.h:228
void setEMax(float e)
Definition: Photon.h:241
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:237
const reco::Candidate * genPhoton() const
return the match to the generated photon
Definition: Photon.h:95
void setERight(float e)
Definition: Photon.h:253
reco::CaloClusterPtr seed() const
direct access to the seed cluster
void setMaxDRDEta(float m)
Definition: Photon.h:267
float eMax_
Definition: Photon.h:358
float subClusRawE1() const
Definition: Photon.h:271
void setPhotonIDs(const std::vector< IdPair > &ids)
Definition: Photon.h:110
float eTop() const
Definition: Photon.h:246
float e3x3() const
Definition: Photon.h:244
void embedBasicClusters()
method to store the electron&#39;s basic clusters
edm::RefProd< pat::PackedCandidateCollection > packedPFCandidates_
Definition: Photon.h:396
const IsoDeposit * hcalIsoDeposit() const
Return the hcal IsoDeposit.
Definition: Photon.h:210
float subClusRawE3() const
Definition: Photon.h:275
void setPassElectronVeto(bool flag)
Definition: Photon.h:231
float patParticleIso() const
Definition: Photon.h:135
void setETop(float e)
Definition: Photon.h:247
float subClusDPhi3() const
Definition: Photon.h:282
float userIso(uint8_t index=0) const
Returns a user defined isolation value.
Definition: Photon.h:150
void setSeedEnergy(float e)
Definition: Photon.h:238
void setSubClusDPhi1(float s)
Definition: Photon.h:279
void hcalIsoDeposit(const IsoDeposit &dep)
Sets hcal IsoDeposit.
Definition: Photon.h:226
float maxDR() const
Definition: Photon.h:262
void setSubClusDEta1(float s)
Definition: Photon.h:286
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
float see() const
Definition: Photon.h:255
std::vector< IdPair > photonIDs_
Definition: Photon.h:346
void embedPreshowerClusters()
method to store the electron&#39;s preshower clusters
bool embeddedSuperCluster_
Definition: Photon.h:329
void setCryEta(float c)
Definition: Photon.h:295
const IsoDeposit * ecalIsoDeposit() const
Return the ecal IsoDeposit.
Definition: Photon.h:208
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:332
float e2nd_
Definition: Photon.h:359
void embedSuperCluster()
method to store the photon&#39;s supercluster internally
float iEta_
Definition: Photon.h:389
EcalRecHitCollection recHits_
Place to store electron&#39;s RecHits internally (5x5 around seed+ all RecHits)
Definition: Photon.h:344
bool embeddedRecHits_
True if RecHits stored internally.
Definition: Photon.h:342
float hcalPFClusIso_
Definition: Photon.h:393
unsigned int index
index type
Definition: Candidate.h:51
bool hasPixelSeed() const
Definition: Photon.h:233
void setCryPhi(float c)
Definition: Photon.h:293
float e3x3_
Definition: Photon.h:360
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:234
float ecalIso() const
Definition: Photon.h:119
const std::vector< IdPair > & photonIDs() const
Definition: Photon.h:107
float cryPhi_
Definition: Photon.h:388
float subClusDEta2_
Definition: Photon.h:384
void setSubClusDEta2(float s)
Definition: Photon.h:288
void setMaxDR(float m)
Definition: Photon.h:263
size_t numberOfSourceCandidatePtrs() const
get the number of non-null PFCandidates
Definition: Photon.h:320
float subClusDEta1_
Definition: Photon.h:383
virtual ~Photon()
destructor
float hcalPFClusterIso() const
Definition: Photon.h:129
IsoDepositPairs isoDeposits_
Definition: Photon.h:349
float eBottom_
Definition: Photon.h:362
void setSubClusRawE2(float s)
Definition: Photon.h:274
float iPhi() const
Definition: Photon.h:297
bool passElectronVeto() const
vertex fit method
Definition: Photon.h:230
void setEBottom(float e)
Definition: Photon.h:249
float maxDRRawEnergy() const
Definition: Photon.h:268
float caloIso() const
Definition: Photon.h:125
float photonIso() const
Definition: Photon.h:144
const IsoDeposit * trackIsoDeposit() const
Return the tracker IsoDeposit.
Definition: Photon.h:206
float seedEnergy_
-— input variables for regression energy corrections -—
Definition: Photon.h:357
void setMaxDRDPhi(float m)
Definition: Photon.h:265
float maxDRDEta() const
Definition: Photon.h:266
float spp() const
Definition: Photon.h:257
void setSubClusDEta3(float s)
Definition: Photon.h:290
float cryEta() const
Definition: Photon.h:294
float subClusDPhi2_
Definition: Photon.h:380
bool embeddedSeedCluster_
True if seed cluster is stored internally.
Definition: Photon.h:338
void setSubClusRawE1(float s)
Definition: Photon.h:272
Templated PAT object container.
Definition: PATObject.h:49
float userIsolation(IsolationKeys key) const
Definition: Photon.h:153
float iPhi_
Definition: Photon.h:390
float sep() const
Definition: Photon.h:259
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:212
void setSubClusRawE3(float s)
Definition: Photon.h:276
std::vector< uint16_t > associatedPackedFCandidateIndices_
Definition: Photon.h:397
float maxDRDEta_
Definition: Photon.h:372
float ecalPFClusIso_
Definition: Photon.h:392
float subClusDEta1() const
Definition: Photon.h:285
long double T
float maxDRRawEnergy_
Definition: Photon.h:373
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:197
float eTop_
Definition: Photon.h:361
float eRight() const
Definition: Photon.h:252
float maxDRDPhi_
Definition: Photon.h:371
float subClusRawE2() const
Definition: Photon.h:273
float maxDR_
Definition: Photon.h:370
std::vector< std::pair< IsolationKeys, pat::IsoDeposit > > IsoDepositPairs
Definition: Photon.h:348
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:131
float cryPhi() const
Definition: Photon.h:292
Photon()
default constructor
void setE3x3(float e)
Definition: Photon.h:245
std::vector< reco::CaloCluster > basicClusters_
Place to store electron&#39;s basic clusters internally.
Definition: Photon.h:334
std::vector< float > isolations_
Definition: Photon.h:350
void setSep(float s)
Definition: Photon.h:260
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Photon.h:76
void setEcalPFClusterIso(float ecalPFClus)
Definition: Photon.h:130