CMS 3D CMS Logo

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

Public Member Functions

double discriminate (const PFTauRef &pfTau) override
 
 PFRecoTauDiscriminationAgainstElectron (const edm::ParameterSet &iConfig)
 
 ~PFRecoTauDiscriminationAgainstElectron ()
 
- 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 ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool isInEcalCrack (double) const
 

Private Attributes

bool applyCut_bremCombined_
 
bool applyCut_bremsRecoveryEOverPLead_
 
bool applyCut_ecalCrack_
 
bool applyCut_electronPreID_
 
bool applyCut_electronPreID_2D_
 
bool applyCut_emFraction_
 
bool applyCut_EOverPLead_
 
bool applyCut_hcal3x3OverPLead_
 
bool applyCut_hcalMaxOverPLead_
 
bool applyCut_hcalTotOverPLead_
 
bool applyCut_PFElectronMVA_
 
double bremCombined_fraction_
 
double bremCombined_maxHOP_
 
double bremCombined_minMass_
 
double bremCombined_stripSize_
 
double bremsRecoveryEOverPLead_maxValue_
 
double bremsRecoveryEOverPLead_minValue_
 
double elecPreID0_EOverPLead_maxValue_
 
double elecPreID0_HOverPLead_minValue_
 
double elecPreID1_EOverPLead_maxValue_
 
double elecPreID1_HOverPLead_minValue_
 
double emFraction_maxValue_
 
double EOverPLead_maxValue_
 
double EOverPLead_minValue_
 
double hcal3x3OverPLead_minValue_
 
double hcalMaxOverPLead_minValue_
 
double hcalTotOverPLead_minValue_
 
double pfelectronMVA_maxValue_
 
edm::InputTag PFTauProducer_
 

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
 
- 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::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::EDGetTokenT< TauCollectionTau_token
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 12 of file PFRecoTauDiscriminationAgainstElectron.cc.

Constructor & Destructor Documentation

PFRecoTauDiscriminationAgainstElectron::PFRecoTauDiscriminationAgainstElectron ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 14 of file PFRecoTauDiscriminationAgainstElectron.cc.

References edm::ParameterSet::getParameter().

15 
16  emFraction_maxValue_ = iConfig.getParameter<double>("EmFraction_maxValue");
17  applyCut_emFraction_ = iConfig.getParameter<bool>("ApplyCut_EmFraction");
18  hcalTotOverPLead_minValue_ = iConfig.getParameter<double>("HcalTotOverPLead_minValue");
19  applyCut_hcalTotOverPLead_ = iConfig.getParameter<bool>("ApplyCut_HcalTotOverPLead");
20  hcalMaxOverPLead_minValue_ = iConfig.getParameter<double>("HcalMaxOverPLead_minValue");
21  applyCut_hcalMaxOverPLead_ = iConfig.getParameter<bool>("ApplyCut_HcalMaxOverPLead");
22  hcal3x3OverPLead_minValue_ = iConfig.getParameter<double>("Hcal3x3OverPLead_minValue");
23 
24  applyCut_hcal3x3OverPLead_ = iConfig.getParameter<bool>("ApplyCut_Hcal3x3OverPLead");
25  EOverPLead_minValue_ = iConfig.getParameter<double>("EOverPLead_minValue");
26  EOverPLead_maxValue_ = iConfig.getParameter<double>("EOverPLead_maxValue");
27  applyCut_EOverPLead_ = iConfig.getParameter<bool>("ApplyCut_EOverPLead");
28  bremsRecoveryEOverPLead_minValue_ = iConfig.getParameter<double>("BremsRecoveryEOverPLead_minValue");
29  bremsRecoveryEOverPLead_maxValue_ = iConfig.getParameter<double>("BremsRecoveryEOverPLead_maxValue");
30 
31  applyCut_bremsRecoveryEOverPLead_ = iConfig.getParameter<bool>("ApplyCut_BremsRecoveryEOverPLead");
32 
33  applyCut_electronPreID_ = iConfig.getParameter<bool>("ApplyCut_ElectronPreID");
34 
35  applyCut_electronPreID_2D_ = iConfig.getParameter<bool>("ApplyCut_ElectronPreID_2D");
36 
37  elecPreID0_EOverPLead_maxValue_ = iConfig.getParameter<double>("ElecPreID0_EOverPLead_maxValue");
38  elecPreID0_HOverPLead_minValue_ = iConfig.getParameter<double>("ElecPreID0_HOverPLead_minValue");
39  elecPreID1_EOverPLead_maxValue_ = iConfig.getParameter<double>("ElecPreID1_EOverPLead_maxValue");
40  elecPreID1_HOverPLead_minValue_ = iConfig.getParameter<double>("ElecPreID1_HOverPLead_minValue");
41 
42 
43  applyCut_PFElectronMVA_ = iConfig.getParameter<bool>("ApplyCut_PFElectronMVA");
44  pfelectronMVA_maxValue_ = iConfig.getParameter<double>("PFElectronMVA_maxValue");
45 
46 
47 
48  applyCut_ecalCrack_ = iConfig.getParameter<bool>("ApplyCut_EcalCrackCut");
49 
50  applyCut_bremCombined_ = iConfig.getParameter<bool>("ApplyCut_BremCombined");
51  bremCombined_fraction_ = iConfig.getParameter<double>("BremCombined_Fraction");
52  bremCombined_maxHOP_ = iConfig.getParameter<double>("BremCombined_HOP");
53  bremCombined_minMass_ = iConfig.getParameter<double>("BremCombined_Mass");
54  bremCombined_stripSize_ = iConfig.getParameter<double>("BremCombined_StripSize");
55 
56  }
T getParameter(std::string const &) const
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
PFRecoTauDiscriminationAgainstElectron::~PFRecoTauDiscriminationAgainstElectron ( )
inline

