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
Conversation
This reverts commit 499518f.
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-31359/18153
|
A new Pull Request was created by @davidlange6 (David Lange) for master. It involves the following packages: CondFormats/GeometryObjects @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. cms-bot commands are listed here |
The tests are being triggered in jenkins.
|
|
||
#include <vector> | ||
#include <string> | ||
|
||
class PDetGeomDesc { | ||
public: | ||
struct Item { | ||
Item() = default; | ||
Item(const DetGeomDesc* const geoInfo) { |
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.
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.
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.
eg, where the code was before (as the class member data are public..)
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.
I wonder why this change even went in
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.
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?
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.
In the previous code for example, as expected, we find later down the line...
PDetGeomDesc* pdet = new PDetGeomDesc;
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.
Ha yes wait the float, int, etc, are data members of Item anyway, not of PDetGeomDesc.
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.
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
)
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.
@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.
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.
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.
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.
@Dr15Jones Ha thanks, good idea, that's the cleanest approach.
+1 |
Comparison job queued. |
Presumably the numerous fixes would need review, no?
On Sep 4, 2020, at 6:09 PM, Carl Vuosalo <notifications@github.com<mailto:notifications@github.com>> wrote:
Can we wait briefly before merging this PR? @ghugo83<https://github.com/ghugo83> is trying to fix the issues in #31240<#31240> and is submitting another PR today. What is the deadline for getting this PR into the next IB?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#31359 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABGPFQ2N7FI5QVLBQK53Q4TSEEGL7ANCNFSM4QXOKLUA>.
|
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. |
+1 |
+1 |
+1 |
@cms-sw/reconstruction-l2 @cms-sw/simulation-l2 @cms-sw/db-l2 any further comment? |
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 |
Thanks for the clarification
Cheers
David
On Sep 7, 2020, at 9:31 AM, Silvio Donato <notifications@github.com<mailto:notifications@github.com>> wrote:
hi @silviodonato<https://github.com/silviodonato> @qliphy<https://github.com/qliphy> - do you plan just to live with the problems introduced in #31240<#31240> or is this getting merged?
hi @davidlange6<https://github.com/davidlange6> I planned to merge this before the morning IB
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#31359 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABGPFQYNPJEN7DZYTMDQKTTSESD4XANCNFSM4QXOKLUA>.
|
merge |
+1 |
Reverts #31240
several problems have been identified in c++ dependencies and python due to this PR.