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.

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

Definition at line 35 of file DTRPCBxCorrection.h.

References EnergyCorrector::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 L1MuDTChambPhDigi::BxCnt(), L1MuDTChambPhDigi::bxNum(), L1MuTMChambPhContainer::chPhiSegm(), L1MuDTChambPhDigi::code(), delta, deltaPhi(), SoftLeptonByDistance_cfi::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 
44  auto m_phiDTDigis_tm=std::make_shared<L1MuTMChambPhContainer>();
45  //std::shared_ptr<L1MuTMChambPhContainer> m_phiDTDigis_tm (new L1MuTMChambPhContainer);
46  const std::vector<L1MuDTChambPhDigi> *phiChambVectorDT;
47  phiChambVectorDT= m_phiDTDigis.getContainer();
48  m_phiDTDigis_tm->setContainer(*phiChambVectorDT);
49  auto m_phiRPCDigis_tm=std::make_shared<L1MuTMChambPhContainer>();
50  //std::shared_ptr<L1MuTMChambPhContainer> m_phiRPCDigis_tm (new L1MuTMChambPhContainer);
51  const std::vector<L1MuDTChambPhDigi> *phiChambVectorRPC;
52  phiChambVectorRPC= m_phiRPCDigis.getContainer();
53  m_phiRPCDigis_tm->setContainer(*phiChambVectorRPC);
54 
55  int ibx_dtm = 0, fbx_dtm = 0;
56  int ibx_dtp = 0, fbx_dtp = 0;
57 
58  for (int wheel=-2;wheel<=2; wheel++ ){
59  for (int sector=0;sector<12; sector++ ){
60  for (int station=1; station<=4; station++){
61  bool shifted[7] = {false, false, false, false,false, false, false};
62  bool dups[7] = {false, false, false, false,false, false, false};
63  bool secondTs[7] = {false, false, false, false,false, false, false};
64  L1MuTMChambPhContainer shiftedPhiDTDigis;
65  L1MuDTChambPhDigi *dtts_sh2nd = nullptr;
66  for(int bx=3; bx>=-3; bx--){
67  vector<int> delta_m, delta_p, delta_0;
68  for(int rpcbx=bx-1; rpcbx<=bx+1; rpcbx++){
69  L1MuDTChambPhDigi * dtts=nullptr;
70  L1MuDTChambPhDigi * rpcts1=nullptr;
71  dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,bx ,track_seg);
72 
73  if(!dtts ) 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 && deltaPhi(dtts->phi(),rpcts1->phi()) < m_DphiWindow){
79  if((dtts->bxNum()-rpcbx)==-1 ) {
80  delta_m.push_back( deltaPhi(dtts->phi(),rpcts1->phi()) );
81  ibx_dtm = dtts->bxNum();
82  fbx_dtm = rpcbx;
83  }
84  if((dtts->bxNum()-rpcbx)==0 ) {
85  delta_0.push_back( deltaPhi(dtts->phi(),rpcts1->phi()) );
86  }
87  if((dtts->bxNum()-rpcbx)==1 ) {
88  delta_p.push_back( deltaPhi(dtts->phi(),rpcts1->phi()) );
89  ibx_dtp = dtts->bxNum();
90  fbx_dtp = rpcbx;
91  }
92  }//end if dtts and quality
93  }
94  }//end of rpc bx and dtts, rpcts1, dttsnew go out of scope
95 
97  vector<int> delta;
98  delta.insert(delta.end(), delta_0.begin(), delta_0.end());
99  delta.insert(delta.end(), delta_p.begin(), delta_p.end());
100  delta.insert(delta.end(), delta_m.begin(), delta_m.end());
102  if(!delta.empty()){
103  L1MuDTChambPhDigi * dtts=nullptr;
104  L1MuDTChambPhDigi * dttsnew=nullptr;
105  L1MuDTChambPhDigi * dtts_sh=nullptr;
106  std::vector<L1MuDTChambPhDigi> l1ttma_outsh;
107  //Find the pair the min dphi(rpc,dt)
108  unsigned int min_index = std::distance(delta.begin(), std::min_element(delta.begin(), delta.end())) + 0;
109  int init_bx = 0, final_bx = 0;
110 
111  if ( ((delta_0.size() <= min_index) && ( min_index < (delta_0.size() + delta_p.size()) ) && !delta_p.empty() ) ) {
112  init_bx = ibx_dtp;
113  final_bx = fbx_dtp;
114  }
115  else if ( (delta_0.size() + delta_p.size()) <= min_index && !delta_m.empty() ) {
116  init_bx = ibx_dtm;
117  final_bx = fbx_dtm;
118  }
119  else continue;
120  //Primitve to be shifted in place of dttsnew
121  dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,init_bx,track_seg);
122  dttsnew = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,final_bx,track_seg);
123  bool shift_1 = false;
124  if(dtts && dtts->code()<m_QualityLimit && (!dttsnew || shifted[final_bx+3] || dups[final_bx+3])) {
125  dtts_sh = new L1MuDTChambPhDigi( final_bx , dtts->whNum(), dtts->scNum(), dtts->stNum(),dtts->phi(), dtts->phiB(), dtts->code(), dtts->Ts2Tag(), dtts->BxCnt(),1);
126  l1ttma_outsh.push_back(*dtts_sh);
127  shifted[init_bx+3] = true;
128  shift_1 = true;}
129  if(dtts && dtts->code()<m_QualityLimit && dttsnew) dups[init_bx+3] = true;
130 
131  //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
132  if(dtts && dtts->code()<m_QualityLimit && dttsnew && !shift_1 && !m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,final_bx,flipBit(track_seg)) ) {
137  if(sign(dtts->phi())!=sign(dttsnew->phi())&& deltaPhi(-(dtts->phi()),dttsnew->phi())>100) {
138  dtts_sh2nd = new L1MuDTChambPhDigi( final_bx , dtts->whNum(), dtts->scNum(), dtts->stNum(),dtts->phi(), dtts->phiB(), dtts->code(), flipBit(track_seg), dtts->BxCnt(),1);
139  secondTs[final_bx+3] = true;
140  dups[init_bx+3] = false;
141  shifted[init_bx+3] = true;
142  }
143  }
144  shiftedPhiDTDigis.setContainer(l1ttma_outsh);
145  }
146  }//end of bx
147 
148  for(int bx=-3; bx<=3; bx++){
149  L1MuDTChambPhDigi * dtts=nullptr;
150  if(secondTs[bx+3] )
151  if(dtts_sh2nd) {m_l1ttma_out.push_back(*dtts_sh2nd); }
152  dtts = shiftedPhiDTDigis.chPhiSegm(wheel,station,sector,bx,track_seg);
153  if(dtts){m_l1ttma_out.push_back(*dtts);
154  continue;}
155  if(dups[bx+3]) continue;
157  dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,bx,track_seg);
158  if(!shifted[bx+3] && dtts) {
159  m_l1ttma_out.push_back(*dtts);
160  }
161  }
162 
163  }//end of station
164  }//end of sc
165  }//end of wheel
166 }
dbl * delta
Definition: mlp_gen.cc:36
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 168 of file DTRPCBxCorrection.cc.

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

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

