CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
Phase2L1GMT::ROITempAssociator Class Reference

#include <ROITempAssociator.h>

Public Member Functions

std::vector< MuonROIassociate (int bx, const l1t::ObjectRefBxCollection< l1t::RegionalMuonCand > &muons, const l1t::MuonStubRefVector &stubs)
 
 ROITempAssociator (const edm::ParameterSet &iConfig)
 
 ~ROITempAssociator ()
 

Private Member Functions

l1t::MuonStubRefVector clean (const l1t::MuonStubRefVector &all, const l1t::MuonStubRefVector &used)
 
l1t::MuonStubRefVector selectLayerBX (const l1t::MuonStubRefVector &all, int bx, uint layer)
 

Detailed Description

Definition at line 11 of file ROITempAssociator.h.

Constructor & Destructor Documentation

◆ ROITempAssociator()

Phase2L1GMT::ROITempAssociator::ROITempAssociator ( const edm::ParameterSet iConfig)
inline

Definition at line 13 of file ROITempAssociator.h.

13 {}

◆ ~ROITempAssociator()

Phase2L1GMT::ROITempAssociator::~ROITempAssociator ( )
inline

Definition at line 14 of file ROITempAssociator.h.

14 {}

Member Function Documentation

◆ associate()

std::vector<MuonROI> Phase2L1GMT::ROITempAssociator::associate ( int  bx,
const l1t::ObjectRefBxCollection< l1t::RegionalMuonCand > &  muons,
const l1t::MuonStubRefVector stubs 
)
inline

Definition at line 16 of file ROITempAssociator.h.

References Phase2L1GMT::MuonROI::addStub(), l1t::bmtf, nano_mu_digi_cff::bx, ALCARECOTkAlJpsiMuMu_cff::charge, clean(), spr::deltaEta, SiPixelRawToDigiRegional_cfi::deltaPhi, PVValHelper::eta, mps_fire::i, M_PI, amptDefaultParameters_cff::mu, DiMuonV_cfg::muons, MillePedeFileConverter_cfg::out, DiDispStaMuonMonitor_cfi::pt, selectLayerBX(), Phase2L1GMT::MuonROI::setMuonRef(), Phase2L1GMT::MuonROI::stubs(), and parallelization::uint.

18  {
19  std::vector<MuonROI> out;
20  l1t::MuonStubRefVector usedStubs;
21 
22  if (muons.size() > 0) {
23  for (unsigned int i = 0; i < muons.size(bx); ++i) {
24  const l1t::RegionalMuonCandRef& mu = muons.at(bx, i);
25  uint pt = mu->hwPt();
26  uint charge = mu->hwSign();
27 
28  float eta = mu->hwEta() * 0.010875;
29 
30  int globalPhi = 0;
31  if (mu->trackFinderType() == l1t::bmtf) {
32  globalPhi = mu->processor() * 48 + mu->hwPhi() - 24;
33  } else {
34  globalPhi = mu->processor() * 96 + mu->hwPhi() + 24;
35  }
36 
37  float phi = globalPhi * 2 * M_PI / 576.0;
38  if (phi > (M_PI))
39  phi = phi - 2 * M_PI;
40  else if (phi < (-M_PI))
41  phi = phi + 2 * M_PI;
42 
43  MuonROI roi(bx, charge, pt, 1);
44  roi.setMuonRef(mu);
45  l1t::MuonStubRefVector cleanedStubs = clean(stubs, usedStubs);
46 
47  for (unsigned int layer = 0; layer <= 4; ++layer) {
48  l1t::MuonStubRefVector selectedStubs = selectLayerBX(cleanedStubs, bx, layer);
49  int bestStubINT = -1;
50  float dPhi = 1000.0;
51 
52  for (uint i = 0; i < selectedStubs.size(); ++i) {
53  const l1t::MuonStubRef& stub = selectedStubs[i];
54  float deltaPhi = (stub->quality() & 0x1) ? stub->offline_coord1() - phi : stub->offline_coord2() - phi;
55  if (deltaPhi > M_PI)
56  deltaPhi = deltaPhi - 2 * M_PI;
57  else if (deltaPhi < -M_PI)
58  deltaPhi = deltaPhi + 2 * M_PI;
59  deltaPhi = fabs(deltaPhi);
60  float deltaEta = (stub->etaQuality() == 0 || (stub->etaQuality() & 0x1))
61  ? fabs(stub->offline_eta1() - eta)
62  : fabs(stub->offline_eta2() - eta);
63  if (deltaPhi < (M_PI / 6.0) && deltaEta < 0.3 && deltaPhi < dPhi) {
64  dPhi = deltaPhi;
65  bestStubINT = i;
66  }
67  }
68  if (bestStubINT >= 0) {
69  roi.addStub(selectedStubs[bestStubINT]);
70  usedStubs.push_back(selectedStubs[bestStubINT]);
71  }
72  }
73  if (out.size() < 16 && !roi.stubs().empty())
74  out.push_back(roi);
75  }
76  }
77  //Now the stubs only . Find per layer
78 
79  l1t::MuonStubRefVector cleanedStubs = clean(stubs, usedStubs);
80 
81  while (!cleanedStubs.empty()) {
82  MuonROI roi(bx, 0, 0, 0);
83  roi.addStub(cleanedStubs[0]);
84  usedStubs.push_back(cleanedStubs[0]);
85  for (unsigned int layer = 0; layer <= 4; ++layer) {
86  if (layer == cleanedStubs[0]->tfLayer())
87  continue;
88  l1t::MuonStubRefVector selectedStubs = selectLayerBX(cleanedStubs, bx, layer);
89  if (!selectedStubs.empty()) {
90  roi.addStub(selectedStubs[0]);
91  usedStubs.push_back(selectedStubs[0]);
92  }
93  }
94  if (!roi.stubs().empty())
95  if (out.size() < 16)
96  out.push_back(roi);
97  cleanedStubs = clean(cleanedStubs, usedStubs);
98  }
99  return out;
100  }
l1t::MuonStubRefVector selectLayerBX(const l1t::MuonStubRefVector &all, int bx, uint layer)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
static const double deltaEta
Definition: CaloConstants.h:8
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44
l1t::MuonStubRefVector clean(const l1t::MuonStubRefVector &all, const l1t::MuonStubRefVector &used)
#define M_PI

◆ clean()

l1t::MuonStubRefVector Phase2L1GMT::ROITempAssociator::clean ( const l1t::MuonStubRefVector all,
const l1t::MuonStubRefVector used 
)
inlineprivate

Definition at line 112 of file ROITempAssociator.h.

References python.cmstools::all(), runTheMatrix::keep, and MillePedeFileConverter_cfg::out.

Referenced by associate().

112  {
114  for (const auto& stub : all) {
115  bool keep = true;
116  for (const auto& st : used) {
117  if (st == stub) {
118  keep = false;
119  break;
120  }
121  }
122  if (keep)
123  out.push_back(stub);
124  }
125  return out;
126  }
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44

◆ selectLayerBX()

l1t::MuonStubRefVector Phase2L1GMT::ROITempAssociator::selectLayerBX ( const l1t::MuonStubRefVector all,
int  bx,
uint  layer 
)
inlineprivate

Definition at line 103 of file ROITempAssociator.h.

References python.cmstools::all(), nano_mu_digi_cff::bx, and MillePedeFileConverter_cfg::out.

Referenced by associate().

103  {
105  for (const auto& stub : all) {
106  if (stub->bxNum() == bx && stub->tfLayer() == layer)
107  out.push_back(stub);
108  }
109  return out;
110  }
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Definition: MuonStub.h:44