CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/TopQuarkAnalysis/TopPairBSM/src/CATopJetHelper.cc

Go to the documentation of this file.
00001 #include "TopQuarkAnalysis/TopPairBSM/interface/CATopJetHelper.h"
00002 
00003 
00004 struct GreaterByPtCandPtr {
00005   bool operator()( const edm::Ptr<reco::Candidate> & t1, const edm::Ptr<reco::Candidate> & t2 ) const {
00006     return t1->pt() > t2->pt();
00007   }
00008 };
00009 
00010 
00011 reco::CATopJetProperties CATopJetHelper::operator()( reco::Jet const & ihardJet ) const {
00012   reco::CATopJetProperties properties;
00013   // Get subjets
00014   reco::Jet::Constituents subjets = ihardJet.getJetConstituents();
00015   properties.nSubJets = subjets.size();  // number of subjets
00016   properties.topMass = ihardJet.mass();      // jet mass
00017   properties.wMass = 99999.;                  // best W mass
00018   properties.minMass = 999999.;            // minimum mass pairing
00019 
00020   // Require at least three subjets in all cases, if not, untagged
00021   if ( properties.nSubJets >= 3 ) {
00022 
00023     // Take the highest 3 pt subjets for cuts
00024     sort ( subjets.begin(), subjets.end(), GreaterByPtCandPtr() );
00025        
00026     // Now look at the subjets that were formed
00027     for ( int isub = 0; isub < 2; ++isub ) {
00028 
00029       // Get this subjet
00030       reco::Jet::Constituent icandJet = subjets[isub];
00031 
00032       // Now look at the "other" subjets than this one, form the minimum invariant mass
00033       // pairing, as well as the "closest" combination to the W mass
00034       for ( int jsub = isub + 1; jsub < 3; ++jsub ) {
00035 
00036         // Get the second subjet
00037         reco::Jet::Constituent jcandJet = subjets[jsub];
00038 
00039         reco::Candidate::LorentzVector wCand = icandJet->p4() + jcandJet->p4();
00040 
00041         // Get the candidate mass
00042         double imw = wCand.mass();
00043 
00044         // Find the combination closest to the W mass
00045         if ( fabs( imw - WMass_ ) < fabs(properties.wMass - WMass_) ) {
00046           properties.wMass = imw;
00047         }
00048         // Find the minimum mass pairing. 
00049         if ( fabs( imw ) < properties.minMass ) {
00050           properties.minMass = imw;
00051         }  
00052       }// end second loop over subjets
00053     }// end first loop over subjets
00054   }// endif 3 subjets
00055  
00056   if (properties.minMass == 999999){properties.minMass=-1;}
00057 
00058   return properties;
00059 }