CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
SAMuonCleaner Class Reference

#include <SAMuonCleaner.h>

Public Member Functions

std::vector< l1t::SAMuoncleanTFMuons (const std::vector< l1t::SAMuon > &muons)
 
 SAMuonCleaner ()=default
 
 ~SAMuonCleaner ()=default
 

Private Member Functions

std::vector< l1t::SAMuoncleanTF (const std::vector< l1t::SAMuon > &tfMuons)
 
std::vector< l1t::SAMuoninterTFClean (const std::vector< l1t::SAMuon > &bmtf, const std::vector< l1t::SAMuon > &omtf, const std::vector< l1t::SAMuon > &emtf)
 
void overlapCleanTrack (l1t::SAMuon &source, const l1t::SAMuon &other, bool eq)
 
void overlapCleanTrackInter (l1t::SAMuon &source, const l1t::SAMuon &other)
 
void sort (std::vector< l1t::SAMuon > &in)
 
void swap (std::vector< l1t::SAMuon > &, int i, int j)
 

Detailed Description

Definition at line 6 of file SAMuonCleaner.h.

Constructor & Destructor Documentation

◆ SAMuonCleaner()

SAMuonCleaner::SAMuonCleaner ( )
default

◆ ~SAMuonCleaner()

SAMuonCleaner::~SAMuonCleaner ( )
default

Member Function Documentation

◆ cleanTF()

std::vector< l1t::SAMuon > SAMuonCleaner::cleanTF ( const std::vector< l1t::SAMuon > &  tfMuons)
private

Definition at line 39 of file SAMuonCleaner.cc.

References mps_fire::i, dqmiolumiharvest::j, MillePedeFileConverter_cfg::out, overlapCleanTrack(), and source.

Referenced by cleanTFMuons().

39  {
40  std::vector<l1t::SAMuon> out;
41  for (unsigned int i = 0; i < tfMuons.size(); ++i) {
42  l1t::SAMuon source = tfMuons[i];
43  for (unsigned int j = 0; j < tfMuons.size(); ++j) {
44  if (i == j)
45  continue;
46  overlapCleanTrack(source, tfMuons[j], false);
47  }
48  if (source.stubs().size() > 1)
49  out.push_back(source);
50  }
51  return out;
52 }
void overlapCleanTrack(l1t::SAMuon &source, const l1t::SAMuon &other, bool eq)
Definition: SAMuonCleaner.cc:3
static std::string const source
Definition: EdmProvDump.cc:49

◆ cleanTFMuons()

std::vector< l1t::SAMuon > SAMuonCleaner::cleanTFMuons ( const std::vector< l1t::SAMuon > &  muons)

Definition at line 119 of file SAMuonCleaner.cc.

References l1t::bmtf, cleanTF(), l1t::emtf_neg, l1t::emtf_pos, interTFClean(), amptDefaultParameters_cff::mu, DiMuonV_cfg::muons, l1t::omtf_neg, l1t::omtf_pos, MillePedeFileConverter_cfg::out, and sort().

Referenced by Phase2L1TGMTSAMuonGhostCleaner::prodMuons().

119  {
120  std::vector<l1t::SAMuon> out;
121 
122  //split into collections
123  std::vector<l1t::SAMuon> bmtf;
124  std::vector<l1t::SAMuon> omtf_pos;
125  std::vector<l1t::SAMuon> emtf_pos;
126  std::vector<l1t::SAMuon> omtf_neg;
127  std::vector<l1t::SAMuon> emtf_neg;
128 
129  for (const auto& mu : muons) {
130  if (mu.tfType() == l1t::tftype::bmtf) {
131  bmtf.push_back(mu);
132  } else if (mu.tfType() == l1t::tftype::omtf_pos) {
133  omtf_pos.push_back(mu);
134  } else if (mu.tfType() == l1t::tftype::emtf_pos) {
135  emtf_pos.push_back(mu);
136  } else if (mu.tfType() == l1t::tftype::omtf_neg) {
137  omtf_neg.push_back(mu);
138  } else if (mu.tfType() == l1t::tftype::emtf_neg) {
139  emtf_neg.push_back(mu);
140  }
141  }
142 
143  std::vector<l1t::SAMuon> omtf_cleaned = cleanTF(omtf_pos);
144  std::vector<l1t::SAMuon> omtf_neg_cleaned = cleanTF(omtf_neg);
145  omtf_cleaned.insert(omtf_cleaned.end(), omtf_neg_cleaned.begin(), omtf_neg_cleaned.end());
146  sort(omtf_cleaned);
147 
148  std::vector<l1t::SAMuon> emtf_cleaned = cleanTF(emtf_pos);
149  std::vector<l1t::SAMuon> emtf_neg_cleaned = cleanTF(emtf_neg);
150  emtf_cleaned.insert(emtf_cleaned.end(), emtf_neg_cleaned.begin(), emtf_neg_cleaned.end());
151  sort(emtf_cleaned);
152 
153  std::vector<l1t::SAMuon> cleaned = interTFClean(bmtf, omtf_cleaned, emtf_cleaned);
154  sort(cleaned);
155  return cleaned;
156 }
void sort(std::vector< l1t::SAMuon > &in)
std::vector< l1t::SAMuon > interTFClean(const std::vector< l1t::SAMuon > &bmtf, const std::vector< l1t::SAMuon > &omtf, const std::vector< l1t::SAMuon > &emtf)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
std::vector< l1t::SAMuon > cleanTF(const std::vector< l1t::SAMuon > &tfMuons)

