Skip to content

Commit 6aedd88

Browse files
authored
PWGHF:Fixed the issue of timeout
Refactor V0 events selection logic and configurations for Lambda_c correlations.
1 parent ac2da13 commit 6aedd88

File tree

1 file changed

+105
-94
lines changed

1 file changed

+105
-94
lines changed

PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx

Lines changed: 105 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ double getDeltaPhi(double phiLc, double phiHadron)
8181
// definition of ME variables
8282
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::mult::MultFT0M<aod::mult::MultFT0A, aod::mult::MultFT0C>>;
8383
using BinningTypeMcGen = ColumnBinningPolicy<aod::mccollision::PosZ, o2::aod::mult::MultMCFT0A>;
84-
84+
double massLambda = o2::constants::physics::MassLambda;
8585
// Code to select collisions with at least one Lambda_c
8686
struct HfCorrelatorLcScHadronsSelection {
8787
Produces<aod::LcSelection> candSel;
@@ -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,89 @@ 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()) * 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+
270+
176271
void processLcSelection(SelCollisions::iterator const& collision,
177272
CandsLcDataFiltered const& candidates)
178273
{
@@ -274,24 +369,12 @@ struct HfCorrelatorLcScHadrons {
274369
Configurable<float> cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 3., "max. TPCnSigma Proton"};
275370
Configurable<float> cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 2., "max. TPCnSigma Pion"};
276371
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"};
283372
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"};
289373
} cfgV0;
290374

291375
HfHelper hfHelper;
292376
SliceCache cache;
293377
Service<o2::framework::O2DatabasePDG> pdg;
294-
double massLambda = o2::constants::physics::MassLambda;
295378
int8_t chargeCand = 3;
296379
int8_t signSoftPion = 0;
297380
int leadingIndex = 0;
@@ -471,38 +554,8 @@ struct HfCorrelatorLcScHadrons {
471554
return y;
472555
}
473556

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-
}
504557

505-
template <typename T>
558+
template <typename T>
506559
bool isSelectedV0Daughter(T const& track, int pid)
507560
{
508561
// if (!track.isGlobalTrackWoDCA())
@@ -532,15 +585,10 @@ struct HfCorrelatorLcScHadrons {
532585
return true;
533586
}
534587

535-
template <bool IsMcRec = false, typename CollType, typename V0, typename TrackType>
536-
void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&)
588+
template <bool IsMcRec = false, typename V0, typename TrackType>
589+
void fillV0Histograms(V0 const& v0s, TrackType const&)
537590
{
538591
for (const auto& v0 : v0s) {
539-
540-
if (!selectionV0(collV0, v0)) {
541-
continue;
542-
}
543-
544592
auto posTrackV0 = v0.template posTrack_as<TrackType>();
545593
auto negTrackV0 = v0.template negTrack_as<TrackType>();
546594

@@ -598,32 +646,6 @@ struct HfCorrelatorLcScHadrons {
598646
}
599647
}
600648

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-
627649
template <typename T1, typename T2, typename McPart>
628650
void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles)
629651
{
@@ -1389,31 +1411,20 @@ struct HfCorrelatorLcScHadrons {
13891411
}
13901412
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false);
13911413

1392-
void processDataLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1414+
void processDataLambdaV0(SelCollisions::iterator const&,
13931415
TracksData const& tracks, aod::V0Datas const& v0s)
13941416
{
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);
1417+
fillV0Histograms<false>(v0s, tracks);
14021418
}
14031419
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false);
14041420

1405-
void processMcLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1406-
TracksWithMc const& tracks, soa::Join<aod::V0Datas, aod::McV0Labels> const& v0s, aod::McParticles const&)
1421+
void processMcLambdaV0(SelCollisions::iterator const&,
1422+
TracksWithMc const& tracks, soa::Join<aod::V0Datas,aod::McV0Labels> const& v0s, aod::McParticles const&)
14071423
{
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);
1424+
fillV0Histograms<true>(v0s, tracks);
14151425
}
14161426
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false);
1427+
14171428
};
14181429

14191430
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)