Definition at line 60 of file PFRecoTauDiscriminationAgainstElectron.cc.

60 {}

Member Function Documentation

double PFRecoTauDiscriminationAgainstElectron::discriminate ( const PFTauRef pfTau)
override

Definition at line 103 of file PFRecoTauDiscriminationAgainstElectron.cc.

References edm::Ref< C, T, F >::isNonnull(), and edm::Ref< C, T, F >::isNull().

104 {
105 
106 
107 
108  // ensure tau has at least one charged object
109 
110  if( (*thePFTauRef).leadPFChargedHadrCand().isNull() )
111  {
112  return 0.;
113  } else
114  {
115  // Check if track goes to Ecal crack
116  TrackRef myleadTk;
117  myleadTk=(*thePFTauRef).leadPFChargedHadrCand()->trackRef();
118  math::XYZPointF myleadTkEcalPos = (*thePFTauRef).leadPFChargedHadrCand()->positionAtECALEntrance();
119  if(myleadTk.isNonnull())
120  {
121  if (applyCut_ecalCrack_ && isInEcalCrack(myleadTkEcalPos.eta()))
122  {
123  return 0.;
124  }
125  }
126  }
127 
128  bool decision = false;
129  bool emfPass = true, htotPass = true, hmaxPass = true;
130  bool h3x3Pass = true, estripPass = true, erecovPass = true;
131  bool epreidPass = true, epreid2DPass = true;
132  bool mvaPass = true, bremCombinedPass = true;
133 
134  if (applyCut_emFraction_) {
135  if ((*thePFTauRef).emFraction() > emFraction_maxValue_) {
136  emfPass = false;
137  }
138  }
140  if ((*thePFTauRef).hcalTotOverPLead() < hcalTotOverPLead_minValue_) {
141  htotPass = false;
142  }
143  }
145  if ((*thePFTauRef).hcalMaxOverPLead() < hcalMaxOverPLead_minValue_) {
146  hmaxPass = false;
147  }
148  }
150  if ((*thePFTauRef).hcal3x3OverPLead() < hcal3x3OverPLead_minValue_) {
151  h3x3Pass = false;
152  }
153  }
154  if (applyCut_EOverPLead_) {
155  if ((*thePFTauRef).ecalStripSumEOverPLead() > EOverPLead_minValue_ &&
156  (*thePFTauRef).ecalStripSumEOverPLead() < EOverPLead_maxValue_) {
157  estripPass = false;
158  } else {
159  estripPass = true;
160  }
161  }
163  if ((*thePFTauRef).bremsRecoveryEOverPLead() > bremsRecoveryEOverPLead_minValue_ &&
164  (*thePFTauRef).bremsRecoveryEOverPLead() < bremsRecoveryEOverPLead_maxValue_) {
165  erecovPass = false;
166  } else {
167  erecovPass = true;
168  }
169  }
171  if ((*thePFTauRef).electronPreIDDecision()) {
172  epreidPass = false;
173  } else {
174  epreidPass = true;
175  }
176  }
177 
179  if (
180  ((*thePFTauRef).electronPreIDDecision() &&
181  ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID1_EOverPLead_maxValue_ ||
182  (*thePFTauRef).hcal3x3OverPLead() > elecPreID1_HOverPLead_minValue_))
183  ||
184  (!(*thePFTauRef).electronPreIDDecision() &&
185  ((*thePFTauRef).ecalStripSumEOverPLead() < elecPreID0_EOverPLead_maxValue_ ||
186  (*thePFTauRef).hcal3x3OverPLead() > elecPreID0_HOverPLead_minValue_))
187  ){
188  epreid2DPass = true;
189  } else {
190  epreid2DPass = false;
191  }
192  }
193 
195  if ((*thePFTauRef).electronPreIDOutput()>pfelectronMVA_maxValue_) {
196  mvaPass = false;
197  }
198  }
200  if (thePFTauRef->leadPFChargedHadrCand()->trackRef().isNull()) {
201  // No KF track found
202  return 0;
203  }
204  if(thePFTauRef->signalPFChargedHadrCands().size()==1 && thePFTauRef->signalPFGammaCands().size()==0) {
205  if(thePFTauRef->leadPFChargedHadrCand()->hcalEnergy()/thePFTauRef->leadPFChargedHadrCand()->trackRef()->p()<bremCombined_maxHOP_)
206  bremCombinedPass = false;
207  }
208  else if(thePFTauRef->signalPFChargedHadrCands().size()==1 && thePFTauRef->signalPFGammaCands().size()>0) {
209  //calculate the brem ratio energy
210  float bremEnergy=0.;
211  float emEnergy=0.;
212  for(unsigned int Nc = 0 ;Nc < thePFTauRef->signalPFGammaCands().size();++Nc)
213  {
214  PFCandidatePtr cand = thePFTauRef->signalPFGammaCands().at(Nc);
215  if(fabs(thePFTauRef->leadPFChargedHadrCand()->trackRef()->eta()-cand->eta())<bremCombined_stripSize_)
216  bremEnergy+=cand->energy();
217  emEnergy+=cand->energy();
218  }
219  if(bremEnergy/emEnergy>bremCombined_fraction_&&thePFTauRef->mass()<bremCombined_minMass_)
220  bremCombinedPass = false;
221 
222  }
223  }
224 
225  decision = emfPass && htotPass && hmaxPass &&
226  h3x3Pass && estripPass && erecovPass && epreidPass && epreid2DPass && mvaPass &&bremCombinedPass;
227 
228  return (decision ? 1. : 0.);
229 }
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
bool PFRecoTauDiscriminationAgainstElectron::isInEcalCrack ( double  eta) const
private

