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

Address differences in ROOT5 and ROOT6 interfaces #47

Merged
merged 4 commits into from
Jul 19, 2021
Merged

Conversation

plexoos
Copy link
Member

@plexoos plexoos commented Jun 30, 2021

The main idea behind the proposed changes is to have the code that can seamlessly work with ROOT5 and ROOT6

The wrapper function `TH1Helper::SetCanRebin(TH1 *h,int axis=0)` is introduced
in c0bf719

See StRoot/StarRoot/TH1Helper.h
Copy link
Contributor

@genevb genevb left a comment

Choose a reason for hiding this comment

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

The FMS code in StQAMakerBase.cxx was provided to the QA group by people who are no longer in the collaboration. I don't expect this change to have any negative consequences for QA, so I'm ok with approving that one change, but I don't speak for the owners of the other codes.

@plexoos plexoos changed the title Use wrapper around TH1 rebin API changed between ROOT5 and ROOT6 Address differences in ROOT5 and ROOT6 interfaces Jul 1, 2021
Copy link
Contributor

@klendathu2k klendathu2k left a comment

Choose a reason for hiding this comment

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

Great solution to what is likely to be a common problem in STAR codes.

The type of `TListIter::fCursor` and `TListIter::fCurCursor` (inherited by
`StFileIter`) changes from `TObjLink*` to `std::shared_ptr<TObjLink>` in ROOT5
and ROOT6 respectively.

In order to solve the problem with assignment operator we introduce a couple of
overloads one of which is selected based on the actual type of the respective
data members in `TListIter`.
`TH2* TH2::Rebin(...)` was introduced in ROOT6 overriding `TH1* TH1::Rebin(...)`
It seems safe if we use covariant (`TH2*`) with the original return type (`TH1*`) for `TH2* StMultiH1F::Rebin(...)`
In ROOT6 the global pointer `TVirtualMC* gMC` was replaced by a macro
`#define gMC (TVirtualMC::GetMC())` causing a compile time error when assigning
to `gMC`

I think is is safe to remove the assignment for the following reasons:

- `TGeant3TGeo`, inheriting from `TVirtualMC`, is a singleton managing the
  global pointer `gMC` internally

- `StarVMC/GeoTestMaker` is excluded from the build

- `StarVMC/StarBASE` appears to be used only by an expert tool
  `StarVMC/StarBASE/macros/starbase.py`
@plexoos
Copy link
Member Author

plexoos commented Jul 1, 2021

Sorry for adding another commit to this thread but I think it belongs here. I believe TVirtualMC is your domain @klendathu2k and @perevbnlgov

Copy link
Contributor

@klendathu2k klendathu2k left a comment

Choose a reason for hiding this comment

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

This should be safe for our code.

It's good to see that ROOT and VMC are cleaning things up a bit. Getting rid of global pointers is a good thing. Singletons aren't much better... but GEANT3 wrappers are likely one of the few places where a singleton pattern makes any sense.

Copy link
Contributor

@klendathu2k klendathu2k left a comment

Choose a reason for hiding this comment

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

Looks like it should work. It's also in the cxx file, so not visible external to the module.

Copy link
Contributor

@klendathu2k klendathu2k left a comment

Choose a reason for hiding this comment

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

I don't see any mission critical codes which depend on this utility class. I note that TH1::Rebin is virtual in ROOT6, so does this solve a real problem? (I guess there is a compiler warning or other motivation here?) Regardless, don't have any issues with it.

@plexoos
Copy link
Member Author

plexoos commented Jul 2, 2021

Thanks very much for the feedback Jason ✌️

I note that TH1::Rebin is virtual in ROOT6, so does this solve a real problem? (I guess there is a compiler warning or other motivation here?)

Yes, the introduction of the new TH2* TH2::Rebin in ROOT6 causes a real error about not covariant return type of a virtual function.

#16 3360.1 In file included from .sl88_gcc789/OBJ/StRoot/StUtilities/StMultiH1F.cxx:13:0:
#16 3360.1 .sl88_gcc789/OBJ/StRoot/StUtilities/StMultiH1F.h:38:23: error: invalid covariant return type for 'virtual TH1* StMultiH1F::Rebin(Int_t, const char*, const Double_t*)'
#16 3360.1    virtual        TH1* Rebin(Int_t ngroup, const char* newname, const Double_t* xbins)

The old and new overriding chains are like this:
TH1* TH1::Rebin -> TH1* StMultiH1F::Rebin ✅
vs
TH1* TH1::Rebin -> TH2* TH2::Rebin -> TH1* StMultiH1F::Rebin ❌
TH1* TH1::Rebin -> TH2* TH2::Rebin -> TH2* StMultiH1F::Rebin ✅

@genevb
Copy link
Contributor

genevb commented Jul 2, 2021

