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

Revert "Port CTPPS to DD4hep" #31359

Merged
merged 1 commit into from Sep 7, 2020
Merged

Revert "Port CTPPS to DD4hep" #31359

merged 1 commit into from Sep 7, 2020

Conversation

davidlange6
Copy link
Contributor

Reverts #31240
several problems have been identified in c++ dependencies and python due to this PR.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-31359/18153

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

A new Pull Request was created by @davidlange6 (David Lange) for master.

It involves the following packages:

CondFormats/GeometryObjects
CondTools/Geometry
DQM/CTPPS
DetectorDescription/DDCMS
Geometry/VeryForwardData
Geometry/VeryForwardGeometry
Geometry/VeryForwardGeometryBuilder
RecoPPS/Local
SimPPS/RPDigiProducer
Validation/CTPPS

@perrotta, @kmaeshima, @andrius-k, @Dr15Jones, @makortel, @cvuosalo, @civanch, @tlampen, @christopheralanwest, @ianna, @mdhildreth, @cmsbuild, @jpata, @jfernan2, @fioriNTU, @slava77, @ggovi, @pohsun, @tocheng can you please review it and eventually sign? Thanks.
@vargasa, @forthommel, @jan-kaspar, @tocheng, @slomeo, @mmusich, @fabiocos, @seemasharmafnal this is something you requested to watch as well.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

The tests are being triggered in jenkins.
Tested with other pull request(s) #31356


#include <vector>
#include <string>

class PDetGeomDesc {
public:
struct Item {
Item() = default;
Item(const DetGeomDesc* const geoInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like one way to break the cyclic dependency is to remove this constructor and replace it with a helper function doing the same operations but in a different package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eg, where the code was before (as the class member data are public..)

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why this change even went in

Copy link
Contributor

@ghugo83 ghugo83 Sep 4, 2020

Choose a reason for hiding this comment

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

A priori is nicer to have things done in the constructor once and for all, than having a constructor not initializing the built-in data members, then pass around an object with non-initialized built-in data members, then finally set the data members to values we already had since the beginning.
Then if there is a circular dependency in the packages, that makes it indeed not worth it, but it is a pity this does not get detected before.
How to test for circular dependencies?

Copy link
Contributor

@ghugo83 ghugo83 Sep 4, 2020

Choose a reason for hiding this comment

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

In the previous code for example, as expected, we find later down the line...
PDetGeomDesc* pdet = new PDetGeomDesc;

Copy link
Contributor

Choose a reason for hiding this comment

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

Ha yes wait the float, int, etc, are data members of Item anyway, not of PDetGeomDesc.

Copy link
Contributor

Choose a reason for hiding this comment

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

but the way the default constructor of the class whose members are built-in types does not matter for the initialization of these members

I take it a bit back that for a class without a user provided default constructor, whether the constructor is called with or without parentheses actually matters, and does dictate whether the member built-in types are zero-initialized. (the actual initialization rules are a bit complex
https://en.cppreference.com/w/cpp/language/default_initialization
https://en.cppreference.com/w/cpp/language/value_initialization
)

Copy link
Contributor

@ghugo83 ghugo83 Sep 4, 2020

Choose a reason for hiding this comment

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

@markotel, yes exactly. Basically if PDetGeomDesc had built-in types, there would not have been zero-initialized.
PDetGeomDesc* pdet = new PDetGeomDesc and PDetGeomDesc* pdet = new PDetGeomDesc() are different.

In general, I tend to do what can be done in the constructor, instead of delaying (in terms of object life timeline) and having this type of situation.

I tend to only alter the object when needed (ie when some info has been computed, which was not already available at construction time).

I think this makes things clearer overall, because one needs to always look when an object is touched, so the less modifications to look at the better.
Imagine a codebase where all objects are zero-intialized at construction (or even not, in the built-in case, which is even problematic), then zillions of setters to modify them. Things quickly become a mess.
So I tend to like constructors ;p

But I understand CondFormats/GeometryObjects is a special package, so we cannot really simply add a constructor there without having a mess. Not worth the effort ;p
In that case, better to call
PDetGeomDesc* pdet = new PDetGeomDesc()
( but not the existing PDetGeomDesc* pdet = new PDetGeomDesc )
and have the settings of all the data members one by one a posteriori.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can (and I’d argue should) have a constructor, just not one using a DetGeomDesc. Instead, pass the values need to set the actual member data. That guarantees everything is properly initialized and avoids unnecessary coupling of packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Dr15Jones Ha thanks, good idea, that's the cleanest approach.

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

+1
Tested at: bf9b9ec
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-8ad442/9122/summary.html
CMSSW: CMSSW_11_2_X_2020-09-04-1100
SCRAM_ARCH: slc7_amd64_gcc820

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 4, 2020

Comparison job queued.

@cvuosalo
Copy link
Contributor

cvuosalo commented Sep 4, 2020

Can we wait briefly before merging this PR? @ghugo83 is trying to fix the issues in #31240 and is submitting another PR today. What is the deadline for getting this PR into the next IB?

@davidlange6
Copy link
Contributor Author

davidlange6 commented Sep 4, 2020 via email

@cvuosalo
Copy link
Contributor

cvuosalo commented Sep 4, 2020

It's probably best to go ahead with this PR now. Revision of #31240 to fix its issues can be done in the next few days.

@cvuosalo
Copy link
Contributor

cvuosalo commented Sep 4, 2020

+1

@christopheralanwest
Copy link
Contributor

+1

@jfernan2
Copy link
Contributor

jfernan2 commented Sep 5, 2020

+1

@qliphy
Copy link
Contributor

qliphy commented Sep 7, 2020

@cms-sw/reconstruction-l2 @cms-sw/simulation-l2 @cms-sw/db-l2 any further comment?

@davidlange6
Copy link
Contributor Author

hi @silviodonato @qliphy - do you plan just to live with the problems introduced in #31240 or is this getting merged?

@silviodonato
Copy link
Contributor

hi @silviodonato @qliphy - do you plan just to live with the problems introduced in #31240 or is this getting merged?

hi @davidlange6 I planned to merge this before the morning IB

@davidlange6
Copy link
Contributor Author

davidlange6 commented Sep 7, 2020 via email

@silviodonato
Copy link
Contributor

merge

@cmsbuild cmsbuild merged commit 2c7b8d6 into master Sep 7, 2020
ghugo83 added a commit to ghugo83/cmssw that referenced this pull request Sep 7, 2020
…S_final"

This reverts commit 2c7b8d6, reversing
changes made to 3173c7f.
ghugo83 added a commit to ghugo83/cmssw that referenced this pull request Sep 7, 2020
…S_final"

This reverts commit 2c7b8d6, reversing
changes made to 3173c7f.
@smuzaffar smuzaffar deleted the revert-31240-CTPPS_final branch November 6, 2020 21:07
@jfernan2
Copy link
Contributor

+1

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