Skip to content

Commit 00323b9

Browse files
committed
[PWGLF] refactored and optimized antiproton loop, moved ITSResponse init, added MC config option
1 parent c7d4892 commit 00323b9

File tree

1 file changed

+25
-34
lines changed

1 file changed

+25
-34
lines changed

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ struct AntinucleiInJets {
138138
Configurable<double> ptMaxItsPidHel{"ptMaxItsPidHel", 1.0, "maximum pt for ITS PID for helium"};
139139
Configurable<double> nSigmaItsMin{"nSigmaItsMin", -3.0, "nSigmaITS min"};
140140
Configurable<double> nSigmaItsMax{"nSigmaItsMax", +3.0, "nSigmaITS max"};
141+
Configurable<bool> setMCDefaultItsParams{"setMCDefaultItsParams", false, "set MC default parameters"};
141142

142143
// CCDB manager service for accessing condition data
143144
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -152,6 +153,9 @@ struct AntinucleiInJets {
152153
// Utility object for jet background subtraction methods
153154
JetBkgSubUtils backgroundSub;
154155

156+
// Initialize ITS PID Response object
157+
o2::aod::ITSResponse itsResponse;
158+
155159
// Initialize CCDB access and histogram registry for Zorro processing
156160
void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
157161
{
@@ -168,6 +172,11 @@ struct AntinucleiInJets {
168172
zorroSummary.setObject(zorro.getZorroSummary());
169173
}
170174

175+
// Set default MC parametrization for ITS response
176+
if (setMCDefaultItsParams) {
177+
itsResponse.setMCDefaultParameters();
178+
}
179+
171180
// Binning
172181
double min = 0.0;
173182
double max = 6.0;
@@ -743,9 +752,6 @@ struct AntinucleiInJets {
743752
return;
744753
registryData.fill(HIST("number_of_events_data"), 8.5);
745754

746-
// Initialize ITS PID Response object
747-
o2::aod::ITSResponse itsResponse;
748-
749755
// Loop over reconstructed tracks
750756
int id(-1);
751757
std::vector<fastjet::PseudoJet> fjParticles;
@@ -1182,11 +1188,6 @@ struct AntinucleiInJets {
11821188
// Antinuclei reconstruction efficiency
11831189
void processAntinucleiEfficiency(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles)
11841190
{
1185-
1186-
// Initialize ITS PID Response object
1187-
o2::aod::ITSResponse itsResponse;
1188-
itsResponse.setMCDefaultParameters();
1189-
11901191
// Loop over all simulated collision events
11911192
for (const auto& collision : collisions) {
11921193

@@ -1496,10 +1497,6 @@ struct AntinucleiInJets {
14961497
// Reconstructed events
14971498
void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&)
14981499
{
1499-
// Initialize ITS PID Response object
1500-
o2::aod::ITSResponse itsResponse;
1501-
itsResponse.setMCDefaultParameters();
1502-
15031500
// Loop over all reconstructed collisions
15041501
for (const auto& collision : collisions) {
15051502

@@ -1546,8 +1543,21 @@ struct AntinucleiInJets {
15461543
// Loop over reconstructed tracks
15471544
int id(-1);
15481545
std::vector<fastjet::PseudoJet> fjParticles;
1546+
std::vector<int> trackIndex;
15491547
for (auto const& track : mcTracks) {
15501548
id++;
1549+
1550+
// Get corresponding MC particle
1551+
if (!track.has_mcParticle())
1552+
continue;
1553+
const auto mcparticle = track.mcParticle();
1554+
1555+
// Store track index for antiproton tracks
1556+
if (passedTrackSelection(track) && track.sign() < 0 && mcparticle.pdgCode() == PDG_t::kProtonBar) {
1557+
trackIndex.emplace_back(id);
1558+
}
1559+
1560+
// Apply track selection for jet reconstruction
15511561
if (!passedTrackSelectionForJetReconstruction(track))
15521562
continue;
15531563

@@ -1667,25 +1677,16 @@ struct AntinucleiInJets {
16671677
}
16681678

16691679
// Loop over tracks in the underlying event
1670-
for (auto const& track : mcTracks) {
1680+
for (auto const& index : trackIndex) {
16711681

1672-
// Apply track selection
1673-
if (!passedTrackSelection(track))
1674-
continue;
1675-
1676-
// Antiproton selection
1677-
if (track.sign() > 0)
1678-
continue;
1682+
// retrieve track associated to index
1683+
auto const& track = mcTracks.iteratorAt(index);
16791684

16801685
// Get corresponding MC particle
16811686
if (!track.has_mcParticle())
16821687
continue;
16831688
const auto mcparticle = track.mcParticle();
16841689

1685-
// Antiproton selection based on the PDG
1686-
if (mcparticle.pdgCode() != PDG_t::kProtonBar)
1687-
continue;
1688-
16891690
// Define variables
16901691
double nsigmaTPCPr = track.tpcNSigmaPr();
16911692
double nsigmaTOFPr = track.tofNSigmaPr();
@@ -1800,9 +1801,6 @@ struct AntinucleiInJets {
18001801
return;
18011802
registryData.fill(HIST("number_of_events_data_syst"), 7.5);
18021803

1803-
// Initialize ITS PID Response object
1804-
o2::aod::ITSResponse itsResponse;
1805-
18061804
// Cut settings
18071805
static std::vector<double> maxDcaxySyst = {
18081806
0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074,
@@ -1907,10 +1905,6 @@ struct AntinucleiInJets {
19071905
// Process MC with systematic variations of analysis parameters
19081906
void processSystEff(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles)
19091907
{
1910-
// Initialize ITS PID Response object
1911-
o2::aod::ITSResponse itsResponse;
1912-
itsResponse.setMCDefaultParameters();
1913-
19141908
// Cut settings
19151909
static std::vector<double> maxDcaxySyst = {
19161910
0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074,
@@ -2149,9 +2143,6 @@ struct AntinucleiInJets {
21492143
return;
21502144
registryCorr.fill(HIST("eventCounter"), 7.5);
21512145

2152-
// Initialize ITS PID Response object
2153-
o2::aod::ITSResponse itsResponse;
2154-
21552146
// Multiplicity percentile
21562147
const float multiplicity = collision.centFT0M();
21572148

0 commit comments

Comments
 (0)