I see....They added a Rebin() to TH2 in ROOT6 with a (slightly) different return type than the previously-inherited Rebin() from TH1. They didn't add one in TH3, so no impact on StMultiH2F. I don't think I (or anyone else) ever used the returned pointer, so I approve the change to StMultiH1F.h.

@genevb
Copy link
Contributor

genevb commented Jul 2, 2021

Hopefully understood, but worth re-iterating: merging any changes like these that have the potential to affect FastOffline should wait until at least a couple weeks after the data-taking ends.

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

I've looked at the changes to StFileIter. The relevant upstream change is root-project/root@b5f8a69#diff-d78120b6a10b89cc75995c1c44f0a347a68f83b1c01cf5fbb3be8c543ec03b55. This PR changes the type and adds wrapper, and that seems to be sufficient.

@plexoos
Copy link
Member Author

plexoos commented Jul 5, 2021

Hopefully understood, but worth re-iterating: merging any changes like these that have the potential to affect FastOffline should wait until at least a couple weeks after the data-taking ends.

Is there anything that would prevent us from creating a stable branch for fast offline and other online tools that would include only hand picked changes during the run? Sharing a common branch for bleeding edge changes is very common and in fact should be encouraged. On the other hand, preventing incremental development of new features during the run because the online chooses to use an unstable branch does not sound very productive.

@genevb
Copy link
Contributor

genevb commented Jul 5, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Jul 6, 2021

Hi Gene: When you refer to the 'main' branch do you think of it as a stable or development branch? Picking the definition based on a specific time of year is at least confusing.

@genevb
Copy link
Contributor

genevb commented Jul 8, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Jul 12, 2021

Gene, the data taking is over. Are you ok with merging these changes now?

@plexoos
Copy link
Member Author

plexoos commented Jul 13, 2021

If there are no further comments I would like to merge this PR. We need to move on with ROOT6

@genevb
Copy link
Contributor

genevb commented Jul 13, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Jul 13, 2021

Good point. Agreed

@plexoos plexoos mentioned this pull request Jul 14, 2021
@starsdong
Copy link
Member

Gene, can you approve this PR (as you already indicated in the comments)? I think merging will happen automatically later.

@genevb
Copy link
Contributor

genevb commented Jul 14, 2021

Gene, can you approve this PR (as you already indicated in the comments)? I think merging will happen automatically later.

Aren't there already 2 approvals? I'd be interested to understand why additional approvals are needed if anyone knows why.

-Gene

@plexoos
Copy link
Member Author

plexoos commented Jul 14, 2021

Aren't there already 2 approvals? I'd be interested to understand why additional approvals are needed if anyone knows why.

Yes, but to enable the merge button 2 approvals from code owers is required. The code owners are indicated by this shield lock icon svgviewer-png-output

We have the corresponding flag set in the settings:

Screen Shot 2021-07-14 at 4 10 32 PM

Copy link
Contributor

@genevb genevb left a comment

Choose a reason for hiding this comment

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

Seems to need my approval. I don't have any objections as long as these changes don't get merged into SL21c as we agreed, so here is that approval.

@genevb
Copy link
Contributor

genevb commented Jul 14, 2021

to enable the merge button 2 approvals from code owers is required.

That implies that the approvals from Jason and Dmitry K. were meaningless. Correct?

@plexoos
Copy link
Member Author

plexoos commented Jul 14, 2021

That implies that the approvals from Jason and Dmitry K. were meaningless. Correct?

Can't speak for others but for me it is important to see the reaction from other contributors especially when I know that they spent time looking over the changes. So, definitely not meaningless.

@genevb
Copy link
Contributor

genevb commented Jul 14, 2021

Can't speak for others but for me it is important to see the reaction from other contributors especially when I know that they spent time looking over the changes. So, definitely not meaningless.

OK, reasonable point. I agree that I would've withheld my approval if there was lesser support from such others.

@plexoos plexoos merged commit a6ab26a into main Jul 19, 2021
@plexoos plexoos deleted the ds-pre-root6 branch July 19, 2021 15:48
@plexoos
Copy link
Member Author

plexoos commented Jul 19, 2021

Perhaps, I should have mentioned in the closing comment that tagging or branching can be done from any past commit in the existing history. So, any changes on the main branch after the tag or branching point can be ignored

@genevb
Copy link
Contributor

genevb commented Jul 19, 2021 via email

@plexoos
Copy link
Member Author

plexoos commented Jul 19, 2021

There is no point in waiting if all we want to include in the release is already in the repo
Hashes can be viewed on this web site or with git log
Amol just asked me to help with the tagging. I am going to do it this time. The hash for SL21c tag will be 0d53a1a

@veprbl
Copy link
Member

veprbl commented Jul 19, 2021

We could make what @plexoos suggests to be more formal by designating a stabilization branch that could receive backports for only the release-critical fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants