Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:48

0001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
0002 #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameterAssociation.h"
0003 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0004 /* 
0005  * class PFRecoTauDiscriminationByIPCut
0006  */
0007 
0008 using namespace reco;
0009 
0010 class PFRecoTauDiscriminationByIPCut final : public PFTauDiscriminationProducerBase {
0011 public:
0012   explicit PFRecoTauDiscriminationByIPCut(const edm::ParameterSet& iConfig)
0013       : PFTauDiscriminationProducerBase(iConfig),
0014         tausTIPToken_(consumes(iConfig.getParameter<edm::InputTag>("tausTIP"))),
0015         tauTIPSelector_(iConfig.getParameter<std::string>("cut")) {}
0016   ~PFRecoTauDiscriminationByIPCut() override {}
0017   void beginEvent(const edm::Event&, const edm::EventSetup&) override;
0018   double discriminate(const PFTauRef& pfTau) const override;
0019   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0020 
0021 private:
0022   typedef edm::AssociationVector<reco::PFTauRefProd, std::vector<reco::PFTauTransverseImpactParameterRef> >
0023       PFTauTIPAssociationByRef;
0024   edm::EDGetTokenT<PFTauTIPAssociationByRef> tausTIPToken_;
0025   edm::Handle<PFTauTIPAssociationByRef> tausTIP_;
0026 
0027   const StringCutObjectSelector<reco::PFTauTransverseImpactParameter> tauTIPSelector_;
0028 };
0029 
0030 double PFRecoTauDiscriminationByIPCut::discriminate(const PFTauRef& thePFTauRef) const {
0031   return tauTIPSelector_(*(*tausTIP_)[thePFTauRef]) ? 1. : 0.;
0032 }
0033 
0034 void PFRecoTauDiscriminationByIPCut::beginEvent(const edm::Event& event, const edm::EventSetup& eventSetup) {
0035   event.getByToken(tausTIPToken_, tausTIP_);
0036 }
0037 
0038 void PFRecoTauDiscriminationByIPCut::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0039   edm::ParameterSetDescription desc;
0040   desc.add<edm::InputTag>("tausTIP", edm::InputTag("hltTauIPCollection"));
0041   desc.add<std::string>("cut", "abs(dxy) > -999.");
0042   fillProducerDescriptions(desc);  // inherited from the base
0043   descriptions.addWithDefaultLabel(desc);
0044 }
0045 
0046 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByIPCut);