CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedSVComputer.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 
5 
7 {
8  edm::ParameterSet psetCopy(pset);
9  psetCopy.addParameter<double>("jetDeltaRMax", 99999.0);
10  return psetCopy;
11 }
12 
14  trackFlip(params.getParameter<bool>("trackFlip")),
15  vertexFlip(params.getParameter<bool>("vertexFlip")),
16  charmCut(params.getParameter<double>("charmCut")),
17  sortCriterium(TrackSorting::getCriterium(params.getParameter<std::string>("trackSort"))),
18  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
19  trackNoDeltaRSelector(dropDeltaR(params.getParameter<edm::ParameterSet>("trackSelection"))),
20  trackPseudoSelector(params.getParameter<edm::ParameterSet>("trackPseudoSelection")),
21  pseudoMultiplicityMin(params.getParameter<unsigned int>("pseudoMultiplicityMin")),
22  trackMultiplicityMin(params.getParameter<unsigned int>("trackMultiplicityMin")),
23  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
24  useTrackWeights(params.getParameter<bool>("useTrackWeights")),
25  vertexMassCorrection(params.getParameter<bool>("correctVertexMass")),
26  pseudoVertexV0Filter(params.getParameter<edm::ParameterSet>("pseudoVertexV0Filter")),
27  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter"))
28 {
29 
30 }
31 
32 inline double CombinedSVComputer::flipValue(double value, bool vertex) const
33 {
34  return (vertex ? vertexFlip : trackFlip) ? -value : value;
35 }
36 
38  int size, bool vertex) const
39 {
40  IterationRange range;
41  if (vertex ? vertexFlip : trackFlip) {
42  range.begin = size - 1;
43  range.end = -1;
44  range.increment = -1;
45  } else {
46  range.begin = 0;
47  range.end = size;
48  range.increment = +1;
49  }
50 
51  return range;
52 }
53 
54 const btag::TrackIPData &
57  const reco::Jet &jet,
58  const GlobalPoint &pv) const
59 {
61  trackIPTagInfo.selectedTracks();
62  const std::vector<btag::TrackIPData> &ipData =
63  trackIPTagInfo.impactParameterData();
64  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
65 
66  IterationRange range = flipIterate(indices.size(), false);
67  TrackKinematics kin;
68  range_for(i, range) {
69  std::size_t idx = indices[i];
70  const btag::TrackIPData &data = ipData[idx];
71  const Track &track = *tracks[idx]->bestTrack();
72 
73  if (!trackNoDeltaRSelector(track, data, jet, pv))
74  continue;
75 
76  kin.add(track);
77  if (kin.vectorSum().M() > charmCut)
78  return data;
79  }
80 
81  static const btag::TrackIPData dummy = {
82  GlobalPoint(),
83  GlobalPoint(),
84  Measurement1D(-1.0, 1.0),
85  Measurement1D(-1.0, 1.0),
86  Measurement1D(-1.0, 1.0),
87  Measurement1D(-1.0, 1.0),
88  0.
89  };
90  return dummy;
91 }
92 
93 const btag::TrackIPData &
95  const btag::SortCriteria sort,
96  const reco::Jet &jet,
97  const GlobalPoint &pv) const
98 {
99  const edm::RefVector<TrackCollection> &tracks =
100  trackIPTagInfo.selectedTracks();
101  const std::vector<btag::TrackIPData> &ipData =
102  trackIPTagInfo.impactParameterData();
103  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
104 
105  IterationRange range = flipIterate(indices.size(), false);
106  TrackKinematics kin;
107  range_for(i, range) {
108  std::size_t idx = indices[i];
109  const btag::TrackIPData &data = ipData[idx];
110  const Track &track = *tracks[idx];
111 
112  if (!trackNoDeltaRSelector(track, data, jet, pv))
113  continue;
114 
115  kin.add(track);
116  if (kin.vectorSum().M() > charmCut)
117  return data;
118  }
119 
120  static const btag::TrackIPData dummy = {
121  GlobalPoint(),
122  GlobalPoint(),
123  Measurement1D(-1.0, 1.0),
124  Measurement1D(-1.0, 1.0),
125  Measurement1D(-1.0, 1.0),
126  Measurement1D(-1.0, 1.0),
127  0.
128  };
129  return dummy;
130 }
131 
132 
135  const SecondaryVertexTagInfo &svInfo) const
136 {
137  using namespace ROOT::Math;
138 
139  edm::RefToBase<Jet> jet = ipInfo.jet();
140  math::XYZVector jetDir = jet->momentum().Unit();
141  TaggingVariableList vars;
142 
143  TrackKinematics vertexKinematics;
144 
145  double vtx_track_ptSum = 0.;
146  double vtx_track_ESum = 0.;
147 
148  // the following is specific depending on the type of vertex
149  int vtx = -1;
150  unsigned int numberofvertextracks = 0;
151 
152  IterationRange range = flipIterate(svInfo.nVertices(), true);
153  range_for(i, range) {
154 
155  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).nTracks();
156 
157  const Vertex &vertex = svInfo.secondaryVertex(i);
158  bool hasRefittedTracks = vertex.hasRefittedTracks();
159  for(reco::Vertex::trackRef_iterator track = vertex.tracks_begin(); track != vertex.tracks_end(); track++) {
160  double w = vertex.trackWeight(*track);
161  if (w < minTrackWeight)
162  continue;
163  if (hasRefittedTracks) {
164  const Track actualTrack = vertex.refittedTrack(*track);
165  vertexKinematics.add(actualTrack, w);
166  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir,actualTrack.momentum()), true);
167  if(vtx < 0) // calculate this only for the first vertex
168  {
169  vtx_track_ptSum += std::sqrt(actualTrack.momentum().Perp2());
170  vtx_track_ESum += std::sqrt(actualTrack.momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
171  }
172  } else {
173  vertexKinematics.add(**track, w);
174  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir,(*track)->momentum()), true);
175  if(vtx < 0) // calculate this only for the first vertex
176  {
177  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
178  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
179  }
180  }
181  }
182 
183  if (vtx < 0) vtx = i;
184  }
185  if(vtx>=0){
186  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
187  vars.insert(btau::vertexFitProb,(svInfo.secondaryVertex(vtx)).normalizedChi2(), true);
188  }
189 
190  // after we collected vertex information we let the common code complete the job
191  fillCommonVariables(vars,vertexKinematics,ipInfo,svInfo,vtx_track_ptSum,vtx_track_ESum);
192 
193  vars.finalize();
194  return vars;
195 }
196 
199  const CandSecondaryVertexTagInfo &svInfo) const
200 {
201  using namespace ROOT::Math;
202 
203  edm::RefToBase<Jet> jet = ipInfo.jet();
204  math::XYZVector jetDir = jet->momentum().Unit();
205  TaggingVariableList vars;
206 
207  TrackKinematics vertexKinematics;
208 
209  double vtx_track_ptSum = 0.;
210  double vtx_track_ESum = 0.;
211 
212  // the following is specific depending on the type of vertex
213  int vtx = -1;
214  unsigned int numberofvertextracks = 0;
215 
216  IterationRange range = flipIterate(svInfo.nVertices(), true);
217  range_for(i, range) {
218 
219  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).numberOfSourceCandidatePtrs();
220 
221  const reco::VertexCompositePtrCandidate &vertex = svInfo.secondaryVertex(i);
222  const std::vector<CandidatePtr> & tracks = vertex.daughterPtrVector();
223  for(std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
224  vertexKinematics.add(*(*track)->bestTrack(), 1.0);
225  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir,(*track)->momentum()), true);
226  if(vtx < 0) // calculate this only for the first vertex
227  {
228  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
229  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
230  }
231  }
232 
233  if (vtx < 0) vtx = i;
234  }
235  if(vtx>=0){
236  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
237  vars.insert(btau::vertexFitProb,(svInfo.secondaryVertex(vtx)).vertexNormalizedChi2(), true);
238  }
239 
240  // after we collected vertex information we let the common code complete the job
241  fillCommonVariables(vars,vertexKinematics,ipInfo,svInfo,vtx_track_ptSum,vtx_track_ESum);
242 
243  vars.finalize();
244  return vars;
245 }
246 
const double piPlus
Definition: ParticleMasses.h:9
int i
Definition: DBlmapReader.cc:9
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
const double w
Definition: UKUtility.cc:23
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
const VTX & secondaryVertex(unsigned int index) const
Track refittedTrack(const TrackBaseRef &track) const
Base class for all types of Jets.
Definition: Jet.h:20
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
reco::TrackSelector trackNoDeltaRSelector
bool hasRefittedTracks() const
Checks whether refitted tracks are stored.
Definition: Vertex.h:134
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual Vector momentum() const
spatial momentum vector
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
static edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset)
virtual reco::TaggingVariableList operator()(const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
CombinedSVComputer(const edm::ParameterSet &params)
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:638
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
T sqrt(T t)
Definition: SSEVec.h:48
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:238
IterationRange flipIterate(int size, bool vertex) const
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
#define range_for(i, x)
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double flipValue(double value, bool vertex) const
edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset) const
const reco::btag::TrackIPData & threshTrack(const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const daughters & daughterPtrVector() const
references to daughtes
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
Container input_container
Definition: IPTagInfo.h:53
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
tuple size
Write out results.
tuple trackSelector
Tracks selection.
Definition: valSkim_cff.py:4
tuple useTrackWeights
Definition: alignBH_cfg.py:24