CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Tau.h
Go to the documentation of this file.
1 //
2 // $Id: Tau.h,v 1.34 2012/04/25 07:32:20 cbern Exp $
3 //
4 
5 #ifndef DataFormats_PatCandidates_Tau_h
6 #define DataFormats_PatCandidates_Tau_h
7 
29 
33 
34 // Define typedefs for convenience
35 namespace pat {
36  class Tau;
37  typedef std::vector<Tau> TauCollection;
40 }
41 
42 namespace reco {
44  std::ostream& operator<<(std::ostream& out, const pat::Tau& obj);
45 }
46 
47 // Class definition
48 namespace pat {
49 
50  class Tau : public Lepton<reco::BaseTau> {
54  friend class PATTauProducer;
55 
56  public:
57 
58  typedef std::pair<std::string,float> IdPair;
59 
61  Tau();
63  Tau(const reco::BaseTau & aTau);
65  Tau(const edm::RefToBase<reco::BaseTau> & aTauRef);
67  Tau(const edm::Ptr<reco::BaseTau> & aTauRef);
69  virtual ~Tau();
70 
72  virtual Tau * clone() const { return new Tau(*this); }
73 
74  // ---- methods for content embedding ----
76  const reco::TrackRefVector & isolationTracks() const;
78  reco::TrackRef leadTrack() const;
80  const reco::TrackRefVector & signalTracks() const;
82  void embedIsolationTracks();
84  void embedLeadTrack();
86  void embedSignalTracks();
89  void embedLeadPFCand();
95  void embedSignalPFCands();
103  void embedIsolationPFCands();
110 
111  // ---- matched GenJet methods ----
113  const reco::GenJet * genJet() const;
115  void setGenJet(const reco::GenJetRef & ref);
116 
117  // ---- CaloTau accessors (getters only) ----
119  bool isCaloTau() const { return !caloSpecific_.empty(); }
121  const pat::tau::TauCaloSpecific & caloSpecific() const ;
148  float maximumHCALhitEt() const { return caloSpecific().maximumHCALhitEt_; }
149 
150  // ---- PFTau accessors (getters only) ----
152  bool isPFTau() const { return !pfSpecific_.empty(); }
154  const pat::tau::TauPFSpecific & pfSpecific() const ;
157  const reco::PFJetRef & pfJetRef() const { return pfSpecific().pfJetRef_; }
169  const reco::PFCandidateRef leadPFCand() const;
184  const std::vector<reco::RecoTauPiZero> & signalPiZeroCandidates() const;
199  const std::vector<reco::RecoTauPiZero> & isolationPiZeroCandidates() const;
211  float emFraction() const { return pfSpecific().emFraction_; }
214  float hcalTotOverPLead() const { return pfSpecific().hcalTotOverPLead_; }
217  float hcalMaxOverPLead() const { return pfSpecific().hcalMaxOverPLead_; }
220  float hcal3x3OverPLead() const { return pfSpecific().hcal3x3OverPLead_; }
238  float caloComp() const { return pfSpecific().caloComp_; }
241  float segComp() const { return pfSpecific().segComp_; }
244  bool muonDecision() const { return pfSpecific().muonDecision_; }
245 
248  const reco::Candidate::LorentzVector& p4Jet() const;
249  float etaetaMoment() const;
250  float phiphiMoment() const;
251  float etaphiMoment() const;
252 
254  int decayMode() const { return pfSpecific().decayMode_; }
256  void setDecayMode(int);
257 
258  // ---- methods for tau ID ----
264  float tauID(const std::string & name) const;
265  float tauID(const char* name ) const {return tauID( std::string(name) );}
267  bool isTauIDAvailable(const std::string & name) const;
270  const std::vector<IdPair> & tauIDs() const { return tauIDs_; }
273  void setTauIDs(const std::vector<IdPair> & ids) { tauIDs_ = ids; }
274 
276  friend std::ostream& reco::operator<<(std::ostream& out, const Tau& obj);
277 
280  const std::vector<std::string> availableJECSets() const;
281  // returns the available JEC Levels for a given jecSet
282  const std::vector<std::string> availableJECLevels(const int& set = 0) const;
283  // returns the available JEC Levels for a given jecSet
284  const std::vector<std::string> availableJECLevels(const std::string& set) const { return availableJECLevels(jecSet(set)); };
287  bool jecSetsAvailable() const { return !jec_.empty(); }
290  bool jecSetAvailable(const std::string& set) const {return (jecSet(set) >= 0); };
293  bool jecSetAvailable(const unsigned int& set) const {return (set < jec_.size()); };
295  std::string currentJECSet() const {
296  return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecSet() : std::string("ERROR");
297  }
299  std::string currentJECLevel() const {
300  return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecLevel(currentJECLevel_) : std::string("ERROR");
301  }
304  float jecFactor(const std::string& level, const std::string& set = "") const;
307  float jecFactor(const unsigned int& level, const unsigned int& set = 0) const;
310  Tau correctedTauJet(const std::string& level, const std::string& set = "") const;
313  Tau correctedTauJet(const unsigned int& level, const unsigned int& set = 0) const;
316  const LorentzVector& correctedP4(const std::string& level, const std::string& set = "") const {
317  return correctedTauJet(level, set).p4();
318  }
321  const LorentzVector& correctedP4(const unsigned int& level, const unsigned int& set = 0) const {
322  return correctedTauJet(level, set).p4();
323  }
324 
325  protected:
326 
329  int jecSet(const std::string& label) const;
331  void currentJECSet(const unsigned int& set) { currentJECSet_=set; };
333  void currentJECLevel(const unsigned int& level) { currentJECLevel_=level; };
335  void addJECFactors(const TauJetCorrFactors& jec) {jec_.push_back(jec); };
337  void initializeJEC(unsigned int level, const unsigned int set = 0);
338 
339  // ---- for content embedding ----
341  std::vector<reco::Track> isolationTracks_;
345  std::vector<reco::Track> leadTrack_;
347  std::vector<reco::Track> signalTracks_;
350  // specific for PFTau
351  std::vector<reco::PFCandidate> leadPFCand_;
353  std::vector<reco::PFCandidate> leadPFChargedHadrCand_;
355  std::vector<reco::PFCandidate> leadPFNeutralCand_;
357 
358  std::vector<reco::PFCandidate> signalPFCands_;
362  std::vector<reco::PFCandidate> signalPFChargedHadrCands_;
366  std::vector<reco::PFCandidate> signalPFNeutralHadrCands_;
370  std::vector<reco::PFCandidate> signalPFGammaCands_;
374  std::vector<reco::PFCandidate> isolationPFCands_;
378  std::vector<reco::PFCandidate> isolationPFChargedHadrCands_;
382  std::vector<reco::PFCandidate> isolationPFNeutralHadrCands_;
386  std::vector<reco::PFCandidate> isolationPFGammaCands_;
390 
391  // ---- matched GenJet holder ----
392  std::vector<reco::GenJet> genJet_;
393 
394  // ---- tau ID's holder ----
395  std::vector<IdPair> tauIDs_;
396 
397  // ---- CaloTau specific variables ----
399  std::vector<pat::tau::TauCaloSpecific> caloSpecific_;
400 
401  // ---- PFTau specific variables ----
403  std::vector<pat::tau::TauPFSpecific> pfSpecific_;
404 
405  // ---- energy scale correction factors ----
406  // energy scale correction factors; the string carries a potential label if
407  // more then one set of correction factors is embedded. The label corresponds
408  // to the label of the jetCorrFactors module that has been embedded.
409  std::vector<pat::TauJetCorrFactors> jec_;
410  // currently applied set of jet energy correction factors (i.e. the index in
411  // jetEnergyCorrections_)
412  unsigned int currentJECSet_;
413  // currently applied jet energy correction level
414  unsigned int currentJECLevel_;
415  };
416 }
417 
418 #endif
const std::vector< reco::RecoTauPiZero > & signalPiZeroCandidates() const
Definition: Tau.cc:520
bool embeddedLeadPFNeutralCand_
Definition: Tau.h:356
virtual Tau * clone() const
required reimplementation of the Candidate&#39;s clone method
Definition: Tau.h:72
const reco::PFCandidateRef leadPFChargedHadrCand() const
Definition: Tau.cc:439
const std::vector< IdPair > & tauIDs() const
Definition: Tau.h:270
const LorentzVector & correctedP4(const std::string &level, const std::string &set="") const
Definition: Tau.h:316
float hcalTotOverPLead() const
Definition: Tau.h:214
void currentJECLevel(const unsigned int &level)
update the current JEC level; used by correctedJet
Definition: Tau.h:333
const LorentzVector & correctedP4(const unsigned int &level, const unsigned int &set=0) const
Definition: Tau.h:321
reco::PFCandidateRefVector signalPFCandsTransientRefVector_
Definition: Tau.h:360
reco::CaloTauTagInfoRef CaloTauTagInfoRef_
std::pair< std::string, float > IdPair
Definition: Tau.h:58
float caloComp() const
Definition: Tau.h:238
bool embeddedSignalPFChargedHadrCands_
Definition: Tau.h:363
float isolationTracksPtSum() const
Definition: Tau.h:142
std::vector< reco::PFCandidate > leadPFNeutralCand_
Definition: Tau.h:355
reco::TrackRef electronPreIDTrack_
Definition: TauPFSpecific.h:52
const reco::PFCandidateRefVector & isolationPFCands() const
Definition: Tau.cc:524
reco::PFCandidateRefVector signalPFGammaCandsTransientRefVector_
Definition: Tau.h:372
std::vector< reco::PFCandidate > signalPFNeutralHadrCands_
Definition: Tau.h:366
const pat::tau::TauCaloSpecific & caloSpecific() const
return CaloTau info or throw exception &#39;not CaloTau&#39;
Definition: Tau.cc:283
std::vector< reco::PFCandidate > signalPFCands_
Definition: Tau.h:358
bool embeddedIsolationPFChargedHadrCands_
Definition: Tau.h:379
bool jecSetAvailable(const std::string &set) const
Definition: Tau.h:290
reco::TrackRefVector signalTracksTransientRefVector_
Definition: Tau.h:348
bool embeddedIsolationPFCands_
Definition: Tau.h:375
float hcal3x3OverPLead() const
Definition: Tau.h:220
reco::PFCandidateRefVector signalPFChargedHadrCandsTransientRefVector_
Definition: Tau.h:364
reco::PFCandidateRefVector isolationPFCandsTransientRefVector_
Definition: Tau.h:376
const reco::PFCandidateRefVector & signalPFChargedHadrCands() const
Definition: Tau.cc:475
bool jecSetAvailable(const unsigned int &set) const
Definition: Tau.h:293
void embedLeadPFChargedHadrCand()
method to store the leading charged hadron candidate internally
Definition: Tau.cc:334
bool signalPFCandsRefVectorFixed_
Definition: Tau.h:361
const reco::PFCandidateRefVector & signalPFNeutrHadrCands() const
Definition: Tau.cc:490
reco::CaloTauTagInfoRef caloTauTagInfoRef() const
Definition: Tau.h:124
bool signalPFNeutralHadrCandsRefVectorFixed_
Definition: Tau.h:369
std::vector< reco::PFCandidate > isolationPFGammaCands_
Definition: Tau.h:386
std::vector< reco::PFCandidate > isolationPFNeutralHadrCands_
Definition: Tau.h:382
float TracksInvariantMass() const
Definition: Tau.h:139
void embedSignalPFGammaCands()
method to store the signal gamma candidates internally
Definition: Tau.cc:386
std::vector< Tau > TauCollection
Definition: Tau.h:36
std::vector< reco::GenJet > genJet_
Definition: Tau.h:392
void embedIsolationPFCands()
method to store the isolation candidates internally
Definition: Tau.cc:397
void embedIsolationPFGammaCands()
method to store the isolation gamma candidates internally
Definition: Tau.cc:428
const reco::GenJet * genJet() const
return matched GenJet, built from the visible particles of a generated tau
Definition: Tau.cc:250
const reco::TrackRef & electronPreIDTrack() const
Definition: Tau.h:229
float leadTrackHCAL3x3hottesthitDEta() const
Definition: Tau.h:133
const reco::Candidate::LorentzVector & p4Jet() const
Definition: Tau.cc:288
edm::Ref< TauCollection > TauRef
Definition: Tau.h:38
const std::vector< std::string > availableJECLevels(const std::string &set) const
Definition: Tau.h:284
const std::vector< std::string > availableJECSets() const
all available label-names of all sets of jet energy corrections
Definition: Tau.cc:610
void setTauIDs(const std::vector< IdPair > &ids)
Definition: Tau.h:273
reco::TrackRef leadTrack() const
override the reco::BaseTau::leadTrack method, to access the internal storage of the leading track ...
Definition: Tau.cc:184
bool embeddedIsolationPFNeutralHadrCands_
Definition: Tau.h:383
void embedSignalTracks()
method to store the signal tracks internally
Definition: Tau.cc:233
float leadPFChargedHadrCandsignedSipt_
Definition: TauPFSpecific.h:29
bool embeddedLeadTrack_
Definition: Tau.h:344
float isolationPFGammaCandsEtSum() const
Definition: Tau.h:205
const pat::tau::TauPFSpecific & pfSpecific() const
return PFTau info or throw exception &#39;not PFTau&#39;
Definition: Tau.cc:278
edm::RefVector< TauCollection > TauRefVector
Definition: Tau.h:39
float maximumHCALPFClusterEt() const
Definition: Tau.h:208
float phiphiMoment() const
Definition: Tau.cc:302
std::vector< reco::PFCandidate > leadPFCand_
Definition: Tau.h:351
bool embeddedSignalPFGammaCands_
Definition: Tau.h:371
float etaetaMoment() const
Definition: Tau.cc:295
int jecSet(const std::string &label) const
return true if this jet carries the jet correction factors of a different set, for systematic studies...
Definition: Tau.cc:600
void initializeJEC(unsigned int level, const unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected ...
Definition: Tau.cc:592
float maximumHCALhitEt() const
Definition: Tau.h:148
const reco::PFCandidateRefVector & signalPFCands() const
Definition: Tau.cc:460
Tau correctedTauJet(const std::string &level, const std::string &set="") const
Definition: Tau.cc:659
reco::PFCandidateRefVector isolationPFNeutralHadrCandsTransientRefVector_
Definition: Tau.h:384
unsigned int currentJECLevel_
Definition: Tau.h:414
void embedSignalPFChargedHadrCands()
method to store the signal charged hadrons candidates internally
Definition: Tau.cc:366
float hcalMaxOverPLead() const
Definition: Tau.h:217
void currentJECSet(const unsigned int &set)
update the current JEC set; used by correctedJet
Definition: Tau.h:331
float isolationPFChargedHadrCandsPtSum() const
Definition: Tau.h:202
void embedSignalPFCands()
method to store the signal candidates internally
Definition: Tau.cc:356
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
std::vector< reco::Track > signalTracks_
Definition: Tau.h:347
std::vector< IdPair > tauIDs_
Definition: Tau.h:395
float signalTracksInvariantMass() const
Definition: Tau.h:136
reco::PFCandidateRefVector isolationPFGammaCandsTransientRefVector_
Definition: Tau.h:388
bool embeddedIsolationPFGammaCands_
Definition: Tau.h:387
std::vector< reco::PFCandidate > signalPFChargedHadrCands_
Definition: Tau.h:362
Tau()
default constructor
Definition: Tau.cc:13
const reco::PFCandidateRefVector & isolationPFNeutrHadrCands() const
Definition: Tau.cc:554
bool signalPFChargedHadrCandsRefVectorFixed_
Definition: Tau.h:365
void embedLeadTrack()
method to store the leading track internally
Definition: Tau.cc:223
Analysis-level lepton class.
Definition: Lepton.h:32
const std::vector< reco::RecoTauPiZero > & isolationPiZeroCandidates() const
Definition: Tau.cc:584
float isolationECALhitsEtSum() const
Definition: Tau.h:145
bool isolationTracksTransientRefVectorFixed_
Definition: Tau.h:343
Jets made from MC generator particles.
Definition: GenJet.h:25
bool embeddedSignalTracks_
Definition: Tau.h:346
reco::PFCandidateRefVector isolationPFChargedHadrCandsTransientRefVector_
Definition: Tau.h:380
const reco::PFCandidateRefVector & isolationPFChargedHadrCands() const
Definition: Tau.cc:539
bool embeddedLeadPFCand_
Definition: Tau.h:352
bool isolationPFGammaCandsRefVectorFixed_
Definition: Tau.h:389
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Tau.h:299
Analysis-level tau class.
Definition: Tau.h:50
bool embeddedLeadPFChargedHadrCand_
Definition: Tau.h:354
void embedIsolationPFNeutralHadrCands()
method to store the isolation neutral hadrons candidates internally
Definition: Tau.cc:418
bool embeddedSignalPFNeutralHadrCands_
Definition: Tau.h:367
std::vector< reco::PFCandidate > isolationPFCands_
Definition: Tau.h:374
std::vector< reco::Track > isolationTracks_
Definition: Tau.h:341
bool isTauIDAvailable(const std::string &name) const
Returns true if a specific ID is available in this pat::Tau.
Definition: Tau.cc:270
tuple out
Definition: dbtoconf.py:99
float isolationPFChargedHadrCandsPtSum_
Definition: TauPFSpecific.h:42
void embedLeadPFNeutralCand()
method to store the leading neutral candidate internally
Definition: Tau.cc:345
float emFraction() const
Definition: Tau.h:211
std::vector< pat::tau::TauCaloSpecific > caloSpecific_
holder for CaloTau info, or empty vector if PFTau
Definition: Tau.h:399
reco::PFCandidateRefVector signalPFNeutralHadrCandsTransientRefVector_
Definition: Tau.h:368
float ecalStripSumEOverPLead() const
Definition: Tau.h:223
bool isCaloTau() const
Returns true if this pat::Tau was made from a reco::CaloTau.
Definition: Tau.h:119
float leadTrackHCAL3x3hitsEtSum() const
Definition: Tau.h:130
int decayMode() const
reconstructed tau decay mode (specific to PFTau)
Definition: Tau.h:254
const reco::PFJetRef & pfJetRef() const
Definition: Tau.h:157
float bremsRecoveryEOverPLead() const
Definition: Tau.h:226
std::vector< pat::TauJetCorrFactors > jec_
Definition: Tau.h:409
reco::PFJetRef pfJetRef_
Definition: TauPFSpecific.h:27
std::vector< reco::PFCandidate > signalPFGammaCands_
Definition: Tau.h:370
const reco::PFCandidateRefVector & signalPFGammaCands() const
Definition: Tau.cc:505
float leadPFChargedHadrCandsignedSipt() const
Definition: Tau.h:163
std::vector< reco::Track > leadTrack_
Definition: Tau.h:345
void embedSignalPFNeutralHadrCands()
method to store the signal neutral hadrons candidates internally
Definition: Tau.cc:376
std::vector< reco::PFCandidate > isolationPFChargedHadrCands_
Definition: Tau.h:378
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
const reco::PFCandidateRef leadPFNeutralCand() const
Definition: Tau.cc:446
float jecFactor(const std::string &level, const std::string &set="") const
Definition: Tau.cc:627
bool isolationPFChargedHadrCandsRefVectorFixed_
Definition: Tau.h:381
bool jecSetsAvailable() const
Definition: Tau.h:287
void setDecayMode(int)
set decay mode
Definition: Tau.cc:316
float etaphiMoment() const
Definition: Tau.cc:309
bool isolationPFCandsRefVectorFixed_
Definition: Tau.h:377
const reco::PFCandidateRef leadPFCand() const
Definition: Tau.cc:453
void embedIsolationPFChargedHadrCands()
method to store the isolation charged hadrons candidates internally
Definition: Tau.cc:408
void addJECFactors(const TauJetCorrFactors &jec)
add more sets of energy correction factors
Definition: Tau.h:335
bool embeddedSignalPFCands_
Definition: Tau.h:359
float tauID(const char *name) const
Definition: Tau.h:265
bool isolationPFNeutralHadrCandsRefVectorFixed_
Definition: Tau.h:385
const std::vector< std::string > availableJECLevels(const int &set=0) const
Definition: Tau.cc:620
const reco::PFCandidateRefVector & isolationPFGammaCands() const
Definition: Tau.cc:569
float segComp() const
Definition: Tau.h:241
bool isPFTau() const
Returns true if this pat::Tau was made from a reco::PFTau.
Definition: Tau.h:152
float tauID(const std::string &name) const
Definition: Tau.cc:256
void setGenJet(const reco::GenJetRef &ref)
set the matched GenJet
Definition: Tau.cc:244
bool embeddedIsolationTracks_
Definition: Tau.h:340
float leadTracksignedSipt() const
Definition: Tau.h:127
tuple level
Definition: testEve_cfg.py:34
void embedIsolationTracks()
method to store the isolation tracks internally
Definition: Tau.cc:212
reco::TrackRefVector isolationTracksTransientRefVector_
Definition: Tau.h:342
const reco::TrackRefVector & signalTracks() const
override the reco::BaseTau::signalTracks method, to access the internal storage of the signal tracks ...
Definition: Tau.cc:194
std::vector< reco::PFCandidate > leadPFChargedHadrCand_
Definition: Tau.h:353
std::string currentJECSet() const
returns the label of the current set of jet energy corrections
Definition: Tau.h:295
bool signalPFGammaCandsRefVectorFixed_
Definition: Tau.h:373
virtual ~Tau()
destructor
Definition: Tau.cc:145
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
void embedLeadPFCand()
method to store the leading candidate internally
Definition: Tau.cc:323
std::vector< pat::tau::TauPFSpecific > pfSpecific_
holder for PFTau info, or empty vector if CaloTau
Definition: Tau.h:403
bool signalTracksTransientRefVectorFixed_
Definition: Tau.h:349
float electronPreIDOutput() const
Definition: Tau.h:232
const reco::TrackRefVector & isolationTracks() const
override the reco::BaseTau::isolationTracks method, to access the internal storage of the isolation t...
Definition: Tau.cc:166
unsigned int currentJECSet_
Definition: Tau.h:412
bool electronPreIDDecision() const
Definition: Tau.h:235
bool muonDecision() const
Definition: Tau.h:244
Produces pat::Tau&#39;s.
void set(const std::string &name, int value)
set the flag, with a run-time name