CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SUSYBSMAnalysis/HSCP/src/CandidateSelector.cc

Go to the documentation of this file.
00001 #include "SUSYBSMAnalysis/HSCP/interface/CandidateSelector.h"
00002 
00003 using namespace edm;
00004 using namespace reco;
00005 using namespace susybsm;
00006 
00007 
00008 
00009 
00010 CandidateSelector::CandidateSelector(const edm::ParameterSet& iConfig){
00011    isTrack               = iConfig.getParameter<bool>   ("onlyConsiderTrack");
00012    isMuon                = iConfig.getParameter<bool>   ("onlyConsiderMuon");
00013    isMuonSTA             = iConfig.getParameter<bool>   ("onlyConsiderMuonSTA"); 
00014    isMuonGB              = iConfig.getParameter<bool>   ("onlyConsiderMuonGB");
00015    isMuonTK              = iConfig.getParameter<bool>   ("onlyConsiderMuonTK");
00016    isRpc                 = iConfig.getParameter<bool>   ("onlyConsiderRpc");
00017    isEcal                = iConfig.getParameter<bool>   ("onlyConsiderEcal");
00018 
00019    minTrackHits          = iConfig.getParameter<int>    ("minTrackHits");
00020    minTrackP             = iConfig.getParameter<double> ("minTrackP");
00021    minTrackPt            = iConfig.getParameter<double> ("minTrackPt");
00022 
00023    minDedx               = iConfig.getParameter<double> ("minDedx");
00024 
00025    minMuonP              = iConfig.getParameter<double> ("minMuonP");
00026    minMuonPt             = iConfig.getParameter<double> ("minMuonPt");
00027 
00028    maxMuTimeDtBeta       = iConfig.getParameter<double> ("maxMuTimeDtBeta");
00029    minMuTimeDtNdof       = iConfig.getParameter<double> ("minMuTimeDtNdof");
00030    maxMuTimeCscBeta      = iConfig.getParameter<double> ("maxMuTimeCscBeta");
00031    minMuTimeCscNdof      = iConfig.getParameter<double> ("minMuTimeCscNdof");
00032    maxMuTimeCombinedBeta = iConfig.getParameter<double> ("maxMuTimeCombinedBeta");
00033    minMuTimeCombinedNdof = iConfig.getParameter<double> ("minMuTimeCombinedNdof");
00034 
00035    maxBetaRpc            = iConfig.getParameter<double> ("maxBetaRpc");
00036    maxBetaEcal           = iConfig.getParameter<double> ("maxBetaEcal");
00037 }
00038 
00039 
00040 bool CandidateSelector::isSelected(HSCParticle& candidate)
00041 {
00042    if(isTrack   && !candidate.hasTrackRef()){return false;}
00043    if(isMuon    && !candidate.hasMuonRef() ){return false;}
00044    if(isMuonSTA && (!candidate.hasMuonRef() || candidate.muonRef()->standAloneMuon().isNull()) ){return false;}
00045    if(isMuonGB  && (!candidate.hasMuonRef() || candidate.muonRef()->combinedMuon  ().isNull()) ){return false;}
00046    if(isMuonTK  && (!candidate.hasMuonRef() || candidate.muonRef()->innerTrack    ().isNull()) ){return false;}
00047    if(isRpc     && !candidate.hasRpcInfo() ){return false;}
00048    if(isEcal    && !candidate.hasCaloInfo()){return false;}
00049 
00050    if(candidate.hasTrackRef()){
00051       if(candidate.trackRef()->found() < minTrackHits){return false;}
00052       if(candidate.trackRef()->p()     < minTrackP   ){return false;}
00053       if(candidate.trackRef()->pt()    < minTrackPt  ){return false;}
00054 
00055 //      Need to be implemented using external dE/dx object
00056 //      if(candidate.hasDedxEstim1()   && minDedxEstimator1>=0     && candidate.dedxEstimator1    ().dEdx()<minDedxEstimator1)    {return false;}
00057 //      if(candidate.hasDedxDiscrim1() && minDedxDiscriminator1>=0 && candidate.dedxDiscriminator1().dEdx()<minDedxDiscriminator1){return false;}
00058    }
00059 
00060    if(candidate.hasMuonRef()){
00061       if(candidate.muonRef()->p()     < minMuonP   ){return false;}
00062       if(candidate.muonRef()->pt()    < minMuonPt  ){return false;}
00063 
00064 //      Need to be implemented using external timing object
00065 //      if(maxMuTimeDtBeta      >=0 && 1.0/candidate.muonTimeDt().inverseBeta()       > maxMuTimeDtBeta      ){return false;}
00066 //      if(minMuTimeDtNdof      >=0 && 1.0/candidate.muonTimeDt().nDof()              < minMuTimeDtNdof      ){return false;}
00067 //      if(maxMuTimeCscBeta     >=0 && 1.0/candidate.muonTimeCsc().inverseBeta()      > maxMuTimeCscBeta     ){return false;}
00068 //      if(minMuTimeCscNdof     >=0 && 1.0/candidate.muonTimeCsc().nDof()             < minMuTimeCscNdof     ){return false;}
00069 //      if(maxMuTimeCombinedBeta>=0 && 1.0/candidate.muonTimeCombined().inverseBeta() > maxMuTimeCombinedBeta){return false;}
00070 //      if(minMuTimeCombinedNdof>=0 && 1.0/candidate.muonTimeCombined().nDof()        < minMuTimeCombinedNdof){return false;}
00071    }
00072 
00073    if(candidate.hasRpcInfo()  && maxBetaRpc>=0  && candidate.rpc ().beta     > maxBetaRpc ){return false;}
00074 
00075 //      Need to be implemented using external dE/dx object
00076 //   if(candidate.hasCaloInfo() && maxBetaEcal>=0 && candidate.calo().ecalBeta > maxBetaEcal){return false;}
00077 
00078    return true;
00079 }
00080