@@ -140,6 +140,20 @@ static const std::string multiplicityCentralityCorrelationsFormulaBase[11][1] =
140140 /* OO Run3 */ {" ((180.584-0.211625*[CT0C]+0.00568101*[CT0C]*[CT0C]-20.9838*sqrt([CT0C])-2.5*(32.665+1.67341*[CT0C]+0.0113878*[CT0C]*[CT0C]-6.83271*sqrt([CT0C])-0.239428*[CT0C]*sqrt([CT0C])))<=[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]+5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))>[MNGLTRK])&&((-0.0533229+0.79235*[MNPVC]-5.0*(0.031512+0.0045874*[MNPVC]-1.06374e-05*[MNPVC]*[MNPVC]+0.407526*sqrt([MNPVC])))<=[MNGLTRK])" },
141141 /* pO Run3 */ {" " }};
142142
143+ /* helpers for the system type assignment */
144+ static const std::string periodsOnSystemType[11 ][1 ] = {
145+ /* no system */ {" " },
146+ /* pp Run2 */ {" " },
147+ /* pPb Run2 */ {" " },
148+ /* Pbp Run2 */ {" " },
149+ /* PbPb Run2 */ {" LHC18q,LHC18r" },
150+ /* XeXe Run2 */ {" " },
151+ /* pp Run3 */ {" LHC22o" },
152+ /* PbPb Run3 */ {" LHC23zzh" },
153+ /* NeNe Run3 */ {" LHC25af" },
154+ /* OO Run3 */ {" LHC25ae" },
155+ /* pO Run3 */ {" LHC25ad" }};
156+
143157// ============================================================================================
144158// The DptDptFilter histogram objects
145159// TODO: consider registering in the histogram registry
@@ -248,6 +262,43 @@ std::vector<int> partMultNeg; // multiplicity of negative particles
248262
249263using namespace dptdptfilter ;
250264
265+ /* we need this for the time being from TableHelper.h */
266+ // / Function to check for a specific configurable from another task in the current workflow and fetch its value. Useful for tasks that need to know the value of a configurable in another task.
267+ // / @param initContext initContext of the init function
268+ // / @param taskName name of the task to check for
269+ // / @param optName name of the option to check for
270+ // / @param value value of the option to set
271+ // / @param verbose if true, print debug messages
272+ template <>
273+ bool o2::common::core::getTaskOptionValue (o2::framework::InitContext& initContext, const std::string& taskName, const std::string& optName, o2::framework::LabeledArray<std::string>& value, const bool verbose)
274+ {
275+ if (verbose) {
276+ LOG (info) << " Checking for option '" << optName << " ' in task '" << taskName << " '" ;
277+ }
278+ const auto & workflows = initContext.services ().get <o2::framework::RunningWorkflowInfo const >();
279+ int deviceCounter = 0 ;
280+ bool found = false ;
281+ for (auto const & device : workflows.devices ) {
282+ if (verbose) {
283+ LOG (info) << " Device " << deviceCounter++ << " " << device.name ;
284+ }
285+ if (device.name == taskName) { // Found the mother task
286+ int optionCounter = 0 ;
287+ for (o2::framework::ConfigParamSpec const & option : device.options ) {
288+ if (verbose) {
289+ LOG (info) << " Option " << optionCounter++ << " " << option.name << " of type " << static_cast <int >(option.type ) << " = '" << option.defaultValue .asString () << " '" ;
290+ }
291+ if (option.name == optName) {
292+ value = option.defaultValue .get <o2::framework::LabeledArray<std::string>>();
293+ return true ;
294+ }
295+ }
296+ return found;
297+ }
298+ }
299+ return false ;
300+ }
301+
251302// ////////////////////////////////////////////////////////////////////////////
252303// Multiplicity in principle for on the fly generated events
253304// ////////////////////////////////////////////////////////////////////////////
@@ -416,68 +467,65 @@ struct Multiplicity {
416467template <typename CollisionObject, typename TrackListObject>
417468inline void storeMultiplicitiesAndCentralities (CollisionObject const & collision, TrackListObject const & tracks)
418469{
419- /* only do it if we are tracking the centrality / multiplicity correlations */
420- if (useCentralityMultiplicityCorrelationsExclusion) {
421- int nGlobalTracks = 0 ;
422- for (auto const & track : tracks) {
423- if (track.isGlobalTrack ()) {
424- nGlobalTracks++;
425- }
470+ int nGlobalTracks = 0 ;
471+ for (auto const & track : tracks) {
472+ if (track.isGlobalTrack ()) {
473+ nGlobalTracks++;
426474 }
427- for (CentMultCorrelationsParams ipar = CentMultCorrelationsMT0A; ipar < CentMultCorrelationsNOOFPARAMS; ++ipar) {
428- switch ( ipar) {
429- case CentMultCorrelationsMT0A:
430- collisionMultiplicityCentralityObservables[ipar] = collision. multFT0A ();
431- break ;
432- case CentMultCorrelationsMT0C:
433- collisionMultiplicityCentralityObservables[ipar] = collision. multFT0C ();
434- break ;
435- case CentMultCorrelationsMT0M:
436- collisionMultiplicityCentralityObservables[ipar] = collision. multFT0M ();
437- break ;
438- case CentMultCorrelationsMV0A:
439- collisionMultiplicityCentralityObservables[ipar] = collision. multFV0A ();
440- break ;
441- case CentMultCorrelationsMV0C:
442- collisionMultiplicityCentralityObservables[ipar] = collision. multFV0C ();
443- break ;
444- case CentMultCorrelationsMV0M:
445- collisionMultiplicityCentralityObservables[ipar] = collision. multFV0M ();
446- break ;
447- case CentMultCorrelationsMNGLTRK:
448- collisionMultiplicityCentralityObservables[ipar] = nGlobalTracks;
449- break ;
450- case CentMultCorrelationsMNPVC:
451- collisionMultiplicityCentralityObservables[ipar] = collision. multNTracksPV ();
452- break ;
453- case CentMultCorrelationsCT0A:
454- if constexpr (framework::has_type_v<aod::cent::CentFT0A, typename CollisionObject::all_columns>) {
455- collisionMultiplicityCentralityObservables[ipar] = collision. centFT0A ();
456- }
457- break ;
458- case CentMultCorrelationsCT0C:
459- if constexpr (framework::has_type_v<aod::cent::CentFT0C, typename CollisionObject::all_columns>) {
460- collisionMultiplicityCentralityObservables[ipar] = collision. centFT0C ();
461- }
462- break ;
463- case CentMultCorrelationsCT0M:
464- if constexpr (framework::has_type_v<aod::cent::CentFT0M, typename CollisionObject::all_columns>) {
465- collisionMultiplicityCentralityObservables[ipar] = collision. centFT0M ();
466- }
467- break ;
468- case CentMultCorrelationsCV0A:
469- if constexpr (framework::has_type_v<aod::cent::CentFV0A, typename CollisionObject::all_columns>) {
470- collisionMultiplicityCentralityObservables[ipar] = collision. centFV0A ();
471- }
472- break ;
473- case CentMultCorrelationsCNTPV:
474- if constexpr (framework::has_type_v<aod::cent::CentNTPV, typename CollisionObject::all_columns>) {
475- collisionMultiplicityCentralityObservables[ipar] = collision. centNTPV ();
476- }
477- break ;
478- default :
479- break ;
480- }
475+ }
476+ for (CentMultCorrelationsParams ipar = CentMultCorrelationsMT0A; ipar < CentMultCorrelationsNOOFPARAMS; ++ ipar) {
477+ switch (ipar) {
478+ case CentMultCorrelationsMT0A:
479+ collisionMultiplicityCentralityObservables[ipar] = collision. multFT0A () ;
480+ break ;
481+ case CentMultCorrelationsMT0C:
482+ collisionMultiplicityCentralityObservables[ipar] = collision. multFT0C () ;
483+ break ;
484+ case CentMultCorrelationsMT0M:
485+ collisionMultiplicityCentralityObservables[ipar] = collision. multFT0M () ;
486+ break ;
487+ case CentMultCorrelationsMV0A:
488+ collisionMultiplicityCentralityObservables[ipar] = collision. multFV0A () ;
489+ break ;
490+ case CentMultCorrelationsMV0C:
491+ collisionMultiplicityCentralityObservables[ipar] = collision. multFV0C () ;
492+ break ;
493+ case CentMultCorrelationsMV0M:
494+ collisionMultiplicityCentralityObservables[ipar] = collision. multFV0M () ;
495+ break ;
496+ case CentMultCorrelationsMNGLTRK:
497+ collisionMultiplicityCentralityObservables[ipar] = nGlobalTracks ;
498+ break ;
499+ case CentMultCorrelationsMNPVC:
500+ collisionMultiplicityCentralityObservables[ipar] = collision. multNTracksPV () ;
501+ break ;
502+ case CentMultCorrelationsCT0A:
503+ if constexpr (framework::has_type_v<aod::cent::CentFT0A, typename CollisionObject::all_columns>) {
504+ collisionMultiplicityCentralityObservables[ipar] = collision. centFT0A ();
505+ }
506+ break ;
507+ case CentMultCorrelationsCT0C:
508+ if constexpr (framework::has_type_v<aod::cent::CentFT0C, typename CollisionObject::all_columns>) {
509+ collisionMultiplicityCentralityObservables[ipar] = collision. centFT0C ();
510+ }
511+ break ;
512+ case CentMultCorrelationsCT0M:
513+ if constexpr (framework::has_type_v<aod::cent::CentFT0M, typename CollisionObject::all_columns>) {
514+ collisionMultiplicityCentralityObservables[ipar] = collision. centFT0M ();
515+ }
516+ break ;
517+ case CentMultCorrelationsCV0A:
518+ if constexpr (framework::has_type_v<aod::cent::CentFV0A, typename CollisionObject::all_columns>) {
519+ collisionMultiplicityCentralityObservables[ipar] = collision. centFV0A ();
520+ }
521+ break ;
522+ case CentMultCorrelationsCNTPV:
523+ if constexpr (framework::has_type_v<aod::cent::CentNTPV, typename CollisionObject::all_columns>) {
524+ collisionMultiplicityCentralityObservables[ipar] = collision. centNTPV ();
525+ }
526+ break ;
527+ default :
528+ break ;
481529 }
482530 }
483531}
@@ -515,7 +563,7 @@ struct DptDptFilter {
515563 Configurable<float > maxOccupancy{" maxOccupancy" , 1e6f, " Maximum allowed occupancy. Depends on the occupancy estimation" };
516564 } occupancySelection;
517565 } cfgEventSelection;
518- Configurable<std::string> cfgSystem{ " cfgSystem " , " PbPb " , " System: Auto, pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb " };
566+ Configurable<LabeledArray< std::string>> cfgSystemForPeriod{ " cfgSystemForPeriod " , {periodsOnSystemType[ 0 ], 11 , 1 , { SYSTEMNAME ( 0 ), SYSTEMNAME ( 1 ), SYSTEMNAME ( 2 ), SYSTEMNAME ( 3 ), SYSTEMNAME ( 4 ), SYSTEMNAME ( 5 ), SYSTEMNAME ( 6 ), SYSTEMNAME ( 7 ), SYSTEMNAME ( 8 ), SYSTEMNAME ( 9 ), SYSTEMNAME ( 10 )}, { " Periods separated by commas " }}, " List of periods associated to each system type " };
519567 Configurable<std::string> cfgDataType{" cfgDataType" , " data" , " Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data" };
520568 Configurable<std::string> cfgCentSpec{" cfgCentSpec" , " 00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80" , " Centrality/multiplicity ranges in min-max separated by commas" };
521569 Configurable<float > cfgOverallMinP{" cfgOverallMinP" , 0 .0f , " The overall minimum momentum for the analysis. Default: 0.0" };
@@ -588,8 +636,8 @@ struct DptDptFilter {
588636 triggerSelectionFlags = getTriggerSelection (cfgEventSelection.triggSel .value .c_str ());
589637 traceCollId0 = cfgTraceCollId0;
590638
591- /* if the system type is not known at this time, we have to put the initialization somewhere else */
592- fSystem = getSystemType (cfgSystem .value . c_str () );
639+ /* get the system type */
640+ fSystem = getSystemType (cfgSystemForPeriod .value );
593641 fLhcRun = multRunForSystemMap.at (fSystem );
594642 fDataType = getDataType (cfgDataType);
595643
@@ -1151,10 +1199,10 @@ struct DptDptFilterTracks {
11511199 tpcExcluder.setCuts (pLowCut, pUpCut, nLowCut, nUpCut);
11521200
11531201 /* self configure system type and data type */
1154- /* if the system type is not known at this time, we have to put the initialization somewhere else */
1202+ o2::framework::LabeledArray<std::string> tmpArray = {periodsOnSystemType[0 ], 11 , 1 , {SYSTEMNAME (0 ), SYSTEMNAME (1 ), SYSTEMNAME (2 ), SYSTEMNAME (3 ), SYSTEMNAME (4 ), SYSTEMNAME (5 ), SYSTEMNAME (6 ), SYSTEMNAME (7 ), SYSTEMNAME (8 ), SYSTEMNAME (9 ), SYSTEMNAME (10 )}, {" Periods separated by commas" }};
1203+ getTaskOptionValue (initContext, " dpt-dpt-filter" , " cfgSystem" , tmpArray, false );
1204+ fSystem = getSystemType (tmpArray);
11551205 std::string tmpstr;
1156- getTaskOptionValue (initContext, " dpt-dpt-filter" , " cfgSystem" , tmpstr, false );
1157- fSystem = getSystemType (tmpstr);
11581206 getTaskOptionValue (initContext, " dpt-dpt-filter" , " cfgDataType" , tmpstr, false );
11591207 fDataType = getDataType (tmpstr);
11601208
0 commit comments