Skip to content
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

Merged
merged 11 commits into from Nov 20, 2018
Merged

Fix RPCtoDTTranslator #25275

merged 11 commits into from Nov 20, 2018

Conversation

Dr15Jones
Copy link
Contributor

Fixed a crash in RPCtoDTTranslator (the first commit)
Also did code improvements to the package, including one case where the orginal code would have lead to a crash.

This avoids a crash seen in production.
In addition, moved declaration of additional loop variables to be
within the scope of the loop.
The constructor now holds a const& to the collection.
Create a L1MuTMChambPhContainer on the stack rather than having
a pointer to null.
Also made calling arguments const.
The helper classes were being made each call and where being allocated
via a shared_ptr. Putting them on the stack is more efficient.

Also tried to avoid some copies of returned values.
Moved the variables to be on the stack. They have the same lifetime
as before but can be handled more efficiently.
@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 18, 2018

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/31721/console Started: 2018/11/18 20:01

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones (Chris Jones) for master.

It involves the following packages:

L1Trigger/L1TTwinMux

@nsmith-, @rekovic, @cmsbuild, @thomreis can you please review it and eventually sign? Thanks.
@Martin-Grunewald this is something you requested to watch as well.
@davidlange6, @slava77, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor Author

NOTE: many of the helper classes in this package, e.g. RPCHitCleaner, should just be converted to a function which takes as arguments the values passed to the constructor and return the value accessed from the get* function.

@fabiocos
Copy link
Contributor

please test workflow 136.855,136.867,136.879,136.891

@@ -41,15 +41,15 @@ void DTLowQMatching::Matching(int track_seg){

L1MuDTChambPhDigi * dtts=nullptr;
L1MuDTChambPhDigi * rpcts1=nullptr;
auto m_phiRPCDigis_tm=std::make_shared<L1MuTMChambPhContainer>();
Copy link
Contributor Author

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.

@@ -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>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The share_ptr only lived as long as the function.

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

const std::vector<L1MuDTChambPhDigi> * vInCon=inphiDigis->getContainer();
inphiDigis_tm->setContainer(*vInCon);
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

}

namespace {
constexpr int max_rpc_bx = 2;
constexpr int min_rpc_bx = -2;

struct rpc_hit
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The struct is only used within the implementation so it is better to encapsulate it here.

int strip;
int roll;
int layer;
rpc_hit(int pbx, int pstation,int psector, int pwheel, RPCDetId pdet, int pstrip, int proll, int player) : bx(pbx),station(pstation),sector(psector),wheel(pwheel), detid(pdet),strip(pstrip),roll(proll),layer(player) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor is needed for the call to emplace_back.

if(detid.station()==3) vrpc_hit_st3.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
if(detid.layer()==2) vrpc_hit_layer2.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
if(detid.station()==4) vrpc_hit_st4.push_back({digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer()});
if(detid.layer()==1) vrpc_hit_layer1.emplace_back(digi->bx(), detid.station(), detid.sector(), detid.ring(), detid, digi->strip(), detid.roll(), detid.layer());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emplace_back avoids the need to create a temporary and then copy it.

@@ -135,7 +145,7 @@ void RPCtoDTTranslator::run(const edm::EventSetup& c) {
phi1 = phi1 + (radialAngle(vrpc_hit_layer1[l1-1].detid, c, vrpc_hit_layer1[l1-1].strip));
phi1 /= 2;
}

int itr2 = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one line needed to avoid the crash.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25275/31721/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 32
  • DQMHistoTests: Total histograms compared: 3013311
  • DQMHistoTests: Total failures: 30
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3013084
  • DQMHistoTests: Total skipped: 197
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 31 files compared)
  • Checked 134 log files, 14 edm output root files, 32 DQM output files

@rekovic
Copy link
Contributor

rekovic commented Nov 20, 2018

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2)

@fabiocos
Copy link
Contributor

+1

DQM changes are unrelated to this PR

@cmsbuild cmsbuild merged commit 06afbf8 into cms-sw:master Nov 20, 2018
@fabiocos
Copy link
Contributor

@rekovic @thomreis as this is a fix to a crash that is affecting MC productions, could you please backport it to 10_2_X and 10_3_X?

@fabiocos
Copy link
Contributor

ok, see #25314 and #25315

@Dr15Jones Dr15Jones deleted the fixRPCtoDTTranslator branch November 22, 2018 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants