Skip to content

Commit f36f616

Browse files
committed
Removed using std namespace, corrected track quality default values, and removed unused functions
1 parent b5b8115 commit f36f616

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed

L1Trigger/L1TTrackMatch/interface/DisplacedVertexProducer.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include <ap_int.h>
2222
#include "conifer.h"
2323

24-
using namespace std;
25-
2624
class Track_Parameters {
2725
public:
2826
float pt;
@@ -42,8 +40,8 @@ class Track_Parameters {
4240
float MVA1;
4341

4442
float trackZAtVertex(float x, float y) {
45-
float t = sinh(eta);
46-
float r = sqrt(pow(x, 2) + pow(y, 2));
43+
float t = std::sinh(eta);
44+
float r = std::sqrt(pow(x, 2) + pow(y, 2));
4745
return (z0 +
4846
(t * r *
4947
(1 + (pow(d0, 2) / pow(r, 2)) +
@@ -75,8 +73,8 @@ class Track_Parameters {
7573
}
7674
index = index_in;
7775
rho = fabs(rho_in);
78-
x0 = (rho + charge * d0) * cos(phi - (charge * numbers::pi / 2));
79-
y0 = (rho + charge * d0) * sin(phi - (charge * numbers::pi / 2));
76+
x0 = (rho + charge * d0) * std::cos(phi - (charge * std::numbers::pi / 2));
77+
y0 = (rho + charge * d0) * std::sin(phi - (charge * std::numbers::pi / 2));
8078
nstubs = nstubs_in;
8179
chi2rphi = chi2rphi_in;
8280
chi2rz = chi2rz_in;
@@ -94,7 +92,7 @@ inline std::valarray<float> calcPVec(Track_Parameters a, double_t v_x, double_t
9492
p_vec *= -1;
9593
}
9694
if ((p_vec[0] != 0.0) || (p_vec[1] != 0.0)) {
97-
p_vec /= sqrt(pow(p_vec[0], 2) + pow(p_vec[1], 2));
95+
p_vec /= std::sqrt(pow(p_vec[0], 2) + pow(p_vec[1], 2));
9896
}
9997
p_vec *= a.pt;
10098
return p_vec;
@@ -126,17 +124,18 @@ class Vertex_Parameters {
126124
std::valarray<float> p_trk_1 = calcPVec(a_in, x_dv_in, y_dv_in);
127125
std::valarray<float> p_trk_2 = calcPVec(b_in, x_dv_in, y_dv_in);
128126
std::valarray<float> p_tot = p_trk_1 + p_trk_2;
129-
p_mag = sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2));
127+
p_mag = std::sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2));
130128
if (((p_trk_1[0] != 0.0) || (p_trk_1[1] != 0.0)) && ((p_trk_2[0] != 0.0) || (p_trk_2[1] != 0.0))) {
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)));
129+
openingAngle =
130+
(p_trk_1[0] * p_trk_2[0] + p_trk_1[1] * p_trk_2[1]) /
131+
(std::sqrt(pow(p_trk_1[0], 2) + pow(p_trk_1[1], 2)) * std::sqrt(pow(p_trk_2[0], 2) + pow(p_trk_2[1], 2)));
133132
}
134-
R_T = sqrt(pow(x_dv_in, 2) + pow(y_dv_in, 2));
133+
R_T = std::sqrt(pow(x_dv_in, 2) + pow(y_dv_in, 2));
135134
if ((R_T != 0.0) && ((p_tot[0] != 0.0) || (p_tot[1] != 0.0))) {
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)));
135+
cos_T = (p_tot[0] * x_dv_in + p_tot[1] * y_dv_in) / (R_T * std::sqrt(pow(p_tot[0], 2) + pow(p_tot[1], 2)));
137136
}
138137
phi = atan2(p_tot[1], p_tot[0]);
139-
d_T = fabs(cos(phi) * y_dv_in - sin(phi) * x_dv_in);
138+
d_T = fabs(std::cos(phi) * y_dv_in - std::sin(phi) * x_dv_in);
140139
p2_mag = pow(a_in.pt, 2) + pow(b_in.pt, 2);
141140
delta_z = fabs(a_in.trackZAtVertex(x_dv_in, y_dv_in) - b_in.trackZAtVertex(x_dv_in, y_dv_in));
142141
}

L1Trigger/L1TTrackMatch/plugins/DisplacedVertexProducer.cc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ double DisplacedVertexProducer::FloatPhiFromBits(const L1TTTrackType& track) con
4040
digiphi, TTTrack_TrackWord::TrackBitWidths::kPhiSize + kExtraGlobalPhiBit, TTTrack_TrackWord::stepPhi0);
4141
}
4242

