ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc (file contents):
Revision 1.41 by mingyang, Wed Jan 16 23:27:21 2013 UTC vs.
Revision 1.42 by mingyang, Sat Feb 9 15:14:15 2013 UTC

# Line 688 | Line 688 | void PhotonTreeWriter::Process()
688        
689        // end of Vtx synching stuff ...
690        // =================================================================================
691 <
692 <
693 <
691 >      
692 >      
693 >      
694        if (jet1 && jet2) {
695          fDiphotonEvent->zeppenfeld = TMath::Abs(_etagg - 0.5*(jet1->Eta()+jet2->Eta()));
696          fDiphotonEvent->dphidijetgg = MathUtils::DeltaPhi( (jet1->Mom()+jet2->Mom()).Phi(), _phigg );
# Line 725 | Line 725 | void PhotonTreeWriter::Process()
725                                        &pfjets,
726                                        int(fPV->GetEntries()),
727                                        kFALSE);      
728 <                                  
728 >          
729            TMatrixD *metcov = fMVAMet.GetMetCovariance();
730            
731            ThreeVector fullmet(mmet.Px() - phHard->Px() - phSoft->Px(),
# Line 742 | Line 742 | void PhotonTreeWriter::Process()
742            vmet(1) = fullmet.Y();
743            mcov.Invert();
744            Double_t metsig = sqrt(ROOT::Math::Similarity(mcov,vmet));
745 <                                  
745 >          
746            fDiphotonEvent->mvametsel = fullmet.Rho();
747            fDiphotonEvent->mvametselphi = fullmet.Phi();
748            fDiphotonEvent->mvametselx = fullmet.X();
# Line 787 | Line 787 | void PhotonTreeWriter::Process()
787        
788      }
789      
790 <
790 >    
791      fDiphotonEvent->corrpfmet = -99.;
792      fDiphotonEvent->corrpfmetphi = -99.;
793      fDiphotonEvent->corrpfmetx = -99.;
794      fDiphotonEvent->corrpfmety = -99.;
795 <
795 >    
796      Met *corrMet =NULL;
797      
798      if (fApplyPFMetCorrections){
799 <    corrMet = new Met(fPFMet->At(0)->Px(),fPFMet->At(0)->Py());
800 <    
801 <    if (!fIsData){
802 <      PFMetCorrectionTools::correctMet(corrMet,phHard,phSoft,1,0,funcorrPFJets,fGenJets,fPFJets,_evt);
803 <      PFMetCorrectionTools::shiftMet(corrMet,fIsData,_spfMet);
804 <    }
805 <    else {
806 <      PFMetCorrectionTools::shiftMet(corrMet,fIsData,_spfMet);
807 <      PFMetCorrectionTools::correctMet(corrMet,phHard,phSoft,0,1,funcorrPFJets,fGenJets,fPFJets,_evt);
808 <     }    
809 <
810 <    fDiphotonEvent->corrpfmet = corrMet->Pt();
811 <    fDiphotonEvent->corrpfmetphi = corrMet->Phi();
812 <    fDiphotonEvent->corrpfmetx = corrMet->Px();
813 <    fDiphotonEvent->corrpfmety = corrMet->Py();
814 <
815 <    delete corrMet;
799 >      corrMet = new Met(fPFMet->At(0)->Px(),fPFMet->At(0)->Py());
800 >      
801 >      if (!fIsData){
802 >        PFMetCorrectionTools::correctMet(corrMet,phHard,phSoft,1,0,funcorrPFJets,fGenJets,fPFJets,_evt);
803 >        PFMetCorrectionTools::shiftMet(corrMet,fIsData,_spfMet);
804 >      }
805 >      else {
806 >        PFMetCorrectionTools::shiftMet(corrMet,fIsData,_spfMet);
807 >        PFMetCorrectionTools::correctMet(corrMet,phHard,phSoft,0,1,funcorrPFJets,fGenJets,fPFJets,_evt);
808 >      }    
809 >      
810 >      fDiphotonEvent->corrpfmet = corrMet->Pt();
811 >      fDiphotonEvent->corrpfmetphi = corrMet->Phi();
812 >      fDiphotonEvent->corrpfmetx = corrMet->Px();
813 >      fDiphotonEvent->corrpfmety = corrMet->Py();
814 >      
815 >      delete corrMet;
816      }
817 <
818 <
817 >    
818 >    
819      Float_t _massele = -99.;
820      Float_t _ptee = -99.;
821      Float_t _costhetaele = -99.;
# Line 829 | Line 829 | void PhotonTreeWriter::Process()
829      if (phgen1 && phgen2) {
830        _gencostheta = ThreeVector(phgen1->Mom()).Unit().Dot(ThreeVector(phgen2->Mom()).Unit());
831      }
832 <  
832 >    
833      fDiphotonEvent->gencostheta = _gencostheta;
834      fDiphotonEvent->dphiMetgg = _dphiMetgg;
835      fDiphotonEvent->cosdphiMetgg = _cosdphiMetgg;
# Line 847 | Line 847 | void PhotonTreeWriter::Process()
847      fDiphotonEvent->ptee = _ptee;
848      fDiphotonEvent->costhetaele =  _costhetaele;    
849      fDiphotonEvent->evtcat = _evtcat;
850 <
850 >    
851      fDiphotonEvent->photons[0].SetVars(phHard,conv1,ele1,pfsc1,phgen1,fPhfixph,fPhfixele,fTracks,fPV,fPFCands,rho,fFillClusterArrays,fElectrons,fConversions,bsp,fApplyElectronVeto,realVtx);
852      fDiphotonEvent->photons[1].SetVars(phSoft,conv2,ele2,pfsc2,phgen2,fPhfixph,fPhfixele,fTracks,fPV,fPFCands,rho,fFillClusterArrays,fElectrons,fConversions,bsp,fApplyElectronVeto,realVtx);
853      
# Line 855 | Line 855 | void PhotonTreeWriter::Process()
855      Float_t ph1ecorerr = fDiphotonEvent->photons[0].Ecorerr();
856      Float_t ph2ecor    = fDiphotonEvent->photons[1].Ecor();
857      Float_t ph2ecorerr = fDiphotonEvent->photons[1].Ecorerr();
858 <
858 >    
859      Float_t ph1ecorele    = fDiphotonEvent->photons[0].Ecorele();
860      Float_t ph1ecoreleerr = fDiphotonEvent->photons[0].Ecoreleerr();
861      Float_t ph2ecorele    = fDiphotonEvent->photons[1].Ecorele();
862      Float_t ph2ecoreleerr = fDiphotonEvent->photons[1].Ecoreleerr();
863 <      
863 >    
864      fDiphotonEvent->masscor    = TMath::Sqrt(2.0*ph1ecor*ph2ecor*(1.0-fDiphotonEvent->costheta));
865      fDiphotonEvent->masscorerr = 0.5*fDiphotonEvent->masscor*
866        TMath::Sqrt(ph1ecorerr*ph1ecorerr/ph1ecor/ph1ecor + ph2ecorerr*ph2ecorerr/ph2ecor/ph2ecor);
# Line 890 | Line 890 | void PhotonTreeWriter::Process()
890      fDiphotonEvent-> muNpixhits = -99;
891      fDiphotonEvent-> muNegs = -99;
892      fDiphotonEvent-> muNMatch = -99;
893 <
893 >    
894      // Electron Stuff
895      fDiphotonEvent-> elePt = -99.;
896      fDiphotonEvent-> eleEta = -99.;
# Line 911 | Line 911 | void PhotonTreeWriter::Process()
911      fDiphotonEvent-> eleNinnerHits = -99;    
912      
913      fDiphotonEvent-> eleIdMva = -99.;
914 <
914 >    
915      if( fApplyLeptonTag ) {
916 <        
916 >      
917        // perform lepton tagging
918        // the diphoton event record will have one more entry; i.e. leptonTag
919        // leptonTag = -1   -> lepton-taggng was swicthed off
# Line 930 | Line 930 | void PhotonTreeWriter::Process()
930              ((phSoft->Pt()/(phHard->Mom() + phSoft->Mom()).M())>(30./120.)) ){
931            
932            fDiphotonEvent->leptonTag = 2;
933 <
933 >          
934            fDiphotonEvent-> muonPt  = fLeptonTagMuons->At(0)->Pt();
935            fDiphotonEvent-> muonEta = fLeptonTagMuons->At(0)->Eta();
936            fDiphotonEvent-> muDR1   = MathUtils::DeltaR(fLeptonTagMuons->At(0),phHard);
937            fDiphotonEvent-> muDR2   = MathUtils::DeltaR(fLeptonTagMuons->At(0),phSoft);
938 <
938 >          
939            fDiphotonEvent-> muIso1   = (fLeptonTagMuons->At(0)->IsoR03SumPt() + fLeptonTagMuons->At(0)->IsoR03EmEt() + fLeptonTagMuons->At(0)->IsoR03HadEt() - fPileUpDen->At(0)->RhoRandomLowEta() * TMath::Pi() * 0.3 * 0.3)/ fLeptonTagMuons->At(0)->Pt();
940            fDiphotonEvent-> muIso2   = (fLeptonTagMuons->At(0)->IsoR03SumPt() + fLeptonTagMuons->At(0)->IsoR03EmEt() + fLeptonTagMuons->At(0)->IsoR03HadEt() - fPileUpDen->At(0)->RhoRandom() * TMath::Pi() * 0.3 * 0.3)/ fLeptonTagMuons->At(0)->Pt();
941            fDiphotonEvent-> muIso3   = (fLeptonTagMuons->At(0)->IsoR03SumPt() + fLeptonTagMuons->At(0)->IsoR03EmEt() + fLeptonTagMuons->At(0)->IsoR03HadEt() - fPileUpDen->At(0)->RhoLowEta() * TMath::Pi() * 0.3 * 0.3)/ fLeptonTagMuons->At(0)->Pt();
# Line 943 | Line 943 | void PhotonTreeWriter::Process()
943            fDiphotonEvent-> muD0  = TMath::Abs(fLeptonTagMuons->At(0)->BestTrk()->D0Corrected(*fPV->At(0)));
944            fDiphotonEvent-> muDZ  = TMath::Abs(fLeptonTagMuons->At(0)->BestTrk()->DzCorrected(*fPV->At(0)));
945            fDiphotonEvent-> muChi2  = fLeptonTagMuons->At(0)->GlobalTrk()->Chi2()/fLeptonTagMuons->At(0)->GlobalTrk()->Ndof();
946 <                  
946 >          
947            fDiphotonEvent-> muNhits = fLeptonTagMuons->At(0)->BestTrk()->NHits();
948            fDiphotonEvent-> muNpixhits = fLeptonTagMuons->At(0)->BestTrk()->NPixelHits();
949            fDiphotonEvent-> muNegs = fLeptonTagMuons->At(0)->NSegments();
# Line 960 | Line 960 | void PhotonTreeWriter::Process()
960              ((phHard->Pt()/(phHard->Mom() + phSoft->Mom()).M())>(45./120.)) &&
961              ((phSoft->Pt()/(phHard->Mom() + phSoft->Mom()).M())>(30./120.))){
962            
963 <          int ph1passeveto=1;
964 <          int ph2passeveto=1;
965 <          
966 <          for(UInt_t k=0;k<fElectrons->GetEntries();k++){
963 >          /*int ph1passeveto=1;
964 >            int ph2passeveto=1;
965 >            
966 >            for(UInt_t k=0;k<fElectrons->GetEntries();k++){
967              if(fElectrons->At(k)->BestTrk()->NMissingHits()==0){
968 <              if((fElectrons->At(k)->SCluster()==phHard->SCluster()) && (MathUtils::DeltaR(*fElectrons->At(k)->BestTrk(),*phHard) < 1)){
969 <                ph1passeveto=0;
970 <              }
971 <              if((fElectrons->At(k)->SCluster()==phSoft->SCluster()) && (MathUtils::DeltaR(*fElectrons->At(k)->BestTrk(),*phSoft) < 1)){
972 <                ph2passeveto=0;
973 <              }
968 >            if((fElectrons->At(k)->SCluster()==phHard->SCluster()) && (MathUtils::DeltaR(*fElectrons->At(k)->BestTrk(),*phHard) < 1)){
969 >            ph1passeveto=0;
970              }
971 <          }
971 >            if((fElectrons->At(k)->SCluster()==phSoft->SCluster()) && (MathUtils::DeltaR(*fElectrons->At(k)->BestTrk(),*phSoft) < 1)){
972 >            ph2passeveto=0;
973 >            }
974 >            }
975 >            }
976 >            
977 >            if(ph1passeveto==1 && ph2passeveto==1){*/
978            
979 <          if(ph1passeveto==1 && ph2passeveto==1){
979 >          if(PhotonTools::ElectronVetoCiC(phHard, fElectrons)>=1 && PhotonTools::ElectronVetoCiC(phSoft, fElectrons)>=1){
980 >            
981              fDiphotonEvent->leptonTag = 1;
982              
983              fDiphotonEvent-> elePt = fLeptonTagElectrons->At(0)->Pt();
# Line 1009 | Line 1012 | void PhotonTreeWriter::Process()
1012              fDiphotonEvent-> eleDR2 = MathUtils::DeltaR(fLeptonTagElectrons->At(0),phSoft);
1013              fDiphotonEvent-> eleMass1 = (phHard->Mom()+fLeptonTagElectrons->At(0)->Mom()).M();
1014              fDiphotonEvent-> eleMass2 = (phSoft->Mom()+fLeptonTagElectrons->At(0)->Mom()).M();
1015 <          fDiphotonEvent-> eleNinnerHits =      fLeptonTagElectrons->At(0)->Trk()->NExpectedHitsInner();
1015 >            fDiphotonEvent-> eleNinnerHits =      fLeptonTagElectrons->At(0)->Trk()->NExpectedHitsInner();
1016            }
1017          }
1018        }
1019        
1020        if(false){
1021 <        if(fDiphotonEvent->evt==79737729 || fDiphotonEvent->evt==197022547 || fDiphotonEvent->evt==172664113 || fDiphotonEvent->evt==332789938 || fDiphotonEvent->evt==465586356){
1021 >        if(fDiphotonEvent->evt==101794856 || fDiphotonEvent->evt==528937923 || fDiphotonEvent->evt==483561562 || fDiphotonEvent->evt==1374972270 || fDiphotonEvent->evt==835731908){
1022 >        //if(fDiphotonEvent->evt==369441614 || fDiphotonEvent->evt==79737729){
1023            printf("ming sync check 0:  run:%d  evt:%d  lumi:%d  leptonTag:%d  numelectrons:%d  idmva:%f  mass:%f\n  elePt:%f  eleEta:%f  eleSCEta:%f  vtx:%d\n",fDiphotonEvent->run,fDiphotonEvent->evt,fDiphotonEvent->lumi,fDiphotonEvent->leptonTag,fLeptonTagElectrons->GetEntries(),fDiphotonEvent->eleIdMva,_mass,fDiphotonEvent->elePt,fDiphotonEvent->eleEta,fDiphotonEvent->eleSCEta,closestVtx);
1024 +          //return;
1025          }
1026        }
1027      }
# Line 1047 | Line 1052 | void PhotonTreeWriter::Process()
1052          }
1053        }
1054      }
1055 +    
1056      //printf("vbfbdt:%f\n",fDiphotonEvent->vbfbdt);
1057      if (fWriteDiphotonTree)
1058        hCiCTuple->Fill();  
# Line 1058 | Line 1064 | void PhotonTreeWriter::Process()
1064          hVtxTree->Fill();
1065        }
1066      }
1061    
1067    }
1068 <
1068 >  
1069    if (!fWriteSingleTree)
1070      return;
1071 <
1071 >  
1072    for (UInt_t iph = 0; iph<egcol->GetEntries(); ++iph) {
1073      const Particle *p = 0;
1074      const Photon *ph = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines