Skip to content

Commit 5925497

Browse files
jikim1290alibuild
andauthored
[PWGLF] calculating ITS-TPC matching efficiency (#10014)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent e5ddd1c commit 5925497

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

PWGLF/Tasks/Strangeness/lambdapolarization.cxx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "Common/DataModel/TrackSelectionTables.h"
4343
#include "Common/DataModel/EventSelection.h"
4444
#include "Common/DataModel/Qvectors.h"
45+
#include "Common/DataModel/PIDResponseITS.h"
4546

4647
#include "Common/Core/trackUtilities.h"
4748
#include "Common/Core/TrackSelection.h"
@@ -57,6 +58,7 @@
5758
#include "CCDB/BasicCCDBManager.h"
5859

5960
#include "PWGLF/DataModel/LFStrangenessTables.h"
61+
#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table
6062

6163
using namespace o2;
6264
using namespace o2::framework;
@@ -168,6 +170,18 @@ struct lambdapolarization {
168170

169171
std::string fullCCDBShiftCorrPath;
170172

173+
double GetPhiInRange(double phi)
174+
{
175+
double result = phi;
176+
while (result < 0) {
177+
result = result + 2. * TMath::Pi() / 2;
178+
}
179+
while (result > 2. * TMath::Pi() / 2) {
180+
result = result - 2. * TMath::Pi() / 2;
181+
}
182+
return result;
183+
}
184+
171185
template <typename T>
172186
int GetDetId(const T& name)
173187
{
@@ -301,6 +315,16 @@ struct lambdapolarization {
301315
}
302316
}
303317

318+
if (doprocessMC_ITSTPC) {
319+
histos.add("hImpactParameter", "Impact parameter", kTH1F, {{200, 0.0f, 20.0f}});
320+
histos.add("hEventPlaneAngle", "hEventPlaneAngle", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}});
321+
histos.add("hEventPlaneAngleRec", "hEventPlaneAngleRec", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}});
322+
histos.add("hNchVsImpactParameter", "hNchVsImpactParameter", kTH2F, {{200, 0.0f, 20.0f}, {500, -0.5f, 5000.5f}});
323+
histos.add("hSparseMCGenWeight", "hSparseMCGenWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0f, TMath::Pi()}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}});
324+
histos.add("hSparseMCRecWeight", "hSparseMCRecWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0f, TMath::Pi()}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}});
325+
histos.add("hSparseMCRecAllTrackWeight", "hSparseMCRecAllTrackWeight", HistType::kTHnSparseF, {centAxis, {36, 0.0, TMath::Pi()}, {50, 0.0f, 1}, ptAxis, {8, -0.8, 0.8}});
326+
}
327+
304328
if (cfgShiftCorrDef) {
305329
for (auto i = 2; i < cfgnMods + 2; i++) {
306330
histos.add(Form("psi%d/ShiftFIT", i), "", kTProfile3D, {centQaAxis, basisAxis, shiftAxis});
@@ -855,6 +879,89 @@ struct lambdapolarization {
855879
} // FIXME: need to fill different histograms for different harmonic
856880
}
857881
PROCESS_SWITCH(lambdapolarization, processData, "Process Event for data", true);
882+
883+
using recoTracks = soa::Join<aod::TracksIU, aod::TracksExtra>;
884+
void processMC_ITSTPC(aod::McCollision const& mcCollision, soa::Join<aod::McParticles, aod::ParticlesToTracks> const& mcParticles, recoTracks const&)
885+
{
886+
float imp = mcCollision.impactParameter();
887+
float evPhi = mcCollision.eventPlaneAngle() / 2.0;
888+
float centclass = -999;
889+
if (imp >= 0 && imp < 3.49) {
890+
centclass = 2.5;
891+
}
892+
if (imp >= 3.49 && imp < 4.93) {
893+
centclass = 7.5;
894+
}
895+
if (imp >= 4.93 && imp < 6.98) {
896+
centclass = 15.0;
897+
}
898+
if (imp >= 6.98 && imp < 8.55) {
899+
centclass = 25.0;
900+
}
901+
if (imp >= 8.55 && imp < 9.87) {
902+
centclass = 35.0;
903+
}
904+
if (imp >= 9.87 && imp < 11) {
905+
centclass = 45.0;
906+
}
907+
if (imp >= 11 && imp < 12.1) {
908+
centclass = 55.0;
909+
}
910+
if (imp >= 12.1 && imp < 13.1) {
911+
centclass = 65.0;
912+
}
913+
if (imp >= 13.1 && imp < 14) {
914+
centclass = 75.0;
915+
}
916+
// if (evPhi < 0)
917+
// evPhi += 2. * TMath::Pi();
918+
919+
int nCh = 0;
920+
921+
if (centclass > 0 && centclass < 80) {
922+
// event within range
923+
histos.fill(HIST("hImpactParameter"), imp);
924+
histos.fill(HIST("hEventPlaneAngle"), evPhi);
925+
for (auto const& mcParticle : mcParticles) {
926+
927+
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
928+
// focus on bulk: e, mu, pi, k, p
929+
int pdgCode = TMath::Abs(mcParticle.pdgCode());
930+
if (pdgCode != 3122)
931+
continue;
932+
if (!mcParticle.isPhysicalPrimary())
933+
continue;
934+
if (TMath::Abs(mcParticle.eta()) > 0.8) // main acceptance
935+
continue;
936+
histos.fill(HIST("hSparseMCGenWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
937+
nCh++;
938+
bool validGlobal = false;
939+
bool validAny = false;
940+
if (mcParticle.has_tracks()) {
941+
auto const& tracks = mcParticle.tracks_as<recoTracks>();
942+
for (auto const& track : tracks) {
943+
if (track.hasTPC() && track.hasITS()) {
944+
validGlobal = true;
945+
}
946+
if (track.hasTPC() || track.hasITS()) {
947+
validAny = true;
948+
}
949+
}
950+
}
951+
// if valid global, fill
952+
if (validGlobal) {
953+
histos.fill(HIST("hSparseMCRecWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
954+
}
955+
if (validAny) {
956+
histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
957+
histos.fill(HIST("hEventPlaneAngleRec"), GetPhiInRange(deltaPhi));
958+
}
959+
// if any track present, fill
960+
}
961+
}
962+
histos.fill(HIST("hNchVsImpactParameter"), imp, nCh);
963+
}
964+
PROCESS_SWITCH(lambdapolarization, processMC_ITSTPC, "Process MC for ITSTPC", false);
858965
};
859966

860967
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)