#include <TopQuarkAnalysis/TopEventSelection/interface/TtDilepLRSignalSelObservables.h>
Public Types | |
typedef pair< unsigned int, bool > | IntBoolPair |
Public Member Functions | |
void | jetSource (const edm::InputTag &jetSource) |
vector< IntBoolPair > | operator() (TtDilepEvtSolution &, const edm::Event &iEvent, bool matchOnly=false) |
TtDilepLRSignalSelObservables () | |
~TtDilepLRSignalSelObservables () | |
Private Types | |
typedef pair< unsigned int, double > | IntDblPair |
Private Member Functions | |
double | delta (double phi1, double phi2) |
void | fillMinMax (double v1, double v2, int obsNbr, vector< IntDblPair > &varList, bool match1, bool match2, vector< IntBoolPair > &matchList) |
Private Attributes | |
int | count1 |
int | count2 |
int | count3 |
int | count4 |
int | count5 |
vector< IntBoolPair > | evtselectVarMatch |
vector< IntDblPair > | evtselectVarVal |
edm::InputTag | jetSource_ |
Definition at line 17 of file TtDilepLRSignalSelObservables.h.
typedef pair<unsigned int,bool> TtDilepLRSignalSelObservables::IntBoolPair |
Definition at line 24 of file TtDilepLRSignalSelObservables.h.
typedef pair<unsigned int,double> TtDilepLRSignalSelObservables::IntDblPair [private] |
Definition at line 31 of file TtDilepLRSignalSelObservables.h.
TtDilepLRSignalSelObservables::TtDilepLRSignalSelObservables | ( | ) |
TtDilepLRSignalSelObservables::~TtDilepLRSignalSelObservables | ( | ) |
Definition at line 34 of file TtDilepLRSignalSelObservables.cc.
00034 { 00035 // cout << "Jet flavour match: " << count1<<" "<< count2<<" "<< count3 00036 // <<" "<< count4<<" "<< count5<<endl; 00037 }
double TtDilepLRSignalSelObservables::delta | ( | double | phi1, | |
double | phi2 | |||
) | [private] |
Definition at line 270 of file TtDilepLRSignalSelObservables.cc.
References deltaPhi().
Referenced by operator()().
00271 { 00272 double deltaPhi = phi1 - phi2; 00273 while (deltaPhi > M_PI) deltaPhi -= 2*M_PI; 00274 while (deltaPhi <= -M_PI) deltaPhi += 2*M_PI; 00275 return deltaPhi; 00276 }
void TtDilepLRSignalSelObservables::fillMinMax | ( | double | v1, | |
double | v2, | |||
int | obsNbr, | |||
vector< IntDblPair > & | varList, | |||
bool | match1, | |||
bool | match2, | |||
vector< IntBoolPair > & | matchList | |||
) | [private] |
Definition at line 253 of file TtDilepLRSignalSelObservables.cc.
Referenced by operator()().
00255 { 00256 if (v1<v2) { 00257 varList.push_back(IntDblPair(obsNbr, v1)); 00258 varList.push_back(IntDblPair(obsNbr+1, v2)); 00259 matchList.push_back(IntBoolPair(obsNbr, match1)); 00260 matchList.push_back(IntBoolPair(obsNbr+1, match2)); 00261 00262 } else { 00263 varList.push_back(IntDblPair(obsNbr, v2)); 00264 varList.push_back(IntDblPair(obsNbr+1, v1)); 00265 matchList.push_back(IntBoolPair(obsNbr, match2)); 00266 matchList.push_back(IntBoolPair(obsNbr+1, match1)); 00267 } 00268 }
void TtDilepLRSignalSelObservables::jetSource | ( | const edm::InputTag & | jetSource | ) | [inline] |
Definition at line 27 of file TtDilepLRSignalSelObservables.h.
References jetSource_.
00027 {jetSource_ = jetSource;}
std::vector< TtDilepLRSignalSelObservables::IntBoolPair > TtDilepLRSignalSelObservables::operator() | ( | TtDilepEvtSolution & | solution, | |
const edm::Event & | iEvent, | |||
bool | matchOnly = false | |||
) |
Definition at line 40 of file TtDilepLRSignalSelObservables.cc.
References funct::abs(), count1, count2, count3, count4, count5, GenMuonPlsPt100GeV_cfg::cout, delta(), deltaPhi(), evtselectVarMatch, evtselectVarVal, fillMinMax(), MCTruth2::genEvent, edm::Event::getByLabel(), TtDilepEvtSolution::getCalJetB(), TtDilepEvtSolution::getCalJetBbar(), TtDilepEvtSolution::getGenLepm(), TtDilepEvtSolution::getGenLepp(), TtDilepEvtSolution::getJetB(), TtDilepEvtSolution::getJetBbar(), TtDilepEvtSolution::getLeptNeg(), TtDilepEvtSolution::getLeptPos(), TtDilepEvtSolution::getWmDecay(), TtDilepEvtSolution::getWpDecay(), i, int, pfTauBenchmarkGeneric_cfi::jets, jetSource_, reco::Particle::p4(), pat::Jet::partonFlavour(), reco::Particle::pdgId(), TtDilepEvtSolution::setLRSignalEvtObservables(), v1, and v2.
00042 { 00043 evtselectVarVal.clear(); 00044 evtselectVarMatch.clear(); 00045 00046 // Check whether the objects are matched: 00047 bool matchB1 = false; 00048 bool matchB2 = false; 00049 bool matchB = false; 00050 bool matchBbar = false; 00051 bool matchLeptPos = false; 00052 bool matchLeptNeg = false; 00053 00054 try { 00055 // cout <<endl; 00056 double dr, dr1, dr2; 00057 00058 Handle<TtGenEvent> genEvent; 00059 iEvent.getByLabel ("genEvt",genEvent); 00060 00061 if (genEvent->isFullLeptonic()) { 00062 //cout << "Dilepton:\n"; 00063 // Match the leptons, by type and deltaR 00064 dr = DeltaR<reco::Particle>()(solution.getLeptPos(), *(solution.getGenLepp())); 00065 matchLeptPos = ( 00066 ( ((solution.getWpDecay()=="electron")&&(abs(solution.getGenLepp()->pdgId())==11)) 00067 || ((solution.getWpDecay()=="muon")&&(abs(solution.getGenLepp()->pdgId())==13)) ) 00068 && (dr < 0.1) ); 00069 // cout << solution.getWpDecay() << solution.getGenLepp()->pdgId()<<" "<<dr<<endl; 00070 00071 dr = DeltaR<reco::Particle>()(solution.getLeptNeg(), *(solution.getGenLepm())); 00072 matchLeptNeg = ( 00073 ( ((solution.getWmDecay()=="electron")&&(abs(solution.getGenLepm()->pdgId())==11)) 00074 || ((solution.getWmDecay()=="muon")&&(abs(solution.getGenLepm()->pdgId())==13)) ) 00075 && (dr < 0.1) ); 00076 // cout << solution.getWmDecay() << solution.getGenLepm()->pdgId()<<" "<<dr<<endl; 00077 } 00078 00079 if (genEvent->isSemiLeptonic()) { 00080 int id = genEvent->singleLepton()->pdgId(); 00081 //cout << "Semi-Leptonic: "; 00082 00083 if (id>0) { 00084 dr = DeltaR<reco::Particle>()(solution.getLeptNeg(), *(genEvent->singleLepton())); 00085 matchLeptNeg = ( 00086 ( ((solution.getWmDecay()=="electron") && (id==11)) 00087 || ((solution.getWmDecay()=="muon") && (id==13)) ) 00088 && (dr < 0.1) ); 00089 // cout << solution.getWmDecay() << id<<" "<<dr<<endl; 00090 } else { 00091 dr = DeltaR<reco::Particle>()(solution.getLeptPos(), *(genEvent->singleLepton())); 00092 matchLeptPos = ( 00093 ( ((solution.getWpDecay()=="electron")&& (id==-11)) 00094 || ((solution.getWpDecay()=="muon") && (id==-13)) ) 00095 && (dr < 0.1) ); 00096 // cout << solution.getWpDecay() << id<<" "<<dr<<endl; 00097 } 00098 } 00099 00100 if (genEvent->isFullHadronic()) { 00101 // cout << "Hadronic\n"; 00102 } 00103 00104 if (genEvent->isTtBar() && genEvent->numberOfBQuarks()>1) { 00105 if (solution.getJetB().partonFlavour()==5) ++count1; 00106 if (solution.getJetBbar().partonFlavour()==5) ++count1; 00107 00108 dr1 = DeltaR<reco::Particle>()(solution.getCalJetB(), *(genEvent->b())); 00109 dr2 = DeltaR<reco::Particle>()(solution.getCalJetB(), *(genEvent->bBar())); 00110 00111 matchB1= ( (dr1<0.4) || (dr2<0.4)); 00112 matchB = ( (solution.getJetB().partonFlavour()==5) && (dr1<0.4) ); 00113 if (matchB) ++count3; 00114 matchB = ( (dr1<0.4) ); 00115 if (dr1<0.5) ++count2; 00116 if (dr1<0.4) ++count4; 00117 if (dr1<0.3) ++count5; 00118 //cout << solution.getJetB().partonFlavour() << " "<<dr<<endl; 00119 00120 dr1 = DeltaR<reco::Particle>()(solution.getCalJetBbar(), *(genEvent->b())); 00121 dr2 = DeltaR<reco::Particle>()(solution.getCalJetBbar(), *(genEvent->bBar())); 00122 00123 matchBbar = ( (solution.getJetBbar().partonFlavour()==5) && (dr2<0.4) ); 00124 if (matchBbar) ++count3; 00125 matchBbar = ( (dr2<0.4) ); 00126 matchB2 = ( (dr1<0.4) || (dr2<0.4)); 00127 if (dr2<0.5) ++count2; 00128 if (dr2<0.4) ++count4; 00129 if (dr2<0.3) ++count5; 00130 //cout << solution.getJetBbar().partonFlavour() << " "<<dr<<endl; 00131 } 00132 00133 //Look at the b-jets: 00134 //cout << "Final Match: "<< matchB<<matchBbar <<matchLeptPos <<matchLeptNeg<<endl; 00135 00136 } catch (...){cout << "Exception\n";} 00137 00138 Handle<vector<pat::Jet> > jets; 00139 iEvent.getByLabel(jetSource_, jets); 00140 00141 // Lower / Higher of both jet angles 00142 00143 double v1 = abs( solution.getJetB().p4().theta() - M_PI/2 ); 00144 double v2 = abs( solution.getJetBbar().p4().theta() - M_PI/2 ) ; 00145 fillMinMax(v1, v2, 1, evtselectVarVal, matchB1, matchB2, evtselectVarMatch); 00146 00147 // Lower / Higher of both jet pT 00148 00149 double pt1 = solution.getJetB().p4().pt(); 00150 double pt2 = solution.getJetBbar().p4().pt(); 00151 fillMinMax(pt1, pt2, 3, evtselectVarVal, matchB1, matchB2, evtselectVarMatch); 00152 00153 // Lower / Higher of both lepton pT 00154 00155 pt1 = solution.getLeptPos().p4().pt(); 00156 pt2 = solution.getLeptNeg().p4().pt(); 00157 fillMinMax(pt1, pt2, 5, evtselectVarVal, matchLeptPos, matchLeptNeg, evtselectVarMatch); 00158 00159 // delta theta btw the b-jets 00160 00161 double deltaPhi = abs ( delta(solution.getJetB().p4().phi(), 00162 solution.getJetBbar().p4().phi()) ); 00163 // double deltaPhi = abs( solution.getJetB().p4().DeltaPhi( 00164 // solution.getJetBbar().p4() ) ); 00165 00166 00167 evtselectVarVal.push_back(IntDblPair(7, deltaPhi)); 00168 evtselectVarMatch.push_back(IntBoolPair(7, matchB1&&matchB2)); 00169 00170 // delta phi btw the b-jets 00171 00172 // double deltaTheta = DeltaPhi<reco::Particle>()(solution.getJetB(), 00173 // solution.getJetBbar()); 00174 00175 // double deltaPhi = delta( solution.getJetB().p4().phi(), 00176 // solution.getJetBbar().p4().phi() ); 00177 double deltaTheta = abs( delta (solution.getJetBbar().p4().theta(), 00178 solution.getJetB().p4().theta() ) ); 00179 00180 evtselectVarVal.push_back(IntDblPair(8, deltaTheta)); 00181 evtselectVarMatch.push_back(IntBoolPair(8, matchB1&&matchB2)); 00182 00183 // Lower / Higher of phi difference between the b and associated lepton 00184 00185 double deltaPhi1 = abs ( delta( solution.getJetB().p4().phi(), 00186 solution.getLeptPos().p4().phi() ) ); 00187 double deltaPhi2 = abs ( delta( solution.getJetBbar().p4().phi(), 00188 solution.getLeptNeg().p4().phi() ) ); 00189 // if (deltaPhi1<0.05) { 00190 // cout << deltaPhi1<<" " 00191 // <<solution.getJetB().p4().phi()<<" " 00192 // <<solution.getLeptPos().p4().phi()<<" " 00193 // <<solution.getJetB().p4().eta()<<" " 00194 // <<solution.getLeptPos().p4().eta()<<" " 00195 // << solution.getJetB().p4().phi() - solution.getLeptPos().p4().phi()<<"\n"; 00196 // double d1 = solution.getJetB().p4().phi(); 00197 // double d2 = solution.getLeptPos().p4().phi(); 00198 // cout << deltaPhi1<<" " 00199 // <<d1<<" " 00200 // <<d2<<" " 00201 // <<d1-d2<<" " 00202 // <<delta(d1,d2)<<" " 00203 // << solution.getJetB().p4().phi() - solution.getLeptPos().p4().phi()<<"\n"; 00204 // 00205 // } 00206 00207 fillMinMax(deltaPhi1, deltaPhi2, 9, evtselectVarVal, 00208 matchB&&matchLeptPos, matchBbar&&matchLeptNeg, evtselectVarMatch); 00209 00210 // Lower / Higher of theta difference between the b and associated lepton 00211 00212 double deltaTheta1 = abs( solution.getJetB().p4().theta() - 00213 solution.getLeptPos().p4().theta() ); 00214 double deltaTheta2 = abs( solution.getJetBbar().p4().theta() - 00215 solution.getLeptNeg().p4().theta() ); 00216 fillMinMax(deltaTheta1, deltaTheta2, 11, evtselectVarVal, 00217 matchB&&matchLeptPos, matchBbar&&matchLeptNeg, evtselectVarMatch); 00218 00219 // Invariant Mass of lepton pair 00220 00221 XYZTLorentzVector pp = solution.getLeptPos().p4() + solution.getLeptNeg().p4(); 00222 double mass = pp.mass(); 00223 evtselectVarVal.push_back(IntDblPair(13, mass)); 00224 evtselectVarMatch.push_back(IntBoolPair(13, matchLeptNeg&&matchLeptPos)); 00225 00226 evtselectVarVal.push_back(IntDblPair(13, mass)); 00227 evtselectVarMatch.push_back(IntBoolPair(13, matchLeptNeg&&matchLeptPos)); 00228 00229 vector <pat::Jet> jet3; 00230 for (int i=0;i<(int)jets->size();++i) { 00231 if ( ((*jets)[i].et()<solution.getJetB().et()) && ((*jets)[i].et()<solution.getJetBbar().et())) {jet3.push_back((*jets)[i]); 00232 // cout << "jet " << i << " " << jet3.back().partonFlavour()<< " " << jet3.back().pt() << " " << jet3.back().eta()<<endl; 00233 }} 00234 double jet1Ratio = 0., jet2Ratio = 0.; 00235 if (jet3.size()>0) { 00236 jet1Ratio = jet3[0].et()/solution.getJetB().et(); 00237 jet2Ratio = jet3[0].et()/solution.getJetBbar().et(); 00238 //cout << solution.getJetB().et() << " "<<solution.getJetBbar().et()<<endl; 00239 //cout << (*jets)[0].et() << " "<<(*jets)[1].et() << " "<<(*jets)[2].et() << jet1Ratio<< " "<<jet2Ratio<<endl<<endl; 00240 } 00241 fillMinMax(jet1Ratio, jet2Ratio, 14, evtselectVarVal, 00242 matchB1, matchB2, evtselectVarMatch); 00243 00244 evtselectVarVal.push_back(IntDblPair(16, jets->size())); 00245 evtselectVarMatch.push_back(IntBoolPair(16, matchB&&matchBbar)); 00246 00247 00248 if (!matchOnly) solution.setLRSignalEvtObservables(evtselectVarVal); 00249 return evtselectVarMatch; 00250 }
int TtDilepLRSignalSelObservables::count1 [private] |
Definition at line 42 of file TtDilepLRSignalSelObservables.h.
Referenced by operator()(), and TtDilepLRSignalSelObservables().
int TtDilepLRSignalSelObservables::count2 [private] |
Definition at line 42 of file TtDilepLRSignalSelObservables.h.
Referenced by operator()(), and TtDilepLRSignalSelObservables().
int TtDilepLRSignalSelObservables::count3 [private] |
Definition at line 42 of file TtDilepLRSignalSelObservables.h.
Referenced by operator()(), and TtDilepLRSignalSelObservables().
int TtDilepLRSignalSelObservables::count4 [private] |
Definition at line 42 of file TtDilepLRSignalSelObservables.h.
Referenced by operator()(), and TtDilepLRSignalSelObservables().
int TtDilepLRSignalSelObservables::count5 [private] |
Definition at line 42 of file TtDilepLRSignalSelObservables.h.
Referenced by operator()(), and TtDilepLRSignalSelObservables().
vector< IntBoolPair > TtDilepLRSignalSelObservables::evtselectVarMatch [private] |
vector< IntDblPair > TtDilepLRSignalSelObservables::evtselectVarVal [private] |
Definition at line 38 of file TtDilepLRSignalSelObservables.h.
Referenced by jetSource(), and operator()().