Skip to content

Commit 5880c77

Browse files
authored
[PWGEM/Dilepton] update table producers (#9127)
1 parent 31d5088 commit 5880c77

File tree

4 files changed

+95
-206
lines changed

4 files changed

+95
-206
lines changed

PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -329,128 +329,10 @@ struct AssociateDileptonToEMEvent {
329329
PROCESS_SWITCH(AssociateDileptonToEMEvent, processFwdMuon, "process forward muon indexing", false);
330330
PROCESS_SWITCH(AssociateDileptonToEMEvent, processDummy, "process dummy", true);
331331
};
332-
struct EMEventPropertyTask {
333-
SliceCache cache;
334-
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
335-
using Run3Tracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA>;
336-
337-
Configurable<bool> fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"};
338-
339-
Produces<aod::EMEventsProperty> evprop;
340-
struct : ConfigurableGroup {
341-
std::string prefix = "spherocity_cutgroup";
342-
Configurable<bool> require_isPVContributor{"require_isPVContributor", false, "require tracks to be PV contributors"};
343-
Configurable<int> min_ntrack{"min_ntrack", 3, "min. number of tracks"};
344-
Configurable<float> min_pt{"min_pt", 0.15, "min. pT of track in GeV/c"};
345-
Configurable<float> min_eta{"min_eta", -0.8, "min. eta of track"};
346-
Configurable<float> max_eta{"max_eta", +0.8, "max. eta of track"};
347-
Configurable<float> max_dcaxy{"max_dcaxy", 2.4, "max. DCAxy of track in cm"};
348-
Configurable<float> max_dcaz{"max_dcaz", 3.2, "max. DCAz of track in cm"};
349-
Configurable<int> min_ncluster_tpc{"min_ncluster_tpc", 50, "min. number of TPC clusters"};
350-
Configurable<float> max_chi2tpc{"max_chi2tpc", 4.0, "max. chi2/ncls TPC"};
351-
} spherocity_cuts;
352-
353-
HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
354-
void init(InitContext&)
355-
{
356-
if (fillQAHistogram) {
357-
fRegistry.add("Spherocity/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{200, 0.0f, 10}}, false);
358-
fRegistry.add("Spherocity/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {40, -1.0f, 1.0f}}, false);
359-
fRegistry.add("Spherocity/hSpherocity_ptweighted", "spherocity;Number of used tracks;spherocity", kTH2F, {{101, -0.5, 100.5}, {100, 0.0f, 1}}, false);
360-
fRegistry.add("Spherocity/hSpherocity_ptunweighted", "spherocity;Number of used tracks;spherocity", kTH2F, {{101, -0.5, 100.5}, {100, 0.0f, 1}}, false);
361-
}
362-
}
363-
364-
template <typename TTracks>
365-
int getSpherocity(TTracks const& tracks, float& spherocity_ptweighted, float& spherocity_ptunweighted)
366-
{
367-
// Reference for spherocity : https://arxiv.org/pdf/1905.07208, https://arxiv.org/abs/2310.20406, https://arxiv.org/abs/1205.3963
368-
int used_ntrack_spherocity = 0;
369-
float sum_pt = 0.f, sum_ntrack = 0.f;
370-
371-
for (auto const& track : tracks) {
372-
if (spherocity_cuts.require_isPVContributor && !track.isPVContributor()) {
373-
continue;
374-
}
375-
if (track.tpcNClsFound() < spherocity_cuts.min_ncluster_tpc) {
376-
continue;
377-
}
378-
379-
sum_pt += track.pt();
380-
sum_ntrack += 1.f;
381-
382-
if (fillQAHistogram) {
383-
fRegistry.fill(HIST("Spherocity/hPt"), track.pt());
384-
fRegistry.fill(HIST("Spherocity/hEtaPhi"), track.phi(), track.eta());
385-
}
386-
used_ntrack_spherocity++;
387-
} // end of track loop per collision
388-
389-
float tempSph = 1.f, tempSph_pt1 = 1.f;
390-
for (int i = 0; i < 360 / 0.1; i++) {
391-
float nx = std::cos(M_PI / 180.f * i * 0.1);
392-
float ny = std::sin(M_PI / 180.f * i * 0.1);
393-
float sum_crossprod = 0.f, sum_crossprod_pt1 = 0.f;
394-
for (auto const& track : tracks) {
395-
if (spherocity_cuts.require_isPVContributor && !track.isPVContributor()) {
396-
continue;
397-
}
398-
if (track.tpcNClsFound() < spherocity_cuts.min_ncluster_tpc) {
399-
continue;
400-
}
401-
float px = track.px();
402-
float py = track.py();
403-
sum_crossprod += abs(px * ny - py * nx);
404-
sum_crossprod_pt1 += abs(std::cos(track.phi()) * ny - std::sin(track.phi()) * nx);
405-
}
406-
float sph = std::pow(sum_crossprod / sum_pt, 2);
407-
float sph_pt1 = std::pow(sum_crossprod_pt1 / sum_ntrack, 2);
408-
if (sph < tempSph) {
409-
tempSph = sph;
410-
}
411-
if (sph_pt1 < tempSph_pt1) {
412-
tempSph_pt1 = sph_pt1;
413-
}
414-
} // end of track loop per collision
415-
spherocity_ptweighted = std::pow(M_PI_2, 2) * tempSph;
416-
spherocity_ptunweighted = std::pow(M_PI_2, 2) * tempSph_pt1;
417-
if (used_ntrack_spherocity < spherocity_cuts.min_ntrack) {
418-
spherocity_ptweighted = -1.f;
419-
spherocity_ptunweighted = -1.f;
420-
}
421-
return used_ntrack_spherocity;
422-
}
423-
424-
Partition<Run3Tracks> tracks_for_spherocity = spherocity_cuts.min_pt < aod::track::pt && spherocity_cuts.min_eta < o2::aod::track::eta && o2::aod::track::eta < spherocity_cuts.max_eta && nabs(o2::aod::track::dcaXY) < spherocity_cuts.max_dcaxy && nabs(o2::aod::track::dcaZ) < spherocity_cuts.max_dcaz && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true && o2::aod::track::tpcChi2NCl < spherocity_cuts.max_chi2tpc; // ITS-TPC matched tracks
425-
426-
void processProp(aod::EMEvents const& collisions, Run3Tracks const&)
427-
{
428-
for (auto& collision : collisions) {
429-
auto tracks_for_spherocity_per_collision = tracks_for_spherocity->sliceByCached(o2::aod::track::collisionId, collision.collisionId(), cache);
430-
float spherocity_ptweighted = -1.f, spherocity_ptunweighted = -1.f;
431-
int ntrack = getSpherocity(tracks_for_spherocity_per_collision, spherocity_ptweighted, spherocity_ptunweighted);
432-
if (fillQAHistogram) {
433-
fRegistry.fill(HIST("Spherocity/hSpherocity_ptweighted"), ntrack, spherocity_ptweighted);
434-
fRegistry.fill(HIST("Spherocity/hSpherocity_ptunweighted"), ntrack, spherocity_ptunweighted);
435-
}
436-
evprop(spherocity_ptweighted, spherocity_ptunweighted, ntrack);
437-
} // end of collision loop
438-
}
439-
PROCESS_SWITCH(EMEventPropertyTask, processProp, "process event property", true);
440-
441-
void processDummy(aod::EMEvents const& collisions)
442-
{
443-
for (int i = 0; i < collisions.size(); i++) {
444-
evprop(-1.f, -1.f, 0);
445-
} // end of collision loop
446-
}
447-
PROCESS_SWITCH(EMEventPropertyTask, processDummy, "process dummy", false);
448-
};
449332
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
450333
{
451334
return WorkflowSpec{
452335
adaptAnalysisTask<CreateEMEventDilepton>(cfgc, TaskName{"create-emevent-dilepton"}),
453336
adaptAnalysisTask<AssociateDileptonToEMEvent>(cfgc, TaskName{"associate-dilepton-to-emevent"}),
454-
adaptAnalysisTask<EMEventPropertyTask>(cfgc, TaskName{"emevent-property"}),
455337
};
456338
}

PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ struct filterDielectronEvent {
7474
Configurable<int> min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"};
7575
Configurable<int> mincrossedrows{"mincrossedrows", 80, "min. crossed rows"};
7676
Configurable<float> min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"};
77-
Configurable<float> max_mean_its_cluster_size{"max_mean_its_cluster_size", 16.f, "max. <ITS cluster size> x cos(lambda)"};
78-
Configurable<float> max_p_for_its_cluster_size{"max_p_for_its_cluster_size", 0, "its cluster size cut is applied below this p"};
79-
Configurable<float> max_pin_for_pion_rejection{"max_pin_for_pion_rejection", -1, "pion rejection is applied below this pin"};
80-
Configurable<int> minitsncls{"minitsncls", 4, "min. number of ITS clusters"};
77+
Configurable<float> max_pin_for_pion_rejection{"max_pin_for_pion_rejection", 1e+10, "pion rejection is applied below this pin"};
78+
Configurable<float> max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"};
79+
Configurable<int> min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"};
80+
Configurable<int> min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"};
8181
Configurable<float> maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"};
8282
Configurable<float> maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"};
8383
Configurable<float> minpt{"minpt", 0.15, "min pt for track"};
@@ -102,8 +102,6 @@ struct filterDielectronEvent {
102102

103103
HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
104104

105-
std::pair<int8_t, std::set<uint8_t>> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers.
106-
107105
int mRunNumber;
108106
float d_bz;
109107
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -220,25 +218,10 @@ struct filterDielectronEvent {
220218
if (!track.hasITS() || !track.hasTPC()) {
221219
return false;
222220
}
223-
if (track.itsNCls() < minitsncls) {
221+
if (track.itsNCls() < min_ncluster_its) {
224222
return false;
225223
}
226-
227-
auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); });
228-
if (hits < itsRequirement.first) {
229-
return false;
230-
}
231-
232-
uint32_t itsClusterSizes = track.itsClusterSizes();
233-
int total_cluster_size = 0, nl = 0;
234-
for (unsigned int layer = 0; layer < 7; layer++) {
235-
int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf;
236-
if (cluster_size_per_layer > 0) {
237-
nl++;
238-
}
239-
total_cluster_size += cluster_size_per_layer;
240-
}
241-
if (static_cast<float>(total_cluster_size) / static_cast<float>(nl) * std::cos(std::atan(track.tgl())) > max_mean_its_cluster_size && track.p() < max_p_for_its_cluster_size) {
224+
if (track.itsNClsInnerBarrel() < min_ncluster_itsib) {
242225
return false;
243226
}
244227

@@ -254,6 +237,10 @@ struct filterDielectronEvent {
254237
return false;
255238
}
256239

240+
if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) {
241+
return false;
242+
}
243+
257244
gpu::gpustd::array<float, 2> dcaInfo;
258245
auto track_par_cov_recalc = getTrackParCov(track);
259246
track_par_cov_recalc.setPID(o2::track::PID::Electron);
@@ -298,7 +285,7 @@ struct filterDielectronEvent {
298285
if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) {
299286
return false;
300287
}
301-
if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) {
288+
if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) {
302289
return false;
303290
}
304291
if (minTPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < maxTPCNsigmaKa) {
@@ -316,7 +303,7 @@ struct filterDielectronEvent {
316303
template <typename TTrack>
317304
bool isElectron_TOFreq(TTrack const& track)
318305
{
319-
if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) {
306+
if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) {
320307
return false;
321308
}
322309
return minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl && fabs(track.tofNSigmaEl()) < maxTOFNsigmaEl;

0 commit comments

Comments
 (0)