Skip to content

Commit ed2b824

Browse files
[PWGCF] Identified Bf, Changed how PID is performed, added configurables to improve performance (AliceO2Group#10714)
Co-authored-by: ALICE Action Bot <[email protected]>
1 parent e8e958d commit ed2b824

File tree

3 files changed

+80
-48
lines changed

3 files changed

+80
-48
lines changed

PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Framework/O2DatabasePDGPlugin.h"
3737
#include <TROOT.h>
3838
#include <TParameter.h>
39+
#include <TPDGCode.h>
3940
#include <TList.h>
4041
#include <TDirectory.h>
4142
#include <TFolder.h>
@@ -132,6 +133,7 @@ TH2F* fhdEdxB = nullptr;
132133
TH2F* fhdEdxIPTPCB = nullptr;
133134
TH2F* fhdEdxA[kIdBfNoOfSpecies + 2] = {nullptr};
134135
TH2F* fhdEdxIPTPCA[kIdBfNoOfSpecies + 2] = {nullptr};
136+
TH2F* fhTrackTime[kIdBfNoOfSpecies + 2] = {nullptr};
135137

136138
TH1F* fhMassB = nullptr;
137139
TH1F* fhMassA[kIdBfNoOfSpecies + 1] = {nullptr};
@@ -177,6 +179,9 @@ TH1F* fhTruePtNegA[kIdBfNoOfSpecies + 1] = {nullptr};
177179
TH2F* fhTrueNPosNegA[kIdBfNoOfSpecies + 1] = {nullptr};
178180
TH1F* fhTrueDeltaNA[kIdBfNoOfSpecies + 1] = {nullptr};
179181

182+
TH2F* fhTruedEdx[kIdBfNoOfSpecies + 1] = {nullptr};
183+
TH2F* fhTrueTrackTime[kIdBfNoOfSpecies + 1] = {nullptr};
184+
180185
TH2F* fhTruePtEtaPosA[kIdBfNoOfSpecies + 1] = {nullptr};
181186
TH2F* fhTruePtEtaNegA[kIdBfNoOfSpecies + 1] = {nullptr};
182187

@@ -421,7 +426,7 @@ void IdentifiedBfFilter::processReconstructed(CollisionObject const& collision,
421426
fhVertexZB->Fill(collision.posZ());
422427
uint8_t acceptedevent = uint8_t(false);
423428
float centormult = tentativecentmult;
424-
if (IsEvtSelected(collision, centormult)) {
429+
if (isEvtSelected(collision, centormult)) {
425430
acceptedevent = true;
426431
fhCentMultA->Fill(centormult);
427432
fhMultA->Fill(mult);
@@ -535,7 +540,7 @@ void IdentifiedBfFilter::processGenerated(CollisionObject const& mccollision, Pa
535540
using namespace identifiedbffilter;
536541

537542
uint8_t acceptedevent = uint8_t(false);
538-
if (IsEvtSelected(mccollision, centormult)) {
543+
if (isEvtSelected(mccollision, centormult)) {
539544
acceptedevent = uint8_t(true);
540545
}
541546
if (fullDerivedData) {
@@ -565,7 +570,7 @@ void IdentifiedBfFilter::processGeneratorLevel(aod::McCollision const& mccollisi
565570
if (tmpcollision.has_mcCollision()) {
566571
if (tmpcollision.mcCollisionId() == mccollision.globalIndex()) {
567572
typename AllCollisions::iterator const& collision = allcollisions.iteratorAt(tmpcollision.globalIndex());
568-
if (IsEvtSelected(collision, defaultcent)) {
573+
if (isEvtSelected(collision, defaultcent)) {
569574
fhTrueVertexZAA->Fill(mccollision.posZ());
570575
processGenerated(mccollision, mcparticles, defaultcent);
571576
processed = true;
@@ -609,7 +614,7 @@ void IdentifiedBfFilter::processVertexGenerated(aod::McCollisions const& mccolli
609614
fhTrueVertexZB->Fill(mccollision.posZ());
610615
/* we assign a default value */
611616
float centmult = 50.0f;
612-
if (IsEvtSelected(mccollision, centmult)) {
617+
if (isEvtSelected(mccollision, centmult)) {
613618
fhTrueVertexZA->Fill((mccollision.posZ()));
614619
}
615620
}
@@ -658,6 +663,7 @@ struct IdentifiedBfFilterTracks {
658663
return lst;
659664
}
660665

666+
Service<o2::framework::O2DatabasePDG> fPDG;
661667
Produces<aod::ScannedTracks> scannedtracks;
662668
Produces<aod::IdentifiedBfCFTracksInfo> tracksinfo;
663669
Produces<aod::ScannedTrueTracks> scannedgentracks;
@@ -689,6 +695,7 @@ struct IdentifiedBfFilterTracks {
689695
Configurable<float> maxRejectSigma{"maxRejectSigma", 1.0, "Maximum required sigma for PID double match rejection"};
690696

691697
Configurable<float> tofCut{"tofCut", 0.8, "Momentum under which we don't use TOF PID data"};
698+
Configurable<bool> makeNSigmaPlots{"makeNSigmaPlots", false, "Produce the N Sigma Plots for external storage. Default false"};
692699

693700
OutputObj<TList> fOutput{"IdentifiedBfFilterTracksInfo", OutputObjHandlingPolicy::AnalysisObject};
694701
bool checkAmbiguousTracks = false;
@@ -769,7 +776,6 @@ struct IdentifiedBfFilterTracks {
769776
/* if the system type is not known at this time, we have to put the initialization somewhere else */
770777
fSystem = getSystemType(cfgSystem);
771778
fDataType = getDataType(cfgDataType);
772-
fPDG = o2::O2DatabasePDG::Instance();
773779

774780
/* required ambiguous tracks checks? */
775781
if (dofilterDetectorLevelWithoutPIDAmbiguous || dofilterDetectorLevelWithPIDAmbiguous || dofilterRecoWithoutPIDAmbiguous || dofilterRecoWithPIDAmbiguous) {
@@ -1025,18 +1031,19 @@ struct IdentifiedBfFilterTracks {
10251031
TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution (truth);N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(),
10261032
79, -39.5, 39.5);
10271033
}
1028-
1029-
for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) {
1030-
for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) {
1031-
fhTrueNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(),
1032-
TString::Format("N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(),
1033-
48, -6, 6,
1034-
ptbins, ptlow, ptup);
1035-
1036-
fhTrueNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(),
1037-
TString::Format("N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(),
1038-
48, -6, 6,
1039-
ptbins, ptlow, ptup);
1034+
if (makeNSigmaPlots) {
1035+
for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) {
1036+
for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) {
1037+
fhTrueNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(),
1038+
TString::Format("N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(),
1039+
48, -6, 6,
1040+
ptbins, ptlow, ptup);
1041+
1042+
fhTrueNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(),
1043+
TString::Format("N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(),
1044+
48, -6, 6,
1045+
ptbins, ptlow, ptup);
1046+
}
10401047
}
10411048
}
10421049

@@ -1076,10 +1083,12 @@ struct IdentifiedBfFilterTracks {
10761083
fOutputList->Add(fhTrueNPosNegA[sp]);
10771084
fOutputList->Add(fhTrueDeltaNA[sp]);
10781085
}
1079-
for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) {
1080-
for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) {
1081-
fOutputList->Add(fhTrueNSigmaTPC[sp1][sp2]);
1082-
fOutputList->Add(fhTrueNSigmaTOF[sp1][sp2]);
1086+
if (makeNSigmaPlots) {
1087+
for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) {
1088+
for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) {
1089+
fOutputList->Add(fhTrueNSigmaTPC[sp1][sp2]);
1090+
fOutputList->Add(fhTrueNSigmaTOF[sp1][sp2]);
1091+
}
10831092
}
10841093
}
10851094
}
@@ -1321,17 +1330,17 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyParticle(ParticleOb
13211330
int pdgcode = std::fabs(particle.pdgCode());
13221331

13231332
switch (pdgcode) {
1324-
case pdgcodeEl:
1333+
case kPositron:
13251334
return kIdBfElectron;
13261335
break;
13271336

1328-
case pdgcodePi:
1337+
case kPiPlus:
13291338
return kIdBfPion;
13301339
break;
1331-
case pdgcodeKa:
1340+
case kKPlus:
13321341
return kIdBfKaon;
13331342
break;
1334-
case pdgcodePr:
1343+
case kProton:
13351344
return kIdBfProton;
13361345
break;
13371346

@@ -1351,16 +1360,16 @@ inline void IdentifiedBfFilterTracks::identifyPIDMismatch(ParticleObject const&
13511360
int pdgcode = std::fabs(particle.pdgCode());
13521361

13531362
switch (pdgcode) {
1354-
case pdgcodeEl:
1363+
case kPositron:
13551364
realPID = kIdBfElectron;
13561365
break;
1357-
case pdgcodePi:
1366+
case kPiPlus:
13581367
realPID = kIdBfPion;
13591368
break;
1360-
case pdgcodeKa:
1369+
case kKPlus:
13611370
realPID = kIdBfKaon;
13621371
break;
1363-
case pdgcodePr:
1372+
case kProton:
13641373
realPID = kIdBfProton;
13651374
break;
13661375
default:
@@ -1386,16 +1395,16 @@ inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& p
13861395
MatchRecoGenSpecies realPID = kWrongSpecies;
13871396
int pdgcode = std::fabs(particle.pdgCode());
13881397
switch (pdgcode) {
1389-
case pdgcodeEl:
1398+
case kPositron:
13901399
realPID = kIdBfElectron;
13911400
break;
1392-
case pdgcodePi:
1401+
case kPiPlus:
13931402
realPID = kIdBfPion;
13941403
break;
1395-
case pdgcodeKa:
1404+
case kKPlus:
13961405
realPID = kIdBfKaon;
13971406
break;
1398-
case pdgcodePr:
1407+
case kProton:
13991408
realPID = kIdBfProton;
14001409
break;
14011410
default:
@@ -1486,7 +1495,9 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
14861495
float nsigmas[kIdBfNoOfSpecies];
14871496

14881497
if constexpr (framework::has_type_v<aod::mctracklabel::McParticleId, typename TrackObject::all_columns>) {
1489-
identifyRealNSigma(track.template mcParticle_as<aod::McParticles>(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam());
1498+
if (makeNSigmaPlots) {
1499+
identifyRealNSigma(track.template mcParticle_as<aod::McParticles>(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam());
1500+
}
14901501
}
14911502

14921503
if (loadfromccdb) {
@@ -1495,7 +1506,7 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
14951506
}
14961507
}
14971508

1498-
if (track.tpcInnerParam() < tofCut && !reqTOF && !onlyTOF) {
1509+
if (track.tpcInnerParam() < tofCut && !onlyTOF) {
14991510

15001511
for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) {
15011512
nsigmas[iSp] = actualTPCNSigma[iSp];
@@ -1507,7 +1518,7 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject c
15071518
for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) {
15081519
nsigmas[iSp] = sqrtf(actualTPCNSigma[iSp] * actualTPCNSigma[iSp] + actualTOFNSigma[iSp] * actualTOFNSigma[iSp]);
15091520
}
1510-
} else if (!reqTOF || !onlyTOF) {
1521+
} else if (!track.hasTOF() && !reqTOF && !onlyTOF) {
15111522
for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) {
15121523
nsigmas[iSp] = actualTPCNSigma[iSp];
15131524
}

PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file identifiedBfFilter.h
13+
/// \brief Filters collisions and tracks according to selection criteria
14+
/// \author [email protected]
15+
1216
#ifndef PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_
1317
#define PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_
1418

@@ -19,6 +23,8 @@
1923

2024
#include "Framework/AnalysisTask.h"
2125
#include "Framework/AnalysisDataModel.h"
26+
#include "Framework/runDataProcessing.h"
27+
#include "Framework/O2DatabasePDGPlugin.h"
2228
#include "Common/DataModel/EventSelection.h"
2329
#include "Common/DataModel/Multiplicity.h"
2430
#include "Common/DataModel/Centrality.h"
@@ -27,9 +33,9 @@
2733
#include "Common/Core/TrackSelectionDefaults.h"
2834
#include "PWGCF/Core/AnalysisConfigurableCuts.h"
2935
#include "MathUtils/Utils.h"
30-
#include <TDatabasePDG.h>
3136

3237
namespace o2
38+
3339
{
3440
namespace aod
3541
{
@@ -60,11 +66,6 @@ enum MatchRecoGenSpecies {
6066
kWrongSpecies = -1
6167
};
6268

63-
constexpr int pdgcodeEl = 11;
64-
constexpr int pdgcodePi = 211;
65-
constexpr int pdgcodeKa = 321;
66-
constexpr int pdgcodePr = 2212;
67-
6869
/// \enum SpeciesPairMatch
6970
/// \brief The species pair considered by the matching test
7071
enum SpeciesPairMatch {
@@ -237,8 +238,6 @@ float particleMaxDCAxy = 999.9f;
237238
float particleMaxDCAZ = 999.9f;
238239
bool traceCollId0 = false;
239240

240-
TDatabasePDG* fPDG = nullptr;
241-
242241
inline TriggerSelectionType getTriggerSelection(std::string const& triggstr)
243242
{
244243
if (triggstr.empty() || triggstr == "MB") {
@@ -685,7 +684,7 @@ inline bool centralitySelection<aod::McCollision>(aod::McCollision const&, float
685684
//////////////////////////////////////////////////////////////////////////////////
686685

687686
template <typename CollisionObject>
688-
inline bool IsEvtSelected(CollisionObject const& collision, float& centormult)
687+
inline bool isEvtSelected(CollisionObject const& collision, float& centormult)
689688
{
690689
bool trigsel = triggerSelection(collision);
691690

@@ -710,7 +709,7 @@ inline bool matchTrackType(TrackObject const& track)
710709
if (useOwnTrackSelection) {
711710
return ownTrackSelection.IsSelected(track);
712711
} else {
713-
for (auto filter : trackFilters) {
712+
for (const auto& filter : trackFilters) {
714713
if (filter->IsSelected(track)) {
715714
if (dca2Dcut) {
716715
if (track.dcaXY() * track.dcaXY() / maxDCAxy / maxDCAxy + track.dcaZ() * track.dcaZ() / maxDCAz / maxDCAz > 1) {
@@ -738,7 +737,7 @@ inline bool matchTrackType(TrackObject const& track)
738737
template <typename ParticleObject, typename MCCollisionObject>
739738
void exploreMothers(ParticleObject& particle, MCCollisionObject& collision)
740739
{
741-
for (auto& m : particle.template mothers_as<aod::McParticles>()) {
740+
for (const auto& m : particle.template mothers_as<aod::McParticles>()) {
742741
LOGF(info, " mother index: %d", m.globalIndex());
743742
LOGF(info, " Tracking back mother");
744743
LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", m.mcCollisionId(), collision.globalIndex());

PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct IdentifiedbfTask {
9595
std::vector<TH1F*> fhN1VsPt{nch, nullptr}; //!<! weighted single particle distribution vs \f$p_T\f$, for the different species
9696
std::vector<TH2F*> fhN1VsEtaPhi{nch, nullptr}; //!<! weighted single particle distribution vs \f$\eta,\;\phi\f$, for the different species
9797
std::vector<TH2F*> fhSum1PtVsEtaPhi{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
98-
std::vector<TH3F*> fhN1VsZEtaPhiPt{nch, nullptr}; //!<! single particle distribution vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
98+
std::vector<TH3F*> fhN1VsZEtaPhiPt{nch + 1, nullptr}; //!<! single particle distribution vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
9999
std::vector<TH3F*> fhN1VsZEtaPhiPtPrimary{nch, nullptr}; //!<! single particle distribution of primary particles vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
100100
std::vector<TH3F*> fhN1VsZEtaPhiPtSecondary{nch, nullptr}; //!<! single particle distribution of primary particles vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
101101
std::vector<TH3F*> fhSum1PtVsZEtaPhiPt{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
@@ -303,6 +303,7 @@ struct IdentifiedbfTask {
303303
fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr);
304304
fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr);
305305
} else {
306+
fhN1VsZEtaPhiPt[nch]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr);
306307
fhN1VsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr);
307308
fhSum1PtVsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr);
308309
trackPrimaryCheck(track, zvtx, corr);
@@ -626,6 +627,27 @@ struct IdentifiedbfTask {
626627
fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]);
627628
}
628629
}
630+
if (!smallsingles) {
631+
TH1::SetDefaultSumw2(false);
632+
fhN1VsZEtaPhiPt[nch] = new TH3F(
633+
TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", "h"),
634+
TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)",
635+
"h",
636+
"h",
637+
"h")
638+
.Data(),
639+
zvtxbins,
640+
zvtxlow,
641+
zvtxup,
642+
etabins * phibins,
643+
0.0,
644+
static_cast<double>(etabins * phibins),
645+
ptbins,
646+
ptlow,
647+
ptup);
648+
fOutputList->Add(fhN1VsZEtaPhiPt[nch]);
649+
}
650+
629651
} else {
630652
for (uint i = 0; i < nch; ++i) {
631653
/* histograms for each track species */

0 commit comments

Comments
 (0)