@@ -124,6 +124,17 @@ struct strangenessderivedbinnedinfo {
124124 Configurable<float > maxIR{" maxIR" , -1 , " maximum IR collisions" };
125125 } eventSelections;
126126
127+ static constexpr float defaultSqrtScalingParameters[1 ][4 ] = {{0.1 , 0.1 , 0 , 128 }};
128+
129+ // preselection options
130+ struct : ConfigurableGroup {
131+ std::string prefix = " encodingOpts" ;
132+ Configurable<bool > useSqrtEncodingForOccupancy{" useSqrtEncodingForOccupancy" , false , " Store sqrt(occupancy) instead of occupancy" };
133+ Configurable<bool > useSqrtEncodingForRadius{" useSqrtEncodingForRadius" , false , " Store sqrt(radius) instead of radius" };
134+ Configurable<bool > useSqrtScalingForEncodingPt{" useSqrtScalingForEncodingPt" , false , " Store sqrt scaling(pT) instead of pT" };
135+ Configurable<LabeledArray<float >> sqrtScalingParameters{" sqrtScalingParameters" , {defaultSqrtScalingParameters[0 ], 4 , {" sigma0" , " sigma1" , " clampMin" , " clampMax" }}, " Sqrt scaling parameters" };
136+ } encodingOpts;
137+
127138 struct : ConfigurableGroup {
128139 Configurable<int > v0TypeSelection{" v0Selections.v0TypeSelection" , 1 , " select on a certain V0 type (leave negative if no selection desired)" };
129140
@@ -246,6 +257,20 @@ struct strangenessderivedbinnedinfo {
246257 // PDG database
247258 Service<o2::framework::O2DatabasePDG> pdgDB;
248259
260+ // Sqrt scaling function
261+ // Author: Marian Ivanov
262+ int codeSqrtScaling (float val, float sigma0, float sigma1, int clampMin, int clampMax) {
263+ float code_f = std::asinh ((sigma1 * val) / sigma0) / sigma0;
264+ return std::clamp (static_cast <int >(std::round (code_f)), clampMin, clampMax);
265+ }
266+
267+ // Function to decode the sqrt scaling
268+ // Author: Marian Ivanov
269+ float decodeSqrtScaling (int code, float sigma0, float sigma1, int clampMin, int clampMax) {
270+ float code_f = static_cast <float >(code);
271+ return (sigma0 / sigma1) * std::sinh (sigma0 * code_f);
272+ }
273+
249274 void init (InitContext const &)
250275 {
251276 if (analyseK0Short + analyseLambda + analyseAntiLambda + analyseXi + analyseOmega > 1 ) {
@@ -481,6 +506,8 @@ struct strangenessderivedbinnedinfo {
481506 } else {
482507 centrality = collision.centFT0C ();
483508 occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange () : collision.trackOccupancyInTimeRange ();
509+ if (encodingOpts.useSqrtEncodingForOccupancy )
510+ occupancy = std::sqrt (occupancy);
484511 }
485512 histos.fill (HIST (" hEventCentrality" ), centrality);
486513 histos.fill (HIST (" hEventOccupancy" ), occupancy);
@@ -772,14 +799,17 @@ struct strangenessderivedbinnedinfo {
772799 if (v0.v0Type () != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1 )
773800 continue ; // skip V0s that are not standard
774801
802+ float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling (v0.pt (), encodingOpts.sqrtScalingParameters ->get (" sigma0" ), encodingOpts.sqrtScalingParameters ->get (" sigma1" ), encodingOpts.sqrtScalingParameters ->get (" clampMin" ), encodingOpts.sqrtScalingParameters ->get (" clampMax" )) : v0.pt ();
803+ float decayRadius = encodingOpts.useSqrtEncodingForRadius ? decayRadius = std::sqrt (v0.v0radius ()) : v0.v0radius ();
804+
775805 if (analyseK0Short && isV0Selected (v0, collision, v0.yK0Short ())) {
776- histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mK0Short (), v0. pt () , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), v0. v0radius () , centrality, occupancy);
806+ histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mK0Short (), pT , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), decayRadius , centrality, occupancy);
777807 }
778808 if (analyseLambda && isV0Selected (v0, collision, v0.yLambda ())) {
779- histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mLambda (), v0. pt () , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), v0. v0radius () , centrality, occupancy);
809+ histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mLambda (), pT , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), decayRadius , centrality, occupancy);
780810 }
781811 if (analyseAntiLambda && isV0Selected (v0, collision, v0.yLambda ())) {
782- histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mAntiLambda (), v0. pt () , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), v0. v0radius () , centrality, occupancy);
812+ histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), v0.mAntiLambda (), pT , v0.phi (), v0.eta (), v0.qtarm (), v0.alpha (), decayRadius , centrality, occupancy);
783813 }
784814 } // end v0 loop
785815 }
@@ -791,11 +821,14 @@ struct strangenessderivedbinnedinfo {
791821 std::abs (cascade.bacheloreta ()) > cascSelections.daughterEtaCut )
792822 continue ; // remove acceptance that's badly reproduced by MC / superfluous in future
793823
824+ float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling (cascade.pt (), encodingOpts.sqrtScalingParameters ->get (" sigma0" ), encodingOpts.sqrtScalingParameters ->get (" sigma1" ), encodingOpts.sqrtScalingParameters ->get (" clampMin" ), encodingOpts.sqrtScalingParameters ->get (" clampMax" )) : cascade.pt ();
825+ float decayRadius = encodingOpts.useSqrtEncodingForRadius ? decayRadius = std::sqrt (cascade.cascradius ()) : cascade.cascradius ();
826+
794827 if (analyseXi && isCascadeSelected (cascade, collision, cascade.yXi ())) {
795- histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), cascade.m (1 ), cascade. pt () , cascade.phi (), cascade.eta (), 0 ., 0 ., cascade. cascradius () , centrality, occupancy);
828+ histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), cascade.m (1 ), pT , cascade.phi (), cascade.eta (), 0 ., 0 ., decayRadius , centrality, occupancy);
796829 }
797830 if (analyseOmega && isCascadeSelected (cascade, collision, cascade.yOmega ())) {
798- histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), cascade.pt (), cascade. m (2 ), cascade. pt () , cascade.phi (), cascade.eta (), 0 ., 0 ., cascade. cascradius () , centrality, occupancy);
831+ histos.fill (HIST (" h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc" ), cascade.m (2 ), pT , cascade.phi (), cascade.eta (), 0 ., 0 ., decayRadius , centrality, occupancy);
799832 }
800833 } // end cascade loop
801834 }
0 commit comments