CMS 3D CMS Logo

DTBunchCrossingCleaner.cc
Go to the documentation of this file.
1 #include <algorithm>
8 
12 
13 using namespace L1TMuon;
14 
15 namespace {
16  typedef edm::ParameterSet PSet;
17 }
18 
19 DTBunchCrossingCleaner::DTBunchCrossingCleaner(const PSet& ps) : bx_window_size(ps.getParameter<int>("bxWindowSize")) {}
20 
22  TriggerPrimitiveCollection leftovers = inlist;
24 
25  auto tpin = inlist.cbegin();
26  auto inend = inlist.cend();
27  for (; tpin != inend; ++tpin) {
28  const TriggerPrimitive::DTData data = tpin->getDTData();
29 
30  // automatically add well matched tracks
31  if (data.qualityCode != -1 && data.theta_quality != -1) {
32  outlist.push_back(*tpin);
33  auto toerase = std::find(leftovers.begin(), leftovers.end(), *tpin);
34  if (toerase != leftovers.end()) {
35  leftovers.erase(toerase);
36  }
37  }
38 
39  // clean up phi/theta digis split across a BX
40  // key off of the phi digis since they are of higher quality
41  if (data.qualityCode != -1 && data.theta_quality == -1) {
42  auto tp_bx = leftovers.cbegin();
43  auto tp_bx_end = leftovers.cend();
44  for (; tp_bx != tp_bx_end; ++tp_bx) {
45  if (*tp_bx == *tpin)
46  continue;
47  const TriggerPrimitive::DTData bx_data = tp_bx->getDTData();
48  // look in-window and match to the segment number
49  // requiring that we find a theta-segment with no phi info
50  if (std::abs(bx_data.bx - data.bx) <= bx_window_size && bx_data.qualityCode == -1 &&
51  bx_data.theta_quality != -1 && data.segment_number == bx_data.segment_number) {
52  // we need spoof the Digis used to create the individual objects
53  L1MuDTChambPhDigi phi_digi(data.bx,
54  data.wheel,
55  data.sector,
56  data.station,
57  data.radialAngle,
58  data.bendingAngle,
59  data.qualityCode,
60  data.Ts2TagCode,
61  data.BxCntCode);
62  int qual[7], position[7];
63  for (int i = 0; i < 7; ++i) {
64  qual[i] = 0;
65  position[i] = 0;
66  if (bx_data.theta_bti_group == i) {
67  qual[i] = bx_data.theta_quality;
68  position[i] = bx_data.segment_number;
69  }
70  }
71  L1MuDTChambThDigi the_digi(data.bx, data.wheel, data.sector, data.station, position, qual);
72 
73  DTChamberId the_id = tpin->detId<DTChamberId>();
74  TriggerPrimitive newtp(the_id, phi_digi, the_digi, bx_data.theta_bti_group);
75 
76  outlist.push_back(newtp);
77  // remove these primitives from the leftovers list
78  auto phierase = std::find(leftovers.begin(), leftovers.end(), *tpin);
79  auto theerase = std::find(leftovers.begin(), leftovers.end(), *tp_bx);
80  if (phierase != leftovers.end()) {
81  leftovers.erase(phierase);
82  }
83  if (theerase != leftovers.end()) {
84  leftovers.erase(theerase);
85  }
86  break; // do not look for further matches!
87  }
88  }
89  }
90  }
91  // re-insert any un-used trigger primitives
92  auto lo_tp = leftovers.cbegin();
93  auto lo_end = leftovers.cend();
94  for (; lo_tp != lo_end; ++lo_tp) {
95  outlist.push_back(*lo_tp);
96  }
97  return outlist;
98 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TriggerPrimitiveCollection clean(const TriggerPrimitiveCollection &) const
std::vector< TriggerPrimitive > TriggerPrimitiveCollection
Definition: PSet.py:1
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTBunchCrossingCleaner(const edm::ParameterSet &)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static int position[264][3]
Definition: ReadPGInfo.cc:289