CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1TPhase2GMTEndcapStubProcessor Class Reference

#include <L1TPhase2GMTEndcapStubProcessor.h>

Public Member Functions

 L1TPhase2GMTEndcapStubProcessor ()
 
 L1TPhase2GMTEndcapStubProcessor (const edm::ParameterSet &)
 
l1t::MuonStubCollection makeStubs (const MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > &csc, const MuonDigiCollection< RPCDetId, RPCDigi > &rpc, const L1TMuon::GeometryTranslator *t, const edm::EventSetup &iSetup)
 
 ~L1TPhase2GMTEndcapStubProcessor ()
 

Private Member Functions

l1t::MuonStub buildCSCOnlyStub (const CSCDetId &, const CSCCorrelatedLCTDigi &, const L1TMuon::GeometryTranslator *)
 
l1t::MuonStub buildRPCOnlyStub (const RPCDetId &, const RPCDigi &, const L1TMuon::GeometryTranslator *)
 
l1t::MuonStubCollection combineStubs (const l1t::MuonStubCollection &, const l1t::MuonStubCollection &)
 

Private Attributes

double coord1LSB_
 
double coord2LSB_
 
double eta1LSB_
 
double eta2LSB_
 
double etaMatch_
 
int maxBX_
 
int minBX_
 
double phiMatch_
 
bool verbose_
 

Detailed Description

Definition at line 16 of file L1TPhase2GMTEndcapStubProcessor.h.

Constructor & Destructor Documentation

◆ L1TPhase2GMTEndcapStubProcessor() [1/2]

L1TPhase2GMTEndcapStubProcessor::L1TPhase2GMTEndcapStubProcessor ( )

◆ L1TPhase2GMTEndcapStubProcessor() [2/2]

L1TPhase2GMTEndcapStubProcessor::L1TPhase2GMTEndcapStubProcessor ( const edm::ParameterSet iConfig)

Definition at line 10 of file L1TPhase2GMTEndcapStubProcessor.cc.

