4040#include " Framework/ASoAHelpers.h"
4141#include " Framework/O2DatabasePDGPlugin.h"
4242#include " ReconstructionDataFormats/Track.h"
43+ #include " CCDB/BasicCCDBManager.h"
4344#include " CommonConstants/PhysicsConstants.h"
4445#include " Common/Core/trackUtilities.h"
4546#include " PWGLF/DataModel/LFStrangenessTables.h"
5556#include " Tools/ML/MlResponse.h"
5657#include " Tools/ML/model.h"
5758
59+ #include " EventFiltering/Zorro.h"
60+ #include " EventFiltering/ZorroSummary.h"
61+
5862// constants
5963const float ctauXiPDG = 4.91 ; // from PDG
6064const float ctauOmegaPDG = 2.461 ; // from PDG
@@ -83,6 +87,11 @@ struct quarkoniaToHyperons {
8387 // master analysis switches
8488 Configurable<bool > isPP{" isPP" , true , " If running on pp collision, switch it on true" };
8589
90+ // for running over skimmed dataset
91+ Configurable<bool > cfgSkimmedProcessing{" cfgSkimmedProcessing" , false , " If running over skimmed data, switch it on true" };
92+ Configurable<std::string> cfgSkimmedTrigger{" cfgSkimmedTrigger" , " fDoubleXi,fTripleXi,fQuadrupleXi" , " (std::string) Comma separated list of triggers of interest" };
93+
94+ // switch on/off event selections
8695 Configurable<bool > requireSel8{" requireSel8" , true , " require sel8 event selection" };
8796 Configurable<bool > rejectITSROFBorder{" rejectITSROFBorder" , true , " reject events at ITS ROF border" };
8897 Configurable<bool > rejectTFBorder{" rejectTFBorder" , true , " reject events at TF border" };
@@ -98,6 +107,8 @@ struct quarkoniaToHyperons {
98107 Configurable<bool > buildXiXiBarPairs{" buildXiXiBarPairs" , false , " Build Xi antiXi from charmonia decay" };
99108 Configurable<bool > buildOmOmBarPairs{" buildOmOmBarPairs" , false , " Build Omega antiOmega from charmonia decay" };
100109
110+ Configurable<bool > buildSameSignPairs{" buildSameSignPairs" , false , " If true: build same-sign pairs, otherwise consider only opposite-sign pairs" };
111+
101112 // fast check on occupancy
102113 Configurable<float > minOccupancy{" minOccupancy" , -1 , " minimum occupancy from neighbouring collisions" };
103114 Configurable<float > maxOccupancy{" maxOccupancy" , -1 , " maximum occupancy from neighbouring collisions" };
@@ -255,10 +266,14 @@ struct quarkoniaToHyperons {
255266 Configurable<std::string> mVtxPath {" ccdbConfigurations.mVtxPath" , " GLO/Calib/MeanVertex" , " Path of the mean vertex file" };
256267 } ccdbConfigurations;
257268
269+ Service<o2::ccdb::BasicCCDBManager> ccdb;
258270 o2::ccdb::CcdbApi ccdbApi;
259271 int mRunNumber ;
260272 std::map<std::string, std::string> metadata;
261273
274+ Zorro zorro;
275+ OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
276+
262277 static constexpr float defaultLifetimeCuts[1 ][2 ] = {{30 ., 20 .}};
263278 Configurable<LabeledArray<float >> lifetimecut{" lifetimecut" , {defaultLifetimeCuts[0 ], 2 , {" lifetimecutLambda" , " lifetimecutK0S" }}, " lifetimecut" };
264279
@@ -654,6 +669,11 @@ struct quarkoniaToHyperons {
654669 histos.add (" OmOmBar/h3dInvMassTruePsi2S" , " h3dInvMassTruePsi2S" , kTH3F , {axisCentrality, axisPt, axisQuarkoniumMass});
655670 }
656671 }
672+
673+ if (cfgSkimmedProcessing) {
674+ zorroSummary.setObject (zorro.getZorroSummary ());
675+ }
676+
657677 // inspect histogram sizes, please
658678 histos.print ();
659679 }
@@ -666,6 +686,15 @@ struct quarkoniaToHyperons {
666686 }
667687
668688 mRunNumber = collision.runNumber ();
689+ if (cfgSkimmedProcessing) {
690+ ccdb->setURL (ccdbConfigurations.ccdburl );
691+ ccdb->setCaching (true );
692+ ccdb->setLocalObjectValidityChecking ();
693+ ccdb->setFatalWhenNull (false );
694+
695+ zorro.initCCDB (ccdb.service , collision.runNumber (), collision.timestamp (), cfgSkimmedTrigger.value );
696+ zorro.populateHistRegistry (histos, collision.runNumber ());
697+ }
669698
670699 // machine learning initialization if requested
671700 if (mlConfigurations.calculateK0ShortScores ||
@@ -1272,7 +1301,7 @@ struct quarkoniaToHyperons {
12721301 }
12731302
12741303 template <typename TV0>
1275- void analyseV0Candidate (TV0 v0, float pt, float /* centrality */ , uint64_t selMap, std::vector<bool >& selK0ShortIndices, std::vector<bool >& selLambdaIndices, std::vector<bool >& selAntiLambdaIndices, int v0TableOffset)
1304+ void analyseV0Candidate (TV0 v0, float pt, uint64_t selMap, std::vector<bool >& selK0ShortIndices, std::vector<bool >& selLambdaIndices, std::vector<bool >& selAntiLambdaIndices, int v0TableOffset)
12761305 // precalculate this information so that a check is one mask operation, not many
12771306 {
12781307 bool passK0ShortSelections = false ;
@@ -1349,7 +1378,7 @@ struct quarkoniaToHyperons {
13491378 float hyperonDecayLength = std::sqrt (std::pow (hyperon.x () - collision.posX (), 2 ) + std::pow (hyperon.y () - collision.posY (), 2 ) + std::pow (hyperon.z () - collision.posZ (), 2 )) * o2::constants::physics::MassLambda0 / (hyperon.p () + 1E-10 );
13501379 float antiHyperonDecayLength = std::sqrt (std::pow (antiHyperon.x () - collision.posX (), 2 ) + std::pow (antiHyperon.y () - collision.posY (), 2 ) + std::pow (antiHyperon.z () - collision.posZ (), 2 )) * o2::constants::physics::MassLambda0 / (antiHyperon.p () + 1E-10 );
13511380
1352- // Candidates after Xi selections
1381+ // Candidates after Lambda selections
13531382 histos.fill (HIST (" LaLaBar/Lambda/hPosDCAToPV" ), hyperon.dcapostopv ());
13541383 histos.fill (HIST (" LaLaBar/Lambda/hNegDCAToPV" ), hyperon.dcapostopv ());
13551384 histos.fill (HIST (" LaLaBar/Lambda/hDCAV0Daughters" ), hyperon.dcaV0daughters ());
@@ -1363,7 +1392,7 @@ struct quarkoniaToHyperons {
13631392 histos.fill (HIST (" LaLaBar/Lambda/hNegTPCNsigma" ), negTrackExtraHyperon.tpcNSigmaPi ());
13641393 histos.fill (HIST (" LaLaBar/Lambda/h2dPositiveITSvsTPCpts" ), posTrackExtraHyperon.tpcCrossedRows (), posTrackExtraHyperon.itsNCls ());
13651394 histos.fill (HIST (" LaLaBar/Lambda/h2dNegativeITSvsTPCpts" ), negTrackExtraHyperon.tpcCrossedRows (), negTrackExtraHyperon.itsNCls ());
1366- // Candidates after AntiXi selections
1395+ // Candidates after AntiLambda selections
13671396 histos.fill (HIST (" LaLaBar/AntiLambda/hPosDCAToPV" ), antiHyperon.dcapostopv ());
13681397 histos.fill (HIST (" LaLaBar/AntiLambda/hNegDCAToPV" ), antiHyperon.dcapostopv ());
13691398 histos.fill (HIST (" LaLaBar/AntiLambda/hDCAV0Daughters" ), antiHyperon.dcaV0daughters ());
@@ -1745,7 +1774,8 @@ struct quarkoniaToHyperons {
17451774 void processRealData (soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps>::iterator const & collision, v0Candidates const & fullV0s, cascadeCandidates const & fullCascades, dauTracks const &)
17461775 {
17471776 // Fire up CCDB
1748- if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores ) ||
1777+ if (cfgSkimmedProcessing ||
1778+ (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores ) ||
17491779 (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores ) ||
17501780 (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores )) {
17511781 initCCDB (collision);
@@ -1755,6 +1785,10 @@ struct quarkoniaToHyperons {
17551785 return ;
17561786 }
17571787
1788+ if (cfgSkimmedProcessing) {
1789+ zorro.isSelected (collision.globalBC ()); // / Just let Zorro do the accounting
1790+ }
1791+
17581792 float centrality = -1 ;
17591793 int selGapSide = -1 ; // only useful in case one wants to use this task in Pb-Pb UPC
17601794 fillEventHistograms (collision, centrality, selGapSide);
@@ -1779,7 +1813,7 @@ struct quarkoniaToHyperons {
17791813 selMap = selMap | (uint64_t (1 ) << selConsiderK0Short) | (uint64_t (1 ) << selConsiderLambda) | (uint64_t (1 ) << selConsiderAntiLambda);
17801814 selMap = selMap | (uint64_t (1 ) << selPhysPrimK0Short) | (uint64_t (1 ) << selPhysPrimLambda) | (uint64_t (1 ) << selPhysPrimAntiLambda);
17811815
1782- analyseV0Candidate (v0, v0.pt (), centrality, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset ());
1816+ analyseV0Candidate (v0, v0.pt (), selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset ());
17831817 } // end v0 loop
17841818
17851819 // count the number of K0s, Lambda and AntiLambdas passsing the selections
@@ -1794,9 +1828,15 @@ struct quarkoniaToHyperons {
17941828
17951829 // Check the number of Lambdas and antiLambdas
17961830 // needs at least 1 of each
1797- if (nLambdas >= 1 && nAntiLambdas >= 1 ) {
1831+ if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1 ) { // consider Lambda antiLambda pairs
17981832 buildHyperonAntiHyperonPairs (collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0 );
17991833 }
1834+ if (buildSameSignPairs && nLambdas > 1 ) { // consider Lambda Lambda pairs
1835+ buildHyperonAntiHyperonPairs (collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 0 );
1836+ }
1837+ if (buildSameSignPairs && nAntiLambdas > 1 ) { // consider antiLambda antiLambda pairs
1838+ buildHyperonAntiHyperonPairs (collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0 );
1839+ }
18001840 }
18011841
18021842 if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades
@@ -1839,19 +1879,31 @@ struct quarkoniaToHyperons {
18391879
18401880 // Check the number of Lambdas and antiLambdas
18411881 // needs at least 1 of each
1842- if (nXis >= 1 && nAntiXis >= 1 ) {
1882+ if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1 ) {
18431883 buildHyperonAntiHyperonPairs (collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 1 );
18441884 }
1885+ if (buildSameSignPairs && nXis > 1 ) {
1886+ buildHyperonAntiHyperonPairs (collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 1 );
1887+ }
1888+ if (buildSameSignPairs && nAntiXis > 1 ) {
1889+ buildHyperonAntiHyperonPairs (collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 1 );
1890+ }
18451891 }
18461892 if (buildOmOmBarPairs) {
18471893 histos.fill (HIST (" OmOmBar/h2dNbrOfOmegaVsCentrality" ), centrality, nOmegas);
18481894 histos.fill (HIST (" OmOmBar/h2dNbrOfAntiOmegaVsCentrality" ), centrality, nAntiOmegas);
18491895
18501896 // Check the number of Lambdas and antiLambdas
18511897 // needs at least 1 of each
1852- if (nOmegas >= 1 && nAntiOmegas >= 1 ) {
1898+ if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1 ) {
18531899 buildHyperonAntiHyperonPairs (collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 2 );
18541900 }
1901+ if (buildSameSignPairs && nOmegas > 1 ) {
1902+ buildHyperonAntiHyperonPairs (collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 2 );
1903+ }
1904+ if (buildSameSignPairs && nAntiOmegas > 1 ) {
1905+ buildHyperonAntiHyperonPairs (collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 2 );
1906+ }
18551907 }
18561908 }
18571909 }
@@ -1861,7 +1913,8 @@ struct quarkoniaToHyperons {
18611913 void processMonteCarlo (soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels>::iterator const & collision, v0MCCandidates const & fullV0s, cascadeMCCandidates const & fullCascades, dauTracks const &, aod::MotherMCParts const &, soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const & /* mccollisions*/ , soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const &, soa::Join<aod::CascMCCores, aod::CascMCCollRefs> const &)
18621914 {
18631915 // Fire up CCDB
1864- if ((mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores ) ||
1916+ if (cfgSkimmedProcessing ||
1917+ (mlConfigurations.useK0ShortScores && mlConfigurations.calculateK0ShortScores ) ||
18651918 (mlConfigurations.useLambdaScores && mlConfigurations.calculateLambdaScores ) ||
18661919 (mlConfigurations.useAntiLambdaScores && mlConfigurations.calculateAntiLambdaScores )) {
18671920 initCCDB (collision);
@@ -1871,6 +1924,10 @@ struct quarkoniaToHyperons {
18711924 return ;
18721925 }
18731926
1927+ if (cfgSkimmedProcessing) {
1928+ zorro.isSelected (collision.globalBC ()); // / Just let Zorro do the accounting
1929+ }
1930+
18741931 float centrality = -1 ;
18751932 int selGapSide = -1 ; // only useful in case one wants to use this task in Pb-Pb UPC
18761933 fillEventHistograms (collision, centrality, selGapSide);
@@ -1906,7 +1963,7 @@ struct quarkoniaToHyperons {
19061963 selMap = selMap | (uint64_t (1 ) << selPhysPrimK0Short) | (uint64_t (1 ) << selPhysPrimLambda) | (uint64_t (1 ) << selPhysPrimAntiLambda);
19071964 }
19081965
1909- analyseV0Candidate (v0, ptmc, centrality, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset ());
1966+ analyseV0Candidate (v0, ptmc, selMap, selK0ShortIndices, selLambdaIndices, selAntiLambdaIndices, fullV0s.offset ());
19101967 } // end v0 loop
19111968
19121969 // / count the number of K0s, Lambda and AntiLambdas passsing the selections
@@ -1919,9 +1976,15 @@ struct quarkoniaToHyperons {
19191976 histos.fill (HIST (" LaLaBar/h2dNbrOfLambdaVsCentrality" ), centrality, nLambdas);
19201977 histos.fill (HIST (" LaLaBar/h2dNbrOfAntiLambdaVsCentrality" ), centrality, nAntiLambdas);
19211978
1922- if (nLambdas >= 1 && nAntiLambdas >= 1 ) {
1979+ if (!buildSameSignPairs && nLambdas >= 1 && nAntiLambdas >= 1 ) { // consider Lambda antiLambda pairs
19231980 buildHyperonAntiHyperonPairs (collision, fullV0s, selLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0 );
19241981 }
1982+ if (buildSameSignPairs && nLambdas > 1 ) { // consider Lambda Lambda pairs
1983+ buildHyperonAntiHyperonPairs (collision, fullV0s, selLambdaIndices, selLambdaIndices, centrality, selGapSide, 0 );
1984+ }
1985+ if (buildSameSignPairs && nAntiLambdas > 1 ) { // consider antiLambda antiLambda pairs
1986+ buildHyperonAntiHyperonPairs (collision, fullV0s, selAntiLambdaIndices, selAntiLambdaIndices, centrality, selGapSide, 0 );
1987+ }
19251988 }
19261989
19271990 if (buildXiXiBarPairs || buildOmOmBarPairs) { // Look at Cascades
@@ -1940,7 +2003,6 @@ struct quarkoniaToHyperons {
19402003
19412004 auto cascadeMC = cascade.cascMCCore_as <soa::Join<aod::CascMCCores, aod::CascMCCollRefs>>();
19422005
1943- // float ptmc = RecoDecay::sqrtSumOfSquares(cascadeMC.pxMC(), cascadeMC.pyMC());
19442006 float ymc = 1e-3 ;
19452007 if (TMath::Abs (cascadeMC.pdgCode ()) == 3312 )
19462008 ymc = RecoDecay::y (std::array{cascadeMC.pxMC (), cascadeMC.pyMC (), cascadeMC.pzMC ()}, o2::constants::physics::MassXiMinus);
@@ -1976,19 +2038,31 @@ struct quarkoniaToHyperons {
19762038
19772039 // Check the number of Lambdas and antiLambdas
19782040 // needs at least 1 of each
1979- if (nXis >= 1 && nAntiXis >= 1 ) {
2041+ if (!buildSameSignPairs && nXis >= 1 && nAntiXis >= 1 ) {
19802042 buildHyperonAntiHyperonPairs (collision, fullCascades, selXiIndices, selAntiXiIndices, centrality, selGapSide, 1 );
19812043 }
2044+ if (buildSameSignPairs && nXis > 1 ) {
2045+ buildHyperonAntiHyperonPairs (collision, fullCascades, selXiIndices, selXiIndices, centrality, selGapSide, 1 );
2046+ }
2047+ if (buildSameSignPairs && nAntiXis > 1 ) {
2048+ buildHyperonAntiHyperonPairs (collision, fullCascades, selAntiXiIndices, selAntiXiIndices, centrality, selGapSide, 1 );
2049+ }
19822050 }
19832051 if (buildOmOmBarPairs) {
19842052 histos.fill (HIST (" OmOmBar/h2dNbrOfOmegaVsCentrality" ), centrality, nOmegas);
19852053 histos.fill (HIST (" OmOmBar/h2dNbrOfAntiOmegaVsCentrality" ), centrality, nAntiOmegas);
19862054
19872055 // Check the number of Lambdas and antiLambdas
19882056 // needs at least 1 of each
1989- if (nOmegas >= 1 && nAntiOmegas >= 1 ) {
2057+ if (!buildSameSignPairs && nOmegas >= 1 && nAntiOmegas >= 1 ) {
19902058 buildHyperonAntiHyperonPairs (collision, fullCascades, selOmIndices, selAntiOmIndices, centrality, selGapSide, 2 );
19912059 }
2060+ if (buildSameSignPairs && nOmegas > 1 ) {
2061+ buildHyperonAntiHyperonPairs (collision, fullCascades, selOmIndices, selOmIndices, centrality, selGapSide, 2 );
2062+ }
2063+ if (buildSameSignPairs && nAntiOmegas > 1 ) {
2064+ buildHyperonAntiHyperonPairs (collision, fullCascades, selAntiOmIndices, selAntiOmIndices, centrality, selGapSide, 2 );
2065+ }
19922066 }
19932067 }
19942068 }
0 commit comments