CMS 3D CMS Logo

CaloRecoTauDiscriminationByLeadingTrackPtCut.cc
Go to the documentation of this file.
1 /*
2  * class CaloRecoTauDiscriminationByLeadingTrackPtCut
3  * created : October 08 2008,
4  * revised : ,
5  * Authors : Simone Gennai (SNS), Evan Friis (UC Davis)
6  */
7 
9 
12 
14 
15 using namespace reco;
16 
18  public:
20  minPtLeadTrack_ = iConfig.getParameter<double>("MinPtLeadingTrack");
21  }
23  double discriminate(const CaloTauRef& theCaloTauRef) const override;
24 
25  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
26 
27  private:
29 };
30 
32 {
33  double leadTrackPt_ = -1;
34 
35  if( theCaloTauRef->leadTrack().isNonnull() )
36  {
37  leadTrackPt_ = theCaloTauRef->leadTrack()->pt();
38  }
39 
40  return ( (leadTrackPt_ > minPtLeadTrack_) ? 1. : 0. );
41 }
42 
43 void
45  // caloRecoTauDiscriminationByLeadingTrackPtCut
47  desc.add<double>("MinPtLeadingTrack", 5.0);
48  desc.add<edm::InputTag>("CaloTauProducer", edm::InputTag("caloRecoTauProducer"));
49  {
51  requireLeadTrackCalo.add<std::string>("BooleanOperator", "and");
52  {
54  leadTrack.add<double>("cut");
55  leadTrack.add<edm::InputTag>("Producer");
56  requireLeadTrackCalo.add<edm::ParameterSetDescription>("leadTrack", leadTrack);
57  }
58  desc.add<edm::ParameterSetDescription>("Prediscriminants", requireLeadTrackCalo);
59  }
60  descriptions.add("caloRecoTauDiscriminationByLeadingTrackPtCut", desc);
61 }
62 
64 
65 /*
66  edm::Handle<CaloTauCollection> theCaloTauCollection;
67  iEvent.getByLabel(CaloTauProducer_,theCaloTauCollection);
68 
69  double theleadTrackPtCutDiscriminator = 0.;
70  auto theCaloTauDiscriminatorByLeadingTrackPtCut = std::make_unique<CaloTauDiscriminator>(CaloTauRefProd(theCaloTauCollection));
71 
72  //loop over the CaloTau candidates
73  for(size_t iCaloTau=0;iCaloTau<theCaloTauCollection->size();++iCaloTau) {
74  CaloTauRef theCaloTauRef(theCaloTauCollection,iCaloTau);
75  CaloTau theCaloTau=*theCaloTauRef;
76 
77  // fill the AssociationVector object
78  if (!theCaloTau.leadTrack())
79  theleadTrackPtCutDiscriminator=0.;
80  else if(theCaloTau.leadTrack()->pt() > minPtLeadTrack_) theleadTrackPtCutDiscriminator=1.;
81 
82  theCaloTauDiscriminatorByLeadingTrackPtCut->setValue(iCaloTau,theleadTrackPtCutDiscriminator);
83  }
84 
85  iEvent.put(std::move(theCaloTauDiscriminatorByLeadingTrackPtCut));
86 
87 }
88 
89 */
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double discriminate(const CaloTauRef &theCaloTauRef) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix