CMS 3D CMS Logo

TtSemiEvtSolution.h

Go to the documentation of this file.
00001 //
00002 // $Id: TtSemiEvtSolution.h,v 1.28.2.1 2009/04/01 22:32:52 rwolf Exp $
00003 //
00004 
00005 #ifndef TopObjects_TtSemiEvtSolution_h
00006 #define TopObjects_TtSemiEvtSolution_h
00007 
00008 #include <vector>
00009 #include <string>
00010 
00011 #include "DataFormats/Common/interface/Handle.h"
00012 #include "DataFormats/Common/interface/RefProd.h"
00013 #include "DataFormats/Common/interface/Ref.h"
00014 
00015 #include "DataFormats/Candidate/interface/Particle.h"
00016 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00017 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
00018 
00019 #include "DataFormats/PatCandidates/interface/Particle.h"
00020 #include "DataFormats/PatCandidates/interface/Electron.h"
00021 #include "DataFormats/PatCandidates/interface/Muon.h"
00022 #include "DataFormats/PatCandidates/interface/Tau.h"
00023 #include "DataFormats/PatCandidates/interface/Jet.h"
00024 #include "DataFormats/PatCandidates/interface/MET.h"
00025 
00026 #include "DataFormats/Candidate/interface/ShallowClonePtrCandidate.h"
00027 #include "DataFormats/Candidate/interface/CompositeCandidate.h"
00028 
00029 // FIXME: make the decay member an enumerable
00030 // FIXME: Can we generalize all the muon and electron to lepton?
00031 
00032 class TtSemiEvtSolution {
00033   
00034   friend class TtSemiEvtSolutionMaker;
00035   friend class TtSemiLepKinFitter;
00036   friend class TtSemiLRSignalSelObservables;
00037   friend class TtSemiLRSignalSelCalc;
00038   friend class TtSemiLRJetCombObservables;
00039   friend class TtSemiLRJetCombCalc;
00040   
00041  public:
00042 
00043   
00044   TtSemiEvtSolution();
00045   virtual ~TtSemiEvtSolution();
00046  
00047   //-------------------------------------------
00048   // get calibrated base objects 
00049   //------------------------------------------- 
00050   pat::Jet getHadb() const;
00051   pat::Jet getHadp() const;
00052   pat::Jet getHadq() const;
00053   pat::Jet getLepb() const;
00054   pat::Muon getMuon() const { return *muon_; };
00055   pat::Electron getElectron() const { return *electron_; };
00056   pat::MET getNeutrino() const { return *neutrino_; };
00057 
00058   //-------------------------------------------
00059   // get the matched gen particles
00060   //-------------------------------------------
00061   const edm::RefProd<TtGenEvent> & getGenEvent() const { return theGenEvt_; };
00062   const reco::GenParticle * getGenHadt() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->hadronicDecayTop(false); };
00063   const reco::GenParticle * getGenHadW() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->hadronicDecayW(false); };
00064   const reco::GenParticle * getGenHadb() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->hadronicDecayB(false); };
00065   const reco::GenParticle * getGenHadp() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->hadronicDecayQuark(); };
00066   const reco::GenParticle * getGenHadq() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->hadronicDecayQuarkBar(); };
00067   const reco::GenParticle * getGenLept() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->leptonicDecayTop(false); };
00068   const reco::GenParticle * getGenLepW() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->leptonicDecayW(false); };
00069   const reco::GenParticle * getGenLepb() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->leptonicDecayB(false); };
00070   const reco::GenParticle * getGenLepl() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->singleLepton(false); };
00071   const reco::GenParticle * getGenLepn() const { if (!theGenEvt_) return 0; else return this->getGenEvent()->singleNeutrino(false); };
00072 
00073   //-------------------------------------------
00074   // get (un-)/calibrated reco objects
00075   //-------------------------------------------
00076   reco::Particle getRecHadt() const;
00077   reco::Particle getRecHadW() const;       
00078   pat::Jet getRecHadb() const { return hadb_->correctedJet("RAW"); };
00079   pat::Jet getRecHadp() const { return hadp_->correctedJet("RAW"); };
00080   pat::Jet getRecHadq() const { return hadq_->correctedJet("RAW"); };
00081   reco::Particle getRecLept() const;             
00082   reco::Particle getRecLepW() const;  
00083   pat::Jet getRecLepb() const { return lepb_->correctedJet("RAW"); }; 
00084   pat::Muon getRecLepm() const { return this->getMuon(); };
00085   pat::Electron getRecLepe() const { return this->getElectron(); };
00086   pat::MET getRecLepn() const { return this->getNeutrino(); };  
00087   // FIXME: Why these functions??? Not needed!
00088   // methods to get calibrated objects 
00089   reco::Particle getCalHadt() const;
00090   reco::Particle getCalHadW() const;
00091   pat::Jet getCalHadb() const { return this->getHadb(); };
00092   pat::Jet getCalHadp() const { return this->getHadp(); };
00093   pat::Jet getCalHadq() const { return this->getHadq(); };
00094   reco::Particle getCalLept() const;
00095   reco::Particle getCalLepW() const;
00096   pat::Jet getCalLepb() const { return this->getLepb(); };
00097   pat::Muon getCalLepm() const { return this->getMuon(); };
00098   pat::Electron getCalLepe() const { return this->getElectron(); };
00099   pat::MET getCalLepn() const { return this->getNeutrino(); };
00100 
00101   //-------------------------------------------
00102   // get objects from kinematic fit
00103   //-------------------------------------------  
00104   reco::Particle getFitHadt() const;
00105   reco::Particle getFitHadW() const;
00106   pat::Particle getFitHadb() const { return (fitHadb_.size()>0 ? fitHadb_.front() : pat::Particle()); };
00107   pat::Particle getFitHadp() const { return (fitHadp_.size()>0 ? fitHadp_.front() : pat::Particle()); };
00108   pat::Particle getFitHadq() const { return (fitHadq_.size()>0 ? fitHadq_.front() : pat::Particle()); };
00109   reco::Particle getFitLept() const;      
00110   reco::Particle getFitLepW() const;
00111   pat::Particle getFitLepb() const { return (fitLepb_.size()>0 ? fitLepb_.front() : pat::Particle()); };
00112   pat::Particle getFitLepl() const { return (fitLepl_.size()>0 ? fitLepl_.front() : pat::Particle()); }; 
00113   pat::Particle getFitLepn() const { return (fitLepn_.size()>0 ? fitLepn_.front() : pat::Particle()); };    
00114 
00115   //-------------------------------------------
00116   // get the selected semileptonic decay chain 
00117   //-------------------------------------------
00118   std::string getDecay() const { return decay_; }
00119 
00120   //-------------------------------------------
00121   // get info on the matching
00122   //-------------------------------------------
00123   double getMCBestSumAngles() const { return sumAnglejp_;};
00124   double getMCBestAngleHadp() const { return angleHadp_; };
00125   double getMCBestAngleHadq() const { return angleHadq_; };
00126   double getMCBestAngleHadb() const { return angleHadb_; };
00127   double getMCBestAngleLepb() const { return angleLepb_; };
00128   int getMCChangeWQ() const { return changeWQ_; };     
00129 
00130   //-------------------------------------------
00131   // get the selected kinfit parametrisations 
00132   // of each type of object 
00133   //-------------------------------------------
00134   int getJetParametrisation() const { return jetParam_; }
00135   int getLeptonParametrisation() const { return leptonParam_; }
00136   int getNeutrinoParametrisation() const { return neutrinoParam_; }
00137 
00138   //-------------------------------------------
00139   // get the prob of the chi2 value resulting 
00140   // from the kinematic fit
00141   //-------------------------------------------
00142   double getProbChi2() const { return probChi2_; }
00143 
00144   //-------------------------------------------
00145   // get info on the outcome of the signal 
00146   // selection LR
00147   //-------------------------------------------
00148   double getLRSignalEvtObsVal(unsigned int) const;
00149   double getLRSignalEvtLRval() const { return lrSignalEvtLRval_; }
00150   double getLRSignalEvtProb() const { return lrSignalEvtProb_; }
00151 
00152   //-------------------------------------------
00153   // get info on the outcome of the different 
00154   // jet combination methods
00155   //-------------------------------------------
00156   int getMCBestJetComb() const { return mcBestJetComb_; }
00157   int getSimpleBestJetComb() const { return simpleBestJetComb_; }
00158   int getLRBestJetComb() const { return lrBestJetComb_; }
00159   double getLRJetCombObsVal(unsigned int) const;
00160   double getLRJetCombLRval() const { return lrJetCombLRval_; }
00161   double getLRJetCombProb() const { return lrJetCombProb_; }
00162 
00163 
00164 
00165   //-------------------------------------------  
00166   // get the various event hypotheses
00167   //-------------------------------------------  
00168   const reco::CompositeCandidate & getRecoHyp() const { return recoHyp_; }
00169   const reco::CompositeCandidate & getFitHyp () const { return fitHyp_;  }
00170   const reco::CompositeCandidate & getMCHyp  () const { return mcHyp_;   }
00171   
00172  protected:         
00173 
00174   //-------------------------------------------  
00175   // set the generated event
00176   //-------------------------------------------
00177   void setGenEvt(const edm::Handle<TtGenEvent> & aGenEvt);
00178 
00179   //------------------------------------------- 
00180   // set the basic objects 
00181   //-------------------------------------------  
00182   void setJetCorrectionScheme(int scheme) { jetCorrScheme_ = scheme; };
00183   void setHadp(const edm::Handle<std::vector<pat::Jet> > & jet, int i)
00184   { hadp_ = edm::Ptr<pat::Jet>(jet, i); };
00185   void setHadq(const edm::Handle<std::vector<pat::Jet> > & jet, int i)
00186   { hadq_ = edm::Ptr<pat::Jet>(jet, i); };
00187   void setHadb(const edm::Handle<std::vector<pat::Jet> > & jet, int i)
00188   { hadb_ = edm::Ptr<pat::Jet>(jet, i); };
00189   void setLepb(const edm::Handle<std::vector<pat::Jet> > & jet, int i)
00190   { lepb_ = edm::Ptr<pat::Jet>(jet, i); };
00191   void setMuon(const edm::Handle<std::vector<pat::Muon> > & muon, int i)
00192   { muon_ = edm::Ptr<pat::Muon>(muon, i); decay_ = "muon"; };
00193   void setElectron(const edm::Handle<std::vector<pat::Electron> > & elec, int i)
00194   { electron_ = edm::Ptr<pat::Electron>(elec, i); decay_ = "electron"; };
00195   void setNeutrino(const edm::Handle<std::vector<pat::MET> > & met, int i)
00196   { neutrino_ = edm::Ptr<pat::MET>(met, i); };
00197 
00198   //-------------------------------------------  
00199   // set the fitted objects 
00200   //-------------------------------------------  
00201   void setFitHadb(const pat::Particle & aFitHadb) { fitHadb_.clear(); fitHadb_.push_back(aFitHadb); };
00202   void setFitHadp(const pat::Particle & aFitHadp) { fitHadp_.clear(); fitHadp_.push_back(aFitHadp); };
00203   void setFitHadq(const pat::Particle & aFitHadq) { fitHadq_.clear(); fitHadq_.push_back(aFitHadq); };
00204   void setFitLepb(const pat::Particle & aFitLepb) { fitLepb_.clear(); fitLepb_.push_back(aFitLepb); };
00205   void setFitLepl(const pat::Particle & aFitLepl) { fitLepl_.clear(); fitLepl_.push_back(aFitLepl); };
00206   void setFitLepn(const pat::Particle & aFitLepn) { fitLepn_.clear(); fitLepn_.push_back(aFitLepn); };
00207 
00208   //-------------------------------------------  
00209   // set the info on the matching
00210   //-------------------------------------------  
00211   void setMCBestSumAngles(double sdr) { sumAnglejp_= sdr; };
00212   void setMCBestAngleHadp(double adr) { angleHadp_ = adr; };
00213   void setMCBestAngleHadq(double adr) { angleHadq_ = adr; };
00214   void setMCBestAngleHadb(double adr) { angleHadb_ = adr; };
00215   void setMCBestAngleLepb(double adr) { angleLepb_ = adr; };
00216   void setMCChangeWQ(int wq) { changeWQ_ = wq; };
00217 
00218   //-------------------------------------------  
00219   // set the kinfit parametrisations of each 
00220   // type of object 
00221   //-------------------------------------------  
00222   void setJetParametrisation(int jp) { jetParam_ = jp; };
00223   void setLeptonParametrisation(int lp) { leptonParam_ = lp; };
00224   void setNeutrinoParametrisation(int mp) { neutrinoParam_ = mp; };
00225 
00226   //-------------------------------------------  
00227   // set the prob. of the chi2 value resulting 
00228   // from the kinematic fit 
00229   //-------------------------------------------  
00230   void setProbChi2(double c) { probChi2_ = c; };
00231 
00232   //-------------------------------------------  
00233   // set the outcome of the different jet 
00234   // combination methods
00235   //-------------------------------------------  
00236   void setMCBestJetComb(int mcbs) { mcBestJetComb_ = mcbs; };
00237   void setSimpleBestJetComb(int sbs) { simpleBestJetComb_ = sbs;  };
00238   void setLRBestJetComb(int lrbs) { lrBestJetComb_ = lrbs;  };
00239   void setLRJetCombObservables(std::vector<std::pair<unsigned int, double> > varval);
00240   void setLRJetCombLRval(double clr) {lrJetCombLRval_ = clr;};
00241   void setLRJetCombProb(double plr) {lrJetCombProb_ = plr;};
00242 
00243   //-------------------------------------------  
00244   // set the outcome of the signal selection LR
00245   //-------------------------------------------  
00246   void setLRSignalEvtObservables(std::vector<std::pair<unsigned int, double> > varval);
00247   void setLRSignalEvtLRval(double clr) {lrSignalEvtLRval_ = clr;};
00248   void setLRSignalEvtProb(double plr) {lrSignalEvtProb_ = plr;};
00249 
00250 
00251 
00252  private:
00253 
00254   //-------------------------------------------    
00255   // particle content
00256   //-------------------------------------------  
00257   edm::RefProd<TtGenEvent> theGenEvt_;
00258   edm::Ptr<pat::Jet> hadb_, hadp_, hadq_, lepb_;
00259   edm::Ptr<pat::Muon> muon_;
00260   edm::Ptr<pat::Electron> electron_;
00261   edm::Ptr<pat::MET> neutrino_;
00262   std::vector<pat::Particle> fitHadb_, fitHadp_, fitHadq_;
00263   std::vector<pat::Particle> fitLepb_, fitLepl_, fitLepn_;
00264 
00265   reco::CompositeCandidate mcHyp_;
00266   reco::CompositeCandidate recoHyp_;
00267   reco::CompositeCandidate fitHyp_;
00268 
00269   void setupHyp();
00270 
00271   std::string decay_;
00272   int jetCorrScheme_;
00273   double sumAnglejp_, angleHadp_, angleHadq_, angleHadb_, angleLepb_;
00274   int changeWQ_;
00275   int jetParam_, leptonParam_, neutrinoParam_;
00276   double probChi2_;
00277   int mcBestJetComb_, simpleBestJetComb_, lrBestJetComb_;
00278   double lrJetCombLRval_, lrJetCombProb_;
00279   double lrSignalEvtLRval_, lrSignalEvtProb_;
00280   std::vector<std::pair<unsigned int, double> > lrJetCombVarVal_;
00281   std::vector<std::pair<unsigned int, double> > lrSignalEvtVarVal_;  
00282 };
00283 
00284 #endif

Generated on Tue Jun 9 17:25:09 2009 for CMSSW by  doxygen 1.5.4