CMS 3D CMS Logo

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

#include <DTRPCBxCorrection.h>

Public Member Functions

 DTRPCBxCorrection (L1MuDTChambPhContainer, L1MuDTChambPhContainer)
 
L1MuDTChambPhContainer getDTContainer ()
 Return Output PhContainer. More...
 
void run (const edm::EventSetup &c)
 
 ~DTRPCBxCorrection ()
 

Static Public Member Functions

static int deltaPhi (int dt_phi, int rpc_strip)
 
static int nRPCHits (L1MuTMChambPhContainer inCon, int bx, int wh, int sec, int st)
 
static int nRPCHits (L1MuDTChambPhContainer inCon, int bx, int wh, int sec, int st)
 

Public Attributes

edm::ESHandle< L1TTwinMuxParamstmParamsHandle
 

Private Member Functions

void BxCorrection (int track_seg)
 
int flipBit (int inv)
 
int sign (float)
 

Private Attributes

int m_DphiWindow
 
L1MuDTChambPhContainer m_dt_tsshifted
 
std::vector< L1MuDTChambPhDigim_l1ttma_out
 
L1MuDTChambPhContainer m_phiDTDigis
 
L1MuDTChambPhContainer m_phiRPCDigis
 
int m_QualityLimit
 

Detailed Description

Definition at line 32 of file DTRPCBxCorrection.h.

Constructor & Destructor Documentation

DTRPCBxCorrection::DTRPCBxCorrection ( L1MuDTChambPhContainer  inphiDTDigis,
L1MuDTChambPhContainer  inphiRPCDigis 
)

Definition at line 21 of file DTRPCBxCorrection.cc.

22  : m_phiDTDigis(inphiDTDigis),
23  m_phiRPCDigis(inphiRPCDigis){
24  // m_phiDTDigis=inphiDTDigis;
25  // m_phiRPCDigis=inphiRPCDigis;
26  };
L1MuDTChambPhContainer m_phiRPCDigis
L1MuDTChambPhContainer m_phiDTDigis
DTRPCBxCorrection::~DTRPCBxCorrection ( )
inline

Definition at line 35 of file DTRPCBxCorrection.h.

References HltBtagPostValidation_cff::c, and run().

35 {};

Member Function Documentation

void DTRPCBxCorrection::BxCorrection ( int  track_seg)
private

Concatanate all vectors in one

Shift primitives if vector>0

XXX: Source of discrepancies in order to send as second TS the two prims must come from different halves of the station this information does not exist in data 'simulate' this information by requiring different sign in phis and dphi>100

if there is no shift then put the original primitive

Definition at line 42 of file DTRPCBxCorrection.cc.

References l1GtPatternGenerator_cfi::bx, L1MuDTChambPhDigi::BxCnt(), L1MuDTChambPhDigi::bxNum(), L1MuTMChambPhContainer::chPhiSegm(), L1MuDTChambPhDigi::code(), dumpMFGeometry_cfg::delta, deltaPhi(), HLT_2018_cff::distance, flipBit(), L1MuDTChambPhContainer::getContainer(), m_DphiWindow, m_l1ttma_out, m_phiDTDigis, m_phiRPCDigis, m_QualityLimit, nhits, nRPCHits(), L1MuDTChambPhDigi::phi(), L1MuDTChambPhDigi::phiB(), L1MuDTChambPhDigi::scNum(), L1MuTMChambPhContainer::setContainer(), sign(), relativeConstraints::station, L1MuDTChambPhDigi::stNum(), L1MuDTChambPhDigi::Ts2Tag(), makeMuonMisalignmentScenario::wheel, and L1MuDTChambPhDigi::whNum().

Referenced by flipBit(), and run().

42  {
43  L1MuTMChambPhContainer m_phiDTDigis_tm;
44  //std::shared_ptr<L1MuTMChambPhContainer> m_phiDTDigis_tm (new L1MuTMChambPhContainer);
45  const std::vector<L1MuDTChambPhDigi>* phiChambVectorDT;
46  phiChambVectorDT = m_phiDTDigis.getContainer();
47  m_phiDTDigis_tm.setContainer(*phiChambVectorDT);
48  L1MuTMChambPhContainer m_phiRPCDigis_tm;
49  //std::shared_ptr<L1MuTMChambPhContainer> m_phiRPCDigis_tm (new L1MuTMChambPhContainer);
50  const std::vector<L1MuDTChambPhDigi>* phiChambVectorRPC;
51  phiChambVectorRPC = m_phiRPCDigis.getContainer();
52  m_phiRPCDigis_tm.setContainer(*phiChambVectorRPC);
53 
54  int ibx_dtm = 0, fbx_dtm = 0;
55  int ibx_dtp = 0, fbx_dtp = 0;
56 
57  for (int wheel = -2; wheel <= 2; wheel++) {
58  for (int sector = 0; sector < 12; sector++) {
59  for (int station = 1; station <= 4; station++) {
60  bool shifted[7] = {false, false, false, false, false, false, false};
61  bool dups[7] = {false, false, false, false, false, false, false};
62  bool secondTs[7] = {false, false, false, false, false, false, false};
63  L1MuTMChambPhContainer shiftedPhiDTDigis;
64  L1MuDTChambPhDigi* dtts_sh2nd = nullptr;
65  for (int bx = 3; bx >= -3; bx--) {
66  vector<int> delta_m, delta_p, delta_0;
67  for (int rpcbx = bx - 1; rpcbx <= bx + 1; rpcbx++) {
68  L1MuDTChambPhDigi* dtts = nullptr;
69  L1MuDTChambPhDigi* rpcts1 = nullptr;
70  dtts = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, bx, track_seg);
71 
72  if (!dtts)
73  continue;
74  int nhits = nRPCHits(m_phiRPCDigis_tm, rpcbx, wheel, sector, station);
75  for (int hit = 0; hit < nhits; hit++) {
76  rpcts1 = m_phiRPCDigis_tm.chPhiSegm(wheel, station, sector, rpcbx, hit);
77  //Store in vectors the dphi of matched dt/rpc
78  if (rpcts1 && dtts && dtts->code() < m_QualityLimit &&
79  deltaPhi(dtts->phi(), rpcts1->phi()) < m_DphiWindow) {
80  if ((dtts->bxNum() - rpcbx) == -1) {
81  delta_m.push_back(deltaPhi(dtts->phi(), rpcts1->phi()));
82  ibx_dtm = dtts->bxNum();
83  fbx_dtm = rpcbx;
84  }
85  if ((dtts->bxNum() - rpcbx) == 0) {
86  delta_0.push_back(deltaPhi(dtts->phi(), rpcts1->phi()));
87  }
88  if ((dtts->bxNum() - rpcbx) == 1) {
89  delta_p.push_back(deltaPhi(dtts->phi(), rpcts1->phi()));
90  ibx_dtp = dtts->bxNum();
91  fbx_dtp = rpcbx;
92  }
93  } //end if dtts and quality
94  }
95  } //end of rpc bx and dtts, rpcts1, dttsnew go out of scope
96 
98  vector<int> delta;
99  delta.insert(delta.end(), delta_0.begin(), delta_0.end());
100  delta.insert(delta.end(), delta_p.begin(), delta_p.end());
101  delta.insert(delta.end(), delta_m.begin(), delta_m.end());
103  if (!delta.empty()) {
104  L1MuDTChambPhDigi* dtts = nullptr;
105  L1MuDTChambPhDigi* dttsnew = nullptr;
106  L1MuDTChambPhDigi* dtts_sh = nullptr;
107  std::vector<L1MuDTChambPhDigi> l1ttma_outsh;
108  //Find the pair the min dphi(rpc,dt)
109  unsigned int min_index = std::distance(delta.begin(), std::min_element(delta.begin(), delta.end())) + 0;
110  int init_bx = 0, final_bx = 0;
111 
112  if (((delta_0.size() <= min_index) && (min_index < (delta_0.size() + delta_p.size())) &&
113  !delta_p.empty())) {
114  init_bx = ibx_dtp;
115  final_bx = fbx_dtp;
116  } else if ((delta_0.size() + delta_p.size()) <= min_index && !delta_m.empty()) {
117  init_bx = ibx_dtm;
118  final_bx = fbx_dtm;
119  } else
120  continue;
121  //Primitve to be shifted in place of dttsnew
122  dtts = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, init_bx, track_seg);
123  dttsnew = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, final_bx, track_seg);
124  bool shift_1 = false;
125  if (dtts && dtts->code() < m_QualityLimit && (!dttsnew || shifted[final_bx + 3] || dups[final_bx + 3])) {
126  dtts_sh = new L1MuDTChambPhDigi(final_bx,
127  dtts->whNum(),
128  dtts->scNum(),
129  dtts->stNum(),
130  dtts->phi(),
131  dtts->phiB(),
132  dtts->code(),
133  dtts->Ts2Tag(),
134  dtts->BxCnt(),
135  1);
136  l1ttma_outsh.push_back(*dtts_sh);
137  shifted[init_bx + 3] = true;
138  shift_1 = true;
139  }
140  if (dtts && dtts->code() < m_QualityLimit && dttsnew)
141  dups[init_bx + 3] = true;
142 
143  //dtts exists and qual lt m_QualityLimit and dttsnew exists and the previous (shift_1) prim was not shifted and there is empty space in second TS
144  if (dtts && dtts->code() < m_QualityLimit && dttsnew && !shift_1 &&
145  !m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, final_bx, flipBit(track_seg))) {
150  if (sign(dtts->phi()) != sign(dttsnew->phi()) && deltaPhi(-(dtts->phi()), dttsnew->phi()) > 100) {
151  dtts_sh2nd = new L1MuDTChambPhDigi(final_bx,
152  dtts->whNum(),
153  dtts->scNum(),
154  dtts->stNum(),
155  dtts->phi(),
156  dtts->phiB(),
157  dtts->code(),
158  flipBit(track_seg),
159  dtts->BxCnt(),
160  1);
161  secondTs[final_bx + 3] = true;
162  dups[init_bx + 3] = false;
163  shifted[init_bx + 3] = true;
164  }
165  }
166  shiftedPhiDTDigis.setContainer(l1ttma_outsh);
167  }
168  } //end of bx
169 
170  for (int bx = -3; bx <= 3; bx++) {
171  L1MuDTChambPhDigi* dtts = nullptr;
172  if (secondTs[bx + 3])
173  if (dtts_sh2nd) {
174  m_l1ttma_out.push_back(*dtts_sh2nd);
175  }
176  dtts = shiftedPhiDTDigis.chPhiSegm(wheel, station, sector, bx, track_seg);
177  if (dtts) {
178  m_l1ttma_out.push_back(*dtts);
179  continue;
180  }
181  if (dups[bx + 3])
182  continue;
184  dtts = m_phiDTDigis_tm.chPhiSegm(wheel, station, sector, bx, track_seg);
185  if (!shifted[bx + 3] && dtts) {
186  m_l1ttma_out.push_back(*dtts);
187  }
188  }
189 
190  } //end of station
191  } //end of sc
192  } //end of wheel
193 }
L1MuDTChambPhDigi * chPhiSegm(int wheel, int stat, int sect, int bx, int ts2tag)
void setContainer(const Phi_Container &inputSegments)
std::vector< L1MuDTChambPhDigi > m_l1ttma_out
int flipBit(int inv)
L1MuDTChambPhContainer m_phiRPCDigis
static int deltaPhi(int dt_phi, int rpc_strip)
static int nRPCHits(L1MuTMChambPhContainer inCon, int bx, int wh, int sec, int st)
Phi_Container const * getContainer() const
L1MuDTChambPhContainer m_phiDTDigis
int DTRPCBxCorrection::deltaPhi ( int  dt_phi,
int  rpc_strip 
)
static

