Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions PWGLF/Tasks/Nuspex/antinucleiInJets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ struct AntinucleiInJets {
Configurable<std::string> weightsXi{"weightsXi", "", "weightsXi"};
Configurable<std::string> weightsOmega{"weightsOmega", "", "weightsOmega"};

// Number of events
Configurable<int> shrinkInterval{"shrinkInterval", 1000, "variable that controls how often shrinking happens"};

// Reweighting histograms
TH1F* primaryAntiprotons;
TH1F* primaryAntiLambda;
Expand Down Expand Up @@ -1616,9 +1619,23 @@ struct AntinucleiInJets {
// Generated events
void processJetsMCgen(GenCollisionsMc const& collisions, aod::McParticles const& mcParticles)
{
// Define per-event particle containers
std::vector<fastjet::PseudoJet> fjParticles;
std::vector<TVector3> protonMomentum;

// Event counter
int eventCounter = 0;

// Loop over all simulated collisions
for (const auto& collision : collisions) {

// Increment event counter
eventCounter++;

// Clear containers at the start of the event loop
fjParticles.clear();
protonMomentum.clear();

// Event counter: before event selection
registryMC.fill(HIST("genEvents"), 0.5);

Expand All @@ -1629,9 +1646,7 @@ struct AntinucleiInJets {
// Event counter: after event selection
registryMC.fill(HIST("genEvents"), 1.5);

// Loop over all MC particles
std::vector<fastjet::PseudoJet> fjParticles;
std::vector<TVector3> protonMomentum;
// Loop over MC particles
for (const auto& particle : mcParticles) {

// Select physical primaries within acceptance
Expand All @@ -1644,7 +1659,7 @@ struct AntinucleiInJets {
// Store 3-momentum vectors of antiprotons for further analysis
if (particle.pdgCode() == PDG_t::kProtonBar) {
TVector3 pVec(particle.px(), particle.py(), particle.pz());
protonMomentum.push_back(pVec);
protonMomentum.emplace_back(pVec);
}

// 4-momentum representation of a particle
Expand Down Expand Up @@ -1754,16 +1769,36 @@ struct AntinucleiInJets {
if (isAtLeastOneJetSelected) {
registryMC.fill(HIST("genEvents"), 3.5);
}

// Shrink large vectors
if (eventCounter % shrinkInterval == 0) {
fjParticles.shrink_to_fit();
protonMomentum.shrink_to_fit();
}
}
}
PROCESS_SWITCH(AntinucleiInJets, processJetsMCgen, "process jets mc gen", false);

// Reconstructed events
void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&)
{
// Define per-event containers
std::vector<fastjet::PseudoJet> fjParticles;
std::vector<int> antiprotonTrackIndex;

// Event counter
int eventCounter = 0;

// Loop over all reconstructed collisions
for (const auto& collision : collisions) {

// Increment event counter
eventCounter++;

// Clear containers at the start of the event loop
fjParticles.clear();
antiprotonTrackIndex.clear();

// Event counter: before event selection
registryMC.fill(HIST("recEvents"), 0.5);

Expand Down Expand Up @@ -1806,8 +1841,6 @@ struct AntinucleiInJets {

// Loop over reconstructed tracks
int id(-1);
std::vector<fastjet::PseudoJet> fjParticles;
std::vector<int> antiprotonTrackIndex;
for (auto const& track : mcTracks) {
id++;

Expand Down Expand Up @@ -2028,6 +2061,12 @@ struct AntinucleiInJets {
if (isAtLeastOneJetSelected) {
registryMC.fill(HIST("recEvents"), 9.5);
}

// Shrink large vectors
if (eventCounter % shrinkInterval == 0) {
fjParticles.shrink_to_fit();
antiprotonTrackIndex.shrink_to_fit();
}
}
}
PROCESS_SWITCH(AntinucleiInJets, processJetsMCrec, "process jets MC rec", false);
Expand Down
Loading