CMS 3D CMS Logo

ConeIsolationAlgorithm.cc
Go to the documentation of this file.
2 using namespace std;
3 using namespace reco;
4 using namespace edm;
5 
7 
9  //FIXME: use unsigned int where needed
10  m_cutPixelHits = parameters.getParameter<int>("MinimumNumberOfPixelHits"); // not used
11  m_cutTotalHits = parameters.getParameter<int>("MinimumNumberOfHits");
12  m_cutMaxTIP = parameters.getParameter<double>("MaximumTransverseImpactParameter");
13  m_cutMinPt = parameters.getParameter<double>("MinimumTransverseMomentum");
14  m_cutMaxChiSquared = parameters.getParameter<double>("MaximumChiSquared");
15  dZ_vertex = parameters.getParameter<double>("DeltaZetTrackVertex"); // to be modified
16  useVertexConstrain_ = parameters.getParameter<bool>("useVertex");
17 
18  matching_cone = parameters.getParameter<double>("MatchingCone");
19  signal_cone = parameters.getParameter<double>("SignalCone");
20  isolation_cone = parameters.getParameter<double>("IsolationCone");
21  pt_min_isolation = parameters.getParameter<double>("MinimumTransverseMomentumInIsolationRing");
22  pt_min_leadTrack = parameters.getParameter<double>("MinimumTransverseMomentumLeadingTrack");
23  n_tracks_isolation_ring = parameters.getParameter<int>("MaximumNumberOfTracksIsolationRing");
24 
25  useFixedSizeCone = parameters.getParameter<bool>("UseFixedSizeCone");
26  variableConeParameter = parameters.getParameter<double>("VariableConeParameter");
27  variableMaxCone = parameters.getParameter<double>("VariableMaxCone");
28  variableMinCone = parameters.getParameter<double>("VariableMinCone");
29 }
30 
32  desc.add<int>("MinimumNumberOfPixelHits", 2);
33  desc.add<int>("MinimumNumberOfHits", 8);
34  desc.add<double>("MaximumTransverseImpactParameter", 0.03);
35  desc.add<double>("MinimumTransverseMomentum", 1.0);
36  desc.add<double>("MaximumChiSquared", 100.0);
37  desc.add<double>("DeltaZetTrackVertex", 0.2);
38  desc.add<bool>("useVertex", true);
39  desc.add<double>("MatchingCone", 0.1);
40  desc.add<double>("SignalCone", 0.07);
41  desc.add<double>("IsolationCone", 0.45);
42  desc.add<double>("MinimumTransverseMomentumInIsolationRing", 0.0);
43  desc.add<double>("MinimumTransverseMomentumLeadingTrack", 6.0);
44  desc.add<int>("MaximumNumberOfTracksIsolationRing", 0);
45  desc.add<bool>("UseFixedSizeCone", true);
46  desc.add<double>("VariableConeParameter", 3.5);
47  desc.add<double>("VariableMaxCone", 0.17);
48  desc.add<double>("VariableMinCone", 0.05);
49 }
50 
51 pair<float, IsolatedTauTagInfo> ConeIsolationAlgorithm::tag(const JetTracksAssociationRef& jetTracks,
52  const Vertex& pv) {
55 
56  // Selection of the Tracks
57  float z_pv = pv.z();
58  for (auto&& track : tracks) {
59  if ((track)->pt() > m_cutMinPt && (track)->normalizedChi2() < m_cutMaxChiSquared &&
60  fabs((track)->dxy(pv.position())) < m_cutMaxTIP && (track)->recHitsSize() >= (unsigned int)m_cutTotalHits &&
61  (track)->hitPattern().numberOfValidPixelHits() >= m_cutPixelHits) {
62  if (useVertexConstrain_ && z_pv > -500.) {
63  if (fabs((track)->dz(pv.position())) < dZ_vertex)
64  myTracks.push_back(track);
65  } else
66  myTracks.push_back(track);
67  }
68  }
69  IsolatedTauTagInfo resultExtended(myTracks, jetTracks);
70 
71  double r_sigCone = signal_cone;
72  double energyJet = jetTracks->first->energy();
73  if (not useFixedSizeCone) {
74  r_sigCone = std::min(variableMaxCone, variableConeParameter / energyJet);
75  r_sigCone = std::max((double)r_sigCone, variableMinCone);
76  }
77 
78  // now I can use it for the discriminator;
79  math::XYZVector jetDir(jetTracks->first->px(), jetTracks->first->py(), jetTracks->first->pz());
80  float discriminator = 0.;
81  if (useVertexConstrain_) {
82  // In this case all the selected tracks comes from the same vertex, so no need to pass the dZ_vertex requirement to the discriminator
83  const TrackRef myLeadTk = resultExtended.leadingSignalTrack(matching_cone, pt_min_leadTrack);
84  resultExtended.setLeadingTrack(myLeadTk);
85  discriminator = resultExtended.discriminator(
86  jetDir, matching_cone, r_sigCone, isolation_cone, pt_min_leadTrack, pt_min_isolation, n_tracks_isolation_ring);
87  resultExtended.setDiscriminator(discriminator);
88  } else {
89  // In this case the dZ_vertex is used to associate the tracks to the Z_imp parameter of the Leading Track
90  const TrackRef myLeadTk = resultExtended.leadingSignalTrack(matching_cone, pt_min_leadTrack);
91  resultExtended.setLeadingTrack(myLeadTk);
92  discriminator = resultExtended.discriminator(jetDir,
93  matching_cone,
94  r_sigCone,
95  isolation_cone,
96  pt_min_leadTrack,
97  pt_min_isolation,
98  n_tracks_isolation_ring,
99  dZ_vertex);
100  resultExtended.setDiscriminator(discriminator);
101  }
102 
103  return std::make_pair(discriminator, resultExtended);
104 }
static void fillDescription(edm::ParameterSetDescription &desc)
void setDiscriminator(double discriminator)
const TrackRef leadingSignalTrack() const
def pv(vc)
Definition: MetAnalyzer.py:7
void setLeadingTrack(const TrackRef)
std::pair< float, reco::IsolatedTauTagInfo > tag(const reco::JetTracksAssociationRef &jetTracks, const reco::Vertex &pv)
auto const & tracks
cannot be loose
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
fixed size matrix
HLT enums.
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67