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 (L1MuDTChambPhContainer inCon, int bx, int wh, int sec, int st)
 
static int nRPCHits (L1MuTMChambPhContainer 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::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  };

◆ ~DTRPCBxCorrection()

DTRPCBxCorrection::~DTRPCBxCorrection ( )
inline

Definition at line 35 of file DTRPCBxCorrection.h.

35 {};

Member Function Documentation

◆ BxCorrection()

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.

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 }

References simKBmtfDigis_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 run().

◆ deltaPhi()

int DTRPCBxCorrection::deltaPhi ( int  dt_phi,
int  rpc_strip 
)
static

Definition at line 195 of file DTRPCBxCorrection.cc.

195  {
196  int delta_phi = abs(dt_phi - rpc2dt_phi);
197  return delta_phi;
198 }

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

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

◆ flipBit()

int DTRPCBxCorrection::flipBit ( int  inv)
inlineprivate

Definition at line 50 of file DTRPCBxCorrection.h.

50 { return (inv ^ 1); };

Referenced by BxCorrection().

◆ getDTContainer()

L1MuDTChambPhContainer DTRPCBxCorrection::getDTContainer ( )
inline

Return Output PhContainer.

Definition at line 42 of file DTRPCBxCorrection.h.

42 { return m_dt_tsshifted; }

References m_dt_tsshifted.

◆ nRPCHits() [1/2]

int DTRPCBxCorrection::nRPCHits ( L1MuDTChambPhContainer  inCon,
int  bx,
int  wh,
int  sec,
int  st 
)
static

Definition at line 219 of file DTRPCBxCorrection.cc.

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 }

References simKBmtfDigis_cfi::bx, L1MuDTChambPhContainer::getContainer(), mps_fire::i, fileinputsource_cfi::sec, and findQualityFiles::size.

◆ nRPCHits() [2/2]

int DTRPCBxCorrection::nRPCHits ( L1MuTMChambPhContainer  inCon,
int  bx,
int  wh,
int  sec,
int  st 
)
static

Definition at line 208 of file DTRPCBxCorrection.cc.

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 }

References simKBmtfDigis_cfi::bx, L1MuTMChambPhContainer::getContainer(), mps_fire::i, fileinputsource_cfi::sec, and findQualityFiles::size.

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

◆ run()

void DTRPCBxCorrection::run ( const edm::EventSetup c)

◆ sign()

int DTRPCBxCorrection::sign ( float  inv)
private

Definition at line 200 of file DTRPCBxCorrection.cc.

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

Referenced by BxCorrection().

Member Data Documentation

◆ m_DphiWindow

int DTRPCBxCorrection::m_DphiWindow
private

Definition at line 62 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

◆ m_dt_tsshifted

L1MuDTChambPhContainer DTRPCBxCorrection::m_dt_tsshifted
private

Definition at line 57 of file DTRPCBxCorrection.h.

Referenced by getDTContainer(), and run().

◆ m_l1ttma_out

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

Definition at line 59 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

◆ m_phiDTDigis

L1MuDTChambPhContainer DTRPCBxCorrection::m_phiDTDigis
private

Definition at line 55 of file DTRPCBxCorrection.h.

Referenced by BxCorrection().

◆ m_phiRPCDigis

L1MuDTChambPhContainer DTRPCBxCorrection::m_phiRPCDigis
private

Definition at line 56 of file DTRPCBxCorrection.h.

Referenced by BxCorrection().

◆ m_QualityLimit

int DTRPCBxCorrection::m_QualityLimit
private

Definition at line 61 of file DTRPCBxCorrection.h.

Referenced by BxCorrection(), and run().

◆ tmParamsHandle

edm::ESHandle<L1TTwinMuxParams> DTRPCBxCorrection::tmParamsHandle

Definition at line 39 of file DTRPCBxCorrection.h.

