Skip to content

Commit 276ecb9

Browse files
committed
Changed tmath functions to std equivalents. Reverted track quality parameter to default to false
1 parent 49df272 commit 276ecb9

File tree

4 files changed

+29
-28
lines changed

4 files changed

+29
-28
lines changed

L1Trigger/L1TTrackMatch/interface/DisplacedVertexProducer.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "FWCore/MessageLogger/interface/MessageLogger.h"
1313
#include "FWCore/ParameterSet/interface/ParameterSet.h"
1414
#include "SimDataFormats/Associations/interface/TTTrackAssociationMap.h"
15-
#include "TMath.h"
1615
#include <iostream>
1716
#include <map>
1817
#include <set>
@@ -42,9 +41,9 @@ class Track_Parameters {
4241
float bendchi2;
4342
float MVA1;
4443

45-
float z(float x, float y) {
46-
float t = std::sinh(eta);
47-
float r = TMath::Sqrt(pow(x, 2) + pow(y, 2));
44+
float trackZAtVertex(float x, float y) {
45+
float t = sinh(eta);
46+
float r = sqrt(pow(x, 2) + pow(y, 2));
4847
return (z0 +
4948
(t * r *
5049
(1 + (pow(d0, 2) / pow(r, 2)) +
@@ -55,13 +54,13 @@ class Track_Parameters {
5554
float z0_in,
5655
float eta_in,
5756
float phi_in,
58-
float rho_in = 0,
59-
int index_in = -1,
60-
int nstubs_in = 0,
61-
float chi2rphi_in = 0,
62-
float chi2rz_in = 0,
63-
float bendchi2_in = 0,
64-
float MVA1_in = 0) {
57+
float rho_in,
58+
int index_in,
59+
int nstubs_in,
60+
float chi2rphi_in,
61+
float chi2rz_in,
62+
float bendchi2_in,
63+
float MVA1_in) {
6564
pt = pt_in;
6665
d0 = d0_in;
6766
z0 = z0_in;
@@ -76,8 +75,8 @@ class Track_Parameters {
7675
}
7776
index = index_in;
7877
rho = fabs(rho_in);
79-
x0 = (rho + charge * d0) * TMath::Cos(phi - (charge * TMath::Pi() / 2));
80-
y0 = (rho + charge * d0) * TMath::Sin(phi - (charge * TMath::Pi() / 2));
78+
x0 = (rho + charge * d0) * cos(phi - (charge * numbers::pi / 2));
79+
y0 = (rho + charge * d0) * sin(phi - (charge * numbers::pi / 2));
8180
nstubs = nstubs_in;
8281
chi2rphi = chi2rphi_in;
8382
chi2rz = chi2rz_in;
@@ -95,7 +94,7 @@ inline std::valarray<float> calcPVec(Track_Parameters a, double_t v_x, double_t
9594
p_vec *= -1;
9695
}
9796
if ((p_vec[0] != 0.0) || (p_vec[1] != 0.0)) {
98-
p_vec /= TMath::Sqrt(pow(p_vec[0], 2) + pow(p_vec[1], 2));
97+
p_vec /= sqrt(pow(p_vec[0], 2) + pow(p_vec[1], 2));
9998
}
10099
p_vec *= a.pt;
101100
return p_vec;
@@ -127,20 +126,19 @@ class Vertex_Parameters {
127126
std::valarray<float> p_trk_1 = calcPVec(a_in, x_dv_in, y_dv_in);
128127
std::valarray<float> p_trk_2 = calcPVec(b_in, x_dv_in, y_dv_in);
129128
std::valarray<float> p_tot = p_trk_1 + p_trk_2;
130-
p_mag = TMath::Sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2));
129+
p_mag = sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2));
131130
if (((p_trk_1[0] != 0.0) || (p_trk_2[1] != 0.0)) && ((p_trk_2[0] != 0.0) || (p_trk_2[1] != 0.0))) {
132-
openingAngle =
133-
(p_trk_1[0] * p_trk_2[0] + p_trk_1[1] * p_trk_2[1]) /
134-
(TMath::Sqrt(pow(p_trk_1[0], 2) + pow(p_trk_1[1], 2)) * TMath::Sqrt(pow(p_trk_2[0], 2) + pow(p_trk_2[1], 2)));
131+
openingAngle = (p_trk_1[0] * p_trk_2[0] + p_trk_1[1] * p_trk_2[1]) /
132+
(sqrt(pow(p_trk_1[0], 2) + pow(p_trk_1[1], 2)) * sqrt(pow(p_trk_2[0], 2) + pow(p_trk_2[1], 2)));
135133
}
136-
R_T = TMath::Sqrt(pow(x_dv_in, 2) + pow(y_dv_in, 2));
134+
R_T = sqrt(pow(x_dv_in, 2) + pow(y_dv_in, 2));
137135
if ((R_T != 0.0) && ((p_tot[0] != 0.0) || (p_tot[1] != 0.0))) {
138-
cos_T = (p_tot[0] * x_dv_in + p_tot[1] * y_dv_in) / (R_T * TMath::Sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2)));
136+
cos_T = (p_tot[0] * x_dv_in + p_tot[1] * y_dv_in) / (R_T * sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2)));
139137
}
140138
phi = atan2(p_tot[1], p_tot[0]);
141139
d_T = fabs(cos(phi) * y_dv_in - sin(phi) * x_dv_in);
142140
p2_mag = pow(a_in.pt, 2) + pow(b_in.pt, 2);
143-
delta_z = fabs(a_in.z(x_dv_in, y_dv_in) - b_in.z(x_dv_in, y_dv_in));
141+
delta_z = fabs(a_in.trackZAtVertex(x_dv_in, y_dv_in) - b_in.trackZAtVertex(x_dv_in, y_dv_in));
144142
}
145143

