Skip to content

Commit 370052b

Browse files
committed
calculating ITS-TPC matching efficiency
1 parent af190f2 commit 370052b

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

PWGLF/Tasks/Strangeness/lambdapolarization.cxx

Lines changed: 108 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});
@@ -798,6 +822,7 @@ struct lambdapolarization {
798822
histos.fill(HIST("psi4/h_alambda_vncos"), v0.mAntiLambda(), v0.pt(), qvecMag * TMath::Cos(relphi), centrality, weight);
799823
histos.fill(HIST("psi4/h_alambda_vnsin"), v0.mAntiLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight);
800824

825+
801826
if (cfgRapidityDep) {
802827
histos.fill(HIST("psi4/h_alambda_cos2_rap"), v0.mAntiLambda(), v0.pt(), angle * angle, centrality, v0.yLambda(), weight);
803828
}
@@ -855,6 +880,89 @@ struct lambdapolarization {
855880
} // FIXME: need to fill different histograms for different harmonic
856881
}
857882
PROCESS_SWITCH(lambdapolarization, processData, "Process Event for data", true);
883+
884+
using recoTracks = soa::Join<aod::TracksIU, aod::TracksExtra>;
885+
void processMC_ITSTPC(aod::McCollision const& mcCollision, soa::Join<aod::McParticles, aod::ParticlesToTracks> const& mcParticles, recoTracks const&)
886+
{
887+
float imp = mcCollision.impactParameter();
888+
float evPhi = mcCollision.eventPlaneAngle() / 2.0;
889+
float centclass = -999;
890+
if (imp >= 0 && imp < 3.49) {
891+
centclass = 2.5;
892+
}
893+
if (imp >= 3.49 && imp < 4.93) {
894+
centclass = 7.5;
895+
}
896+
if (imp >= 4.93 && imp < 6.98) {
897+
centclass = 15.0;
898+
}
899+
if (imp >= 6.98 && imp < 8.55) {
900+
centclass = 25.0;
901+
}
902+
if (imp >= 8.55 && imp < 9.87) {
903+
centclass = 35.0;
904+
}
905+
if (imp >= 9.87 && imp < 11) {
906+
centclass = 45.0;
907+
}
908+
if (imp >= 11 && imp < 12.1) {
909+
centclass = 55.0;
910+
}
911+
if (imp >= 12.1 && imp < 13.1) {
912+
centclass = 65.0;
913+
}
914+
if (imp >= 13.1 && imp < 14) {
915+
centclass = 75.0;
916+
}
917+
// if (evPhi < 0)
918+
// evPhi += 2. * TMath::Pi();
919+
920+
int nCh = 0;
921+
922+
if (centclass > 0 && centclass < 80) {
923+
// event within range
924+
histos.fill(HIST("hImpactParameter"), imp);
925+
histos.fill(HIST("hEventPlaneAngle"), evPhi);
926+
for (auto const& mcParticle : mcParticles) {
927+
928+
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
929+
// focus on bulk: e, mu, pi, k, p
930+
int pdgCode = TMath::Abs(mcParticle.pdgCode());
931+
if (pdgCode != 3122)
932+
continue;
933+
if (!mcParticle.isPhysicalPrimary())
934+
continue;
935+
if (TMath::Abs(mcParticle.eta()) > 0.8) // main acceptance
936+
continue;
937+
histos.fill(HIST("hSparseMCGenWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
938+
nCh++;
939+
bool validGlobal = false;
940+
bool validAny = false;
941+
if (mcParticle.has_tracks()) {
942+
auto const& tracks = mcParticle.tracks_as<recoTracks>();
943+
for (auto const& track : tracks) {
944+
if (track.hasTPC() && track.hasITS()) {
945+
validGlobal = true;
946+
}
947+
if (track.hasTPC() || track.hasITS()) {
948+
validAny = true;
949+
}
950+
}
951+
}
952+
// if valid global, fill
953+
if (validGlobal) {
954+
histos.fill(HIST("hSparseMCRecWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
955+
}
956+
if (validAny) {
957+
histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, GetPhiInRange(deltaPhi), TMath::Power(TMath::Cos(2.0 * GetPhiInRange(deltaPhi)), 2.0), mcParticle.pt(), mcParticle.eta());
958+
histos.fill(HIST("hEventPlaneAngleRec"), GetPhiInRange(deltaPhi));
959+
}
960+
// if any track present, fill
961+
}
962+
}
963+
histos.fill(HIST("hNchVsImpactParameter"), imp, nCh);
964+
}
965+
PROCESS_SWITCH(lambdapolarization, processMC_ITSTPC, "Process MC for ITSTPC", false);
858966
};
859967

860968
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)