CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/TopQuarkAnalysis/TopJetCombination/src/TtSemiLRJetCombObservables.cc

Go to the documentation of this file.
00001 //
00002 // Author:  Jan Heyninck
00003 // Created: Tue Apr  3 17:33:23 PDT 2007
00004 //
00005 // $Id: TtSemiLRJetCombObservables.cc,v 1.16 2011/10/12 13:39:34 snaumann Exp $
00006 //
00007 #include "TopQuarkAnalysis/TopJetCombination/interface/TtSemiLRJetCombObservables.h"
00008 #include "DataFormats/PatCandidates/interface/Jet.h"
00009 #include "DataFormats/Math/interface/deltaR.h"
00010 #include "DataFormats/Math/interface/deltaPhi.h"
00011 #include "DataFormats/Common/interface/Handle.h"
00012 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
00013 
00014 // constructor with path; default should not be used
00015 TtSemiLRJetCombObservables::TtSemiLRJetCombObservables() {}
00016 
00017 
00018 // destructor
00019 TtSemiLRJetCombObservables::~TtSemiLRJetCombObservables() {}
00020 
00021 std::vector< TtSemiLRJetCombObservables::IntBoolPair >
00022 TtSemiLRJetCombObservables::operator() (TtSemiEvtSolution &solution, const edm::Event & iEvent, bool matchOnly)
00023 { 
00024   bool debug=false;
00025   
00026   evtselectVarVal.clear();
00027   evtselectVarMatch.clear();
00028  
00029   // Check whether the objects are matched:
00030 //  bool matchHadt = false; //commented out since gcc461 complained that this variable was set but unused
00031 //  bool matchLept = false; //commented out since gcc461 complained that this variable was set but unused
00032 //  bool matchHadW = false; //commented out since gcc461 complained that this variable was set but unused
00033 //  bool matchLepW = false; //commented out since gcc461 complained that this variable was set but unused
00034   bool matchHadb = false;
00035   bool matchLepb = false;
00036   bool matchHadp = false;
00037   bool matchHadq = false;  
00038   bool matchHadpq = false;
00039   bool matchHadqp = false;
00040   bool matchLepl = false;
00041   bool matchLepn = false;
00042   
00043   if(debug) std::cout << "== start matching the objects " << std::endl;
00044   
00045   try {
00046     
00047     if(debug) std::cout << "== start trying " << std::endl;
00048     double drLepl=0, drLepn=0, drHadb=0, drLepb=0, drHadp=0, drHadq=0, drHadpq=0, drHadqp=0; // drHadt=0, drLept=0, drLepW=0, drHadW=0;
00049     
00050     edm::Handle<TtGenEvent> genEvent;
00051     iEvent.getByLabel ("genEvt",genEvent);
00052     if(debug) std::cout << "== found genEvent " << std::endl;
00053     
00054     if (genEvent->isSemiLeptonic() && genEvent->numberOfBQuarks() == 2) {
00055 
00056       //if(debug) std::cout << "== genEvent->quarkFromAntiTop() " << genEvent->quarkFromAntiTop()->pt() << std::endl;
00057       if(debug) std::cout << "== genEvent->isSemiLeptonic() && genEvent->numberOfBQuarks() == 2 " << std::endl;
00058       if(debug) std::cout << "== solution.getDecay() == " <<solution.getDecay()<< std::endl;     
00059       if(debug) std::cout << "== solution.getRecLepm().pt() = " <<solution.getRecLepm().pt()  << std::endl;
00060       //if(debug) if(solution.getGenLepl() == 0) std::cout << "solution.getGenLepl() == NULL" << std::endl;
00061       if(debug) std::cout << "== *(solution.getGenLept())" << solution.getGenLept()->pt() << std::endl;
00062       if(debug) std::cout << "== *(solution.getGenLepl())" << solution.getGenLepl()->pt() << std::endl;
00063       // std::cout << "Semilepton:\n";
00064       // Match the lepton by deltaR
00065       if (solution.getDecay() == "muon")     drLepl = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepm(), *(solution.getGenLepl()));
00066       if(debug) std::cout << "== matching lepton " << std::endl;
00067       if (solution.getDecay() == "electron") drLepl = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepe(), *(solution.getGenLepl()));
00068       matchLepl = (drLepl < 0.3);
00069       
00070       if(debug) std::cout << "== lepton is matched " << std::endl;
00071       // Match the neutrino by deltaR
00072       drLepn = DeltaR<pat::Particle, reco::GenParticle>()(solution.getRecLepn(), *(solution.getGenLepn()));
00073       matchLepn = (drLepn < 0.3);
00074 
00075       // Match the hadronic b by deltaR
00076       drHadb = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadb(), *(solution.getGenHadb()));
00077       matchHadb = (drHadb < 0.3);
00078 
00079       // Match the hadronicleptonic b by deltaR
00080       drLepb = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecLepb(), *(solution.getGenLepb()));
00081       matchLepb = (drLepb < 0.3);
00082 
00083       // Match the hadronic p by deltaR
00084       drHadp = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadp(), *(solution.getGenHadp()));
00085       matchHadp = (drHadp < 0.3);
00086       
00087       // Match the hadronic pq by deltaR
00088       drHadpq = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadp(), *(solution.getGenHadq()));
00089       matchHadpq = (drHadpq < 0.3);
00090     
00091       // Match the hadronic q by deltaR
00092       drHadq = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadq(), *(solution.getGenHadq()));
00093       matchHadq = (drHadq < 0.3);      
00094 
00095       // Match the hadronic qp by deltaR
00096       drHadqp = DeltaR<pat::Jet, reco::GenParticle>()(solution.getRecHadq(), *(solution.getGenHadp()));
00097       matchHadqp = (drHadqp < 0.3);  
00098 
00099       //commented out since gcc461 complained that these variables were set but unused!
00100       /*
00101       // Match the hadronic W by deltaR
00102       drHadW = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecHadW(), *(solution.getGenHadW()));
00103       matchHadW = (drHadW < 0.3);    
00104 
00105       // Match the leptonic W by deltaR
00106       drLepW = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecLepW(), *(solution.getGenLepW()));
00107       matchLepW = (drLepW < 0.3);  
00108      
00109       // Match the hadronic t by deltaR
00110       drHadt = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecHadt(), *(solution.getGenHadt()));
00111       matchHadt = (drHadt < 0.3);    
00112 
00113       // Match the leptonic t by deltaR
00114       drLept = DeltaR<reco::Particle, reco::GenParticle>()(solution.getRecLept(), *(solution.getGenLept()));
00115       matchLept = (drLept < 0.3);   
00116       */
00117     }
00118   } catch (...){std::cout << "Exception\n";}
00119 
00120   if(debug) std::cout << "== objects matched" <<std::endl;
00121 
00122   edm::Handle<std::vector<pat::Jet> > jets;
00123   iEvent.getByLabel(jetSource_, jets);
00124 
00125   if(debug) std::cout << "== start calculating observables" << std::endl;
00126 
00127 
00128   //obs1 : pt(had top) 
00129   double AverageTop =((solution.getHadb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt()+(solution.getLepb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt()+(solution.getHadb().p4()+solution.getLepb().p4()+solution.getHadp().p4()).pt()+(solution.getHadb().p4()+solution.getHadq().p4()+solution.getLepb().p4()).pt())/4.;
00130   double Obs1 = ((solution.getHadb().p4()+solution.getHadq().p4()+solution.getHadp().p4()).pt())/AverageTop;
00131   evtselectVarVal.push_back(IntDblPair(1,Obs1));
00132   evtselectVarMatch.push_back(IntBoolPair(1, ((matchHadq&&matchHadp)||(matchHadpq&&matchHadqp))&&matchHadb)); 
00133 
00134   if(debug) std::cout << "== observable 1 " << Obs1 << std::endl;
00135  
00136   //obs2 : (pt_b1 + pt_b2)/(sum jetpt)
00137   double Obs2 = (solution.getHadb().pt()+solution.getLepb().pt())/(solution.getHadp().pt()+solution.getHadq().pt());
00138   evtselectVarVal.push_back(IntDblPair(2,Obs2));
00139   evtselectVarMatch.push_back(IntBoolPair(2,((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb)); 
00140 
00141   if(debug) std::cout << "== observable 2 " << Obs2 << std::endl;
00142 
00143   //obs3: delta R between lep b and lepton 
00144   double Obs3 = -999;
00145   if (solution.getDecay() == "muon")     Obs3 = ROOT::Math::VectorUtil::DeltaR( solution.getLepb().p4(),solution.getRecLepm().p4() );
00146   if (solution.getDecay() == "electron") Obs3 = ROOT::Math::VectorUtil::DeltaR( solution.getLepb().p4(),solution.getRecLepe().p4() );
00147   evtselectVarVal.push_back(IntDblPair(3,Obs3));
00148   evtselectVarMatch.push_back(IntBoolPair(3,matchLepb&&matchLepl)); 
00149 
00150   if(debug) std::cout << "== observable 3 " << Obs3 << std::endl;
00151   
00152    //obs4 : del R ( had b, had W)
00153   double Obs4 = ROOT::Math::VectorUtil::DeltaR( solution.getHadb().p4(), solution.getHadq().p4()+solution.getHadp().p4() );
00154   evtselectVarVal.push_back(IntDblPair(4,Obs4));  
00155   evtselectVarMatch.push_back(IntBoolPair(4,matchHadb&&((matchHadp&&matchHadp)||(matchHadpq&&matchHadqp)))); 
00156 
00157   if(debug) std::cout << "== observable 4 " << Obs4 << std::endl;
00158  
00159   //obs5 : del R between light quarkssolution.getHadp().phi(
00160   double Obs5 = ROOT::Math::VectorUtil::DeltaR( solution.getHadq().p4(),solution.getHadp().p4() );
00161   evtselectVarVal.push_back(IntDblPair(5,Obs5)); 
00162   evtselectVarMatch.push_back(IntBoolPair(5,(matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))); 
00163 
00164   if(debug) std::cout << "== observable 5 " << Obs5 << std::endl;
00165 
00166   //obs6 : b-tagging information
00167   double Obs6 = 0;
00168   if ( fabs(solution.getHadb().bDiscriminator("trackCountingJetTags") +10) < 0.0001 || fabs(solution.getLepb().bDiscriminator("trackCountingJetTags") +10)< 0.0001 ){
00169     Obs6 = -10.;
00170   } else {
00171     Obs6 = (solution.getHadb().bDiscriminator("trackCountingJetTags")+solution.getLepb().bDiscriminator("trackCountingJetTags"));
00172   }
00173   evtselectVarVal.push_back(IntDblPair(6,Obs6)); 
00174   evtselectVarMatch.push_back(IntBoolPair(6,1)); 
00175  
00176   if(debug) std::cout << "== observable 6 " << Obs6 << std::endl;
00177 
00178   //obs7 : chi2 value of kinematical fit with W-mass constraint
00179   double Obs7 =0;
00180   if(solution.getProbChi2() <0){Obs7 = -0;} else { Obs7 = log10(solution.getProbChi2()+.00001);}
00181   evtselectVarVal.push_back(IntDblPair(7,Obs7)); 
00182   evtselectVarMatch.push_back(IntBoolPair(7,((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)))); 
00183 
00184   if(debug) std::cout << "== observable 7 " << Obs7 << std::endl;
00185 
00186   //obs8(=7+1)
00187   double Obs8 =  solution.getCalHadt().p4().pt();
00188   evtselectVarVal.push_back(IntDblPair(8,Obs8));
00189   evtselectVarMatch.push_back(IntBoolPair(8, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00190 
00191   if(debug) std::cout << "== observable 8 " << Obs8 << std::endl;
00192 
00193   //obs9
00194   double Obs9  = fabs(solution.getCalHadt().p4().eta());
00195   evtselectVarVal.push_back(IntDblPair(9,Obs9));
00196   evtselectVarMatch.push_back(IntBoolPair(9, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00197 
00198   if(debug) std::cout << "== observable 9 " << Obs9 << std::endl;
00199 
00200   //obs10  
00201   double Obs10  = solution.getCalHadt().p4().theta();
00202   evtselectVarVal.push_back(IntDblPair(10,Obs10));
00203   evtselectVarMatch.push_back(IntBoolPair(10, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00204 
00205   if(debug) std::cout << "== observable 10 " << Obs10 << std::endl;
00206  
00207   //obs11
00208   double Obs11  = solution.getCalHadW().p4().pt();
00209   evtselectVarVal.push_back(IntDblPair(11,Obs11));
00210   evtselectVarMatch.push_back(IntBoolPair(11, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00211   
00212   if(debug) std::cout << "== observable 11 " << Obs11 << std::endl;
00213 
00214   //obs12
00215   double Obs12  = fabs(solution.getCalHadW().p4().eta());
00216   evtselectVarVal.push_back(IntDblPair(12,Obs12));
00217   evtselectVarMatch.push_back(IntBoolPair(12, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00218 
00219   if(debug) std::cout << "== observable 12 " << Obs12 << std::endl;
00220   
00221   //obs13
00222   double Obs13  = solution.getCalHadW().p4().theta();
00223   evtselectVarVal.push_back(IntDblPair(13,Obs13));
00224   evtselectVarMatch.push_back(IntBoolPair(13, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00225 
00226   if(debug) std::cout << "== observable 13 " << Obs13 << std::endl;
00227         
00228   //obs14
00229   double Obs14  = solution.getCalHadb().p4().pt();
00230   evtselectVarVal.push_back(IntDblPair(14,Obs14));
00231   evtselectVarMatch.push_back(IntBoolPair(14, matchHadb));
00232 
00233   if(debug) std::cout << "== observable 14 " << Obs14 << std::endl;
00234             
00235   //obs15
00236   double Obs15  = fabs(solution.getCalHadb().p4().eta());
00237   evtselectVarVal.push_back(IntDblPair(15,Obs15));
00238   evtselectVarMatch.push_back(IntBoolPair(15, matchHadb));
00239 
00240   if(debug) std::cout << "== observable 15 " << Obs15 << std::endl;
00241             
00242   //obs16
00243   double Obs16  = solution.getCalHadb().p4().theta();
00244   evtselectVarVal.push_back(IntDblPair(16,Obs16));
00245   evtselectVarMatch.push_back(IntBoolPair(16, matchHadb));
00246 
00247   if(debug) std::cout << "== observable 16 " << Obs16 << std::endl;
00248             
00249   //obs17
00250   double Obs17  = solution.getCalHadp().p4().pt();
00251   evtselectVarVal.push_back(IntDblPair(17,Obs17));
00252   evtselectVarMatch.push_back(IntBoolPair(17, matchHadp));
00253 
00254   if(debug) std::cout << "== observable 17 " << Obs17 << std::endl;
00255             
00256   //obs18
00257   double Obs18  = fabs(solution.getCalHadp().p4().eta());
00258   evtselectVarVal.push_back(IntDblPair(18,Obs18));
00259   evtselectVarMatch.push_back(IntBoolPair(18, matchHadp));
00260 
00261   if(debug) std::cout << "== observable 18 " << Obs18 << std::endl;
00262             
00263   //obs19
00264   double Obs19  = solution.getCalHadp().p4().theta();
00265   evtselectVarVal.push_back(IntDblPair(19,Obs19));
00266   evtselectVarMatch.push_back(IntBoolPair(19, matchHadp));
00267 
00268   if(debug) std::cout << "== observable 19 " << Obs19 << std::endl;
00269             
00270   //obs20
00271   double Obs20  = solution.getCalHadq().p4().pt();
00272   evtselectVarVal.push_back(IntDblPair(20,Obs20));
00273   evtselectVarMatch.push_back(IntBoolPair(20, matchHadq));
00274 
00275   if(debug) std::cout << "== observable 20 " << Obs20 << std::endl;
00276             
00277   //obs21
00278   double Obs21  = fabs(solution.getCalHadq().p4().eta());
00279   evtselectVarVal.push_back(IntDblPair(21,Obs21));
00280   evtselectVarMatch.push_back(IntBoolPair(21, matchHadq));
00281 
00282   if(debug) std::cout << "== observable 21 " << Obs21 << std::endl;
00283             
00284   //obs22
00285   double Obs22  = solution.getCalHadq().p4().theta();
00286   evtselectVarVal.push_back(IntDblPair(22,Obs22));
00287   evtselectVarMatch.push_back(IntBoolPair(22, matchHadq));
00288 
00289   if(debug) std::cout << "== observable 22 " << Obs22 << std::endl;
00290             
00291   //obs23
00292   double Obs23  = solution.getCalLept().p4().pt();
00293   evtselectVarVal.push_back(IntDblPair(23,Obs23));
00294   evtselectVarMatch.push_back(IntBoolPair(23, matchLepl&&matchLepn&&matchLepb));
00295 
00296   if(debug) std::cout << "== observable 23 " << Obs23 << std::endl;
00297             
00298   //obs24
00299   double Obs24  = fabs(solution.getCalLept().p4().eta());
00300   evtselectVarVal.push_back(IntDblPair(24,Obs24));
00301   evtselectVarMatch.push_back(IntBoolPair(24, matchLepl&&matchLepn&&matchLepb));
00302 
00303   if(debug) std::cout << "== observable 24 " << Obs24 << std::endl;
00304             
00305   //obs25
00306   double Obs25  = solution.getCalLept().p4().theta();
00307   evtselectVarVal.push_back(IntDblPair(25,Obs25));
00308   evtselectVarMatch.push_back(IntBoolPair(25, matchLepl&&matchLepn&&matchLepb));
00309 
00310   if(debug) std::cout << "== observable 25 " << Obs25 << std::endl;
00311             
00312   //obs26
00313   double Obs26  = solution.getRecLepW().p4().pt(); 
00314   evtselectVarVal.push_back(IntDblPair(26,Obs26));
00315   evtselectVarMatch.push_back(IntBoolPair(26, matchLepl&&matchLepn));
00316 
00317   if(debug) std::cout << "== observable 26 " << Obs26 << std::endl;
00318 
00319   //obs27
00320   double Obs27  = fabs(solution.getRecLepW().p4().eta());  
00321   evtselectVarVal.push_back(IntDblPair(27,Obs27));
00322   evtselectVarMatch.push_back(IntBoolPair(27, matchLepl&&matchLepn));
00323 
00324   if(debug) std::cout << "== observable 27 " << Obs27 << std::endl;
00325             
00326   //obs28
00327   double Obs28  = solution.getRecLepW().p4().theta(); 
00328   evtselectVarVal.push_back(IntDblPair(28,Obs28));
00329   evtselectVarMatch.push_back(IntBoolPair(28, matchLepl&&matchLepn));
00330 
00331   if(debug) std::cout << "== observable 28 " << Obs28 << std::endl;
00332   
00333   //obs29 
00334   double Obs29  = solution.getCalLepb().p4().pt();
00335   evtselectVarVal.push_back(IntDblPair(29,Obs29));
00336   evtselectVarMatch.push_back(IntBoolPair(29, matchLepb));
00337 
00338   if(debug) std::cout << "== observable 29 " << Obs29 << std::endl;
00339   
00340   //obs30
00341   double Obs30  = fabs(solution.getCalLepb().p4().eta());
00342   evtselectVarVal.push_back(IntDblPair(30,Obs30));
00343   evtselectVarMatch.push_back(IntBoolPair(30, matchLepb));
00344 
00345   if(debug) std::cout << "== observable 30 " << Obs30 << std::endl;
00346   
00347   //obs31
00348   double Obs31  = solution.getCalLepb().p4().theta();
00349   evtselectVarVal.push_back(IntDblPair(31,Obs31));
00350   evtselectVarMatch.push_back(IntBoolPair(31, matchLepb));
00351 
00352   if(debug) std::cout << "== observable 31 " << Obs31 << std::endl;
00353   
00354   //obs32
00355   double Obs32 = -999.;
00356   if (solution.getDecay() == "muon") Obs32 = solution.getRecLepm().p4().pt(); 
00357   if (solution.getDecay() == "electron") Obs32 = solution.getRecLepe().p4().pt(); 
00358   evtselectVarVal.push_back(IntDblPair(32,Obs32));
00359   evtselectVarMatch.push_back(IntBoolPair(32, matchLepl));
00360 
00361   if(debug) std::cout << "== observable 32 " << Obs32 << std::endl;
00362    
00363   //obs33
00364   double Obs33 = -999.;
00365   if (solution.getDecay() == "muon") Obs33 = fabs(solution.getRecLepm().p4().eta());
00366   if (solution.getDecay() == "electron") Obs33 = fabs(solution.getRecLepe().p4().eta());
00367   evtselectVarVal.push_back(IntDblPair(33,Obs33));
00368   evtselectVarMatch.push_back(IntBoolPair(33, matchLepl));
00369 
00370   if(debug) std::cout << "== observable 33 " << Obs33 << std::endl;
00371  
00372   //obs34
00373   double Obs34 = -999.;
00374   if (solution.getDecay() == "muon") Obs34 = fabs(solution.getRecLepm().p4().theta());
00375   if (solution.getDecay() == "electron") Obs34 = fabs(solution.getRecLepe().p4().theta()); 
00376   evtselectVarVal.push_back(IntDblPair(34,Obs34));
00377   evtselectVarMatch.push_back(IntBoolPair(34, matchLepl));
00378 
00379   if(debug) std::cout << "== observable 34 " << Obs34 << std::endl;
00380   
00381   //obs35
00382   double Obs35  = solution.getFitLepn().p4().pt();
00383   evtselectVarVal.push_back(IntDblPair(35,Obs35));
00384   evtselectVarMatch.push_back(IntBoolPair(35, matchLepn));
00385 
00386   if(debug) std::cout << "== observable 35 " << Obs35 << std::endl;
00387   
00388   //obs36
00389   double Obs36  = fabs(solution.getFitLepn().p4().eta());
00390   evtselectVarVal.push_back(IntDblPair(36,Obs36));
00391   evtselectVarMatch.push_back(IntBoolPair(36, matchLepn));
00392 
00393   if(debug) std::cout << "== observable 36 " << Obs36 << std::endl;
00394   
00395   //obs37
00396   double Obs37  = solution.getFitLepn().p4().theta();
00397   evtselectVarVal.push_back(IntDblPair(37,Obs37));
00398   evtselectVarMatch.push_back(IntBoolPair(37, matchLepn));
00399 
00400   if(debug) std::cout << "== observable 37 " << Obs37 << std::endl;
00401   
00402   // 2 particle kinematics
00403   //obs38 
00404   double Obs38  = fabs(solution.getCalHadW().p4().phi()- solution.getRecLepW().p4().phi());
00405   if (Obs38 > 3.1415927)  Obs38 =  2*3.1415927 - Obs31;
00406   if (Obs38 < -3.1415927) Obs38 = -2*3.1415927 - Obs31;
00407   evtselectVarVal.push_back(IntDblPair(38,Obs38));
00408   evtselectVarMatch.push_back(IntBoolPair(38, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00409 
00410   if(debug) std::cout << "== observable 38 " << Obs38 << std::endl;
00411   
00412   //obs39
00413   double Obs39  = fabs(solution.getCalHadW().p4().eta()- solution.getRecLepW().p4().eta());
00414   evtselectVarVal.push_back(IntDblPair(39,Obs39));
00415   evtselectVarMatch.push_back(IntBoolPair(39, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00416 
00417   if(debug) std::cout << "== observable 39 " << Obs39 << std::endl;
00418   
00419   //obs40
00420   double Obs40  = fabs(solution.getCalHadW().p4().theta()- solution.getRecLepW().p4().theta());
00421   evtselectVarVal.push_back(IntDblPair(40,Obs40));
00422   evtselectVarMatch.push_back(IntBoolPair(40, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00423 
00424   if(debug) std::cout << "== observable 40 " << Obs40 << std::endl;
00425   
00426   //obs41
00427   double Obs41  = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadW().p4(), solution.getRecLepW().p4());
00428   evtselectVarVal.push_back(IntDblPair(41,Obs41));
00429   evtselectVarMatch.push_back(IntBoolPair(41, matchLepl&&matchLepn&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00430 
00431   if(debug) std::cout << "== observable 41 " << Obs41 << std::endl;
00432   
00433   //obs42
00434   double Obs42  = fabs(solution.getCalHadb().p4().phi()- solution.getCalLepb().p4().phi());
00435   if (Obs42 > 3.1415927)  Obs42 =  2*3.1415927 - Obs42;
00436   if (Obs42 < -3.1415927) Obs42 = -2*3.1415927 - Obs42;
00437   evtselectVarVal.push_back(IntDblPair(42,Obs42));
00438   evtselectVarMatch.push_back(IntBoolPair(42, matchHadb&&matchLepb));
00439 
00440   if(debug) std::cout << "== observable 42 " << Obs42 << std::endl;
00441   
00442   //obs43
00443   double Obs43  = fabs(solution.getCalHadb().p4().eta()- solution.getCalLepb().p4().eta());
00444   evtselectVarVal.push_back(IntDblPair(43,Obs43));
00445   evtselectVarMatch.push_back(IntBoolPair(43, matchHadb&&matchLepb));
00446 
00447   if(debug) std::cout << "== observable 43 " << Obs43 << std::endl;
00448   
00449   //obs44
00450   double Obs44 = fabs(solution.getCalHadb().p4().theta()- solution.getCalLepb().p4().theta());
00451   evtselectVarVal.push_back(IntDblPair(44,Obs44));
00452   evtselectVarMatch.push_back(IntBoolPair(44, matchHadb&&matchLepb));
00453 
00454   if(debug) std::cout << "== observable 44 " << Obs44 << std::endl;
00455   
00456   //obs45
00457   double Obs45  = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadb().p4(), solution.getCalLepb().p4());
00458   evtselectVarVal.push_back(IntDblPair(45,Obs45));
00459   evtselectVarMatch.push_back(IntBoolPair(45, matchHadb&&matchLepb));
00460 
00461   if(debug) std::cout << "== observable 45 " << Obs45 << std::endl;
00462   
00463   //obs46
00464   double Obs46  = fabs(solution.getCalHadb().p4().phi()- solution.getCalHadW().p4().phi());
00465   if (Obs46 > 3.1415927)  Obs46 =  2*3.1415927 - Obs46;
00466   if (Obs46 < -3.1415927) Obs46 = -2*3.1415927 - Obs46;
00467   evtselectVarVal.push_back(IntDblPair(46,Obs46));
00468   evtselectVarMatch.push_back(IntBoolPair(46, matchHadb&&((matchHadq&&matchHadp)||(matchHadpq&&matchHadqp))));
00469 
00470   if(debug) std::cout << "== observable 46 " << Obs46 << std::endl;
00471 
00472   //obs47
00473   double Obs47  = fabs(solution.getCalHadb().p4().eta()- solution.getCalHadW().p4().eta());
00474   evtselectVarVal.push_back(IntDblPair(47,Obs47));
00475   evtselectVarMatch.push_back(IntBoolPair(47, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00476 
00477   if(debug) std::cout << "== observable 47 " << Obs47 << std::endl;
00478   
00479   //obs48
00480   double Obs48  = fabs(solution.getCalHadb().p4().theta()- solution.getCalHadW().p4().theta());
00481   evtselectVarVal.push_back(IntDblPair(48,Obs48));
00482   evtselectVarMatch.push_back(IntBoolPair(48, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00483 
00484   if(debug) std::cout << "== observable 48 " << Obs48 << std::endl;
00485   
00486   //obs49
00487   double Obs49  = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadb().p4(), solution.getCalHadW().p4());
00488   evtselectVarVal.push_back(IntDblPair(49,Obs49));
00489   evtselectVarMatch.push_back(IntBoolPair(49, matchHadb&&((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))));
00490 
00491   if(debug) std::cout << "== observable 49 " << Obs49 << std::endl;
00492   
00493   //obs50
00494   double Obs50  = fabs(solution.getCalLepb().p4().phi()- solution.getRecLepW().p4().phi());
00495   if (Obs50 > 3.1415927)  Obs50 =  2*3.1415927 - Obs50;
00496   if (Obs50 < -3.1415927) Obs50 = -2*3.1415927 - Obs50;
00497   evtselectVarVal.push_back(IntDblPair(50,Obs50));
00498   evtselectVarMatch.push_back(IntBoolPair(50, matchLepb&&matchLepn&&matchLepl));
00499 
00500   if(debug) std::cout << "== observable 50 " << Obs50 << std::endl;
00501   
00502   //obs51
00503   double Obs51  = fabs(solution.getCalLepb().p4().eta()- solution.getRecLepW().p4().eta()); 
00504   evtselectVarVal.push_back(IntDblPair(51,Obs51));
00505   evtselectVarMatch.push_back(IntBoolPair(51, matchLepb&&matchLepn&&matchLepl));
00506 
00507   if(debug) std::cout << "== observable 51 " << Obs51 << std::endl;
00508   
00509   //obs52
00510   double Obs52  = fabs(solution.getCalLepb().p4().theta()- solution.getRecLepW().p4().theta());
00511   evtselectVarVal.push_back(IntDblPair(52,Obs52));
00512   evtselectVarMatch.push_back(IntBoolPair(52, matchLepb&&matchLepn&&matchLepl));
00513 
00514   if(debug) std::cout << "== observable 52 " << Obs52 << std::endl;
00515   
00516   //obs53
00517   double Obs53  = ROOT::Math::VectorUtil::DeltaR(solution.getCalLepb().p4(), solution.getRecLepW().p4());
00518   evtselectVarVal.push_back(IntDblPair(53,Obs53));
00519   evtselectVarMatch.push_back(IntBoolPair(53, matchLepb&&matchLepn&&matchLepl));
00520 
00521   if(debug) std::cout << "== observable 53 " << Obs53 << std::endl;
00522   
00523   //obs54
00524   double Obs54 = fabs(solution.getCalHadp().p4().phi()- solution.getCalHadq().p4().phi());
00525   if (Obs54 > 3.1415927)  Obs54 =  2*3.1415927 - Obs54;
00526   if (Obs54 < -3.1415927) Obs54 = -2*3.1415927 - Obs54;
00527   evtselectVarVal.push_back(IntDblPair(54,Obs54));
00528   evtselectVarMatch.push_back(IntBoolPair(54, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00529 
00530   if(debug) std::cout << "== observable 54 " << Obs54 << std::endl;
00531 
00532   //obs55
00533   double Obs55 = fabs(solution.getCalHadp().p4().eta()- solution.getCalHadq().p4().eta());
00534   evtselectVarVal.push_back(IntDblPair(55,Obs55));
00535   evtselectVarMatch.push_back(IntBoolPair(55, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00536 
00537   if(debug) std::cout << "== observable 55 " << Obs55 << std::endl;
00538   
00539   //obs56
00540   double Obs56  = fabs(solution.getCalHadp().p4().theta()- solution.getCalHadq().p4().theta());
00541   evtselectVarVal.push_back(IntDblPair(56,Obs56));
00542   evtselectVarMatch.push_back(IntBoolPair(56, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00543 
00544   if(debug) std::cout << "== observable 56 " << Obs56 << std::endl;
00545   
00546   //obs57
00547   double Obs57  = ROOT::Math::VectorUtil::DeltaR(solution.getCalHadp().p4(), solution.getCalHadq().p4());
00548   evtselectVarVal.push_back(IntDblPair(57,Obs57));
00549   evtselectVarMatch.push_back(IntBoolPair(57, (matchHadp&&matchHadq)||(matchHadpq&&matchHadqp)));
00550 
00551   if(debug) std::cout << "== observable 57 " << Obs57 << std::endl;
00552   
00553   //obs58
00554   double Obs58 = -999.;
00555   if (solution.getDecay() == "muon") Obs58  = fabs(solution.getRecLepm().p4().phi()- solution.getRecLepn().p4().phi()); 
00556   if (solution.getDecay() == "electron") Obs58 = fabs(solution.getRecLepe().p4().phi()- solution.getRecLepn().p4().phi()); 
00557   if (Obs58 > 3.1415927)  Obs58 =  2*3.1415927 - Obs58;
00558   if (Obs58 < -3.1415927) Obs58 = -2*3.1415927 - Obs58;
00559   evtselectVarVal.push_back(IntDblPair(58,Obs58));
00560   evtselectVarMatch.push_back(IntBoolPair(58, matchLepl&&matchLepn));
00561 
00562   if(debug) std::cout << "== observable 58 " << Obs58 << std::endl;
00563  
00564   //obs59
00565   double Obs59 = -999.;
00566   if (solution.getDecay() == "muon") Obs59 = fabs(solution.getRecLepm().p4().eta()- solution.getRecLepn().p4().eta()); 
00567   if (solution.getDecay() == "electron") Obs59 = fabs(solution.getRecLepe().p4().eta()- solution.getRecLepn().p4().eta());  
00568   evtselectVarVal.push_back(IntDblPair(59,Obs59));
00569   evtselectVarMatch.push_back(IntBoolPair(59, matchLepl&&matchLepn));
00570 
00571   if(debug) std::cout << "== observable 59 " << Obs59 << std::endl;
00572   
00573   //obs60
00574   double Obs60 = -999.;
00575   if (solution.getDecay() == "muon") Obs60  = fabs(solution.getRecLepm().p4().theta()- solution.getRecLepn().p4().theta());
00576   if (solution.getDecay() == "electron") Obs60  = fabs(solution.getRecLepe().p4().theta()- solution.getRecLepn().p4().theta());
00577   evtselectVarVal.push_back(IntDblPair(60,Obs60));
00578   evtselectVarMatch.push_back(IntBoolPair(60, matchLepl&&matchLepn));
00579 
00580   if(debug) std::cout << "== observable 60 " << Obs60 << std::endl;
00581   
00582   //obs61 
00583   double Obs61 = -999.; 
00584   if (solution.getDecay() == "muon") Obs61 = ROOT::Math::VectorUtil::DeltaR(solution.getRecLepm().p4(), solution.getRecLepn().p4());
00585   if (solution.getDecay() == "electron") Obs61 = ROOT::Math::VectorUtil::DeltaR(solution.getRecLepe().p4(), solution.getRecLepn().p4());
00586   evtselectVarVal.push_back(IntDblPair(61,Obs61));
00587   evtselectVarMatch.push_back(IntBoolPair(61, matchLepl&&matchLepn));
00588 
00589   if(debug) std::cout << "== observable 61 " << Obs61 << std::endl;
00590   
00591   // miscellaneous event variables
00592    
00593 
00594   //obs62
00595   double Obs62  = ((jets->size() > 4 && (*jets)[3].p4().Et() > 0.00001) ? (*jets)[4].p4().Et() / (*jets)[3].p4().Et() : 1.0);
00596   //double Obs62 = 1;
00597   evtselectVarVal.push_back(IntDblPair(62,Obs62));
00598   evtselectVarMatch.push_back(IntBoolPair(62, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
00599 
00600   if(debug) std::cout << "== observable 62 " << Obs62 << std::endl;
00601   
00602   float calJetsSumEt = 0;
00603   for (unsigned int i = 4; i < jets->size(); i++) {
00604     calJetsSumEt += (*jets)[i].p4().Et();
00605   }
00606   
00607   //obs63
00608   double Obs63_den = (jets->size() > 4) ? ((*jets)[0].p4().Et()+(*jets)[1].p4().Et()+(*jets)[2].p4().Et()+(*jets)[3].p4().Et()+(*jets)[4].p4().Et()) : 0.0;
00609   double Obs63  = (Obs63_den > 0.00001) ? calJetsSumEt / Obs63_den : 1.0;
00610   //double Obs63 =1;  
00611   evtselectVarVal.push_back(IntDblPair(63,Obs63));
00612   evtselectVarMatch.push_back(IntBoolPair(63, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
00613 
00614   if(debug) std::cout << "== observable 63 " << Obs63 << std::endl;
00615   
00616   //obs64
00617   double Obs64  = solution.getProbChi2();
00618   evtselectVarVal.push_back(IntDblPair(64,Obs64));
00619   evtselectVarMatch.push_back(IntBoolPair(64, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb));
00620 
00621   if(debug) std::cout << "== observable 64 " << Obs64 << std::endl;
00622   
00623   //obs65
00624   double Obs65  = solution.getFitHadt().p4().mass() - solution.getCalHadt().p4().mass();
00625   evtselectVarVal.push_back(IntDblPair(65,Obs65));
00626   evtselectVarMatch.push_back(IntBoolPair(65, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb)); 
00627 
00628   if(debug) std::cout << "== observable 65 " << Obs65 << std::endl;
00629   
00630   //obs66
00631   double Obs66  = solution.getFitLept().p4().mass() - solution.getCalLept().p4().mass();
00632   evtselectVarVal.push_back(IntDblPair(66,Obs66));
00633   evtselectVarMatch.push_back(IntBoolPair(66, ((matchHadp&&matchHadq)||(matchHadpq&&matchHadqp))&&matchHadb&&matchLepb)); 
00634   
00635   if(debug) std::cout << "observables calculated" << std::endl;
00636 
00637   if (!matchOnly) solution.setLRJetCombObservables(evtselectVarVal);
00638   return evtselectVarMatch;
00639 }