Go to the documentation of this file.00001 #include "TopQuarkAnalysis/TopEventSelection/interface/TtFullHadSignalSel.h"
00002 #include "DataFormats/Math/interface/deltaR.h"
00003 #include "TVector3.h"
00004
00005 TtFullHadSignalSel::TtFullHadSignalSel():
00006 pt1_(-1.), pt2_(-1.), pt3_(-1.), pt4_(-1.), pt5_(-1.), pt6_(-1.)
00007 {
00008 }
00009
00010 std::vector<math::XYZVector> makeVecForEventShape(std::vector<pat::Jet> jets, double scale = 1.) {
00011 std::vector<math::XYZVector> p;
00012 unsigned int i=1;
00013 for (std::vector<pat::Jet>::const_iterator jet = jets.begin(); jet != jets.end(); ++jet) {
00014 math::XYZVector Vjet(jet->px() * scale, jet->py() * scale, jet->pz() * scale);
00015 p.push_back(Vjet);
00016 ++i;
00017 if(i==6) break;
00018 }
00019 return p;
00020 }
00021
00022 TtFullHadSignalSel::TtFullHadSignalSel(const std::vector<pat::Jet>& jets)
00023 {
00024
00025 H_ = 0;
00026 Ht_ = 0;
00027 Ht123_ = 0;
00028 Ht3jet_ = 0;
00029 Et56_ = 0;
00030 sqrt_s_ = 0;
00031 M3_ = 0;
00032
00033 TCHP_Bjets_ = 0;
00034 SSV_Bjets_ = 0;
00035 CSV_Bjets_ = 0;
00036 SM_Bjets_ = 0;
00037
00038 TCHP_Bjet1_ = 0;
00039 TCHP_Bjet2_ = 0;
00040 TCHP_Bjet3_ = 0;
00041 TCHP_Bjet4_ = 0;
00042 TCHP_Bjet5_ = 0;
00043 TCHP_Bjet6_ = 0;
00044 SSV_Bjet1_ = 0;
00045 SSV_Bjet2_ = 0;
00046 SSV_Bjet3_ = 0;
00047 SSV_Bjet4_ = 0;
00048 SSV_Bjet5_ = 0;
00049 SSV_Bjet6_ = 0;
00050 CSV_Bjet1_ = 0;
00051 CSV_Bjet2_ = 0;
00052 CSV_Bjet3_ = 0;
00053 CSV_Bjet4_ = 0;
00054 CSV_Bjet5_ = 0;
00055 CSV_Bjet6_ = 0;
00056 SM_Bjet1_ = 0;
00057 SM_Bjet2_ = 0;
00058 SM_Bjet3_ = 0;
00059 SM_Bjet4_ = 0;
00060 SM_Bjet5_ = 0;
00061 SM_Bjet6_ = 0;
00062
00063 jet1_etaetaMoment_ = 0;
00064 jet2_etaetaMoment_ = 0;
00065 jet3_etaetaMoment_ = 0;
00066 jet4_etaetaMoment_ = 0;
00067 jet5_etaetaMoment_ = 0;
00068 jet6_etaetaMoment_ = 0;
00069 jet1_etaphiMoment_ = 0;
00070 jet2_etaphiMoment_ = 0;
00071 jet3_etaphiMoment_ = 0;
00072 jet4_etaphiMoment_ = 0;
00073 jet5_etaphiMoment_ = 0;
00074 jet6_etaphiMoment_ = 0;
00075 jet1_phiphiMoment_ = 0;
00076 jet2_phiphiMoment_ = 0;
00077 jet3_phiphiMoment_ = 0;
00078 jet4_phiphiMoment_ = 0;
00079 jet5_phiphiMoment_ = 0;
00080 jet6_phiphiMoment_ = 0;
00081
00082 aplanarity_ = 0;
00083 sphericity_ = 0;
00084 circularity_ = 0;
00085 isotropy_ = 0;
00086 C_ = 0;
00087 D_ = 0;
00088
00089 dRMin1_ = 0;
00090 dRMin2_ = 0;
00091 sumDR3JetMin1_ = 0;
00092 sumDR3JetMin2_ = 0;
00093
00094 dRMin1Mass_ = 0;
00095 dRMin2Mass_ = 0;
00096 sumDR3JetMin1Mass_ = 0;
00097 sumDR3JetMin2Mass_ = 0;
00098
00099 std::list< double > TCHP_Bjet_Discis;
00100 std::list< double > SSV_Bjet_Discis;
00101 std::list< double > CSV_Bjet_Discis;
00102 std::list< double > SM_Bjet_Discis;
00103
00104 std::list< std::pair< double, std::pair< unsigned int, unsigned int > > > dRs;
00105 std::list< std::pair< double, std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > > dRs3Jets;
00106
00107 unsigned int jetCounter = 1;
00108 for(std::vector<pat::Jet>::const_iterator jet = jets.begin(); jet != jets.end(); ++jet, ++jetCounter){
00109
00110 H_ += jet->energy();
00111 Ht_ += jet->et();
00112 Ht3jet_ += jet->et();
00113
00114 TCHP_Bjet_Discis.push_back( jet->bDiscriminator("trackCountingHighPurBJetTags") );
00115 SSV_Bjet_Discis.push_back( jet->bDiscriminator("simpleSecondaryVertexBJetTags") );
00116 CSV_Bjet_Discis.push_back( jet->bDiscriminator("combinedSecondaryVertexBJetTags") );
00117 SM_Bjet_Discis.push_back( jet->bDiscriminator("softMuonBJetTags") );
00118
00119 if (jetCounter == 1) {
00120 pt1_ = jet->pt();
00121 Ht3jet_ -= jet->et();
00122 Ht123_ += jet->et();
00123 jet1_etaetaMoment_ = jet->etaetaMoment();
00124 jet1_etaphiMoment_ = jet->etaphiMoment();
00125 jet1_phiphiMoment_ = jet->phiphiMoment();
00126 }
00127 else if (jetCounter == 2) {
00128 pt2_ = jet->pt();
00129 Ht3jet_ -= jet->et();
00130 Ht123_ += jet->et();
00131 jet2_etaetaMoment_ = jet->etaetaMoment();
00132 jet2_etaphiMoment_ = jet->etaphiMoment();
00133 jet2_phiphiMoment_ = jet->phiphiMoment();
00134 }
00135 else if (jetCounter == 3) {
00136 pt3_ = jet->pt();
00137 Ht123_ += jet->et();
00138 jet3_etaetaMoment_ = jet->etaetaMoment();
00139 jet3_etaphiMoment_ = jet->etaphiMoment();
00140 jet3_phiphiMoment_ = jet->phiphiMoment();
00141 }
00142 else if (jetCounter == 4) {
00143 pt4_ = jet->pt();
00144 jet4_etaetaMoment_ = jet->etaetaMoment();
00145 jet4_etaphiMoment_ = jet->etaphiMoment();
00146 jet4_phiphiMoment_ = jet->phiphiMoment();
00147 }
00148 else if (jetCounter == 5) {
00149 pt5_ = jet->pt();
00150 jet5_etaetaMoment_ = jet->etaetaMoment();
00151 jet5_etaphiMoment_ = jet->etaphiMoment();
00152 jet5_phiphiMoment_ = jet->phiphiMoment();
00153 Et56_ += jet->et();
00154 }
00155 else if (jetCounter == 6) {
00156 pt6_ = jet->pt();
00157 jet6_etaetaMoment_ = jet->etaetaMoment();
00158 jet6_etaphiMoment_ = jet->etaphiMoment();
00159 jet6_phiphiMoment_ = jet->phiphiMoment();
00160 Et56_ += jet->et();
00161 }
00162
00163 if(jet->bDiscriminator("trackCountingHighPurBJetTags") > 2.17) ++TCHP_Bjets_;
00164 if(jet->bDiscriminator("simpleSecondaryVertexBJetTags") > 2.02) ++SSV_Bjets_;
00165 if(jet->bDiscriminator("combinedSecondaryVertexBJetTags") > 0.9 ) ++CSV_Bjets_;
00166 if(jet->bDiscriminator("softMuonBJetTags") > 0.3 ) ++SM_Bjets_;
00167
00168 unsigned int jetCounter2 = jetCounter + 1;
00169 for(std::vector<pat::Jet>::const_iterator jet2 = jet; (jet2 != jets.end() && jet2 != (--jets.end()) && jet2 != (--(--jets.end()))); ++jet2, ++jetCounter2){
00170 ++jet2;
00171 dRs.push_back( std::make_pair( deltaR( jet->phi(), jet->eta(), jet2->phi(), jet2->eta() ), std::make_pair( jetCounter-1, jetCounter2-1 ) ) );
00172
00173 unsigned int jetCounter3 = jetCounter2 + 1;
00174 for(std::vector<pat::Jet>::const_iterator jet3 = jet2; (jet3 != jets.end() && jet3 != (--jets.end()) && jet3 != (--(--jets.end())) && jet3 != (--(--(--jets.end())))); ++jet3, ++jetCounter3){
00175 ++jet3;
00176 double dR1 = deltaR( jet->phi() , jet->eta() , jet2->phi(), jet2->eta() );
00177 double dR2 = deltaR( jet->phi() , jet->eta() , jet3->phi(), jet3->eta() );
00178 double dR3 = deltaR( jet2->phi(), jet2->eta(), jet3->phi(), jet3->eta() );
00179 dRs3Jets.push_back( std::make_pair( dR1+dR2+dR3, std::make_pair( std::make_pair( jetCounter-1, jetCounter2-1 ), jetCounter3-1 ) ) );
00180 }
00181 }
00182
00183 }
00184
00185 dRs.sort();
00186 dRs3Jets.sort();
00187
00188 dRMin1_ = dRs.begin()->first;
00189 dRMin1Mass_ = (jets[dRs.begin()->second.first].p4()+jets[dRs.begin()->second.second].p4()).mass();
00190 sumDR3JetMin1_ = dRs3Jets.begin()->first;
00191 sumDR3JetMin1Mass_ = (jets[dRs3Jets.begin()->second.first.first].p4()+jets[dRs3Jets.begin()->second.first.second].p4()+jets[dRs3Jets.begin()->second.second].p4()).mass();
00192
00193 for(std::list< std::pair< double, std::pair< unsigned int, unsigned int > > >::const_iterator dR = ++dRs.begin(); dR != dRs.end(); ++dR){
00194 if( (dR->second.first != dRs.begin()->second.first) && (dR->second.first != dRs.begin()->second.second) &&
00195 (dR->second.second != dRs.begin()->second.first) && (dR->second.second != dRs.begin()->second.second) ){
00196 dRMin2_ = dR->first;
00197 dRMin2Mass_ = (jets[dR->second.first].p4()+jets[dR->second.second].p4()).mass();
00198 break;
00199 }
00200 }
00201
00202 for(std::list< std::pair< double, std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > >::const_iterator dR = ++dRs3Jets.begin(); dR != dRs3Jets.end(); ++dR){
00203 if( (dR->second.first.first != dRs3Jets.begin()->second.first.first) && (dR->second.first.first != dRs3Jets.begin()->second.first.second) &&
00204 (dR->second.first.second != dRs3Jets.begin()->second.first.first) && (dR->second.first.second != dRs3Jets.begin()->second.first.second) &&
00205 (dR->second.first.first != dRs3Jets.begin()->second.second) && (dR->second.first.second != dRs3Jets.begin()->second.second) ){
00206 sumDR3JetMin2_ = dR->first;
00207 sumDR3JetMin2Mass_ = (jets[dR->second.first.first].p4()+jets[dR->second.first.second].p4()+jets[dR->second.second].p4()).mass();
00208 break;
00209 }
00210 }
00211
00212 TCHP_Bjet_Discis.sort();
00213 SSV_Bjet_Discis.sort();
00214 CSV_Bjet_Discis.sort();
00215 SM_Bjet_Discis.sort();
00216
00217 unsigned int counter = 1;
00218 for(std::list< double >::const_reverse_iterator jet = TCHP_Bjet_Discis.rbegin(); jet != TCHP_Bjet_Discis.rend(); ++jet, ++counter){
00219 if (counter == 1) TCHP_Bjet1_ = *jet;
00220 else if(counter == 2) TCHP_Bjet2_ = *jet;
00221 else if(counter == 3) TCHP_Bjet3_ = *jet;
00222 else if(counter == 4) TCHP_Bjet4_ = *jet;
00223 else if(counter == 5) TCHP_Bjet5_ = *jet;
00224 else if(counter == 6) TCHP_Bjet6_ = *jet;
00225 }
00226
00227 counter = 1;
00228 for(std::list< double >::const_reverse_iterator jet = SSV_Bjet_Discis.rbegin(); jet != SSV_Bjet_Discis.rend(); ++jet, ++counter){
00229 if (counter == 1) SSV_Bjet1_ = *jet;
00230 else if(counter == 2) SSV_Bjet2_ = *jet;
00231 else if(counter == 3) SSV_Bjet3_ = *jet;
00232 else if(counter == 4) SSV_Bjet4_ = *jet;
00233 else if(counter == 5) SSV_Bjet5_ = *jet;
00234 else if(counter == 6) SSV_Bjet6_ = *jet;
00235 }
00236
00237 counter = 1;
00238 for(std::list< double >::const_reverse_iterator jet = CSV_Bjet_Discis.rbegin(); jet != CSV_Bjet_Discis.rend(); ++jet, ++counter){
00239 if (counter == 1) CSV_Bjet1_ = *jet;
00240 else if(counter == 2) CSV_Bjet2_ = *jet;
00241 else if(counter == 3) CSV_Bjet3_ = *jet;
00242 else if(counter == 4) CSV_Bjet4_ = *jet;
00243 else if(counter == 5) CSV_Bjet5_ = *jet;
00244 else if(counter == 6) CSV_Bjet6_ = *jet;
00245 }
00246
00247 counter = 1;
00248 for(std::list< double >::const_reverse_iterator jet = SM_Bjet_Discis.rbegin(); jet != SM_Bjet_Discis.rend(); ++jet, ++counter){
00249 if (counter == 1) SM_Bjet1_ = *jet;
00250 else if(counter == 2) SM_Bjet2_ = *jet;
00251 else if(counter == 3) SM_Bjet3_ = *jet;
00252 else if(counter == 4) SM_Bjet4_ = *jet;
00253 else if(counter == 5) SM_Bjet5_ = *jet;
00254 else if(counter == 6) SM_Bjet6_ = *jet;
00255 }
00256
00257 if(jets.size() > 2){
00258
00259 M3_ = (jets[0].p4() + jets[1].p4() + jets[2].p4()).mass();
00260
00261 if(jets.size() > 5){
00262 sqrt_s_ = (jets[0].p4() + jets[1].p4() + jets[2].p4() + jets[3].p4() + jets[4].p4() + jets[5].p4()).mass();
00263 }
00264 }
00265
00266 EventShapeVariables eventshape(makeVecForEventShape(jets));
00267
00268 aplanarity_ = eventshape.aplanarity();
00269 sphericity_ = eventshape.sphericity();
00270 circularity_ = eventshape.circularity();
00271 isotropy_ = eventshape.isotropy();
00272 C_ = eventshape.C();
00273 D_ = eventshape.D();
00274
00275 }
00276
00277 TtFullHadSignalSel::~TtFullHadSignalSel()
00278 {
00279 }