Definition at line 195 of file DTRPCBxCorrection.cc.

References funct::abs(), and HLT_2018_cff::delta_phi.

Referenced by BxCorrection(), getDTContainer(), and DTLowQMatching::Matching().

195  {
196  int delta_phi = abs(dt_phi - rpc2dt_phi);
197  return delta_phi;
198 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int DTRPCBxCorrection::flipBit ( int  inv)
inlineprivate

Definition at line 50 of file DTRPCBxCorrection.h.

References BxCorrection().

Referenced by BxCorrection().

50 { return (inv ^ 1); };
L1MuDTChambPhContainer DTRPCBxCorrection::getDTContainer ( )
inline

Return Output PhContainer.

Definition at line 42 of file DTRPCBxCorrection.h.

References l1GtPatternGenerator_cfi::bx, deltaPhi(), m_dt_tsshifted, nRPCHits(), fileinputsource_cfi::sec, and sign().

42 { return m_dt_tsshifted; }
L1MuDTChambPhContainer m_dt_tsshifted
int DTRPCBxCorrection::nRPCHits ( L1MuTMChambPhContainer  inCon,
int  bx,
int  wh,
int  sec,
int  st 
)
static

Definition at line 208 of file DTRPCBxCorrection.cc.

References L1MuTMChambPhContainer::getContainer(), mps_fire::i, and findQualityFiles::size.

Referenced by BxCorrection(), getDTContainer(), DTLowQMatching::Matching(), and IOPrinter::run().

208  {
209  int size = 0;
210  const std::vector<L1MuDTChambPhDigi>* vInCon = inCon.getContainer();
211  for (auto& i : *vInCon) {
212  if (bx == i.bxNum() && i.code() != 7 && i.whNum() == wh && i.scNum() == sec && i.stNum() == st)
213  size++;
214  }
215 
216  return size;
217 }
size
Write out results.
Phi_Container const * getContainer() const
int DTRPCBxCorrection::nRPCHits ( L1MuDTChambPhContainer  inCon,
int  bx,
int  wh,
int  sec,
int  st 
)
static

Definition at line 219 of file DTRPCBxCorrection.cc.

References L1MuDTChambPhContainer::getContainer(), mps_fire::i, and findQualityFiles::size.

219  {
220  int size = 0;
221  const std::vector<L1MuDTChambPhDigi>* vInCon = inCon.getContainer();
222  for (auto& i : *vInCon) {
223  if (bx == i.bxNum() && i.code() != 7 && i.whNum() == wh && i.scNum() == sec && i.stNum() == st)
224  size++;
225  }
226 
227  return size;
228 }
size
Write out results.
Phi_Container const * getContainer() const
void DTRPCBxCorrection::run ( const edm::EventSetup c)

Definition at line 28 of file DTRPCBxCorrection.cc.

References BxCorrection(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), L1TTwinMuxParams::get_DphiWindowBxShift(), L1TTwinMuxParams::get_USERPCBXFORDTBELOWQUALITY(), m_DphiWindow, m_dt_tsshifted, m_l1ttma_out, m_QualityLimit, edm::ESHandle< T >::product(), L1MuDTChambPhContainer::setContainer(), and tmParamsHandle.

Referenced by ~DTRPCBxCorrection().

28  {
29  const L1TTwinMuxParamsRcd& tmParamsRcd = c.get<L1TTwinMuxParamsRcd>();
30  tmParamsRcd.get(tmParamsHandle);
31  const L1TTwinMuxParams& tmParams = *tmParamsHandle.product();
32 
35 
36  BxCorrection(0);
37  BxCorrection(1);
38 
40 }
int get_DphiWindowBxShift() const
void BxCorrection(int track_seg)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
void setContainer(Phi_Container inputSegments)
std::vector< L1MuDTChambPhDigi > m_l1ttma_out
int get_USERPCBXFORDTBELOWQUALITY() const
T get() const
Definition: EventSetup.h:73
edm::ESHandle< L1TTwinMuxParams > tmParamsHandle
T const * product() const
Definition: ESHandle.h:86
L1MuDTChambPhContainer m_dt_tsshifted
int DTRPCBxCorrection::sign ( float  inv)
private

Definition at line 200 of file DTRPCBxCorrection.cc.

Referenced by BxCorrection(), and getDTContainer().

200  {
201  if (inv < 0)
202  return -1;
203  if (inv > 0)
204  return 1;
205  return 0;
206 }

Member Data Documentation

int DTRPCBxCorrection::m_DphiWindow
private

Definition at line 62 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

L1MuDTChambPhContainer DTRPCBxCorrection::m_dt_tsshifted
private

Definition at line 57 of file DTRPCBxCorrection.h.

Referenced by getDTContainer(), and run().

std::vector<L1MuDTChambPhDigi> DTRPCBxCorrection::m_l1ttma_out
private

Definition at line 59 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

L1MuDTChambPhContainer DTRPCBxCorrection::m_phiDTDigis
private

Definition at line 55 of file DTRPCBxCorrection.h.

Referenced by BxCorrection().

L1MuDTChambPhContainer DTRPCBxCorrection::m_phiRPCDigis
private

Definition at line 56 of file DTRPCBxCorrection.h.

Referenced by BxCorrection().

int DTRPCBxCorrection::m_QualityLimit
private

Definition at line 61 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

edm::ESHandle<L1TTwinMuxParams> DTRPCBxCorrection::tmParamsHandle

Definition at line 39 of file DTRPCBxCorrection.h.

Referenced by run().