CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoTauTag/TauTagTools/src/PFTauQualityCutWrapper.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/TauTagTools/interface/PFTauQualityCutWrapper.h"
00002 
00003 // ****************************************************
00004 // ******   Isolation filters  ************************
00005 // ****************************************************
00006 
00007 using namespace reco;
00008 
00009 void
00010 PFTauQualityCutWrapper::isolationChargedObjects(const PFTau& pfTau, const Vertex& pv, std::vector<reco::LeafCandidate>& output)
00011 {
00012    if( isoQCuts.useTracksInsteadOfPF )
00013    {
00014       TrackRefVector result = TauTagTools::filteredTracks(pfTau.isolationTracks(), 
00015                                              isoQCuts.minTrackPt,
00016                                              isoQCuts.minTrackPixelHits,
00017                                              isoQCuts.minTrackHits,
00018                                              isoQCuts.maxTransverseImpactParameter,
00019                                              isoQCuts.maxTrackChi2,
00020                                              isoQCuts.maxDeltaZ,
00021                                              pv,
00022                                              pv.position().z() ); //????
00023 
00024       size_t nTracks = result.size();
00025       for(size_t iTrack = 0; iTrack < nTracks; ++iTrack)
00026       {
00027          // this sucks
00028          int charge         = result[iTrack]->charge();
00029          math::XYZVector p3 = result[iTrack]->momentum();
00030          reco::Particle::LorentzVector p4(p3.R(), p3.x(), p3.y(), p3.z());
00031          output.push_back(reco::LeafCandidate(charge, p4));
00032       }
00033    } else
00034    {
00035       PFCandidateRefVector preresult = TauTagTools::filteredPFChargedHadrCands(pfTau.isolationPFChargedHadrCands(), 
00036                                              isoQCuts.minTrackPt,
00037                                              isoQCuts.minTrackPixelHits,
00038                                              isoQCuts.minTrackHits,
00039                                              isoQCuts.maxTransverseImpactParameter,
00040                                              isoQCuts.maxTrackChi2,
00041                                              10000.,                                //                                             isoQCuts.maxDeltaZ,
00042                                              pv,
00043                                              pv.position().z() ); //????
00044 
00045 
00046       for(unsigned int i=0;i<preresult.size();++i)
00047         if(preresult.at(i)->trackRef().isNonnull()) {
00048           //get the vertex weight and require to be >50%
00049           float w = pv.trackWeight(preresult.at(i)->trackRef());
00050           if(w>0.0) 
00051             output.push_back(reco::LeafCandidate(preresult.at(i)->charge(), preresult[i]->p4()));
00052           
00053         }
00054 
00055 
00056    }
00057    
00058 }
00059 
00060 
00061 void
00062 PFTauQualityCutWrapper::isolationPUObjects(const PFTau& pfTau, const Vertex& pv, std::vector<reco::LeafCandidate>& output)
00063 {
00064 
00065       PFCandidateRefVector preresult = TauTagTools::filteredPFChargedHadrCands(pfTau.isolationPFChargedHadrCands(), 
00066                                              isoQCuts.minGammaEt,0,0,1000.,100000,
00067                                              10000.,                                //                                             isoQCuts.maxDeltaZ,
00068                                              pv,
00069                                              pv.position().z() ); //????
00070 
00071 
00072       for(unsigned int i=0;i<preresult.size();++i)
00073         if(preresult.at(i)->trackRef().isNonnull()) {
00074           //get the vertex weight and require to be >50%
00075           float w = pv.trackWeight(preresult.at(i)->trackRef());
00076           if(w==0.0) 
00077             output.push_back(reco::LeafCandidate(preresult.at(i)->charge(), preresult[i]->p4()));
00078           
00079         }
00080    
00081 }
00082 
00083 
00084 
00085 void
00086 PFTauQualityCutWrapper::isolationGammaObjects(const PFTau& pfTau, std::vector<reco::LeafCandidate>& output)
00087 {
00088    PFCandidateRefVector result = TauTagTools::filteredPFGammaCands(pfTau.isolationPFGammaCands(), isoQCuts.minGammaEt);
00089 
00090    size_t nGammas = result.size();
00091    for(size_t iGamma = 0; iGamma < nGammas; ++iGamma)
00092    {
00093       output.push_back(reco::LeafCandidate(result[iGamma]->charge(), result[iGamma]->p4()));
00094    }
00095    
00096 }
00097 
00098 // ****************************************************
00099 // ******   Signal region filters *********************
00100 // ****************************************************
00101 
00102 void
00103 PFTauQualityCutWrapper::signalChargedObjects(const PFTau& pfTau, const Vertex& pv, std::vector<reco::LeafCandidate>& output)
00104 {
00105    if( signalQCuts.useTracksInsteadOfPF )
00106    {
00107       TrackRefVector result = TauTagTools::filteredTracks(pfTau.signalTracks(), 
00108                                              signalQCuts.minTrackPt,
00109                                              signalQCuts.minTrackPixelHits,
00110                                              signalQCuts.minTrackHits,
00111                                              signalQCuts.maxTransverseImpactParameter,
00112                                              signalQCuts.maxTrackChi2,
00113                                              signalQCuts.maxDeltaZ,
00114                                              pv,
00115                                              pv.position().z() ); //????
00116 
00117       size_t nTracks = result.size();
00118       for(size_t iTrack = 0; iTrack < nTracks; ++iTrack)
00119       {
00120          // this sucks
00121          int charge         = result[iTrack]->charge();
00122          math::XYZVector p3 = result[iTrack]->momentum();
00123          reco::Particle::LorentzVector p4(p3.R(), p3.x(), p3.y(), p3.z());
00124          output.push_back(reco::LeafCandidate(charge, p4));
00125       }
00126    } else
00127    {
00128 
00129      //First perform basic filtering without vertex dz
00130       PFCandidateRefVector preresult = TauTagTools::filteredPFChargedHadrCands(pfTau.signalPFChargedHadrCands(), 
00131 
00132                                              signalQCuts.minTrackPt,
00133                                              signalQCuts.minTrackPixelHits,
00134                                              signalQCuts.minTrackHits,
00135                                              signalQCuts.maxTransverseImpactParameter,
00136                                              signalQCuts.maxTrackChi2,
00137                                              10000.,   //                              signalQCuts.maxDeltaZ,
00138                                              pv,
00139                                              pv.position().z() ); //????
00140       
00141       //Now check the vertex association
00142       for(unsigned int i=0;i<preresult.size();++i)
00143         if(preresult.at(i)->trackRef().isNonnull()) {
00144           //get the vertex weight and require to be >50%
00145           float w = pv.trackWeight(preresult.at(i)->trackRef());
00146           if(w>0.0) 
00147             output.push_back(reco::LeafCandidate(preresult.at(i)->charge(), preresult[i]->p4()));
00148                                    
00149         }
00150       
00151 
00152    }
00153    
00154 }
00155 
00156 void
00157 PFTauQualityCutWrapper::signalGammaObjects(const PFTau& pfTau, std::vector<reco::LeafCandidate>& output)
00158 {
00159    PFCandidateRefVector result = TauTagTools::filteredPFGammaCands(pfTau.signalPFGammaCands(), signalQCuts.minGammaEt);
00160 
00161    size_t nGammas = result.size();
00162    for(size_t iGamma = 0; iGamma < nGammas; ++iGamma)
00163    {
00164       output.push_back(reco::LeafCandidate(result[iGamma]->charge(), result[iGamma]->p4()));
00165    }
00166    
00167 }