Skip to content

Commit ae0dc8b

Browse files
[PWGHF] Fixed the issue of timeout for V0 process (#13421)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 605336a commit ae0dc8b

File tree

1 file changed

+102
-94
lines changed

1 file changed

+102
-94
lines changed

PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx

Lines changed: 102 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ struct HfCorrelatorLcScHadronsSelection {
9393
Configurable<float> yCandMax{"yCandMax", 0.8, "max. cand. rapidity"};
9494
Configurable<float> ptCandMin{"ptCandMin", 1., "min. cand. pT"};
9595

96+
struct : ConfigurableGroup {
97+
Configurable<float> cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"};
98+
Configurable<float> cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"};
99+
Configurable<float> cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"};
100+
Configurable<float> cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"};
101+
Configurable<float> cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"};
102+
Configurable<float> cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"};
103+
Configurable<float> cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"};
104+
Configurable<float> cfgPV{"cfgPV", 10., "maximum z-vertex"};
105+
Configurable<int> cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
106+
Configurable<int> cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
107+
} cfgV0;
108+
96109
HfHelper hfHelper;
97110
SliceCache cache;
98111

@@ -172,7 +185,88 @@ struct HfCorrelatorLcScHadronsSelection {
172185
candSel(isCandFound);
173186
}
174187

188+
template <typename TCollision, typename V0>
189+
bool selectionV0(TCollision const& collision, V0 const& candidate)
190+
{
191+
if (candidate.v0radius() < cfgV0.cfgV0radiusMin) {
192+
return false;
193+
}
194+
if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) {
195+
return false;
196+
}
197+
if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) {
198+
return false;
199+
}
200+
if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) {
201+
return false;
202+
}
203+
if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) {
204+
return false;
205+
}
206+
if (candidate.pt() < cfgV0.cfgV0PtMin) {
207+
return false;
208+
}
209+
if (std::abs(candidate.yLambda()) > yCandMax) {
210+
return false;
211+
}
212+
if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda > cfgV0.cfgV0LifeTime) {
213+
return false;
214+
}
215+
216+
return true;
217+
}
218+
219+
template <typename TCollision>
220+
bool eventSelV0(TCollision collision)
221+
{
222+
if (!collision.sel8()) {
223+
return 0;
224+
}
225+
226+
if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
227+
return 0;
228+
}
229+
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
230+
return 0;
231+
}
232+
if (std::abs(collision.posZ()) > cfgV0.cfgPV) {
233+
return 0;
234+
}
235+
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
236+
return 0;
237+
}
238+
if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) {
239+
return 0;
240+
}
241+
242+
return 1;
243+
} // event selection V0
244+
175245
/// Code to select collisions with at least one Lc - for real data and data-like analysis
246+
void processV0Selection(SelCollisions::iterator const& collision,
247+
aod::V0Datas const& V0s)
248+
{
249+
bool isCandFound = false;
250+
const int64_t kMinV0Candidates = 1;
251+
252+
if (!eventSelV0(collision)) {
253+
candSel(isCandFound);
254+
return;
255+
}
256+
if (V0s.size() < kMinV0Candidates) {
257+
candSel(isCandFound);
258+
return;
259+
}
260+
for (const auto& v0 : V0s) {
261+
if (selectionV0(collision, v0)) {
262+
isCandFound = true;
263+
break;
264+
}
265+
}
266+
candSel(isCandFound);
267+
}
268+
PROCESS_SWITCH(HfCorrelatorLcScHadronsSelection, processV0Selection, "Process V0 Collision Selection for Data", true);
269+
176270
void processLcSelection(SelCollisions::iterator const& collision,
177271
CandsLcDataFiltered const& candidates)
178272
{
@@ -274,24 +368,12 @@ struct HfCorrelatorLcScHadrons {
274368
Configurable<float> cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 3., "max. TPCnSigma Proton"};
275369
Configurable<float> cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 2., "max. TPCnSigma Pion"};
276370
Configurable<float> cfgDaughPIDCutsTOFPi{"cfgDaughPIDCutsTOFPi", 2., "max. TOFnSigma Pion"};
277-
278-
Configurable<float> cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"};
279-
Configurable<float> cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"};
280-
Configurable<float> cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"};
281-
Configurable<float> cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"};
282-
Configurable<float> cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"};
283371
Configurable<float> cfgHypMassWindow{"cfgHypMassWindow", 0.5, "single lambda mass selection"};
284-
Configurable<float> cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"};
285-
Configurable<float> cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"};
286-
Configurable<float> cfgPV{"cfgPV", 10., "maximum z-vertex"};
287-
Configurable<int> cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
288-
Configurable<int> cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
289372
} cfgV0;
290373

291374
HfHelper hfHelper;
292375
SliceCache cache;
293376
Service<o2::framework::O2DatabasePDG> pdg;
294-
double massLambda = o2::constants::physics::MassLambda;
295377
int8_t chargeCand = 3;
296378
int8_t signSoftPion = 0;
297379
int leadingIndex = 0;
@@ -471,37 +553,6 @@ struct HfCorrelatorLcScHadrons {
471553
return y;
472554
}
473555