146144
Vertex_Parameters() {};

L1Trigger/L1TTrackMatch/plugins/DisplacedVertexProducer.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool ComparePtTrack(std::pair<Track_Parameters, edm::Ptr<TrackingParticle>> a,
6565
}
6666

6767
Double_t dist(Double_t x1, Double_t y1, Double_t x2 = 0, Double_t y2 = 0) { // Distance between 2 points
68-
return (TMath::Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
68+
return (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
6969
}
7070

7171
Double_t dist_TPs(Track_Parameters a, Track_Parameters b) {
@@ -99,16 +99,16 @@ Int_t calcVertex(Track_Parameters a, Track_Parameters b, Double_t& x_vtx, Double
9999
float radicand = (2 / pow(R, 2)) * (pow(R1, 2) + pow(R2, 2)) - (pow(pow(R1, 2) - pow(R2, 2), 2) / pow(R, 4)) - 1;
100100
float co2 = 0;
101101
if (radicand > 0)
102-
co2 = 0.5 * TMath::Sqrt(radicand);
102+
co2 = 0.5 * sqrt(radicand);
103103
float ix1_x = 0.5 * (x1 + x2) + co1 * (x2 - x1) + co2 * (y2 - y1);
104104
float ix2_x = 0.5 * (x1 + x2) + co1 * (x2 - x1) - co2 * (y2 - y1);
105105
float ix1_y = 0.5 * (y1 + y2) + co1 * (y2 - y1) + co2 * (x1 - x2);
106106
float ix2_y = 0.5 * (y1 + y2) + co1 * (y2 - y1) - co2 * (x1 - x2);
107-
float ix1_z1 = a.z(ix1_x, ix1_y);
108-
float ix1_z2 = b.z(ix1_x, ix1_y);
107+
float ix1_z1 = a.trackZAtVertex(ix1_x, ix1_y);
108+
float ix1_z2 = b.trackZAtVertex(ix1_x, ix1_y);
109109
float ix1_delz = fabs(ix1_z1 - ix1_z2);
110-
float ix2_z1 = a.z(ix2_x, ix2_y);
111-
float ix2_z2 = b.z(ix2_x, ix2_y);
110+
float ix2_z1 = a.trackZAtVertex(ix2_x, ix2_y);
111+
float ix2_z2 = b.trackZAtVertex(ix2_x, ix2_y);
112112
float ix2_delz = fabs(ix2_z1 - ix2_z2);
113113
float trk1_POCA[2] = {a.d0 * sin(a.phi), -1 * a.d0 * cos(a.phi)};
114114
float trk2_POCA[2] = {b.d0 * sin(b.phi), -1 * b.d0 * cos(b.phi)};

L1Trigger/L1TTrackMatch/python/DisplacedVertexProducer_cfi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@
2929
Features for displaced vertex BDT: ['trkExt_pt_firstTrk', 'trkExt_pt', 'trkExt_eta_firstTrk', 'trkExt_eta', 'trkExt_phi_firstTrk', 'trkExt_phi', 'trkExt_d0_firstTrk', 'trkExt_d0', 'trkExt_z0_firstTrk', 'trkExt_z0', 'trkExt_chi2rz_firstTrk', 'trkExt_chi2rz', 'trkExt_bendchi2_firstTrk', 'trkExt_bendchi2', 'trkExt_MVA_firstTrk', 'trkExt_MVA', 'dv_d_T', 'dv_R_T', 'dv_cos_T', 'dv_del_Z'])
3030
3131
dv inputs are vertex quantities and trkExt is a displaced track property. The firstTrk suffix means the track quantity comes from the higher pt track associated to a vertex. If there's no firstTrk suffix, then the track property is from the lower pt track associated to a vertex.
32+
33+
Note: TrackQuality parameter in L1Trigger/TrackFindingTracklet/python/l1tTTTracksFromTrackletEmulation_cfi.py needs to be set to True to get MVA values needed for BDT
34+
3235
'''

L1Trigger/TrackFindingTracklet/python/l1tTTTracksFromTrackletEmulation_cfi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
processingModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/processingmodules_hourglassExtendedAllCombined.dat'),
2121
wiresFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/wires_hourglassExtendedAllCombined.dat'),
2222
# Quality Flag and Quality params
23-
TrackQuality = cms.bool(True),
23+
TrackQuality = cms.bool(False),
2424
TrackQualityPSet = cms.PSet(TrackQualityParams),
2525
Fakefit = cms.bool(False), # True causes Tracklet reco to output TTTracks before DR & KF
2626
StoreTrackBuilderOutput = cms.bool(False), # if True EDProducts for TrackBuilder tracks and stubs will be filled

0 commit comments

Comments
 (0)