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.73 by degrutto, Wed May 16 15:13:51 2012 UTC vs.
Revision 1.77.2.1 by ntran, Fri Nov 16 21:20:42 2012 UTC

# Line 206 | Line 206 | HbbAnalyzerNew::produce(edm::Event& iEve
206    edm::Handle<double> rho25Handle;
207    iEvent.getByLabel(edm::InputTag("kt6PFJets25", "rho"),rho25Handle);  
208    auxInfo->puInfo.rho25 = *rho25Handle;
209 +  edm::Handle<double> rho25HandleIso;
210 +  iEvent.getByLabel(edm::InputTag("kt6PFJetsForIsolation", "rho"),rho25HandleIso);  
211 +  auxInfo->puInfo.rho25Iso = *rho25HandleIso;
212  
213    edm::Handle<double> rhoNeutralHandle;
214    iEvent.getByLabel(edm::InputTag("kt6PFJetsCentralNeutral", "rho"),rhoNeutralHandle);  
# Line 221 | Line 224 | HbbAnalyzerNew::produce(edm::Event& iEve
224        std::vector< PileupSummaryInfo> pu = (*puHandle);
225        for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){
226           int bx = (*it).getBunchCrossing();
227 +         if(bx == 0) { auxInfo->puInfo.truePU = (*it).getTrueNumInteractions();}
228          unsigned int num = (*it).getPU_NumInteractions();
229          //      std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl;
230          auxInfo->puInfo.pus[bx]  =num;
# Line 387 | Line 391 | HbbAnalyzerNew::produce(edm::Event& iEve
391  
392    /////// end generator block    
393  
394 + /// photon used in isolation
395 +  edm::Handle<edm::View<reco::PFCandidate> > photonIsoH;
396 +  iEvent.getByLabel("pfAllPhotons",photonIsoH);
397 +  edm::View<reco::PFCandidate> photonsForIso = *photonIsoH;
398  
399    edm::Handle<edm::View<pat::Muon> > muonHandle;
400    iEvent.getByLabel(muoLabel_,muonHandle);
# Line 824 | Line 832 | BTagSFContainer btagSFs;
832         }
833    */
834    
835 +        //////////////////////////////////////////////////////////////
836 +        //////////////////////////////////////////////////////////////
837 +        ////// Nhan's Jets  
838 +    
839 +    edm::Handle<edm::View<pat::Jet> > ca12jetHandle;
840 +    iEvent.getByLabel("selectedPatJetsCA12PF",ca12jetHandle);
841 +    edm::View<pat::Jet> ca12jets = *ca12jetHandle;
842 +    int ctr = 0;
843 +    for(edm::View<pat::Jet>::const_iterator jet_iter = ca12jets.begin(); jet_iter!=ca12jets.end(); ++jet_iter){
844 + //        std::cout << "jet # " << ctr << std::endl;
845 + //        std::cout << "size: " << jet_iter->getPFConstituents().size() << std::endl;
846 +        
847 +        std::vector<reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents();        
848 +        VHbbEvent::RawJet rj;
849 +        rj.p4 = GENPTOLORP(jet_iter);
850 +        rj.Nconstituents = jet_iter->getPFConstituents().size();
851 +        
852 +        for (unsigned int iJC = 0; iJC<constituents.size(); ++iJC ){
853 +
854 +            rj.constituents_px.push_back( jet_iter->getPFConstituents().at(iJC)->px() );
855 +            rj.constituents_py.push_back( jet_iter->getPFConstituents().at(iJC)->py() );
856 +            rj.constituents_pz.push_back( jet_iter->getPFConstituents().at(iJC)->pz() );
857 +            rj.constituents_e.push_back( jet_iter->getPFConstituents().at(iJC)->energy() );
858 +            rj.constituents_pdgId.push_back( jet_iter->getPFConstituents().at(iJC)->pdgId() );
859 +        }
860 +        
861 +        hbbInfo->rawJets.push_back( rj );
862 +        ctr++;
863 +        
864 +    }
865  
866 +        // fill the GEN jet information too!
867 +    if(runOnMC_){
868 +        
869 +        
870 +        edm::Handle<reco::GenJetCollection> genJets ;
871 +        iEvent.getByLabel("ca12GenJetsNoNu",genJets);
872 +        
873 +        for (reco::GenJetCollection::const_iterator moIter = genJets->begin(); moIter != genJets->end(); ++moIter) {
874 + //            std::cout << "jet eta: " << moIter->eta() << std::endl;
875 +            if (moIter->pt() > 80.){
876 +                VHbbEvent::RawJet rgj;
877 +                rgj.p4 = TLorentzVector( moIter->px(), moIter->py(), moIter->pz(), moIter->energy() );
878 +                rgj.Nconstituents = moIter->getGenConstituents().size();
879 +
880 +                for (unsigned int iJC = 0; iJC < moIter->getGenConstituents().size(); iJC++){
881 +                    rgj.constituents_px.push_back( moIter->getGenConstituents().at(iJC)->px() );
882 +                    rgj.constituents_py.push_back( moIter->getGenConstituents().at(iJC)->py() );
883 +                    rgj.constituents_pz.push_back( moIter->getGenConstituents().at(iJC)->pz() );
884 +                    rgj.constituents_e.push_back( moIter->getGenConstituents().at(iJC)->energy() );
885 +                    rgj.constituents_pdgId.push_back( moIter->getGenConstituents().at(iJC)->pdgId() );
886 +                }
887 +                hbbInfo->rawJetsGen.push_back( rgj );
888 +            }
889 +        }
890 + //        edm::Handle<edm::View<reco::GenJet> > ca12genjetHandle;
891 + //        iEvent.getByLabel("ca12GenJetsNoNu",ca12genjetHandle);
892 + //        edm::View<pat::Jet> ca12genjets = *ca12genjetHandle;
893 + //        ctr = 0;
894 + //        for(edm::View<reco::GenJet>::const_iterator jet_iter = ca12genjets.begin(); jet_iter!=ca12genjets.end(); ++jet_iter){
895 + //            std::cout << "jet # " << ctr << std::endl;
896 + //            std::coit << "jet pt = " << jet_iter->pt() << std::endl;
897 +
898 + //            std::cout << "size: " << jet_iter->getPFConstituents().size() << std::endl;
899 + //            
900 + //            std::vector<reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents();        
901 + //            VHbbEvent::RawJet rj;
902 + //            rj.p4 = GENPTOLORP(jet_iter);
903 + //            rj.Nconstituents = jet_iter->getPFConstituents().size();
904 + //            
905 + //            for (unsigned int iJC = 0; iJC<constituents.size(); ++iJC ){
906 + //                
907 + //                rj.constituents_px.push_back( jet_iter->getPFConstituents().at(iJC)->px() );
908 + //                rj.constituents_py.push_back( jet_iter->getPFConstituents().at(iJC)->py() );
909 + //                rj.constituents_pz.push_back( jet_iter->getPFConstituents().at(iJC)->pz() );
910 + //                rj.constituents_e.push_back( jet_iter->getPFConstituents().at(iJC)->energy() );
911 + //                rj.constituents_pdgId.push_back( jet_iter->getPFConstituents().at(iJC)->pdgId() );
912 + //            }
913 + //            
914 + //            hbbInfo->rawJetsGen.push_back( rj );
915 +
916 + //            ctr++;
917 + //            
918 + //        }
919 +
920 +    }
921 +        //////////////////////////////////////////////////////////////
922 +        //////////////////////////////////////////////////////////////
923  
924    /////// hard jet
925  
# Line 837 | Line 932 | BTagSFContainer btagSFs;
932      if(printJet) {std::cout << "Jet Pt: " << jet_iter->pt() << " E,M: " << jet_iter->p4().E() << " " << jet_iter->p4().M() << "\n";}
933      
934      reco::Jet::Constituents constituents = jet_iter->getJetConstituents();
935 <    
935 >    std::cout << "NsubJets: " << constituents.size() << "\n";
936 > //    std::cout << "Nconstituents: " << jet_iter->getConstituents().size() << "\n";
937 >      
938      //    if(printJet) {std::cout << "NsubJets: " << constituents.size() << "\n";}
939      VHbbEvent::HardJet hj;
940      hj.constituents=constituents.size();
# Line 853 | Line 950 | BTagSFContainer btagSFs;
950        hj.subFourMomentum.push_back(GENPTOLORP(icandJet));
951        hj.etaSub.push_back(icandJet->eta());
952        hj.phiSub.push_back(icandJet->phi());
953 +        
954 + //        std::cout << "subjet constituents: " << icandJet->getJetConstituents.size() << std::endl;  
955      
956      }
957      hbbInfo->hardJets.push_back(hj);
# Line 921 | Line 1020 | BTagSFContainer btagSFs;
1020      //  if(!runOnMC_)  
1021      setJecUnc(fj,jecUnc);
1022  
1023 +    if(runOnMC_){
1024 +
1025 +      //BTV scale factors
1026 +     // fillScaleFactors(sj, btagSFs);
1027 +
1028 +      //PAT genJet matching
1029 +      //genJet
1030 +      const reco::GenJet *gJ = filterjet_iter->genJet();
1031 +      //physical parton for mother info ONLY
1032 +      if( (filterjet_iter->genParton()) ){
1033 +        fj.bestMCid = filterjet_iter->genParton()->pdgId();
1034 +        if( (filterjet_iter->genParton()->mother()) )
1035 +          fj.bestMCmomid=filterjet_iter->genParton()->mother()->pdgId();
1036 +      }
1037 +      TLorentzVector gJp4;
1038 +      if(gJ){
1039 +        gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
1040 +        fj.bestMCp4 = gJp4;
1041 +        if(verbose_){
1042 +          std::clog << "filter genJet matched Pt = " << gJp4.Pt() << std::endl;
1043 +          std::clog << "filter genJet matched eta = " << gJp4.Eta() << std::endl;
1044 +          std::clog << "filter genJet matched deltaR = " << gJp4.DeltaR(fj.p4) << std::endl;
1045 +          std::clog << "filter genJet matched mother id = " << fj.bestMCmomid << std::endl;
1046 +        }
1047 +      }
1048 +    }
1049 +
1050      hbbInfo->filterJets.push_back(fj);
1051      
1052  
# Line 1357 | Line 1483 | BTagSFContainer btagSFs;
1483    }
1484    
1485    edm::Handle<edm::View<pat::MET> > metPFHandle;
1486 <  iEvent.getByLabel("patMETs",metPFHandle);
1486 >  iEvent.getByLabel("patMETsPFlow",metPFHandle);
1487    edm::View<pat::MET> metsPF = *metPFHandle;
1488    
1489    if(metsPF.size()){
# Line 1495 | Line 1621 | BTagSFContainer btagSFs;
1621      ef.pfChaIso=elec->chargedHadronIso();
1622      ef.pfChaPUIso=elec->puChargedHadronIso();//userIso(5);
1623      ef.pfPhoIso=elec->photonIso();
1624 +    ef.pfPhoIsoDoubleCounted=0;
1625 +
1626 + /* Check if there are photons sharing the super cluster*/
1627 +    for(size_t k=0;k<photonsForIso.size();k++) {
1628 +       if(deltaR(elec->eta(),elec->phi(),photonsForIso[k].eta(),photonsForIso[k].phi()) < 0.05 && abs(photonsForIso[k].pt()-elec->pt())/(photonsForIso[k].pt()+elec->pt()) < 0.05 ) {
1629 +          std::cout << "Double counting of supercluster!" << std::endl;
1630 +          ef.pfPhoIsoDoubleCounted+=photonsForIso[k].pt();
1631 +     }
1632 +    }
1633      ef.pfNeuIso=elec->neutralHadronIso();
1634  
1635      //
# Line 1515 | Line 1650 | BTagSFContainer btagSFs;
1650      ef.HoE = elec->hadronicOverEm();
1651      ef.convDist = elec->convDist();
1652      ef.convDcot = elec->convDcot();
1653 <    if(elec->gsfTrack().isNonnull()) ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits();  
1653 >    if(elec->gsfTrack().isNonnull())
1654 >    {
1655 >     ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits();  
1656 >    }
1657      ef.isEB = elec->isEB();
1658      ef.isEE = elec->isEE();
1659   /* 2012 ELEID*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines