CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes
PFRecoTauDiscriminationByHPSSelection Class Reference
Inheritance diagram for PFRecoTauDiscriminationByHPSSelection:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  DecayModeCuts
 

Public Member Functions

double discriminate (const reco::PFTauRef &)
 
 PFRecoTauDiscriminationByHPSSelection (const edm::ParameterSet &)
 
 ~PFRecoTauDiscriminationByHPSSelection ()
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual void beginEvent (const edm::Event &evt, const edm::EventSetup &evtSetup)
 
virtual double discriminate (const TauRef &tau)=0
 
virtual void endEvent (edm::Event &evt)
 
void produce (edm::Event &, const edm::EventSetup &)
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
virtual ~TauDiscriminationProducerBase ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::map< IntPair,
DecayModeCuts
DecayModeCutMap
 
typedef std::pair< double, double > DoublePair
 
typedef std::pair< unsigned
int, unsigned int > 
IntPair
 
typedef StringObjectFunction
< reco::PFTau
TauFunc
 

Private Attributes

DecayModeCutMap decayModeCuts_
 
double matchingCone_
 
double minPt_
 
TauFunc signalConeFun_
 

Additional Inherited Members

- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
typedef std::vector< TauType > TauCollection
 
typedef edm::Ref< TauCollectionTauRef
 
typedef edm::RefProd
< TauCollection
TauRefProd
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 19 of file PFRecoTauDiscriminationByHPSSelection.cc.

Member Typedef Documentation

Definition at line 44 of file PFRecoTauDiscriminationByHPSSelection.cc.

typedef std::pair<double, double> PFRecoTauDiscriminationByHPSSelection::DoublePair
private

Definition at line 43 of file PFRecoTauDiscriminationByHPSSelection.cc.

typedef std::pair<unsigned int, unsigned int> PFRecoTauDiscriminationByHPSSelection::IntPair
private

Definition at line 42 of file PFRecoTauDiscriminationByHPSSelection.cc.

Definition at line 27 of file PFRecoTauDiscriminationByHPSSelection.cc.

Constructor & Destructor Documentation

PFRecoTauDiscriminationByHPSSelection::PFRecoTauDiscriminationByHPSSelection ( const edm::ParameterSet pset)
explicit

Definition at line 52 of file PFRecoTauDiscriminationByHPSSelection.cc.

References PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::assumeStripMass_, hpstanc_transforms::cuts, decayModeCuts_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), matchingCone_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxPi0Mass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minPi0Mass_, minPt_, and AlCaHLTBitMon_QueryRunRegistry::string.

54  signalConeFun_(pset.getParameter<std::string>("coneSizeFormula"))
55 {
56  // Get the matchign cut
57  matchingCone_ = pset.getParameter<double>("matchingCone");
58  minPt_ = pset.getParameter<double>("minTauPt");
59  // Get the mass cuts for each decay mode
60  typedef std::vector<edm::ParameterSet> VPSet;
61  const VPSet& decayModes = pset.getParameter<VPSet>("decayModes");
62  BOOST_FOREACH(const edm::ParameterSet &dm, decayModes) {
63  // The mass window(s)
64  DecayModeCuts cuts;
65  cuts.minMass_ = dm.getParameter<double>("minMass");
66  cuts.maxMass_ = new TauFunc(dm.getParameter<std::string>("maxMass"));
67  if (dm.exists("minPi0Mass")) {
68  cuts.minPi0Mass_ = dm.getParameter<double>("minPi0Mass");
69  cuts.maxPi0Mass_ = dm.getParameter<double>("maxPi0Mass");
70  } else {
71  cuts.minPi0Mass_ = -1.e3;
72  cuts.maxPi0Mass_ = 1.e9;
73  }
74  if (dm.exists("assumeStripMass")) {
75  cuts.assumeStripMass_ = dm.getParameter<double>("assumeStripMass");
76  } else {
77  cuts.assumeStripMass_ = -1.0;
78  }
79  decayModeCuts_.insert(std::make_pair(
80  // The decay mode as a key
81  std::make_pair(
82  dm.getParameter<uint32_t>("nCharged"),
83  dm.getParameter<uint32_t>("nPiZeros")),
84  cuts
85  ));
86  }
87 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
PFRecoTauDiscriminationByHPSSelection::~PFRecoTauDiscriminationByHPSSelection ( )

Definition at line 89 of file PFRecoTauDiscriminationByHPSSelection.cc.

References decayModeCuts_.

90 {
91  for ( DecayModeCutMap::iterator it = decayModeCuts_.begin();
92  it != decayModeCuts_.end(); ++it ) {
93  delete it->second.maxMass_;
94  }
95 }

Member Function Documentation

double PFRecoTauDiscriminationByHPSSelection::discriminate ( const reco::PFTauRef tau)

Definition at line 98 of file PFRecoTauDiscriminationByHPSSelection.cc.

References PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::assumeStripMass_, decayModeCuts_, deltaR(), matchingCone_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxPi0Mass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minPi0Mass_, minPt_, reco::LeafCandidate::p4(), and signalConeFun_.

99 {
100  //std::cout << "<PFRecoTauDiscriminationByHPSSelection::discriminate>:" << std::endl;
101 
102  // Check if we pass the min pt
103  if (tau->pt() < minPt_)
104  return 0.0;
105 
106  // See if we select this decay mode
107  DecayModeCutMap::const_iterator massWindowIter =
108  decayModeCuts_.find(std::make_pair(tau->signalPFChargedHadrCands().size(),
109  tau->signalPiZeroCandidates().size()));
110  // Check if decay mode is supported
111  if (massWindowIter == decayModeCuts_.end()) {
112  return 0.0;
113  }
114  const DecayModeCuts& massWindow = massWindowIter->second;
115 
116  math::XYZTLorentzVector tauP4 = tau->p4();
117  //std::cout << "tau: Pt = " << tauP4.pt() << ", eta = " << tauP4.eta() << ", phi = " << tauP4.phi() << ", mass = " << tauP4.mass() << std::endl;
118  // Find the total pizero p4
120  BOOST_FOREACH(const reco::RecoTauPiZero& cand,
121  tau->signalPiZeroCandidates()){
122  math::XYZTLorentzVector candP4 = cand.p4();
123  stripsP4 += candP4;
124  }
125 
126  // Apply strip mass assumption corrections
127  if (massWindow.assumeStripMass_ >= 0) {
128  BOOST_FOREACH(const reco::RecoTauPiZero& cand,
129  tau->signalPiZeroCandidates()){
130  math::XYZTLorentzVector uncorrected = cand.p4();
131  math::XYZTLorentzVector corrected =
132  applyMassConstraint(uncorrected, massWindow.assumeStripMass_);
133  math::XYZTLorentzVector correction = corrected - uncorrected;
134  tauP4 += correction;
135  stripsP4 += correction;
136  }
137  }
138  //std::cout << "strips: Pt = " << stripsP4.pt() << ", eta = " << stripsP4.eta() << ", phi = " << stripsP4.phi() << ", mass = " << stripsP4.mass() << std::endl;
139 
140  // Check if tau fails mass cut
141  double maxMass_value = (*massWindow.maxMass_)(*tau);
142  if (tauP4.M() > maxMass_value || tauP4.M() < massWindow.minMass_) {
143  return 0.0;
144  }
145 
146  // Check if it fails the pi 0 IM cut
147  if (stripsP4.M() > massWindow.maxPi0Mass_ ||
148  stripsP4.M() < massWindow.minPi0Mass_) {
149  return 0.0;
150  }
151 
152  // Check if tau passes matching cone cut
153  //std::cout << "dR(tau, jet) = " << deltaR(tauP4, tau->jetRef()->p4()) << std::endl;
154  if (deltaR(tauP4, tau->jetRef()->p4()) > matchingCone_) {
155  return 0.0;
156  }
157 
158  // Check if tau passes cone cut
159  double cone_size = signalConeFun_(*tau);
160  // Check if any charged objects fail the signal cone cut
161  BOOST_FOREACH(const reco::PFCandidateRef& cand,
162  tau->signalPFChargedHadrCands()) {
163  //std::cout << "dR(tau, signalPFChargedHadr) = " << deltaR(cand->p4(), tauP4) << std::endl;
164  if (deltaR(cand->p4(), tauP4) > cone_size)
165  return 0.0;
166  }
167  // Now check the pizeros
168  BOOST_FOREACH(const reco::RecoTauPiZero& cand,
169  tau->signalPiZeroCandidates()) {
170  //std::cout << "dR(tau, signalPiZero) = " << deltaR(cand.p4(), tauP4) << std::endl;
171  if (deltaR(cand.p4(), tauP4) > cone_size)
172  return 0.0;
173  }
174 
175  // Otherwise, we pass!
176  return 1.0;
177 }
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41

Member Data Documentation

DecayModeCutMap PFRecoTauDiscriminationByHPSSelection::decayModeCuts_
private
double PFRecoTauDiscriminationByHPSSelection::matchingCone_
private
double PFRecoTauDiscriminationByHPSSelection::minPt_
private
TauFunc PFRecoTauDiscriminationByHPSSelection::signalConeFun_
private

Definition at line 46 of file PFRecoTauDiscriminationByHPSSelection.cc.

Referenced by discriminate().