ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbAnalyzerNew.cc
(Generate patch)

Comparing UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbAnalyzerNew.cc (file contents):
Revision 1.5 by tboccali, Thu Jun 9 16:51:52 2011 UTC vs.
Revision 1.6 by tboccali, Tue Jun 14 12:49:07 2011 UTC

# Line 43 | Line 43 | HbbAnalyzerNew::HbbAnalyzerNew(const edm
43    hltResults_(iConfig.getUntrackedParameter<edm::InputTag>("hltResultsTag")),
44    runOnMC_(iConfig.getParameter<bool>("runOnMC")) {
45  
46
46    //
47    // put the setwhatproduced etc etc
48  
# Line 518 | Line 517 | HbbAnalyzerNew::produce(edm::Event& iEve
517      VHbbEvent::SimpleJet sj;
518      sj.flavour = jet_iter->partonFlavour();
519  
521
520      sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags");
521      sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags");
522      sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags");
# Line 529 | Line 527 | HbbAnalyzerNew::produce(edm::Event& iEve
527      sj.charge=jet_iter->jetCharge();
528      sj.ntracks=jet_iter->associatedTracks().size();
529      sj.fourMomentum=GENPTOLORP(jet_iter);
530 +    sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter)));
531 +    
532      //
533      // add tVector
534      //
# Line 569 | Line 569 | HbbAnalyzerNew::produce(edm::Event& iEve
569      sj.charge=jet_iter->jetCharge();
570      sj.ntracks=jet_iter->associatedTracks().size();
571      sj.fourMomentum=GENPTOLORP(jet_iter);
572 <
572 >    sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter)));
573      sj.tVector = getTvect(&(*jet_iter));
574  
575      Particle::LorentzVector p4Jet = jet_iter->p4();
# Line 634 | Line 634 | HbbAnalyzerNew::produce(edm::Event& iEve
634        hj.subFourMomentum.push_back(GENPTOLORP(icandJet));
635        hj.etaSub.push_back(icandJet->eta());
636        hj.phiSub.push_back(icandJet->phi());
637
637      
638      }
639      hbbInfo->hardJets.push_back(hj);
# Line 670 | Line 669 | HbbAnalyzerNew::produce(edm::Event& iEve
669      sj.charge=subjet_iter->jetCharge();
670      sj.ntracks=subjet_iter->associatedTracks().size();
671      sj.fourMomentum=GENPTOLORP(subjet_iter);
672 <
672 >    sj.fourMomentum=(getChargedTracksMomentum(&*(subjet_iter)));
673      hbbInfo->subJets.push_back(sj);
674  
675    }
# Line 950 | Line 949 | void
949   HbbAnalyzerNew::endJob() {
950   }
951  
953
952   TVector2 HbbAnalyzerNew::getTvect( const pat::Jet* patJet ){
953  
954    TVector2 t_Vect(0,0);
# Line 963 | Line 961 | TVector2 HbbAnalyzerNew::getTvect( const
961    double r_mag = 1e10;
962    unsigned int nOfconst = 0;
963  
964 < //re-reconstruct the jet direction with the charged tracks
964 >  //  std::cout <<" ECCCCCCOOOOO "<<patJet->isPFJet()<<std::endl;
965 >
966 >  if (patJet->isPFJet() == false) {
967 >    return t_Vect;
968 >  }
969 >  
970 >
971 >  //re-reconstruct the jet direction with the charged tracks
972    std::vector<reco::PFCandidatePtr>
973      patJetpfc = patJet->getPFConstituents();
974    for(size_t idx = 0; idx < patJetpfc.size(); idx++){
# Line 973 | Line 978 | TVector2 HbbAnalyzerNew::getTvect( const
978        nOfconst++;
979      }
980    }
976
981   // if there are less than two charged tracks do not calculate the pull (there is not enough info). It returns a null vector
982  
983    if( nOfconst < 2 )
984      return null;
985 +  
986 +
987  
988    TVector2 v_J( J.Rapidity(), J.Phi() );
989   //calculate TVector using only charged tracks
# Line 991 | Line 997 | TVector2 HbbAnalyzerNew::getTvect( const
997      }
998    }
999  
1000 +  
1001    return t_Vect;
1002    
1003   }
1004  
1005 + TLorentzVector HbbAnalyzerNew::getChargedTracksMomentum(const pat::Jet* patJet ){
1006 +  //  return TLorentzVector();
1007 +  TLorentzVector pi(0,0,0,0);
1008 +  TLorentzVector v_j1(0,0,0,0);
1009 +
1010 +
1011 +  //  std::cout <<"fff ECCCCCCOOOOO "<<patJet->isPFJet()<<std::endl;
1012 +
1013 +  if (patJet->isPFJet() == false ){
1014 +      v_j1 = GENPTOLORP(patJet);
1015 +      return v_j1;
1016 +  }
1017 +  std::vector<reco::PFCandidatePtr>
1018 +    j1pfc = patJet->getPFConstituents();
1019 +  for(size_t idx = 0; idx < j1pfc.size(); idx++){
1020 +    if( j1pfc.at(idx)->charge() != 0 ){
1021 +      pi.SetPtEtaPhiE( j1pfc.at(idx)->pt(), j1pfc.at(idx)->eta(), j1pfc.at(idx)->phi(), j1pfc.at(idx)->energy() );
1022 +      v_j1 += pi;
1023 +    }
1024 +  }
1025 +  return v_j1;
1026 +  //re-
1027 + }
1028  
1029   //define this as a plug-in
1030   DEFINE_FWK_MODULE(HbbAnalyzerNew);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines