CMS 3D CMS Logo

DTCollector.cc
Go to the documentation of this file.
1 #include <memory>
2 
7 
12 
13 using namespace L1TMuon;
14 
16  : SubsystemCollector(ps), bx_min(ps.getParameter<int>("BX_min")), bx_max(ps.getParameter<int>("BX_max")) {
17  if (ps.getParameter<bool>("runBunchCrossingCleaner")) {
18  const edm::ParameterSet& bxccfg = ps.getParameterSet("bxCleanerCfg");
19  _bxc = std::make_unique<DTBunchCrossingCleaner>(bxccfg);
20  } else {
21  _bxc.reset(nullptr);
22  }
23 }
24 
26  const edm::EventSetup& es,
28  TriggerPrimitiveCollection cleaned, temp, chamb_list;
31  ev.getByLabel(_src, phiDigis);
32  ev.getByLabel(_src, thetaDigis);
33  for (int wheel = -2; wheel <= 2; ++wheel) {
34  for (int station = 1; station <= 4; ++station) {
35  for (int sector = 0; sector <= 11; ++sector) {
36  chamb_list.clear();
37  for (int bx = bx_min; bx <= bx_max; ++bx) {
38  std::unique_ptr<const L1MuDTChambPhDigi> phi_segm_1(phiDigis->chPhiSegm1(wheel, station, sector, bx));
39  std::unique_ptr<const L1MuDTChambPhDigi> phi_segm_2(phiDigis->chPhiSegm2(wheel, station, sector, bx));
40  std::unique_ptr<const L1MuDTChambThDigi> theta_segm(thetaDigis->chThetaSegm(wheel, station, sector, bx));
41 
42  int bti_group_1 = -1, bti_group_2 = -1;
43 
44  if (theta_segm) {
45  bti_group_1 = findBTIGroupForThetaDigi(*theta_segm, 1);
46  bti_group_2 = findBTIGroupForThetaDigi(*theta_segm, 2);
47  }
48 
49  if (phi_segm_1 && bti_group_1 != -1) {
50  chamb_list.push_back(processDigis(*phi_segm_1, *theta_segm, bti_group_1));
51  } else if (phi_segm_1 && bti_group_1 == -1) {
52  chamb_list.push_back(processDigis(*phi_segm_1, 1));
53  } else if (!phi_segm_1 && bti_group_1 != -1) {
54  chamb_list.push_back(processDigis(*theta_segm, bti_group_1));
55  }
56 
57  if (phi_segm_2 && bti_group_2 != -1) {
58  chamb_list.push_back(processDigis(*phi_segm_2, *theta_segm, bti_group_2));
59  } else if (phi_segm_2 && bti_group_2 == -1) {
60  chamb_list.push_back(processDigis(*phi_segm_2, 2));
61  } else if (!phi_segm_2 && bti_group_2 != -1) {
62  chamb_list.push_back(processDigis(*phi_segm_2, bti_group_2));
63  }
64 
65  phi_segm_1.release();
66  phi_segm_2.release();
67  theta_segm.release();
68  }
69  if (_bxc) {
70  temp = _bxc->clean(chamb_list);
71  cleaned.insert(cleaned.end(), temp.begin(), temp.end());
72  } else {
73  cleaned.insert(cleaned.end(), chamb_list.begin(), chamb_list.end());
74  }
75  }
76  }
77  }
78  out.insert(out.end(), cleaned.begin(), cleaned.end());
79 }
80 
81 TriggerPrimitive DTCollector::processDigis(const L1MuDTChambPhDigi& digi, const int& segment_number) const {
82  DTChamberId detid(digi.whNum(), digi.stNum(), digi.scNum() + 1);
83  return TriggerPrimitive(detid, digi, segment_number);
84 }
85 
86 TriggerPrimitive DTCollector::processDigis(const L1MuDTChambThDigi& digi_th, const int bti_group) const {
87  DTChamberId detid(digi_th.whNum(), digi_th.stNum(), digi_th.scNum() + 1);
88  return TriggerPrimitive(detid, digi_th, bti_group);
89 }
90 
92  const L1MuDTChambThDigi& digi_theta,
93  const int bti_group) const {
94  DTChamberId detid(digi_phi.whNum(), digi_phi.stNum(), digi_phi.scNum() + 1);
95  return TriggerPrimitive(detid, digi_phi, digi_theta, bti_group);
96 }
97 
98 int DTCollector::findBTIGroupForThetaDigi(const L1MuDTChambThDigi& digi, const int pos) const {
99  //if( digi.stNum() == 4 ) return -1; // there is no theta layer there
100  int result = -1;
101  for (int i = 0; i < 7; ++i) {
102  if (digi.position(i) == pos)
103  result = i;
104  }
105  return result;
106 }
107 
void extractPrimitives(const edm::Event &, const edm::EventSetup &, std::vector< TriggerPrimitive > &) const override
Definition: DTCollector.cc:25
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
int findBTIGroupForThetaDigi(const L1MuDTChambThDigi &, const int position) const
Definition: DTCollector.cc:98
DTCollector(const edm::ParameterSet &)
Definition: DTCollector.cc:15
ParameterSet const & getParameterSet(std::string const &) const
int position(const int i) const
std::unique_ptr< DTBunchCrossingCleaner > _bxc
Definition: DTCollector.h:35
TriggerPrimitive processDigis(const L1MuDTChambPhDigi &, const int &segment_number) const
Definition: DTCollector.cc:81
std::vector< TriggerPrimitive > TriggerPrimitiveCollection
L1TMuon::TriggerPrimitive TriggerPrimitive
Definition: Common.h:31
L1MuDTChambPhDigi const * chPhiSegm2(int wheel, int stat, int sect, int bx) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
L1MuDTChambPhDigi const * chPhiSegm1(int wheel, int stat, int sect, int bx) const