CMS 3D CMS Logo

CombinedSVComputer.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 
6  edm::ParameterSet psetCopy(pset);
7  psetCopy.addParameter<double>("jetDeltaRMax", 99999.0);
8  return psetCopy;
9 }
10 
12  : trackFlip(params.getParameter<bool>("trackFlip")),
13  vertexFlip(params.getParameter<bool>("vertexFlip")),
14  charmCut(params.getParameter<double>("charmCut")),
15  sortCriterium(TrackSorting::getCriterium(params.getParameter<std::string>("trackSort"))),
16  trackSelector(params.getParameter<edm::ParameterSet>("trackSelection")),
17  trackNoDeltaRSelector(dropDeltaR(params.getParameter<edm::ParameterSet>("trackSelection"))),
18  trackPseudoSelector(params.getParameter<edm::ParameterSet>("trackPseudoSelection")),
19  pseudoMultiplicityMin(params.getParameter<unsigned int>("pseudoMultiplicityMin")),
20  trackMultiplicityMin(params.getParameter<unsigned int>("trackMultiplicityMin")),
21  minTrackWeight(params.getParameter<double>("minimumTrackWeight")),
22  useTrackWeights(params.getParameter<bool>("useTrackWeights")),
23  vertexMassCorrection(params.getParameter<bool>("correctVertexMass")),
24  pseudoVertexV0Filter(params.getParameter<edm::ParameterSet>("pseudoVertexV0Filter")),
25  trackPairV0Filter(params.getParameter<edm::ParameterSet>("trackPairV0Filter")) {}
26 
27 inline double CombinedSVComputer::flipValue(double value, bool vertex) const {
28  return (vertex ? vertexFlip : trackFlip) ? -value : value;
29 }
30 
33  if (vertex ? vertexFlip : trackFlip) {
34  range.begin = size - 1;
35  range.end = -1;
36  range.increment = -1;
37  } else {
38  range.begin = 0;
39  range.end = size;
40  range.increment = +1;
41  }
42 
43  return range;
44 }
45 
46 const btag::TrackIPData &CombinedSVComputer::threshTrack(const CandIPTagInfo &trackIPTagInfo,
48  const reco::Jet &jet,
49  const GlobalPoint &pv) const {
50  const CandIPTagInfo::input_container &tracks = trackIPTagInfo.selectedTracks();
51  const std::vector<btag::TrackIPData> &ipData = trackIPTagInfo.impactParameterData();
52  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
53 
54  IterationRange range = flipIterate(indices.size(), false);
55  TrackKinematics kin;
56  range_for(i, range) {
57  std::size_t idx = indices[i];
58  const btag::TrackIPData &data = ipData[idx];
59  const CandidatePtr &track = tracks[idx];
60 
62  continue;
63 
64  kin.add(track);
65  if (kin.vectorSum().M() > charmCut)
66  return data;
67  }
68  if (trackFlip) {
69  static const btag::TrackIPData dummy = {GlobalPoint(),
70  GlobalPoint(),
71  Measurement1D(1.0, 1.0),
72  Measurement1D(1.0, 1.0),
73  Measurement1D(1.0, 1.0),
74  Measurement1D(1.0, 1.0),
75  0.};
76  return dummy;
77  } else {
78  static const btag::TrackIPData dummy = {GlobalPoint(),
79  GlobalPoint(),
80  Measurement1D(-1.0, 1.0),
81  Measurement1D(-1.0, 1.0),
82  Measurement1D(-1.0, 1.0),
83  Measurement1D(-1.0, 1.0),
84  0.};
85  return dummy;
86  }
87 }
88 
89 const btag::TrackIPData &CombinedSVComputer::threshTrack(const TrackIPTagInfo &trackIPTagInfo,
91  const reco::Jet &jet,
92  const GlobalPoint &pv) const {
93  const edm::RefVector<TrackCollection> &tracks = trackIPTagInfo.selectedTracks();
94  const std::vector<btag::TrackIPData> &ipData = trackIPTagInfo.impactParameterData();
95  std::vector<std::size_t> indices = trackIPTagInfo.sortedIndexes(sort);
96 
97  IterationRange range = flipIterate(indices.size(), false);
98  TrackKinematics kin;
99  range_for(i, range) {
100  std::size_t idx = indices[i];
101  const btag::TrackIPData &data = ipData[idx];
102  const Track &track = *tracks[idx];
103 
105  continue;
106 
107  kin.add(track);
108  if (kin.vectorSum().M() > charmCut)
109  return data;
110  }
111 
112  if (trackFlip) {
113  static const btag::TrackIPData dummy = {GlobalPoint(),
114  GlobalPoint(),
115  Measurement1D(1.0, 1.0),
116  Measurement1D(1.0, 1.0),
117  Measurement1D(1.0, 1.0),
118  Measurement1D(1.0, 1.0),
119  0.};
120  return dummy;
121  } else {
122  static const btag::TrackIPData dummy = {GlobalPoint(),
123  GlobalPoint(),
124  Measurement1D(-1.0, 1.0),
125  Measurement1D(-1.0, 1.0),
126  Measurement1D(-1.0, 1.0),
127  Measurement1D(-1.0, 1.0),
128  0.};
129  return dummy;
130  }
131 }
132 
134  const SecondaryVertexTagInfo &svInfo) const {
135  using namespace ROOT::Math;
136 
137  edm::RefToBase<Jet> jet = ipInfo.jet();
138  math::XYZVector jetDir = jet->momentum().Unit();
140 
141  TrackKinematics vertexKinematics;
142 
143  double vtx_track_ptSum = 0.;
144  double vtx_track_ESum = 0.;
145 
146  // the following is specific depending on the type of vertex
147  int vtx = -1;
148  unsigned int numberofvertextracks = 0;
149 
150  IterationRange range = flipIterate(svInfo.nVertices(), true);
151  range_for(i, range) {
152  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).nTracks();
153 
154  const Vertex &vertex = svInfo.secondaryVertex(i);
155  bool hasRefittedTracks = vertex.hasRefittedTracks();
156  for (reco::Vertex::trackRef_iterator track = vertex.tracks_begin(); track != vertex.tracks_end(); track++) {
157  double w = vertex.trackWeight(*track);
158  if (w < minTrackWeight)
159  continue;
160  if (hasRefittedTracks) {
161  const Track actualTrack = vertex.refittedTrack(*track);
162  vertexKinematics.add(actualTrack, w);
163  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, actualTrack.momentum()), true);
164  if (vtx < 0) // calculate this only for the first vertex
165  {
166  vtx_track_ptSum += std::sqrt(actualTrack.momentum().Perp2());
167  vtx_track_ESum += std::sqrt(actualTrack.momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
168  }
169  } else {
170  vertexKinematics.add(**track, w);
171  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
172  if (vtx < 0) // calculate this only for the first vertex
173  {
174  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
175  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
176  }
177  }
178  }
179 
180  if (vtx < 0)
181  vtx = i;
182  }
183  if (vtx >= 0) {
184  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
185  vars.insert(btau::vertexFitProb, (svInfo.secondaryVertex(vtx)).normalizedChi2(), true);
186  }
187 
188  // after we collected vertex information we let the common code complete the job
189  fillCommonVariables(vars, vertexKinematics, ipInfo, svInfo, vtx_track_ptSum, vtx_track_ESum);
190 
191  vars.finalize();
192  return vars;
193 }
194 
196  const CandSecondaryVertexTagInfo &svInfo) const {
197  using namespace ROOT::Math;
198 
199  edm::RefToBase<Jet> jet = ipInfo.jet();
200  math::XYZVector jetDir = jet->momentum().Unit();
202 
203  TrackKinematics vertexKinematics;
204 
205  double vtx_track_ptSum = 0.;
206  double vtx_track_ESum = 0.;
207 
208  // the following is specific depending on the type of vertex
209  int vtx = -1;
210  unsigned int numberofvertextracks = 0;
211 
212  IterationRange range = flipIterate(svInfo.nVertices(), true);
213  range_for(i, range) {
214  numberofvertextracks = numberofvertextracks + (svInfo.secondaryVertex(i)).numberOfSourceCandidatePtrs();
215 
217  const std::vector<CandidatePtr> &tracks = vertex.daughterPtrVector();
218  for (std::vector<CandidatePtr>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
219  vertexKinematics.add(*track);
220  vars.insert(btau::trackEtaRel, reco::btau::etaRel(jetDir, (*track)->momentum()), true);
221  if (vtx < 0) // calculate this only for the first vertex
222  {
223  vtx_track_ptSum += std::sqrt((*track)->momentum().Perp2());
224  vtx_track_ESum += std::sqrt((*track)->momentum().Mag2() + ROOT::Math::Square(ParticleMasses::piPlus));
225  }
226  }
227 
228  if (vtx < 0)
229  vtx = i;
230  }
231  if (vtx >= 0) {
232  vars.insert(btau::vertexNTracks, numberofvertextracks, true);
233  vars.insert(btau::vertexFitProb, (svInfo.secondaryVertex(vtx)).vertexNormalizedChi2(), true);
234  }
235 
236  // after we collected vertex information we let the common code complete the job
237  fillCommonVariables(vars, vertexKinematics, ipInfo, svInfo, vtx_track_ptSum, vtx_track_ESum);
238 
239  vars.finalize();
240  return vars;
241 }
TrackSorting
Definition: TrackSorting.h:8
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
reco::TrackKinematics
Definition: TrackKinematics.h:16
CombinedSVComputer::charmCut
double charmCut
Definition: CombinedSVComputer.h:75
Measurement1D
Definition: Measurement1D.h:11
reco::IPTagInfo
Definition: IPTagInfo.h:48
reco::ParticleMasses::piPlus
const double piPlus
Definition: ParticleMasses.h:9
electrons_cff.bool
bool
Definition: electrons_cff.py:366
mps_fire.i
i
Definition: mps_fire.py:428
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
CombinedSVComputer::trackNoDeltaRSelector
reco::TrackSelector trackNoDeltaRSelector
Definition: CombinedSVComputer.h:78
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::IPTagInfo::selectedTracks
const Container & selectedTracks() const
Definition: IPTagInfo.h:99
reco::TemplatedSecondaryVertexTagInfo
Definition: TemplatedSecondaryVertexTagInfo.h:47
reco::TemplatedSecondaryVertexTagInfo::nVertices
unsigned int nVertices() const
Definition: TemplatedSecondaryVertexTagInfo.h:112
reco::TaggingVariableList
Definition: TaggingVariable.h:194
CombinedSVComputer.h
edm::RefVector< TrackCollection >
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
reco::btau::trackEtaRel
Definition: TaggingVariable.h:49
reco::btag::SortCriteria
SortCriteria
Definition: IPTagInfo.h:43
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:42
dropDeltaR
static edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset)
Definition: GhostTrackComputer.cc:35
reco::VertexCompositePtrCandidate
Definition: VertexCompositePtrCandidate.h:16
CombinedSVComputer::flipValue
double flipValue(double value, bool vertex) const
Definition: CombinedSVComputer.cc:27
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
reco::btau::vertexFitProb
Definition: TaggingVariable.h:77
CombinedSVComputer::IterationRange
Definition: CombinedSVComputer.h:48
HLT_FULL_cff.trackPairV0Filter
trackPairV0Filter
Definition: HLT_FULL_cff.py:6759
range_for
#define range_for(i, x)
Definition: CombinedSVComputer.h:37
CombinedSVComputer::minTrackWeight
double minTrackWeight
Definition: CombinedSVComputer.h:82
HLT_FULL_cff.pseudoVertexV0Filter
pseudoVertexV0Filter
Definition: HLT_FULL_cff.py:6762
vars
vars
Definition: DeepTauId.cc:164
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
HGCalGeometryMode::Square
Definition: HGCalGeometryMode.h:26
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
HLT_FULL_cff.trackMultiplicityMin
trackMultiplicityMin
Definition: HLT_FULL_cff.py:6763
CombinedSVComputer::fillCommonVariables
void fillCommonVariables(reco::TaggingVariableList &vars, reco::TrackKinematics &vertexKinematics, const IPTI &ipInfo, const SVTI &svInfo, double &vtx_track_ptSum, double &vtx_track_ESum) const
Definition: CombinedSVComputer.h:91
ROOT::Math
Definition: Transform3DPJ.h:41
CombinedSVComputer::flipIterate
IterationRange flipIterate(int size, bool vertex) const
Definition: CombinedSVComputer.cc:31
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::ParameterSet
Definition: ParameterSet.h:47
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
ParameterSet
Definition: Functions.h:16
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::TemplatedSecondaryVertexTagInfo::secondaryVertex
const VTX & secondaryVertex(unsigned int index) const
Definition: TemplatedSecondaryVertexTagInfo.h:107
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
reco::IPTagInfo::sortedIndexes
std::vector< size_t > sortedIndexes(btag::SortCriteria mode=reco::btag::IP3DSig) const
Definition: IPTagInfo.h:231
createfilelist.int
int
Definition: createfilelist.py:10
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
reco::btau::etaRel
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
Definition: TaggingVariable.h:22
value
Definition: value.py:1
reco::IPTagInfo::impactParameterData
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:90
TrackCollections2monitor_cff.normalizedChi2
normalizedChi2
Definition: TrackCollections2monitor_cff.py:247
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignBH_cfg.useTrackWeights
tuple useTrackWeights
Definition: alignBH_cfg.py:24
reco::IPTagInfo::input_container
Container input_container
Definition: IPTagInfo.h:50
edm::Ptr< Candidate >
HLT_FULL_cff.pseudoMultiplicityMin
pseudoMultiplicityMin
Definition: HLT_FULL_cff.py:6757
HLT_FULL_cff.sortCriterium
sortCriterium
Definition: HLT_FULL_cff.py:52034
std
Definition: JetResolutionObject.h:76
HLT_FULL_cff.charmCut
charmCut
Definition: HLT_FULL_cff.py:6760
CombinedSVComputer::vertexFlip
bool vertexFlip
Definition: CombinedSVComputer.h:74
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
metsig::jet
Definition: SignAlgoResolutions.h:47
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CombinedSVComputer::CombinedSVComputer
CombinedSVComputer(const edm::ParameterSet &params)
Definition: CombinedSVComputer.cc:11
edm::RefToBase< Jet >
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HLT_FULL_cff.trackFlip
trackFlip
Definition: HLT_FULL_cff.py:6753
dummy
Definition: DummySelector.h:38
dqmdumpme.indices
indices
Definition: dqmdumpme.py:50
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
CombinedSVComputer::threshTrack
const reco::btag::TrackIPData & threshTrack(const reco::CandIPTagInfo &trackIPTagInfo, const reco::btag::SortCriteria sort, const reco::Jet &jet, const GlobalPoint &pv) const
TrackSorting::getCriterium
reco::btag::SortCriteria getCriterium(const std::string &name)
Definition: TrackSorting.cc:11
reco::btau::vertexNTracks
Definition: TaggingVariable.h:76
CombinedSVComputer::operator()
virtual reco::TaggingVariableList operator()(const reco::TrackIPTagInfo &ipInfo, const reco::SecondaryVertexTagInfo &svInfo) const
Definition: CombinedSVComputer.cc:133
reco::Vertex
Definition: Vertex.h:35
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MinBiasPDSkim_cfg.trackSelector
trackSelector
Tracks selection.
Definition: MinBiasPDSkim_cfg.py:233
HLT_FULL_cff.vertexFlip
vertexFlip
Definition: HLT_FULL_cff.py:6754
CombinedSVComputer::trackFlip
bool trackFlip
Definition: CombinedSVComputer.h:73
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
CombinedSVComputer::dropDeltaR
edm::ParameterSet dropDeltaR(const edm::ParameterSet &pset) const
Definition: CombinedSVComputer.cc:5
reco::TrackKinematics::add
void add(const reco::Track &track, double weight=1.0)
Definition: TrackKinematics.cc:57