Referenced by run().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
DTRPCBxCorrection::m_DphiWindow
int m_DphiWindow
Definition: DTRPCBxCorrection.h:62
HLT_2018_cff.delta_phi
delta_phi
Definition: HLT_2018_cff.py:10311
DTRPCBxCorrection::m_phiDTDigis
L1MuDTChambPhContainer m_phiDTDigis
Definition: DTRPCBxCorrection.h:55
mps_fire.i
i
Definition: mps_fire.py:355
L1MuDTChambPhDigi::stNum
int stNum() const
Definition: L1MuDTChambPhDigi.cc:72
L1MuTMChambPhContainer::setContainer
void setContainer(const Phi_Container &inputSegments)
Definition: L1MuTMChambPhContainer.cc:44
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DTRPCBxCorrection::m_QualityLimit
int m_QualityLimit
Definition: DTRPCBxCorrection.h:61
L1MuDTChambPhDigi::whNum
int whNum() const
Definition: L1MuDTChambPhDigi.cc:70
L1MuTMChambPhContainer::getContainer
Phi_Container const * getContainer() const
Definition: L1MuTMChambPhContainer.cc:46
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
L1MuDTChambPhDigi::phiB
int phiB() const
Definition: L1MuDTChambPhDigi.cc:76
L1MuDTChambPhContainer::getContainer
Phi_Container const * getContainer() const
Definition: L1MuDTChambPhContainer.cc:41
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
DTRPCBxCorrection::BxCorrection
void BxCorrection(int track_seg)
Definition: DTRPCBxCorrection.cc:42
DTRPCBxCorrection::sign
int sign(float)
Definition: DTRPCBxCorrection.cc:200
L1MuDTChambPhContainer::setContainer
void setContainer(Phi_Container inputSegments)
Definition: L1MuDTChambPhContainer.cc:39
L1MuDTChambPhDigi::BxCnt
int BxCnt() const
Definition: L1MuDTChambPhDigi.cc:82
L1TTwinMuxParams::get_DphiWindowBxShift
int get_DphiWindowBxShift() const
Definition: L1TTwinMuxParams.h:75
L1MuDTChambPhDigi::phi
int phi() const
Definition: L1MuDTChambPhDigi.cc:74
nhits
Definition: HIMultiTrackSelector.h:42
L1MuTMChambPhContainer
Definition: L1MuTMChambPhContainer.h:33
DTRPCBxCorrection::flipBit
int flipBit(int inv)
Definition: DTRPCBxCorrection.h:50
L1MuDTChambPhDigi::bxNum
int bxNum() const
Definition: L1MuDTChambPhDigi.cc:68
DTRPCBxCorrection::nRPCHits
static int nRPCHits(L1MuTMChambPhContainer inCon, int bx, int wh, int sec, int st)
Definition: DTRPCBxCorrection.cc:208
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
DTRPCBxCorrection::m_phiRPCDigis
L1MuDTChambPhContainer m_phiRPCDigis
Definition: DTRPCBxCorrection.h:56
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
DTRPCBxCorrection::deltaPhi
static int deltaPhi(int dt_phi, int rpc_strip)
Definition: DTRPCBxCorrection.cc:195
L1TTwinMuxParamsRcd
Definition: L1TTwinMuxParamsRcd.h:14
L1MuDTChambPhDigi::scNum
int scNum() const
Definition: L1MuDTChambPhDigi.cc:71
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
DTRPCBxCorrection::m_l1ttma_out
std::vector< L1MuDTChambPhDigi > m_l1ttma_out
Definition: DTRPCBxCorrection.h:59
DTRPCBxCorrection::m_dt_tsshifted
L1MuDTChambPhContainer m_dt_tsshifted
Definition: DTRPCBxCorrection.h:57
L1TTwinMuxParams::get_USERPCBXFORDTBELOWQUALITY
int get_USERPCBXFORDTBELOWQUALITY() const
Definition: L1TTwinMuxParams.h:57
L1MuTMChambPhContainer::chPhiSegm
L1MuDTChambPhDigi * chPhiSegm(int wheel, int stat, int sect, int bx, int ts2tag)
Definition: L1MuTMChambPhContainer.cc:92
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
L1MuDTChambPhDigi::Ts2Tag
int Ts2Tag() const
Definition: L1MuDTChambPhDigi.cc:80
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuDTChambPhDigi::code
int code() const
Definition: L1MuDTChambPhDigi.cc:78
hit
Definition: SiStripHitEffFromCalibTree.cc:88
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31
DTRPCBxCorrection::tmParamsHandle
edm::ESHandle< L1TTwinMuxParams > tmParamsHandle
Definition: DTRPCBxCorrection.h:39
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
L1TTwinMuxParams
Definition: L1TTwinMuxParams.h:19