◆ interTFClean()

std::vector< l1t::SAMuon > SAMuonCleaner::interTFClean ( const std::vector< l1t::SAMuon > &  bmtf,
const std::vector< l1t::SAMuon > &  omtf,
const std::vector< l1t::SAMuon > &  emtf 
)
private

Definition at line 54 of file SAMuonCleaner.cc.

References l1t::bmtf, mps_fire::i, trackingPlots::other, MillePedeFileConverter_cfg::out, overlapCleanTrackInter(), and source.

Referenced by cleanTFMuons().

56  {
57  std::vector<l1t::SAMuon> out = emtf;
58  for (unsigned int i = 0; i < omtf.size(); ++i) {
60  for (const auto& other : emtf) {
62  }
63  if (source.stubs().size() > 1)
64  out.push_back(source);
65  }
66  for (unsigned int i = 0; i < bmtf.size(); ++i) {
68  for (const auto& other : omtf) {
70  }
71  if (source.stubs().size() > 1)
72  out.push_back(source);
73  }
74  return out;
75 }
Definition: Event.h:15
void overlapCleanTrackInter(l1t::SAMuon &source, const l1t::SAMuon &other)
static std::string const source
Definition: EdmProvDump.cc:49

◆ overlapCleanTrack()

void SAMuonCleaner::overlapCleanTrack ( l1t::SAMuon source,
const l1t::SAMuon other,
bool  eq 
)
private

Definition at line 3 of file SAMuonCleaner.cc.

References runTheMatrix::keep, convertSQLiteXML::ok, trackingPlots::other, source, and SimL1Emulator_cff::stubs.

Referenced by cleanTF().

3  {
4  int rank1 = source.hwQual();
5  int rank2 = other.hwQual();
6  bool keep = true;
7  if ((eq && rank1 <= rank2) || ((!eq) && rank1 < rank2))
8  keep = false;
10  for (const auto& s1 : source.stubs()) {
11  bool ok = true;
12  for (const auto& s2 : other.stubs()) {
13  if ((*s1) == (*s2) && (!keep))
14  ok = false;
15  }
16  if (ok) {
17  stubs.push_back(s1);
18  }
19  }
20  source.setStubs(stubs);
21 }
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44
static std::string const source
Definition: EdmProvDump.cc:49

◆ overlapCleanTrackInter()

void SAMuonCleaner::overlapCleanTrackInter ( l1t::SAMuon source,
const l1t::SAMuon other 
)
private

Definition at line 23 of file SAMuonCleaner.cc.

References runTheMatrix::keep, convertSQLiteXML::ok, trackingPlots::other, source, and SimL1Emulator_cff::stubs.

Referenced by interTFClean().

23  {
24  bool keep = false;
26  for (const auto& s1 : source.stubs()) {
27  bool ok = true;
28  for (const auto& s2 : other.stubs()) {
29  if ((*s1) == (*s2) && (!keep))
30  ok = false;
31  }
32  if (ok) {
33  stubs.push_back(s1);
34  }
35  }
36  source.setStubs(stubs);
37 }
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44
static std::string const source
Definition: EdmProvDump.cc:49

◆ sort()

void SAMuonCleaner::sort ( std::vector< l1t::SAMuon > &  in)
private

Definition at line 96 of file SAMuonCleaner.cc.

References mps_fire::i, recoMuon::in, align_cfg::iteration, MillePedeFileConverter_cfg::out, reco::LeafCandidate::setP4(), swap(), HLT_2024v14_cff::track, and parallelization::uint.

Referenced by cleanTFMuons().

96  {
97  l1t::SAMuon nullTrack;
98  nullTrack.setP4(reco::Candidate::LorentzVector(0, 0, 0, 0.000001));
99  while (in.size() < 32)
100  in.push_back(nullTrack);
101 
102  for (uint iteration = 0; iteration < 16; ++iteration) {
103  for (uint i = 0; i < 32; i = i + 2) {
104  swap(in, i, i + 1);
105  }
106  for (uint i = 1; i < 31; i = i + 2) {
107  swap(in, i, i + 1);
108  }
109  }
110 
111  std::vector<l1t::SAMuon> out;
112  for (const auto& track : in) {
113  if (!track.stubs().empty() && out.size() < 12)
114  out.push_back(track);
115  }
116  in = out;
117 }
void swap(std::vector< l1t::SAMuon > &, int i, int j)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
void setP4(const LorentzVector &p4) final
set 4-momentum

◆ swap()

void SAMuonCleaner::swap ( std::vector< l1t::SAMuon > &  list,
int  i,
int  j 
)
private

Definition at line 77 of file SAMuonCleaner.cc.

References mps_fire::i, dqmiolumiharvest::j, reco::LeafCandidate::pt(), HLT_2024v14_cff::pt1, HLT_2024v14_cff::pt2, and createJobs::tmp.

Referenced by sort().

77  {
78  const l1t::SAMuon& track1 = list[i];
79  const l1t::SAMuon& track2 = list[j];
80 
81  int pt1 = track1.pt();
82  int pt2 = track2.pt();
83  bool swap = false;
84  if (pt1 > pt2)
85  swap = false;
86  else
87  swap = true;
88 
89  if (swap) {
90  l1t::SAMuon tmp = list[i];
91  list[i] = list[j];
92  list[j] = tmp;
93  }
94 }
void swap(std::vector< l1t::SAMuon > &, int i, int j)
double pt() const final
transverse momentum
tmp
align.sh
Definition: createJobs.py:716