CMS 3D CMS Logo

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