474-
template <typename TCollision, typename V0>
475-
bool selectionV0(TCollision const& collision, V0 const& candidate)
476-
{
477-
if (candidate.v0radius() < cfgV0.cfgV0radiusMin) {
478-
return false;
479-
}
480-
if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) {
481-
return false;
482-
}
483-
if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) {
484-
return false;
485-
}
486-
if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) {
487-
return false;
488-
}
489-
if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) {
490-
return false;
491-
}
492-
if (candidate.pt() < cfgV0.cfgV0PtMin) {
493-
return false;
494-
}
495-
if (std::abs(candidate.yLambda()) > yCandMax) {
496-
return false;
497-
}
498-
if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0.cfgV0LifeTime) {
499-
return false;
500-
}
501-
502-
return true;
503-
}
504-
505556
template <typename T>
506557
bool isSelectedV0Daughter(T const& track, int pid)
507558
{
@@ -532,20 +583,15 @@ struct HfCorrelatorLcScHadrons {
532583
return true;
533584
}
534585

535-
template <bool IsMcRec = false, typename CollType, typename V0, typename TrackType>
536-
void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&)
586+
template <bool IsMcRec = false, typename V0, typename TrackType>
587+
void fillV0Histograms(V0 const& v0s, TrackType const&)
537588
{
538589
for (const auto& v0 : v0s) {
539-
540-
if (!selectionV0(collV0, v0)) {
541-
continue;
542-
}
543-
544590
auto posTrackV0 = v0.template posTrack_as<TrackType>();
545591
auto negTrackV0 = v0.template negTrack_as<TrackType>();
546592

547593
if (isSelectedV0Daughter(posTrackV0, kProton) && isSelectedV0Daughter(negTrackV0, kPiPlus)) {
548-
if (std::abs(massLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) {
594+
if (std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) {
549595
registry.fill(HIST("hV0Lambda"), v0.mLambda(), v0.pt(), posTrackV0.pt());
550596
registry.fill(HIST("hV0LambdaRefl"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
551597

@@ -556,7 +602,7 @@ struct HfCorrelatorLcScHadrons {
556602
}
557603
}
558604
if (isSelectedV0Daughter(negTrackV0, kProton) && isSelectedV0Daughter(posTrackV0, kPiPlus)) {
559-
if (std::abs(massLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) {
605+
if (std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) {
560606
registry.fill(HIST("hV0Lambda"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
561607
registry.fill(HIST("hV0LambdaRefl"), v0.mLambda(), v0.pt(), posTrackV0.pt());
562608

@@ -598,32 +644,6 @@ struct HfCorrelatorLcScHadrons {
598644
}
599645
}
600646

601-
template <typename TCollision>
602-
bool eventSelV0(TCollision collision)
603-
{
604-
if (!collision.sel8()) {
605-
return 0;
606-
}
607-
608-
if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
609-
return 0;
610-
}
611-
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
612-
return 0;
613-
}
614-
if (std::abs(collision.posZ()) > cfgV0.cfgPV) {
615-
return 0;
616-
}
617-
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
618-
return 0;
619-
}
620-
if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) {
621-
return 0;
622-
}
623-
624-
return 1;
625-
} // event selection V0
626-
627647
template <typename T1, typename T2, typename McPart>
628648
void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles)
629649
{
@@ -1389,29 +1409,17 @@ struct HfCorrelatorLcScHadrons {
13891409
}
13901410
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false);
13911411

1392-
void processDataLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1412+
void processDataLambdaV0(SelCollisions::iterator const&,
13931413
TracksData const& tracks, aod::V0Datas const& v0s)
13941414
{
1395-
registry.fill(HIST("hEventLambdaV0"), 0.5);
1396-
if (!eventSelV0(collision)) {
1397-
return;
1398-
}
1399-
registry.fill(HIST("hEventLambdaV0"), 1.5);
1400-
1401-
fillV0Histograms<false>(collision, v0s, tracks);
1415+
fillV0Histograms<false>(v0s, tracks);
14021416
}
14031417
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false);
14041418

1405-
void processMcLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1419+
void processMcLambdaV0(SelCollisions::iterator const&,
14061420
TracksWithMc const& tracks, soa::Join<aod::V0Datas, aod::McV0Labels> const& v0s, aod::McParticles const&)
14071421
{
1408-
registry.fill(HIST("hEventLambdaV0"), 0.5);
1409-
if (!eventSelV0(collision)) {
1410-
return;
1411-
}
1412-
registry.fill(HIST("hEventLambdaV0"), 1.5);
1413-
1414-
fillV0Histograms<true>(collision, v0s, tracks);
1422+
fillV0Histograms<true>(v0s, tracks);
14151423
}
14161424
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false);
14171425
};

0 commit comments

Comments
 (0)