CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/AnalysisDataFormats/TopObjects/interface/TtSemiEvtSolution.h

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