CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloRecoTauDiscriminationAgainstElectron.cc
Go to the documentation of this file.
2 
6 
7 /* class CaloRecoTauDiscriminationAgainstElectron
8  * created : Feb 17 2008,
9  * revised : ,
10  * contributors : Konstantinos Petridis, Sebastien Greder,
11  * Maiko Takahashi, Alexandre Nikitenko (Imperial College, London),
12  * Evan Friis (UC Davis)
13  */
14 
15 
16 namespace {
17 using namespace reco;
18 class CaloRecoTauDiscriminationAgainstElectron final : public CaloTauDiscriminationProducerBase {
19  public:
20  explicit CaloRecoTauDiscriminationAgainstElectron(const edm::ParameterSet& iConfig):CaloTauDiscriminationProducerBase(iConfig){
21  CaloTauProducer_ = iConfig.getParameter<edm::InputTag>("CaloTauProducer");
22  leadTrack_HCAL3x3hitsEtSumOverPt_minvalue_ = iConfig.getParameter<double>("leadTrack_HCAL3x3hitsEtSumOverPt_minvalue");
23  ApplyCut_maxleadTrackHCAL3x3hottesthitDEta_ = iConfig.getParameter<bool>("ApplyCut_maxleadTrackHCAL3x3hottesthitDEta");
24  maxleadTrackHCAL3x3hottesthitDEta_ = iConfig.getParameter<double>("maxleadTrackHCAL3x3hottesthitDEta");
25  ApplyCut_leadTrackavoidsECALcrack_ = iConfig.getParameter<bool>("ApplyCut_leadTrackavoidsECALcrack");
26  }
27  ~CaloRecoTauDiscriminationAgainstElectron(){}
28  double discriminate(const CaloTauRef& theCaloTauRef) const override;
29  void beginEvent(const edm::Event& event, const edm::EventSetup& eventSetup) override;
30  private:
31  edm::ESHandle<MagneticField> theMagneticField;
32  edm::InputTag CaloTauProducer_;
33  double leadTrack_HCAL3x3hitsEtSumOverPt_minvalue_;
34  bool ApplyCut_maxleadTrackHCAL3x3hottesthitDEta_;
35  double maxleadTrackHCAL3x3hottesthitDEta_;
36  bool ApplyCut_leadTrackavoidsECALcrack_;
37 };
38 
39 void CaloRecoTauDiscriminationAgainstElectron::beginEvent(const edm::Event& event, const edm::EventSetup& eventSetup)
40 {
41  if (ApplyCut_leadTrackavoidsECALcrack_)
42  {
43  // get the magnetic field, if we need it
44  eventSetup.get<IdealMagneticFieldRecord>().get(theMagneticField);
45  }
46 }
47 
48 
49 double CaloRecoTauDiscriminationAgainstElectron::discriminate(const CaloTauRef& theCaloTauRef) const
50 {
51  if (ApplyCut_maxleadTrackHCAL3x3hottesthitDEta_){
52  // optional selection : ask for small |deta| between direction of propag. leading Track - ECAL inner surf. contact point and direction of highest Et hit among HCAL hits inside a 3x3 calo. tower matrix centered on direction of propag. leading Track - ECAL inner surf. contact point
53  if (edm::isNotFinite((*theCaloTauRef).leadTrackHCAL3x3hottesthitDEta()) || (*theCaloTauRef).leadTrackHCAL3x3hottesthitDEta()>maxleadTrackHCAL3x3hottesthitDEta_) return 0.;
54  }
55  if (ApplyCut_leadTrackavoidsECALcrack_){
56  // optional selection : ask that leading track - ECAL inner surface contact point does not fall inside any ECAL eta crack
57  math::XYZPoint thepropagleadTrackECALSurfContactPoint = TauTagTools::propagTrackECALSurfContactPoint(theMagneticField.product(),(*theCaloTauRef).leadTrack());
58  if(thepropagleadTrackECALSurfContactPoint.R()==0. ||
59  fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalA().second ||
60  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalB().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalB().second) ||
61  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalC().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalC().second) ||
62  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalD().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalD().second) ||
63  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalE().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalE().second))
64  {
65  return 0.;
66  }
67  }
68  if (edm::isNotFinite((*theCaloTauRef).leadTrackHCAL3x3hitsEtSum()))
69  {
70  return 0.;
71  } else
72  {
73  if ((*theCaloTauRef).leadTrackHCAL3x3hitsEtSum()/(*theCaloTauRef).leadTrack()->pt()<=leadTrack_HCAL3x3hitsEtSumOverPt_minvalue_) return 0.;
74  else return 1.;
75  }
76 }
77 
78  /*
79 void CaloRecoTauDiscriminationAgainstElectron::produce(edm::Event& iEvent,const edm::EventSetup& iEventSetup){
80  edm::Handle<CaloTauCollection> theCaloTauCollection;
81  iEvent.getByLabel(CaloTauProducer_,theCaloTauCollection);
82 
83  // fill the AssociationVector object
84  auto_ptr<CaloTauDiscriminator> theCaloTauDiscriminatorAgainstElectron(new CaloTauDiscriminator(CaloTauRefProd(theCaloTauCollection)));
85 
86  for(size_t iCaloTau=0;iCaloTau<theCaloTauCollection->size();++iCaloTau) {
87  CaloTauRef theCaloTauRef(theCaloTauCollection,iCaloTau);
88  if (!(*theCaloTauRef).leadTrack()){
89  theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,0);
90  continue;
91  }
92  if (ApplyCut_maxleadTrackHCAL3x3hottesthitDEta_){
93  // optional selection : ask for small |deta| between direction of propag. leading Track - ECAL inner surf. contact point and direction of highest Et hit among HCAL hits inside a 3x3 calo. tower matrix centered on direction of propag. leading Track - ECAL inner surf. contact point
94  if (edm::isNotFinite((*theCaloTauRef).leadTrackHCAL3x3hottesthitDEta()) || (*theCaloTauRef).leadTrackHCAL3x3hottesthitDEta()>maxleadTrackHCAL3x3hottesthitDEta_){
95  theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,0);
96  continue;
97  }
98  }
99  if (ApplyCut_leadTrackavoidsECALcrack_){
100  // optional selection : ask that leading track - ECAL inner surface contact point does not fall inside any ECAL eta crack
101  edm::ESHandle<MagneticField> theMagneticField;
102  iEventSetup.get<IdealMagneticFieldRecord>().get(theMagneticField);
103  math::XYZPoint thepropagleadTrackECALSurfContactPoint=TauTagTools::propagTrackECALSurfContactPoint(theMagneticField.product(),(*theCaloTauRef).leadTrack());
104  if(thepropagleadTrackECALSurfContactPoint.R()==0. ||
105  fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalA().second ||
106  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalB().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalB().second) ||
107  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalC().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalC().second) ||
108  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalD().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalD().second) ||
109  (fabs(thepropagleadTrackECALSurfContactPoint.eta())>ECALBounds::crack_absEtaIntervalE().first && fabs(thepropagleadTrackECALSurfContactPoint.eta())<ECALBounds::crack_absEtaIntervalE().second)
110  ){
111  theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,0);
112  continue;
113  }
114  }
115  if (edm::isNotFinite((*theCaloTauRef).leadTrackHCAL3x3hitsEtSum())){
116  theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,0);
117  }else{
118  if ((*theCaloTauRef).leadTrackHCAL3x3hitsEtSum()/(*theCaloTauRef).leadTrack()->pt()<=leadTrack_HCAL3x3hitsEtSumOverPt_minvalue_) theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,0);
119  else theCaloTauDiscriminatorAgainstElectron->setValue(iCaloTau,1);
120  }
121  }
122 
123  iEvent.put(theCaloTauDiscriminatorAgainstElectron);
124 }
125 */
126 
127 }
128 DEFINE_FWK_MODULE(CaloRecoTauDiscriminationAgainstElectron);
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
math::XYZPoint propagTrackECALSurfContactPoint(const MagneticField *, reco::TrackRef)
Definition: TauTagTools.cc:184
static std::pair< float, float > crack_absEtaIntervalA()
Definition: ECALBounds.h:30
static std::pair< float, float > crack_absEtaIntervalB()
Definition: ECALBounds.h:31
static std::pair< float, float > crack_absEtaIntervalE()
Definition: ECALBounds.h:34
bool isNotFinite(T x)
Definition: isFinite.h:10
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static std::pair< float, float > crack_absEtaIntervalC()
Definition: ECALBounds.h:32
static std::pair< float, float > crack_absEtaIntervalD()
Definition: ECALBounds.h:33
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const T & get() const
Definition: EventSetup.h:55