11  : minBX_(iConfig.getParameter<int>("minBX")),
12  maxBX_(iConfig.getParameter<int>("maxBX")),
13  coord1LSB_(iConfig.getParameter<double>("coord1LSB")),
14  coord2LSB_(iConfig.getParameter<double>("coord2LSB")),
15  eta1LSB_(iConfig.getParameter<double>("eta1LSB")),
16  eta2LSB_(iConfig.getParameter<double>("eta2LSB")),
17  etaMatch_(iConfig.getParameter<double>("etaMatch")),
18  phiMatch_(iConfig.getParameter<double>("phiMatch")),
19  verbose_(iConfig.getParameter<unsigned int>("verbose")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ ~L1TPhase2GMTEndcapStubProcessor()

L1TPhase2GMTEndcapStubProcessor::~L1TPhase2GMTEndcapStubProcessor ( )

Definition at line 21 of file L1TPhase2GMTEndcapStubProcessor.cc.

21 {}

Member Function Documentation

◆ buildCSCOnlyStub()

l1t::MuonStub L1TPhase2GMTEndcapStubProcessor::buildCSCOnlyStub ( const CSCDetId detid,
const CSCCorrelatedLCTDigi digi,
const L1TMuon::GeometryTranslator translator 
)
private

Definition at line 23 of file L1TPhase2GMTEndcapStubProcessor.cc.

References nano_mu_digi_cff::bx, relativeConstraints::chamber, CSCDetId::chamber(), coord1LSB_, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, HLT_2023v12_cff::eta1, eta1LSB_, CSCCorrelatedLCTDigi::getBX(), L1TMuon::GeometryTranslator::getGlobalPoint(), runTauDisplay::gp, createfilelist::int, phi, funct::primitive(), quality, CSCDetId::ring(), relativeConstraints::ring, nano_mu_digi_cff::sector, l1t::MuonStub::setOfflineQuantities(), Validation_hcalonly_cfi::sign, relativeConstraints::station, CSCDetId::station(), parallelization::uint, and makeMuonMisalignmentScenario::wheel.

Referenced by makeStubs().

25  {
26  int endcap = detid.endcap();
27  int station = detid.station();
28  int chamber = detid.chamber();
29  int ring = detid.ring();
30 
32 
33  const GlobalPoint& gp = translator->getGlobalPoint(primitive);
34 
35  int phi = int(gp.phi().value() / coord1LSB_);
36  int eta1 = int(gp.eta() / eta1LSB_);
37 
38  int wheel = 0;
39  int sign = endcap == 1 ? -1 : 1;
40 
41  if (ring == 3)
42  wheel = sign * 3;
43  else if (ring == 2)
44  wheel = sign * 4;
45  else if (ring == 1)
46  wheel = sign * 5;
47 
48  int sector = fabs(chamber);
49 
50  int bx = digi.getBX() - 8;
51  int quality = 1;
52 
53  uint tfLayer = 0;
54  if ((ring == 3 || ring == 2) && station == 1) //ME1/3
55  tfLayer = 4;
56  else if (ring == 1 && station == 1) //ME1/3
57  tfLayer = 0;
58  else if (station == 2) //ME2/2
59  tfLayer = 2;
60  else if (station == 3) //ME3/2
61  tfLayer = 1;
62  else if (station == 4) //ME4/2
63  tfLayer = 3;
64 
65  l1t::MuonStub stub(wheel, sector, station, tfLayer, phi, 0, 0, bx, quality, eta1, 0, 1, 0);
66 
67  stub.setOfflineQuantities(gp.phi().value(), 0.0, gp.eta(), 0.0);
68  return stub;
69 }
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
Primitive< F, X >::type primitive(const F &f)
Definition: Primitive.h:41
string quality
uint16_t getBX() const
return BX
int chamber() const
Definition: CSCDetId.h:62
int station() const
Definition: CSCDetId.h:79
int endcap() const
Definition: CSCDetId.h:85
int ring() const
Definition: CSCDetId.h:68

◆ buildRPCOnlyStub()

l1t::MuonStub L1TPhase2GMTEndcapStubProcessor::buildRPCOnlyStub ( const RPCDetId detid,
const RPCDigi digi,
const L1TMuon::GeometryTranslator translator 
)
private

Definition at line 71 of file L1TPhase2GMTEndcapStubProcessor.cc.

References RPCDigi::bx(), nano_mu_digi_cff::bx, coord2LSB_, HLT_2023v12_cff::eta2, eta2LSB_, L1TMuon::GeometryTranslator::getGlobalPoint(), runTauDisplay::gp, createfilelist::int, funct::primitive(), quality, RPCDetId::region(), RPCDetId::ring(), relativeConstraints::ring, nano_mu_digi_cff::sector, RPCDetId::sector(), l1t::MuonStub::setOfflineQuantities(), relativeConstraints::station, RPCDetId::station(), RPCDetId::subsector(), makeGlobalPositionRcd_cfg::tag, RPCDetId::trIndex(), parallelization::uint, and makeMuonMisalignmentScenario::wheel.

Referenced by makeStubs().

73  {
75  const GlobalPoint& gp = translator->getGlobalPoint(primitive);
76 
77  int phi2 = int(gp.phi().value() / coord2LSB_);
78  int eta2 = int(gp.eta() / eta2LSB_);
79 
80  int wheel = -(6 - detid.ring()) * detid.region();
81  int sector = (detid.sector() - 1) * 6 + detid.subsector();
82  int station = detid.station();
83  bool tag = detid.trIndex();
84  int bx = digi.bx();
85  int quality = 2;
86 
87  int ring = detid.ring();
88 
89  uint tfLayer = 0;
90 
91  if ((ring == 3 || ring == 2) && station == 1) //ME1/3
92  tfLayer = 4;
93  // else if (ring==1 && station==1) //ME1/3
94  // tfLayer=0;
95  else if (station == 2) //ME2/2
96  tfLayer = 2;
97  else if (station == 3) //ME3/2
98  tfLayer = 1;
99  else if (station == 4) //ME4/2
100  tfLayer = 3;
101 
102  l1t::MuonStub stub(wheel, sector, station, tfLayer, 0, phi2, tag, bx, quality, 0, eta2, 2, 0);
103  stub.setOfflineQuantities(gp.phi().value(), gp.phi().value(), gp.eta(), gp.eta());
104  return stub;
105 }
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
int bx() const
Definition: RPCDigi.h:28
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
int trIndex() const
Definition: RPCDetId.h:96
int ring() const
Definition: RPCDetId.h:59
Primitive< F, X >::type primitive(const F &f)
Definition: Primitive.h:41
string quality
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:88
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53

◆ combineStubs()

l1t::MuonStubCollection L1TPhase2GMTEndcapStubProcessor::combineStubs ( const l1t::MuonStubCollection cscStubs,
const l1t::MuonStubCollection rpcStubs 
)
private

Definition at line 107 of file L1TPhase2GMTEndcapStubProcessor.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, l1t::MuonStub::depthRegion(), PVValHelper::eta, l1t::MuonStub::eta1(), etaMatch_, l1t::MuonStub::etaRegion(), mps_fire::i, runTheMatrix::keep, l1t::MuonStub::offline_coord1(), l1t::MuonStub::offline_eta1(), MillePedeFileConverter_cfg::out, phi, phiMatch_, omtf::DataWord64::rpc, l1t::MuonStub::setEta(), l1t::MuonStub::setOfflineQuantities(), and parallelization::uint.

Referenced by makeStubs().

108  {
110  l1t::MuonStubCollection usedRPC;
111  l1t::MuonStubCollection cleanedRPC;
112 
113  l1t::MuonStubCollection cleanedCSC;
114 
115  //clean ME11 ambiguities
116  l1t::MuonStubCollection allCSC = cscStubs;
117 
118  while (!allCSC.empty()) {
119  l1t::MuonStub stub = allCSC[0];
120  l1t::MuonStubCollection freeCSC;
121  for (uint i = 1; i < allCSC.size(); ++i) {
122  if ((stub.etaRegion() == allCSC[i].etaRegion()) && (stub.depthRegion() == allCSC[i].depthRegion()) &&
123  (fabs(deltaPhi(stub.offline_coord1(), allCSC[i].offline_coord1())) < 0.001)) {
124  if (fabs(stub.offline_eta1() - allCSC[i].offline_eta1()) > 0.001) {
125  stub.setEta(stub.eta1(), allCSC[i].eta1(), 3);
126  stub.setOfflineQuantities(stub.offline_coord1(), 0.0, stub.offline_eta1(), allCSC[i].offline_eta1());
127  }
128  } else {
129  freeCSC.push_back(allCSC[i]);
130  }
131  }
132  cleanedCSC.push_back(stub);
133  allCSC = freeCSC;
134  }
135 
136  for (const auto& csc : cleanedCSC) {
137  int nRPC = 0;
138  float phiF = 0.0;
139  float etaF = 0.0;
140  int phi = 0;
141  int eta = 0;
142  for (const auto& rpc : rpcStubs) {
143  if (csc.depthRegion() != rpc.depthRegion())
144  continue;
145  if (fabs(deltaPhi(csc.offline_coord1(), rpc.offline_coord2())) < phiMatch_ &&
146  fabs(csc.offline_eta1() - rpc.offline_eta2()) < etaMatch_ && csc.bxNum() == rpc.bxNum()) {
147  phiF += rpc.offline_coord2();
148  etaF += rpc.offline_eta2();
149  phi += rpc.coord2();
150  eta += rpc.eta2();
151  nRPC++;
152  usedRPC.push_back(rpc);
153  }
154  }
155 
156  int finalRPCPhi = 0;
157  int finalRPCEta = 0;
158  double offline_finalRPCPhi = 0;
159  double offline_finalRPCEta = 0;
160  if (nRPC != 0) {
161  finalRPCPhi = phi / nRPC;
162  finalRPCEta = eta / nRPC;
163  offline_finalRPCPhi = phiF / nRPC;
164  offline_finalRPCEta = etaF / nRPC;
165  l1t::MuonStub stub(csc.etaRegion(),
166  csc.phiRegion(),
167  csc.depthRegion(),
168  csc.tfLayer(),
169  csc.coord1(),
170  finalRPCPhi,
171  0,
172  csc.bxNum(),
173  3,
174  csc.eta1(),
175  finalRPCEta,
176  3,
177  0);
178  stub.setOfflineQuantities(csc.offline_coord1(), offline_finalRPCPhi, csc.offline_eta1(), offline_finalRPCEta);
179  out.push_back(stub);
180  } else {
181  out.push_back(csc);
182  }
183  }
184 
185  //clean the RPC from the used ones
186 
187  for (const auto& rpc : rpcStubs) {
188  bool keep = true;
189  for (const auto& rpc2 : usedRPC) {
190  if (rpc == rpc2) {
191  keep = false;
192  break;
193  }
194  }
195  if (keep)
196  cleanedRPC.push_back(rpc);
197  }
198 
199  while (!cleanedRPC.empty()) {
200  l1t::MuonStubCollection freeRPC;
201 
202  int nRPC = 1;
203  float phiF = cleanedRPC[0].offline_coord2();
204  float etaF = cleanedRPC[0].offline_eta2();
205  int phi = cleanedRPC[0].coord2();
206  int eta = cleanedRPC[0].eta2();
207 
208  for (unsigned i = 1; i < cleanedRPC.size(); ++i) {
209  if (fabs(deltaPhi(cleanedRPC[0].offline_coord2(), cleanedRPC[i].offline_coord2())) < phiMatch_ &&
210  cleanedRPC[0].depthRegion() == cleanedRPC[i].depthRegion() &&
211  fabs(cleanedRPC[0].offline_eta2() - cleanedRPC[i].offline_eta2()) < etaMatch_ &&
212  cleanedRPC[0].bxNum() == cleanedRPC[i].bxNum()) {
213  phiF += cleanedRPC[i].offline_coord2();
214  etaF += cleanedRPC[i].offline_eta2();
215  phi += cleanedRPC[i].coord2();
216  eta += cleanedRPC[i].eta2();
217  nRPC++;
218  } else {
219  freeRPC.push_back(cleanedRPC[i]);
220  }
221  }
222  l1t::MuonStub stub(cleanedRPC[0].etaRegion(),
223  cleanedRPC[0].phiRegion(),
224  cleanedRPC[0].depthRegion(),
225  cleanedRPC[0].tfLayer(),
226  0,
227  phi / nRPC,
228  0,
229  cleanedRPC[0].bxNum(),
230  2,
231  0,
232  eta / nRPC,
233  2,
234  0);
235  stub.setOfflineQuantities(phiF / nRPC, phiF / nRPC, etaF / nRPC, etaF / nRPC);
236  out.push_back(stub);
237  cleanedRPC = freeRPC;
238  };
239  return out;
240 }
double offline_eta1() const
Definition: MuonStub.h:98
void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2)
Definition: MuonStub.h:101
double offline_coord1() const
Definition: MuonStub.h:96
int etaRegion() const
return wheel
Definition: MuonStub.h:67
int depthRegion() const
return station
Definition: MuonStub.h:71
int eta1() const
return eta
Definition: MuonStub.h:86
Definition: L1Track.h:19
std::vector< MuonStub > MuonStubCollection
Definition: MuonStub.h:40
void setEta(int eta1, int eta2, int etaQ)
Definition: MuonStub.h:107

