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 }
L1TMuon::TriggerPrimitive::DTData::segment_number
int segment_number
Definition: MuonTriggerPrimitive.h:159
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
L1TMuon::DTBunchCrossingCleaner::clean
TriggerPrimitiveCollection clean(const TriggerPrimitiveCollection &) const
Definition: DTBunchCrossingCleaner.cc:21
L1MuDTChambThDigi.h
L1MuDTChambPhDigi.h
DTBunchCrossingCleaner.h
L1TMuon::TriggerPrimitive::DTData::bx
int bx
Definition: MuonTriggerPrimitive.h:143
L1TMuon::DTBunchCrossingCleaner::DTBunchCrossingCleaner
DTBunchCrossingCleaner(const edm::ParameterSet &)
Definition: DTBunchCrossingCleaner.cc:19
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
L1TMuon::TriggerPrimitiveCollection
std::vector< TriggerPrimitive > TriggerPrimitiveCollection
Definition: MuonTriggerPrimitiveFwd.h:10
L1TMuon::TriggerPrimitive::DTData::theta_bti_group
int theta_bti_group
Definition: MuonTriggerPrimitive.h:158
L1TMuon::TriggerPrimitive
Definition: MuonTriggerPrimitive.h:57
DTChamberId.h
L1TMuon::DTBunchCrossingCleaner::bx_window_size
const int bx_window_size
Definition: DTBunchCrossingCleaner.h:30
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
L1TMuon::TriggerPrimitive::DTData
Definition: MuonTriggerPrimitive.h:125
L1TMuon::TriggerPrimitive::DTData::qualityCode
int qualityCode
Definition: MuonTriggerPrimitive.h:149
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
createfilelist.int
int
Definition: createfilelist.py:10
L1TMuon::TriggerPrimitive::DTData::theta_quality
int theta_quality
Definition: MuonTriggerPrimitive.h:161
L1TMuon
Definition: L1TMuonSubsystems.h:4
MuonTriggerPrimitive.h
L1MuDTChambThDigi
Definition: L1MuDTChambThDigi.h:33
EventSetup.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
ParameterSet.h
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31