168  {
169  int delta_phi = abs( dt_phi - rpc2dt_phi );
170  return delta_phi;
171 }
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 deltaPhi(), m_dt_tsshifted, nRPCHits(), 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 179 of file DTRPCBxCorrection.cc.

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

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

179  {
180  int size = 0;
181  const std::vector<L1MuDTChambPhDigi>* vInCon = inCon.getContainer();
182  for ( auto &i: *vInCon){
183  if (bx == i.bxNum() && i.code() != 7 && i.whNum()==wh && i.scNum()==sec && i.stNum()==st) size++;
184  }
185 
186  return size;
187 }
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 189 of file DTRPCBxCorrection.cc.

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

189  {
190  int size = 0;
191  const std::vector<L1MuDTChambPhDigi>* vInCon = inCon.getContainer();
192  for ( auto &i:* vInCon){
193  if (bx == i.bxNum() && i.code() != 7 && i.whNum()==wh && i.scNum()==sec && i.stNum()==st) size++;
194  }
195 
196  return size;
197 }
size
Write out results.
Phi_Container const * getContainer() const
void DTRPCBxCorrection::run ( const edm::EventSetup c)

Definition at line 27 of file DTRPCBxCorrection.cc.

References BxCorrection(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::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().

27  {
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)
void get(HolderT &iHolder) const
std::vector< L1MuDTChambPhDigi > m_l1ttma_out
int get_USERPCBXFORDTBELOWQUALITY() const
const T & get() const
Definition: EventSetup.h:59
void setContainer(const Phi_Container &inputSegments)
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 173 of file DTRPCBxCorrection.cc.

Referenced by BxCorrection(), and getDTContainer().

173  {
174  if(inv<0) return -1;
175  if(inv>0) return 1;
176  return 0;
177 }

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().