31 const std::vector<double>& scale_mean,
32 const std::vector<double>& scale_std)
33 : scale_mean_(scale_mean), scale_std_(scale_std) {
44 float& DPhiL1TkMu)
const {
46 auto TkRef =
L1TkMu->trkPtr();
49 if (DRL1TkMu_tmp < DRL1TkMu) {
50 DRL1TkMu = DRL1TkMu_tmp;
51 DPhiL1TkMu = DPhiL1TkMu_tmp;
60 vector<LayerTSOS> v_tsos = {};
66 int chargeTk = l1tk.
rInv() > 0. ? 1 : -1;
72 for (
auto it = bpix.begin();
it != bpix.end(); ++
it) {
78 auto deltaZ = 0.5f * (**it).surface().bounds().length();
84 v_tsos.push_back(make_pair((
const DetLayer*)(*
it), tsos));
87 for (
auto it = nfpix.begin();
it != nfpix.end(); ++
it) {
95 auto ri2 =
std::max((**it).specificSurface().innerRadius() -
deltaR, 0.f);
97 auto ro2 = (**it).specificSurface().outerRadius() +
deltaR;
99 bool is_compatible = ((
r2 > ri2) && (
r2 < ro2));
102 v_tsos.push_back(make_pair((
const DetLayer*)(*
it), tsos));
105 for (
auto it = pfpix.begin();
it != pfpix.end(); ++
it) {
113 auto ri2 =
std::max((**it).specificSurface().innerRadius() -
deltaR, 0.f);
115 auto ro2 = (**it).specificSurface().outerRadius() +
deltaR;
117 bool is_compatible = ((
r2 > ri2) && (
r2 < ro2));
119 v_tsos.push_back(make_pair((
const DetLayer*)(*
it), tsos));
132 vector<pair<LayerHit, LayerTSOS> >
out = {};
133 float av_dr_min = 999.;
136 for (
auto L1TkMu = L1TkMuonHandle->begin();
L1TkMu != L1TkMuonHandle->end(); ++
L1TkMu) {
140 vector<int> v_tsos_skip(v_tsos.size(), 0);
141 vector<pair<LayerHit, LayerTSOS> > hitTsosPair = {};
143 for (
const auto&
hit :
seed.recHits()) {
145 int the_tsos = -99999;
147 for (
auto i = 0
U;
i < v_tsos.size(); ++
i) {
148 if (v_tsos_skip.at(
i))
150 float dr = (v_tsos.at(
i).second.globalPosition() -
hit.globalPosition()).
mag();
154 v_tsos_skip.at(
i) = 1;
159 hitTsosPair.push_back(make_pair(make_pair(thelayer, &
hit), v_tsos.at(the_tsos)));
165 if ((
int)hitTsosPair.size() == ihit) {
167 for (
auto it = hitTsosPair.begin();
it != hitTsosPair.end(); ++
it) {
168 auto hit =
it->first.second;
169 auto tsos =
it->second.second;
170 av_dr += (
hit->globalPosition() - tsos.globalPosition()).
mag();
172 av_dr = av_dr > 0 ? av_dr / (
float)hitTsosPair.size() : 1.e6;
173 if (av_dr < av_dr_min) {
187 float& expd2HitL1Tk1,
188 float& expd2HitL1Tk2,
189 float& expd2HitL1Tk3)
const {
190 vector<pair<LayerHit, LayerTSOS> > hitTsosPair =
193 bool found = (!hitTsosPair.empty());
199 float hitx1 = 99999.;
200 float hity1 = 99999.;
201 float hitz1 = 99999.;
206 float hitx2 = 99999.;
207 float hity2 = 99999.;
208 float hitz2 = 99999.;
213 float hitx3 = 99999.;
214 float hity3 = 99999.;
215 float hitz3 = 99999.;
217 if (hitTsosPair.size() > 1) {
218 auto hit1 = hitTsosPair.at(0).first.second;
219 auto tsos1 = hitTsosPair.at(0).second.second;
221 l1x1 = tsos1.globalPosition().x();
222 l1y1 = tsos1.globalPosition().y();
223 l1z1 = tsos1.globalPosition().z();
224 hitx1 = hit1->globalPosition().x();
225 hity1 = hit1->globalPosition().y();
226 hitz1 = hit1->globalPosition().z();
228 auto hit2 = hitTsosPair.at(1).first.second;
229 auto tsos2 = hitTsosPair.at(1).second.second;
231 l1x2 = tsos2.globalPosition().x();
232 l1y2 = tsos2.globalPosition().y();
233 l1z2 = tsos2.globalPosition().z();
234 hitx2 = hit2->globalPosition().x();
235 hity2 = hit2->globalPosition().y();
236 hitz2 = hit2->globalPosition().z();
238 if (hitTsosPair.size() > 2) {
239 auto hit3 = hitTsosPair.at(2).first.second;
240 auto tsos3 = hitTsosPair.at(2).second.second;
242 l1x3 = tsos3.globalPosition().x();
243 l1y3 = tsos3.globalPosition().y();
244 l1z3 = tsos3.globalPosition().z();
245 hitx3 = hit3->globalPosition().x();
246 hity3 = hit3->globalPosition().y();
247 hitz3 = hit3->globalPosition().z();
251 if (hitx1 != 99999.) {
252 expd2HitL1Tk1 =
exp(-(
pow((l1x1 - hitx1), 2) +
pow((l1y1 - hity1), 2) +
pow((l1z1 - hitz1), 2)));
257 if (hitx2 != 99999.) {
258 expd2HitL1Tk2 =
exp(-(
pow((l1x2 - hitx2), 2) +
pow((l1y2 - hity2), 2) +
pow((l1z2 - hitz2), 2)));
263 if (hitx3 != 99999.) {
264 expd2HitL1Tk3 =
exp(-(
pow((l1x3 - hitx3), 2) +
pow((l1y3 - hity3), 2) +
pow((l1z3 - hitz3), 2)));
287 float initDRdPhi = 99999.;
289 float DRL1TkMuSeedP = initDRdPhi;
290 float DPhiL1TkMuSeedP = initDRdPhi;
295 float expd2HitL1Tk1 = initDRdPhi;
296 float expd2HitL1Tk2 = initDRdPhi;
297 float expd2HitL1Tk3 = initDRdPhi;
299 seed, h_L1TkMu, magfieldH,
propagatorAlong, geomTracker, expd2HitL1Tk1, expd2HitL1Tk2, expd2HitL1Tk3);
constexpr double deltaPhi(double phi1, double phi2)
vector< LayerTSOS > getTsosOnPixels(const TTTrack< Ref_Phase2TrackerDigi_ > &, const edm::ESHandle< MagneticField > &, const Propagator &, const GeometricSearchTracker &) const
SeedMvaEstimatorPhase2(const edm::FileInPath &weightsfile, const std::vector< double > &scale_mean, const std::vector< double > &scale_std)
LocalPoint localPosition() const
vector< pair< LayerHit, LayerTSOS > > getHitTsosPairs(const TrajectorySeed &, const edm::Handle< l1t::TrackerMuonCollection > &, const edm::ESHandle< MagneticField > &, const Propagator &, const GeometricSearchTracker &) const
Geom::Phi< T > phi() const
~SeedMvaEstimatorPhase2()
GlobalVector momentum() const
Track momentum.
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
const std::vector< double > scale_std_
const DetLayer * idToLayer(const DetId &detId) const override
Give the DetId of a module, returns the pointer to the corresponding DetLayer.
std::unique_ptr< const GBRForest > gbrForest_
T const * product() const
GlobalPoint globalPosition() const
LocalVector localDirection() const
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
Abs< T >::type abs(const T &t)
double rInv() const
Track curvature.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Class to store the L1 Track Trigger tracks.
GlobalVector globalDirection() const
void getL1TTVariables(const TrajectorySeed &, const GlobalVector &, const GlobalPoint &, const edm::Handle< l1t::TrackerMuonCollection > &, float &, float &) const
double computeMva(const TrajectorySeed &, const GlobalVector &, const GlobalPoint &, const edm::Handle< l1t::TrackerMuonCollection > &, const edm::ESHandle< MagneticField > &, const Propagator &, const GeometricSearchTracker &) const
void getHitL1TkVariables(const TrajectorySeed &, const edm::Handle< l1t::TrackerMuonCollection > &, const edm::ESHandle< MagneticField > &, const Propagator &, const GeometricSearchTracker &, float &, float &, float &) const
const std::vector< double > scale_mean_
Power< A, B >::type pow(const A &a, const B &b)
GlobalPoint POCA() const
POCA.