43-
double DisplacedVertexProducer::FloatZ0FromBits(const L1TTTrackType& track) const {
44-
z0_intern trkZ = track.getZ0Word();
45-
return BitToDouble(trkZ, TTTrack_TrackWord::TrackBitWidths::kZ0Size, TTTrack_TrackWord::stepZ0);
46-
}
47-
48-
double DisplacedVertexProducer::FloatD0FromBits(const L1TTTrackType& track) const {
49-
d0_intern trkD0 = track.getD0Word();
50-
return BitToDouble(trkD0, TTTrack_TrackWord::TrackBitWidths::kD0Size, TTTrack_TrackWord::stepD0);
51-
}
52-
5343
int DisplacedVertexProducer::ChargeFromBits(const L1TTTrackType& track) const {
5444
ap_uint<1> chargeBit = track.getTrackWord()[TTTrack_TrackWord::TrackBitLocations::kRinvMSB];
5545
return 1 - (2 * chargeBit.to_uint());
@@ -65,7 +55,7 @@ bool ComparePtTrack(std::pair<Track_Parameters, edm::Ptr<TrackingParticle>> a,
6555
}
6656

6757
Double_t dist(Double_t x1, Double_t y1, Double_t x2 = 0, Double_t y2 = 0) { // Distance between 2 points
68-
return (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
58+
return (std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
6959
}
7060

7161
Double_t dist_TPs(Track_Parameters a, Track_Parameters b) {
@@ -99,7 +89,7 @@ Int_t calcVertex(Track_Parameters a, Track_Parameters b, Double_t& x_vtx, Double
9989
float radicand = (2 / pow(R, 2)) * (pow(R1, 2) + pow(R2, 2)) - (pow(pow(R1, 2) - pow(R2, 2), 2) / pow(R, 4)) - 1;
10090
float co2 = 0;
10191
if (radicand > 0)
102-
co2 = 0.5 * sqrt(radicand);
92+
co2 = 0.5 * std::sqrt(radicand);
10393
float ix1_x = 0.5 * (x1 + x2) + co1 * (x2 - x1) + co2 * (y2 - y1);
10494
float ix2_x = 0.5 * (x1 + x2) + co1 * (x2 - x1) - co2 * (y2 - y1);
10595
float ix1_y = 0.5 * (y1 + y2) + co1 * (y2 - y1) + co2 * (x1 - x2);
@@ -110,14 +100,14 @@ Int_t calcVertex(Track_Parameters a, Track_Parameters b, Double_t& x_vtx, Double
110100
float ix2_z1 = a.trackZAtVertex(ix2_x, ix2_y);
111101
float ix2_z2 = b.trackZAtVertex(ix2_x, ix2_y);
112102
float ix2_delz = fabs(ix2_z1 - ix2_z2);
113-
float trk1_POCA[2] = {a.d0 * sin(a.phi), -1 * a.d0 * cos(a.phi)};
114-
float trk2_POCA[2] = {b.d0 * sin(b.phi), -1 * b.d0 * cos(b.phi)};
103+
float trk1_POCA[2] = {a.d0 * std::sin(a.phi), -1 * a.d0 * std::cos(a.phi)};
104+
float trk2_POCA[2] = {b.d0 * std::sin(b.phi), -1 * b.d0 * std::cos(b.phi)};
115105
float trk1_ix1_delxy[2] = {ix1_x - trk1_POCA[0], ix1_y - trk1_POCA[1]};
116106
float trk1_ix2_delxy[2] = {ix2_x - trk1_POCA[0], ix2_y - trk1_POCA[1]};
117107
float trk2_ix1_delxy[2] = {ix1_x - trk2_POCA[0], ix1_y - trk2_POCA[1]};
118108
float trk2_ix2_delxy[2] = {ix2_x - trk2_POCA[0], ix2_y - trk2_POCA[1]};
119-
float trk1_traj[2] = {cos(a.phi), sin(a.phi)};
120-
float trk2_traj[2] = {cos(b.phi), sin(b.phi)};
109+
float trk1_traj[2] = {std::cos(a.phi), std::sin(a.phi)};
110+
float trk2_traj[2] = {std::cos(b.phi), std::sin(b.phi)};
121111
bool trk1_ix1_inTraj = ((trk1_ix1_delxy[0] * trk1_traj[0] + trk1_ix1_delxy[1] * trk1_traj[1]) > 0) ? true : false;
122112
bool trk1_ix2_inTraj = ((trk1_ix2_delxy[0] * trk1_traj[0] + trk1_ix2_delxy[1] * trk1_traj[1]) > 0) ? true : false;
123113
bool trk2_ix1_inTraj = ((trk2_ix1_delxy[0] * trk2_traj[0] + trk2_ix1_delxy[1] * trk2_traj[1]) > 0) ? true : false;
@@ -231,7 +221,7 @@ void DisplacedVertexProducer::produce(edm::StreamID, edm::Event& iEvent, const e
231221
z0 = l1track_ptr->z0(); //cm
232222
float x0 = l1track_ptr->POCA().x();
233223
float y0 = l1track_ptr->POCA().y();
234-
d0 = x0 * sin(phi) - y0 * cos(phi);
224+
d0 = x0 * std::sin(phi) - y0 * std::cos(phi);
235225
rho = 1 / l1track_ptr->rInv();
236226
chi2rphi = l1track_ptr->chi2XYRed();
237227
chi2rz = l1track_ptr->chi2ZRed();

L1Trigger/L1TTrackMatch/python/DisplacedVertexProducer_cfi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
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.
3232
33-
Note: TrackQuality parameter in L1Trigger/TrackFindingTracklet/python/l1tTTTracksFromTrackletEmulation_cfi.py needs to be set to True to get MVA values needed for BDT
33+
Note: TrackQuality parameter for l1tTTTracksFromExtendedTrackletEmulation in L1Trigger/TrackFindingTracklet/python/l1tTTTracksFromTrackletEmulation_cfi.py needs to be set to True to get MVA values needed for BDT
3434
3535
'''

L1Trigger/TrackFindingTracklet/python/l1tTTTracksFromTrackletEmulation_cfi.py

Lines changed: 2 additions & 2 deletions
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(False),
23+
TrackQuality = cms.bool(True),
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
@@ -36,6 +36,6 @@
3636
tableTEDFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/table_TED/table_TED_D1PHIA1_D2PHIA1.txt'),
3737
tableTREFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/table_TRE/table_TRE_D1AD2A_1.txt'),
3838
# Quality Flag and Quality params
39-
TrackQuality = cms.bool(True),
39+
TrackQuality = cms.bool(False),
4040
TrackQualityPSet = cms.PSet(TrackQualityParams)
4141
)

0 commit comments

Comments
 (0)