◆ makeStubs()

l1t::MuonStubCollection L1TPhase2GMTEndcapStubProcessor::makeStubs ( const MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > &  csc,
const MuonDigiCollection< RPCDetId, RPCDigi > &  rpc,
const L1TMuon::GeometryTranslator t,
const edm::EventSetup iSetup 
)

Definition at line 242 of file L1TPhase2GMTEndcapStubProcessor.cc.

References MuonDigiCollection< IndexType, DigiType >::begin(), buildCSCOnlyStub(), buildRPCOnlyStub(), l1t::MuonStub::bxNum(), relativeConstraints::chamber, combineStubs(), MuonDigiCollection< IndexType, DigiType >::end(), maxBX_, minBX_, submitPVValidationJobs::t, and verbose_.

Referenced by Phase2L1TGMTStubProducer::produce().

246  {
247  l1t::MuonStubCollection cscStubs;
248  auto chamber = csc.begin();
249  auto chend = csc.end();
250  for (; chamber != chend; ++chamber) {
251  auto digi = (*chamber).second.first;
252  auto dend = (*chamber).second.second;
253  for (; digi != dend; ++digi) {
254  l1t::MuonStub stub = buildCSCOnlyStub((*chamber).first, *digi, t);
255  if (stub.bxNum() >= minBX_ && stub.bxNum() <= maxBX_)
256  cscStubs.push_back(stub);
257  }
258  }
259 
260  l1t::MuonStubCollection rpcStubs;
261 
262  auto rpcchamber = cleaned.begin();
263  auto rpcchend = cleaned.end();
264  for (; rpcchamber != rpcchend; ++rpcchamber) {
265  if ((*rpcchamber).first.region() == 0)
266  continue;
267  auto digi = (*rpcchamber).second.first;
268  auto dend = (*rpcchamber).second.second;
269  for (; digi != dend; ++digi) {
270  l1t::MuonStub stub = buildRPCOnlyStub((*rpcchamber).first, *digi, t);
271  if (stub.bxNum() >= minBX_ && stub.bxNum() <= maxBX_)
272  rpcStubs.push_back(stub);
273  }
274  }
275 
276  l1t::MuonStubCollection combinedStubs = combineStubs(cscStubs, rpcStubs);
277 
278  if (verbose_) {
279  printf("CSC Stubs\n");
280  for (const auto& stub : cscStubs)
281  printf(
282  "CSC Stub bx=%d TF=%d etaRegion=%d phiRegion=%d depthRegion=%d coord1=%f,%d coord2=%f,%d eta1=%f,%d "
283  "eta2=%f,%d quality=%d etaQuality=%d\n",
284  stub.bxNum(),
285  stub.tfLayer(),
286  stub.etaRegion(),
287  stub.phiRegion(),
288  stub.depthRegion(),
289  stub.offline_coord1(),
290  stub.coord1(),
291  stub.offline_coord2(),
292  stub.coord2(),
293  stub.offline_eta1(),
294  stub.eta1(),
295  stub.offline_eta2(),
296  stub.eta2(),
297  stub.quality(),
298  stub.etaQuality());
299  printf("RPC Stubs\n");
300  for (const auto& stub : rpcStubs)
301  printf(
302  "RPC Stub bx=%d TF=%d etaRegion=%d phiRegion=%d depthRegion=%d coord1=%f,%d coord2=%f,%d eta1=%f,%d "
303  "eta2=%f,%d quality=%d etaQuality=%d\n",
304  stub.bxNum(),
305  stub.tfLayer(),
306  stub.etaRegion(),
307  stub.phiRegion(),
308  stub.depthRegion(),
309  stub.offline_coord1(),
310  stub.coord1(),
311  stub.offline_coord2(),
312  stub.coord2(),
313  stub.offline_eta1(),
314  stub.eta1(),
315  stub.offline_eta2(),
316  stub.eta2(),
317  stub.quality(),
318  stub.etaQuality());
319  for (const auto& stub : combinedStubs)
320  printf(
321  "Combined Stub bx=%d TF=%d etaRegion=%d phiRegion=%d depthRegion=%d coord1=%f,%d coord2=%f,%d eta1=%f,%d "
322  "eta2=%f,%d quality=%d etaQuality=%d\n",
323  stub.bxNum(),
324  stub.tfLayer(),
325  stub.etaRegion(),
326  stub.phiRegion(),
327  stub.depthRegion(),
328  stub.offline_coord1(),
329  stub.coord1(),
330  stub.offline_coord2(),
331  stub.coord2(),
332  stub.offline_eta1(),
333  stub.eta1(),
334  stub.offline_eta2(),
335  stub.eta2(),
336  stub.quality(),
337  stub.etaQuality());
338  }
339 
340  return combinedStubs;
341 }
l1t::MuonStub buildCSCOnlyStub(const CSCDetId &, const CSCCorrelatedLCTDigi &, const L1TMuon::GeometryTranslator *)
double offline_eta1() const
Definition: MuonStub.h:98
double offline_eta2() const
Definition: MuonStub.h:99
double offline_coord1() const
Definition: MuonStub.h:96
int coord1() const
return phi
Definition: MuonStub.h:75
int etaRegion() const
return wheel
Definition: MuonStub.h:67
int depthRegion() const
return station
Definition: MuonStub.h:71
int quality() const
return quality code
Definition: MuonStub.h:79
int coord2() const
return phib
Definition: MuonStub.h:77
l1t::MuonStubCollection combineStubs(const l1t::MuonStubCollection &, const l1t::MuonStubCollection &)
int eta1() const
return eta
Definition: MuonStub.h:86
int etaQuality() const
return first eta quality
Definition: MuonStub.h:89
Definition: L1Track.h:19
std::vector< MuonStub > MuonStubCollection
Definition: MuonStub.h:40
int eta2() const
Definition: MuonStub.h:87
int phiRegion() const
return sector
Definition: MuonStub.h:69
double offline_coord2() const
Definition: MuonStub.h:97
uint tfLayer() const
return track finder layer
Definition: MuonStub.h:73
int bxNum() const
return bunch crossing
Definition: MuonStub.h:83
l1t::MuonStub buildRPCOnlyStub(const RPCDetId &, const RPCDigi &, const L1TMuon::GeometryTranslator *)

