@@ -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- };
449332WorkflowSpec 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}
0 commit comments