Definition at line 232 of file PFRecoTauDiscriminationAgainstElectron.cc.

233 {
234  eta = fabs(eta);
235  return (eta < 0.018 ||
236  (eta>0.423 && eta<0.461) ||
237  (eta>0.770 && eta<0.806) ||
238  (eta>1.127 && eta<1.163) ||
239  (eta>1.460 && eta<1.558));
240 }
T eta() const

Member Data Documentation

bool PFRecoTauDiscriminationAgainstElectron::applyCut_bremCombined_
private

Definition at line 93 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_bremsRecoveryEOverPLead_
private

Definition at line 77 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_ecalCrack_
private

Definition at line 91 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_electronPreID_
private

Definition at line 81 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_electronPreID_2D_
private

Definition at line 83 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_emFraction_
private

Definition at line 65 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_EOverPLead_
private

Definition at line 74 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_hcal3x3OverPLead_
private

Definition at line 71 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_hcalMaxOverPLead_
private

Definition at line 69 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_hcalTotOverPLead_
private

Definition at line 67 of file PFRecoTauDiscriminationAgainstElectron.cc.

bool PFRecoTauDiscriminationAgainstElectron::applyCut_PFElectronMVA_
private

Definition at line 89 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremCombined_fraction_
private

Definition at line 94 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremCombined_maxHOP_
private

Definition at line 95 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremCombined_minMass_
private

Definition at line 96 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremCombined_stripSize_
private

Definition at line 97 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremsRecoveryEOverPLead_maxValue_
private

Definition at line 79 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::bremsRecoveryEOverPLead_minValue_
private

Definition at line 78 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::elecPreID0_EOverPLead_maxValue_
private

Definition at line 84 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::elecPreID0_HOverPLead_minValue_
private

Definition at line 85 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::elecPreID1_EOverPLead_maxValue_
private

Definition at line 86 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::elecPreID1_HOverPLead_minValue_
private

Definition at line 87 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::emFraction_maxValue_
private

Definition at line 66 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::EOverPLead_maxValue_
private

Definition at line 76 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::EOverPLead_minValue_
private

Definition at line 75 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::hcal3x3OverPLead_minValue_
private

Definition at line 72 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::hcalMaxOverPLead_minValue_
private

Definition at line 70 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::hcalTotOverPLead_minValue_
private

Definition at line 68 of file PFRecoTauDiscriminationAgainstElectron.cc.

double PFRecoTauDiscriminationAgainstElectron::pfelectronMVA_maxValue_
private

Definition at line 90 of file PFRecoTauDiscriminationAgainstElectron.cc.

edm::InputTag PFRecoTauDiscriminationAgainstElectron::PFTauProducer_
private

Definition at line 64 of file PFRecoTauDiscriminationAgainstElectron.cc.