Member Data Documentation

◆ coord1LSB_

double L1TPhase2GMTEndcapStubProcessor::coord1LSB_
private

Definition at line 34 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by buildCSCOnlyStub().

◆ coord2LSB_

double L1TPhase2GMTEndcapStubProcessor::coord2LSB_
private

Definition at line 35 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by buildRPCOnlyStub().

◆ eta1LSB_

double L1TPhase2GMTEndcapStubProcessor::eta1LSB_
private

Definition at line 36 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by buildCSCOnlyStub().

◆ eta2LSB_

double L1TPhase2GMTEndcapStubProcessor::eta2LSB_
private

Definition at line 37 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by buildRPCOnlyStub().

◆ etaMatch_

double L1TPhase2GMTEndcapStubProcessor::etaMatch_
private

Definition at line 38 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by combineStubs().

◆ maxBX_

int L1TPhase2GMTEndcapStubProcessor::maxBX_
private

Definition at line 33 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by makeStubs().

◆ minBX_

int L1TPhase2GMTEndcapStubProcessor::minBX_
private

Definition at line 32 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by makeStubs().

◆ phiMatch_

double L1TPhase2GMTEndcapStubProcessor::phiMatch_
private

Definition at line 39 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by combineStubs().

◆ verbose_

bool L1TPhase2GMTEndcapStubProcessor::verbose_
private

Definition at line 40 of file L1TPhase2GMTEndcapStubProcessor.h.

Referenced by makeStubs().