-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RPCtoDTTranslator #25275
Fix RPCtoDTTranslator #25275
Changes from all commits
7eced50
2e1e2d0
d6ae57c
bb2e431
1b118cc
5f66c38
8160364
e32e2e3
a08e83a
04bed52
29a8a53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,16 +41,16 @@ void DTRPCBxCorrection::run( const edm::EventSetup& c) { | |
|
||
void DTRPCBxCorrection::BxCorrection(int track_seg){ | ||
|
||
auto m_phiDTDigis_tm=std::make_shared<L1MuTMChambPhContainer>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The share_ptr only lived as long as the function. |
||
L1MuTMChambPhContainer m_phiDTDigis_tm; | ||
//std::shared_ptr<L1MuTMChambPhContainer> m_phiDTDigis_tm (new L1MuTMChambPhContainer); | ||
const std::vector<L1MuDTChambPhDigi> *phiChambVectorDT; | ||
phiChambVectorDT= m_phiDTDigis.getContainer(); | ||
m_phiDTDigis_tm->setContainer(*phiChambVectorDT); | ||
auto m_phiRPCDigis_tm=std::make_shared<L1MuTMChambPhContainer>(); | ||
m_phiDTDigis_tm.setContainer(*phiChambVectorDT); | ||
L1MuTMChambPhContainer m_phiRPCDigis_tm; | ||
//std::shared_ptr<L1MuTMChambPhContainer> m_phiRPCDigis_tm (new L1MuTMChambPhContainer); | ||
const std::vector<L1MuDTChambPhDigi> *phiChambVectorRPC; | ||
phiChambVectorRPC= m_phiRPCDigis.getContainer(); | ||
m_phiRPCDigis_tm->setContainer(*phiChambVectorRPC); | ||
m_phiRPCDigis_tm.setContainer(*phiChambVectorRPC); | ||
|
||
int ibx_dtm = 0, fbx_dtm = 0; | ||
int ibx_dtp = 0, fbx_dtp = 0; | ||
|
@@ -68,12 +68,12 @@ void DTRPCBxCorrection::BxCorrection(int track_seg){ | |
for(int rpcbx=bx-1; rpcbx<=bx+1; rpcbx++){ | ||
L1MuDTChambPhDigi * dtts=nullptr; | ||
L1MuDTChambPhDigi * rpcts1=nullptr; | ||
dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,bx ,track_seg); | ||
dtts = m_phiDTDigis_tm.chPhiSegm(wheel,station,sector,bx ,track_seg); | ||
|
||
if(!dtts ) continue; | ||
int nhits = nRPCHits(*m_phiRPCDigis_tm, rpcbx, wheel, sector, station); | ||
int nhits = nRPCHits(m_phiRPCDigis_tm, rpcbx, wheel, sector, station); | ||
for(int hit=0; hit<nhits; hit++){ | ||
rpcts1 = m_phiRPCDigis_tm->chPhiSegm(wheel, station, sector, rpcbx,hit); | ||
rpcts1 = m_phiRPCDigis_tm.chPhiSegm(wheel, station, sector, rpcbx,hit); | ||
//Store in vectors the dphi of matched dt/rpc | ||
if(rpcts1 && dtts && dtts->code()<m_QualityLimit && deltaPhi(dtts->phi(),rpcts1->phi()) < m_DphiWindow){ | ||
if((dtts->bxNum()-rpcbx)==-1 ) { | ||
|
@@ -118,8 +118,8 @@ void DTRPCBxCorrection::BxCorrection(int track_seg){ | |
} | ||
else continue; | ||
//Primitve to be shifted in place of dttsnew | ||
dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,init_bx,track_seg); | ||
dttsnew = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,final_bx,track_seg); | ||
dtts = m_phiDTDigis_tm.chPhiSegm(wheel,station,sector,init_bx,track_seg); | ||
dttsnew = m_phiDTDigis_tm.chPhiSegm(wheel,station,sector,final_bx,track_seg); | ||
bool shift_1 = false; | ||
if(dtts && dtts->code()<m_QualityLimit && (!dttsnew || shifted[final_bx+3] || dups[final_bx+3])) { | ||
dtts_sh = new L1MuDTChambPhDigi( final_bx , dtts->whNum(), dtts->scNum(), dtts->stNum(),dtts->phi(), dtts->phiB(), dtts->code(), dtts->Ts2Tag(), dtts->BxCnt(),1); | ||
|
@@ -129,7 +129,7 @@ void DTRPCBxCorrection::BxCorrection(int track_seg){ | |
if(dtts && dtts->code()<m_QualityLimit && dttsnew) dups[init_bx+3] = true; | ||
|
||
//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 | ||
if(dtts && dtts->code()<m_QualityLimit && dttsnew && !shift_1 && !m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,final_bx,flipBit(track_seg)) ) { | ||
if(dtts && dtts->code()<m_QualityLimit && dttsnew && !shift_1 && !m_phiDTDigis_tm.chPhiSegm(wheel,station,sector,final_bx,flipBit(track_seg)) ) { | ||
///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 | ||
|
@@ -154,7 +154,7 @@ void DTRPCBxCorrection::BxCorrection(int track_seg){ | |
continue;} | ||
if(dups[bx+3]) continue; | ||
///if there is no shift then put the original primitive | ||
dtts = m_phiDTDigis_tm->chPhiSegm(wheel,station,sector,bx,track_seg); | ||
dtts = m_phiDTDigis_tm.chPhiSegm(wheel,station,sector,bx,track_seg); | ||
if(!shifted[bx+3] && dtts) { | ||
m_l1ttma_out.push_back(*dtts); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,6 @@ void IOPrinter::run(edm::Handle<L1MuDTChambPhContainer> inphiDigis, const L1MuDT | |
|
||
cout<<"======================================================"<<endl; | ||
int bx=0, wheel=0, sector=0, station=1; | ||
L1MuDTChambPhDigi const* dtts1=nullptr; | ||
L1MuDTChambPhDigi const* dtts2=nullptr; | ||
|
||
///Align track segments that are coming in bx-1. | ||
cout<<"DT Inputs/RPCDT Inputs"<<endl; | ||
|
@@ -30,9 +28,8 @@ void IOPrinter::run(edm::Handle<L1MuDTChambPhContainer> inphiDigis, const L1MuDT | |
for (sector=0;sector<12; sector++ ){ | ||
for (station=1; station<=4; station++){ | ||
|
||
dtts1=nullptr; dtts2=nullptr; | ||
dtts1 = inphiDigis->chPhiSegm1(wheel,station,sector,bx); | ||
dtts2 = inphiDigis->chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
auto dtts1 = inphiDigis->chPhiSegm1(wheel,station,sector,bx); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variables are only used within the loop so should be scoped appropriately. |
||
auto dtts2 = inphiDigis->chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
if(dtts1 && dtts1->code()!=7) { | ||
L1MuDTChambPhDigi dt_ts1 = *dtts1; | ||
cout<<dtts1->bxNum()<<"\t"<<dtts1->whNum()<<"\t"<<dtts1->scNum()<<"\t"<<dtts1->stNum()<<"\t"<<dtts1->phi()<<"\t"<<dtts1->phiB()<<"\t"<<dtts1->code()<<"\t"<<dtts1->Ts2Tag()<<"\t"<<dtts1->BxCnt()<<"\t0"<<endl; | ||
|
@@ -68,19 +65,15 @@ void IOPrinter::run(edm::Handle<L1MuDTChambPhContainer> inphiDigis, const L1MuDT | |
|
||
cout<<"TwinMux Output"<<endl; | ||
cout<<"bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit"<<endl; | ||
dtts1=nullptr; | ||
dtts2=nullptr; | ||
|
||
|
||
for(bx=-2; bx<=2; bx++){ | ||
for (wheel=-2;wheel<=2; wheel++ ){ | ||
for (sector=0;sector<12; sector++ ){ | ||
for (station=1; station<=4; station++){ | ||
|
||
dtts1=nullptr; dtts2=nullptr; | ||
|
||
dtts1 = outphiDigis.chPhiSegm1(wheel,station,sector,bx); | ||
dtts2 = outphiDigis.chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
auto dtts1 = outphiDigis.chPhiSegm1(wheel,station,sector,bx); | ||
auto dtts2 = outphiDigis.chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
if(dtts1&& dtts1->code()!=7) { | ||
L1MuDTChambPhDigi dt_ts1 = *dtts1; | ||
cout<<dtts1->bxNum()<<"\t"<<dtts1->whNum()<<"\t"<<dtts1->scNum()<<"\t"<<dtts1->stNum()<<"\t"<<dtts1->phi()<<"\t"<<dtts1->phiB()<<"\t"<<dtts1->code()<<"\t"<<dtts1->Ts2Tag()<<"\t"<<dtts1->BxCnt()<<"\t"<<dtts1->RpcBit()<<endl; | ||
|
@@ -99,15 +92,13 @@ cout<<"======================================================"<<endl; | |
} | ||
|
||
|
||
void IOPrinter::run(L1MuDTChambPhContainer* inphiDigis,const L1MuDTChambPhContainer & outphiDigis,RPCDigiCollection* rpcDigis,const edm::EventSetup& c) { | ||
void IOPrinter::run(L1MuDTChambPhContainer const* inphiDigis,const L1MuDTChambPhContainer & outphiDigis,RPCDigiCollection const* rpcDigis,const edm::EventSetup& c) { | ||
|
||
cout<<"======================================================"<<endl; | ||
int bx=0, wheel=0, sector=0, station=1; | ||
L1MuDTChambPhDigi const* dtts1=nullptr; | ||
L1MuDTChambPhDigi const* dtts2=nullptr; | ||
L1MuTMChambPhContainer * inphiDigis_tm=nullptr; | ||
L1MuTMChambPhContainer inphiDigis_tm; | ||
const std::vector<L1MuDTChambPhDigi> * vInCon=inphiDigis->getContainer(); | ||
inphiDigis_tm->setContainer(*vInCon); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would actually have caused address 0 to be written on (since linke 108 the value is set to nullptr) which would cause a segmentation violation. |
||
inphiDigis_tm.setContainer(*vInCon); | ||
|
||
|
||
///Align track segments that are coming in bx-1. | ||
|
@@ -120,8 +111,7 @@ void IOPrinter::run(L1MuDTChambPhContainer* inphiDigis,const L1MuDTChambPhContai | |
for (station=1; station<=4; station++){ | ||
int nhits = DTRPCBxCorrection::nRPCHits(*inphiDigis, bx, wheel, sector, station); | ||
for(int hit=0; hit<nhits; hit++){ | ||
dtts1=nullptr; | ||
dtts1 = inphiDigis_tm->chPhiSegm(wheel,station,sector,bx,hit); | ||
auto dtts1 = inphiDigis_tm.chPhiSegm(wheel,station,sector,bx,hit); | ||
if(dtts1) { | ||
cout<<dtts1->bxNum()<<"\t"<<dtts1->whNum()<<"\t"<<dtts1->scNum()<<"\t"<<dtts1->stNum()<<"\t"<<dtts1->phi()<<"\t"<<dtts1->phiB()<<"\t"<<dtts1->code()<<"\t"<<dtts1->Ts2Tag()<<"\t"<<dtts1->BxCnt()<<"\t0"<<endl; | ||
} | ||
|
@@ -153,19 +143,15 @@ void IOPrinter::run(L1MuDTChambPhContainer* inphiDigis,const L1MuDTChambPhContai | |
|
||
cout<<"TwinMux Output"<<endl; | ||
cout<<"bx\twheel\tsector\tstation\tphi\tphib\tcode\tts2tag\tbxcnt\trpcbit"<<endl; | ||
dtts1=nullptr; | ||
dtts2=nullptr; | ||
|
||
|
||
for(bx=-2; bx<=2; bx++){ | ||
for (wheel=-2;wheel<=2; wheel++ ){ | ||
for (sector=0;sector<12; sector++ ){ | ||
for (station=1; station<=4; station++){ | ||
|
||
dtts1=nullptr; dtts2=nullptr; | ||
|
||
dtts1 = outphiDigis.chPhiSegm1(wheel,station,sector,bx); | ||
dtts2 = outphiDigis.chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
auto dtts1 = outphiDigis.chPhiSegm1(wheel,station,sector,bx); | ||
auto dtts2 = outphiDigis.chPhiSegm2(wheel,station,sector,bx - 1 ); | ||
if(dtts1&& dtts1->code()!=7) { | ||
L1MuDTChambPhDigi dt_ts1 = *dtts1; | ||
cout<<dtts1->bxNum()<<"\t"<<dtts1->whNum()<<"\t"<<dtts1->scNum()<<"\t"<<dtts1->stNum()<<"\t"<<dtts1->phi()<<"\t"<<dtts1->phiB()<<"\t"<<dtts1->code()<<"\t"<<dtts1->Ts2Tag()<<"\t"<<dtts1->BxCnt()<<"\t"<<dtts1->RpcBit()<<endl; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,29 +47,29 @@ edm::Handle<L1MuDTChambThContainer> thetaDigis, edm::Handle<RPCDigiCollection> r | |
|
||
|
||
///Align track segments that are coming in bx-1. | ||
auto alignedDTs=std::make_shared<AlignTrackSegments>(*inphiDigis); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The shared_ptrs in this routine only have the lifetime of this function. |
||
alignedDTs->run(c); | ||
L1MuDTChambPhContainer phiDigis = alignedDTs->getDTContainer(); | ||
AlignTrackSegments alignedDTs{*inphiDigis}; | ||
alignedDTs.run(c); | ||
L1MuDTChambPhContainer const& phiDigis = alignedDTs.getDTContainer(); | ||
//if only DTs are required without bx correction | ||
//return the aligned track segments | ||
if(onlyDT && !correctBX && !useLowQDT) { | ||
m_tm_phi_output = phiDigis; | ||
return; | ||
} | ||
///Clean RPC hits | ||
auto rpcHitCl=std::make_shared<RPCHitCleaner>(*rpcDigis); | ||
rpcHitCl->run(c); | ||
RPCDigiCollection rpcDigisCleaned = rpcHitCl->getRPCCollection(); | ||
RPCHitCleaner rpcHitCl{*rpcDigis}; | ||
rpcHitCl.run(c); | ||
RPCDigiCollection const& rpcDigisCleaned = rpcHitCl.getRPCCollection(); | ||
|
||
///Translate RPC digis to DT primitives. | ||
auto dt_from_rpc= std::make_shared<RPCtoDTTranslator>(rpcDigisCleaned); | ||
dt_from_rpc->run(c); | ||
L1MuDTChambPhContainer rpcPhiDigis = dt_from_rpc->getDTContainer(); //Primitves used for RPC->DT (only station 1 and 2) | ||
L1MuDTChambPhContainer rpcHitsPhiDigis = dt_from_rpc->getDTRPCHitsContainer(); //Primitves used for bx correction | ||
RPCtoDTTranslator dt_from_rpc{rpcDigisCleaned}; | ||
dt_from_rpc.run(c); | ||
L1MuDTChambPhContainer const& rpcPhiDigis = dt_from_rpc.getDTContainer(); //Primitves used for RPC->DT (only station 1 and 2) | ||
L1MuDTChambPhContainer const& rpcHitsPhiDigis = dt_from_rpc.getDTRPCHitsContainer(); //Primitves used for bx correction | ||
|
||
///Match low q DT primitives with RPC hits in dphiWindow | ||
auto dtlowq= std::make_shared<DTLowQMatching>(&phiDigis, rpcHitsPhiDigis); | ||
dtlowq->run(c); | ||
DTLowQMatching dtlowq{&phiDigis, rpcHitsPhiDigis}; | ||
dtlowq.run(c); | ||
|
||
if(onlyDT && !correctBX && useLowQDT) { | ||
m_tm_phi_output = phiDigis; | ||
|
@@ -88,10 +88,10 @@ edm::Handle<L1MuDTChambThContainer> thetaDigis, edm::Handle<RPCDigiCollection> r | |
|
||
///Correct(in bx) DT primitives by comparing them to RPC. | ||
// DTRPCBxCorrection *rpc_dt_bx = new DTRPCBxCorrection(phiDigis,rpcHitsPhiDigis); | ||
auto rpc_dt_bx=std::make_shared<DTRPCBxCorrection>(phiDigis,rpcHitsPhiDigis); | ||
rpc_dt_bx->run(c); | ||
DTRPCBxCorrection rpc_dt_bx{phiDigis,rpcHitsPhiDigis}; | ||
rpc_dt_bx.run(c); | ||
|
||
L1MuDTChambPhContainer phiDigiscp = rpc_dt_bx->getDTContainer(); | ||
L1MuDTChambPhContainer const& phiDigiscp = rpc_dt_bx.getDTContainer(); | ||
|
||
///Add RPC primitives in case that there are no DT primitives. | ||
std::vector<L1MuDTChambPhDigi> l1ttma_out; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shared_ptr only had the lifetime of this function.