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

optimise cache usage and reduce class size #67

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AuroraPerego
Copy link

BEGINRELEASENOTES

  • add operator<<, reorder class members and do not return const& for simple types in CLUECalorimeterHit
  • use std::vector<T> instead of std::vector<T>* and add the cluster index to each hit in the CLUENtuplizer
  • use the file downloaded when building the repo in clue_gaudi_wrapper.py

ENDRELEASENOTES

@@ -27,11 +27,14 @@
from Configurables import PodioOutput
from Configurables import ApplicationMgr

from os import environ
build_path = environ["ENV_CMAKE_BINARY_DIR"]
Copy link
Member

Choose a reason for hiding this comment

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

This part is making CI fail. It should not be part of the script, at least not as it is. Setting a default name is fine but a default file with a hardcoded path won't be useful for someone else. You can pass the input file as it is being done now in the tests with --EventDataSvc.input in https://github.com/key4hep/k4Clue/blob/main/src/k4clue/CMakeLists.txt#L45.

Copy link
Author

Choose a reason for hiding this comment

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

I thought this would be general enough since the file is the one downloaded for the tests and the directory is the build directory, but it seems that in the CI the env variable is not set. I've commented it.


private:
std::uint8_t m_detectorRegion{0};
std::uint64_t m_layer{};
Copy link
Member

Choose a reason for hiding this comment

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

I don't know the details but this changed from 64 bits to 32 bits, I guess the layer can not be bigger than 32 bits?

Copy link
Author

Choose a reason for hiding this comment

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

layer goes up to 40 right now (80 if we sum the endcap)

delete m_clhits_z;
delete m_clhits_energy;
};
~CLUENtuplizer(){};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
~CLUENtuplizer(){};

If defining the destructor is not needed let's not define it since it's default one.

Copy link
Author

Choose a reason for hiding this comment

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

ok, i'll change it

@@ -98,6 +98,7 @@ StatusCode CLUENtuplizer::execute(const EventContext&) const {
} else {
throw std::runtime_error("CLUE hits collection not available");
}
const auto& clue_calo_coll_vect = clue_calo_coll->vect;
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be used only below when computing clusInBarrel, then maybe move it down there to right before when it's needed so that the definition is close to where it's used?

Copy link
Author

Choose a reason for hiding this comment

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

yes, sure! I probably had some code in the middle that I removed

Comment on lines 30 to 32
#from os import environ
#build_path = environ["ENV_CMAKE_BINARY_DIR"]

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#from os import environ
#build_path = environ["ENV_CMAKE_BINARY_DIR"]

Remove instead of introducing commented out code? I think this may be because you are running this steering file locally? But an argument can be passed in the command line as I mentioned above which is even faster than setting the env variable and commenting this in.

Copy link
Author

Choose a reason for hiding this comment

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

ok sure, no problem

});
uint32_t offset = 0;
if (clusInBarrel != clue_calo_coll_vect.end() && clusInBarrel->inBarrel())
offset = clusInBarrel->getClusterIndex() + 1;
Copy link
Member

Choose a reason for hiding this comment

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

This wasn't here before. Can you explain, for example in the release notes, what effect does this have or what is this used for? (Used later in m_hits_clusId?

Copy link
Author

@AuroraPerego AuroraPerego Mar 27, 2025

Choose a reason for hiding this comment

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

that is a way to obtain the maximum cluster index in the barrel and add this offset to the endcap (thinking about it maybe I can do it in a better way..)
Hits from barrel and endcap are clustered in two separated steps, so we'll have clusters with indices 0, 1 .. in the barrel and 0, 1.. in the endcap. With this offset, the clusters indices will be unique.
I can add it to the release notes

Copy link
Author

Choose a reason for hiding this comment

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

I'll postpone this change to the PR where I'll also remove the if statement that now prevents saving events where there is more than one MC Particle.
With that if only events with one of few clusters are saved, so this fix is not really needed.

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.

2 participants