Skip to content

Commit 5269d07

Browse files
authored
PWGHF: Added processes to select Sc collisions
1 parent 2aead6d commit 5269d07

File tree

1 file changed

+68
-35
lines changed

1 file changed

+68
-35
lines changed

PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx

Lines changed: 68 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,24 @@ struct HfCorrelatorLcScHadronsSelection {
8888
bool isCandFound = false;
8989
bool isSel8 = true;
9090
bool isNosameBunchPileUp = true;
91+
double yCand = -999.;
92+
const int chargeScZero = 0;
9193
if (doSelLcCollision) {
9294
for (const auto& candidate : candidates) {
9395

94-
auto yCand = estimateY<isCandSc>(candidate);
96+
if constexpr (isCandSc) {
97+
int8_t chargeCand = candidate.charge();
9598

99+
if (chargeCand == chargeScZero) {
100+
yCand = hfHelper.ySc0(candidate);
101+
} else {
102+
yCand = hfHelper.yScPlusPlus(candidate);
103+
}
104+
105+
} else {
106+
yCand = hfHelper.yLc(candidate);
107+
}
108+
96109
if (std::abs(yCand) > yCandMax || candidate.pt() < ptCandMin) {
97110
isCandFound = false;
98111
continue;
@@ -119,7 +132,7 @@ struct HfCorrelatorLcScHadronsSelection {
119132
for (const auto& particle : mcParticles) {
120133

121134
isCandFound = matchCandAndMass<isCandSc>(particle, massCand);
122-
if (!isCandFound) {
135+
if (!isCandFound){
123136
continue;
124137
}
125138

@@ -137,31 +150,31 @@ struct HfCorrelatorLcScHadronsSelection {
137150

138151
/// Code to select collisions with at least one Lc - for real data and data-like analysis
139152
void processLcSelection(SelCollisions::iterator const& collision,
140-
CandsLcDataFiltered const& candidates)
153+
CandsLcDataFiltered const& candidates)
141154
{
142-
selectionCollision<false>(collision, candidates);
155+
selectionCollision<false>(collision,candidates);
143156
}
144157
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processLcSelection, "Process Lc Collision Selection for Data and Mc", true);
145158

146-
void processScSelection(SelCollisions::iterator const& collision,
147-
aod::HfCandSc const& candidates)
159+
void processScSelection(SelCollisions::iterator const& collision,
160+
aod::HfCandSc const& candidates)
148161
{
149-
selectionCollision<true>(collision, candidates);
162+
selectionCollision<true>(collision,candidates);
150163
}
151164
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processScSelection, "Process Sc Collision Selection for Data and Mc", false);
152165

153-
void processLcSelectionMcRec(SelCollisions::iterator const& collision,
166+
void processLcSelectionMcRec(SelCollisions::iterator const& collision,
154167
CandsLcMcRecFiltered const& candidates)
155168
{
156-
selectionCollision<false>(collision, candidates);
169+
selectionCollision<false>(collision,candidates);
157170
}
158-
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processLcSelectionMcRec, "Process Lc Selection McRec", false);
171+
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processLcSelectionMcRec, "Process Lc Selection McRec", false);
159172

160173
void processScSelectionMcRec(SelCollisions::iterator const& collision,
161-
CandsScMcRec const& candidates)
162-
{
163-
selectionCollision<true>(collision, candidates);
164-
}
174+
CandsScMcRec const& candidates)
175+
{
176+
selectionCollision<true>(collision,candidates);
177+
}
165178
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processScSelectionMcRec, "Process Sc Selection McRec", false);
166179

167180
void processLcSelectionMcGen(aod::McCollision const&,
@@ -241,12 +254,12 @@ struct HfCorrelatorLcScHadrons {
241254
bool isSignal = false;
242255

243256
TRandom3* rnd = new TRandom3(0);
244-
// std::vector<float> outputMl = {-1., -1., -1.};
257+
//std::vector<float> outputMl = {-1., -1., -1.};
245258
std::vector<float> outputMlPKPi = {-1., -1., -1.};
246259
std::vector<float> outputMlPiKP = {-1., -1., -1.};
247260

248261
// Event Mixing for the Data Mode
249-
// using SelCollisionsWithSc = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
262+
//using SelCollisionsWithSc = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
250263
using SelCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::Mults, aod::EvSels, aod::LcSelection>>;
251264
using SelCollisionsMc = soa::Filtered<soa::Join<aod::McCollisions, aod::LcSelection, aod::MultsExtraMC>>; // collisionFilter applied
252265

@@ -370,6 +383,26 @@ struct HfCorrelatorLcScHadrons {
370383
}
371384
};
372385

386+
template <bool isCandSc, typename CandType>
387+
double estimateY(CandType const& candidate)
388+
{
389+
double y = -999.;
390+
const int chargeScZero = 0;
391+
if constexpr (isCandSc) {
392+
int8_t chargeCand = candidate.charge();
393+
394+
if (chargeCand == chargeScZero) {
395+
y = hfHelper.ySc0(candidate);
396+
} else {
397+
y = hfHelper.yScPlusPlus(candidate);
398+
}
399+
400+
} else {
401+
y = hfHelper.yLc(candidate);
402+
}
403+
return y;
404+
}
405+
373406
template <typename T1, typename T2, typename McPart>
374407
void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles)
375408
{
@@ -834,8 +867,7 @@ struct HfCorrelatorLcScHadrons {
834867
}
835868

836869
template <bool isCandSc, typename CollisionType, typename PartType>
837-
void doSameEventMcGen(CollisionType const& mcCollision, PartType const& mcParticles)
838-
{
870+
void doSameEventMcGen(CollisionType const& mcCollision, PartType const& mcParticles){
839871

840872
int counterCharmCand = 0;
841873
registry.fill(HIST("hMcEvtCount"), 0);
@@ -851,8 +883,9 @@ struct HfCorrelatorLcScHadrons {
851883
for (const auto& particle : mcParticles) {
852884

853885
double massCand = -999.0;
854-
bool isCandFound = isCandSc ? matchCandAndMass<true>(particle, massCand) : matchCandAndMass<false>(particle, massCand);
855-
if (!isCandFound) {
886+
bool isCandFound = isCandSc ? matchCandAndMass<true>(particle, massCand) :
887+
matchCandAndMass<false>(particle, massCand);
888+
if (!isCandFound){
856889
continue;
857890
}
858891
double yCand = RecoDecay::y(particle.pVector(), massCand);
@@ -866,10 +899,10 @@ struct HfCorrelatorLcScHadrons {
866899
registry.fill(HIST("hPhiMcGen"), RecoDecay::constrainAngle(particle.phi(), -PIHalf));
867900
registry.fill(HIST("hYMcGen"), yCand);
868901

869-
int8_t chargeLc = pdg->GetParticle(particle.pdgCode())->Charge(); // Retrieve charge
870-
if (chargeLc != 0) {
871-
chargeLc = chargeLc / std::abs(chargeLc);
872-
}
902+
int8_t chargeLc = pdg->GetParticle(particle.pdgCode())->Charge(); // Retrieve charge
903+
if (chargeLc != 0){
904+
chargeLc = chargeLc / std::abs(chargeLc);
905+
}
873906

874907
isPrompt = particle.originMcGen() == RecoDecay::OriginType::Prompt;
875908
isNonPrompt = particle.originMcGen() == RecoDecay::OriginType::NonPrompt;
@@ -887,19 +920,19 @@ struct HfCorrelatorLcScHadrons {
887920
listDaughters.clear();
888921
const size_t expectedDaughters = isCandSc ? 4 : 3;
889922

890-
if (isCandSc) {
891-
if (massCand == o2::constants::physics::MassSigmaC0 || massCand == o2::constants::physics::MassSigmaCStar0) {
923+
if (isCandSc){
924+
if (massCand == o2::constants::physics::MassSigmaC0 || massCand == o2::constants::physics::MassSigmaCStar0){
892925
std::array<int, NDaughtersSc> arrDaughSc0PDG = {kProton, -kKPlus, kPiPlus, kPiMinus};
893926
RecoDecay::getDaughters(particle, &listDaughters, arrDaughSc0PDG, 2);
894927
} else {
895928
std::array<int, NDaughtersSc> arrDaughScPlusPDG = {kProton, -kKPlus, kPiPlus, kPiPlus};
896929
RecoDecay::getDaughters(particle, &listDaughters, arrDaughScPlusPDG, 2);
897930
}
898931
} else {
899-
std::array<int, NDaughtersLc> arrDaughLcPDG = {kProton, -kKPlus, kPiPlus};
900-
RecoDecay::getDaughters(particle, &listDaughters, arrDaughLcPDG, 2);
932+
std::array<int, NDaughtersLc> arrDaughLcPDG = {kProton, -kKPlus, kPiPlus};
933+
RecoDecay::getDaughters(particle, &listDaughters, arrDaughLcPDG, 2);
901934
}
902-
935+
903936
int counterDaughters = 0;
904937
std::vector<int> prongsId(expectedDaughters);
905938
if (listDaughters.size() == expectedDaughters) {
@@ -921,9 +954,9 @@ struct HfCorrelatorLcScHadrons {
921954

922955
if (std::find(prongsId.begin(), prongsId.end(), particleAssoc.globalIndex()) != prongsId.end()) {
923956
if (!storeAutoCorrelationFlag) {
924-
continue;
925-
}
926-
correlationStatus = true;
957+
continue;
958+
}
959+
correlationStatus = true;
927960
}
928961

929962
if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particle.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) {
@@ -1050,14 +1083,14 @@ struct HfCorrelatorLcScHadrons {
10501083

10511084
/// Lc-Hadron correlation pair builder - for Mc Gen-level analysis
10521085
void processMcGenLc(SelCollisionsMc::iterator const& mcCollision,
1053-
CandidatesLcMcGen const& mcParticles)
1086+
CandidatesLcMcGen const& mcParticles)
10541087
{
10551088
doSameEventMcGen<false>(mcCollision, mcParticles);
10561089
}
10571090
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenLc, "Process Mc Gen Lc mode", false);
10581091

1059-
void processMcGenSc(SelCollisionsMc::iterator const& mcCollision,
1060-
CandidatesScMcGen const& mcParticles)
1092+
void processMcGenSc(SelCollisionsMc::iterator const& mcCollision,
1093+
CandidatesScMcGen const& mcParticles)
10611094
{
10621095
doSameEventMcGen<true>(mcCollision, mcParticles);
10631096
}

0 commit comments

Comments
 (0)