2828#include " TRDBase/Geometry.h"
2929#include " GlobalTrackingWorkflowHelpers/InputHelper.h"
3030#include " ReconstructionDataFormats/GlobalTrackID.h"
31+ #include " ReconstructionDataFormats/PrimaryVertex.h"
3132#include " Framework/ConfigParamSpec.h"
3233#include " DataFormatsMCH/TrackMCH.h"
3334#include " DataFormatsMCH/ROFRecord.h"
@@ -73,7 +74,14 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
7374 {" only-nth-event" , VariantType::Int, 0 , {" process only every nth event" }},
7475 {" primary-vertex-mode" , VariantType::Bool, false , {" produce jsons with individual primary vertices, not total time frame data" }},
7576 {" max-primary-vertices" , VariantType::Int, 5 , {" maximum number of primary vertices to draw per time frame" }},
76- {" primary-vertex-triggers" , VariantType::Bool, false , {" instead of drawing vertices with tracks (and maybe calorimeter triggers), draw vertices with calorimeter triggers (and maybe tracks)" }}};
77+ {" primary-vertex-triggers" , VariantType::Bool, false , {" instead of drawing vertices with tracks (and maybe calorimeter triggers), draw vertices with calorimeter triggers (and maybe tracks)" }},
78+ {" primary-vertex-min-z" , VariantType::Float, -o2::constants::math::VeryBig, {" minimum z position for primary vertex" }},
79+ {" primary-vertex-max-z" , VariantType::Float, o2::constants::math::VeryBig, {" maximum z position for primary vertex" }},
80+ {" primary-vertex-min-x" , VariantType::Float, -o2::constants::math::VeryBig, {" minimum x position for primary vertex" }},
81+ {" primary-vertex-max-x" , VariantType::Float, o2::constants::math::VeryBig, {" maximum x position for primary vertex" }},
82+ {" primary-vertex-min-y" , VariantType::Float, -o2::constants::math::VeryBig, {" minimum y position for primary vertex" }},
83+ {" primary-vertex-max-y" , VariantType::Float, o2::constants::math::VeryBig, {" maximum y position for primary vertex" }}};
84+
7785 o2::raw::HBFUtilsInitializer::addConfigOption (options);
7886 std::swap (workflowOptions, options);
7987}
@@ -134,9 +142,20 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc)
134142 }
135143
136144 const auto pv = keyVal.first ;
137- helper.draw (pv, mTrackSorting );
138-
139- bool save = true ;
145+ bool save = false ;
146+ if (mPrimaryVertexMode ) {
147+ auto primaryVertex = recoCont.getPrimaryVertices ()[pv];
148+ auto primaryVertex_X = primaryVertex.getX ();
149+ auto primaryVertex_Y = primaryVertex.getY ();
150+ auto primaryVertex_Z = primaryVertex.getZ ();
151+ if ((primaryVertex_X >= mPrimaryVertexMinX ) & (primaryVertex_X <= mPrimaryVertexMaxX ) & (primaryVertex_Y >= mPrimaryVertexMinY ) & (primaryVertex_Y <= mPrimaryVertexMaxY ) & (primaryVertex_Z >= mPrimaryVertexMinZ ) & (primaryVertex_Z <= mPrimaryVertexMaxZ )) {
152+ helper.draw (pv, mTrackSorting );
153+ save = true ;
154+ }
155+ } else {
156+ helper.draw (pv, mTrackSorting );
157+ save = true ;
158+ }
140159
141160 if (this ->mMinITSTracks != -1 && helper.mEvent .getDetectorTrackCount (detectors::DetID::ITS ) < this ->mMinITSTracks ) {
142161 save = false ;
@@ -337,6 +356,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
337356 auto onlyNthEvent = cfgc.options ().get <int >(" only-nth-event" );
338357 auto tracksSorting = cfgc.options ().get <bool >(" track-sorting" );
339358 auto primaryVertexTriggers = cfgc.options ().get <bool >(" primary-vertex-triggers" );
359+ auto primaryVertexMinZ = cfgc.options ().get <float >(" primary-vertex-min-z" );
360+ auto primaryVertexMaxZ = cfgc.options ().get <float >(" primary-vertex-max-z" );
361+ auto primaryVertexMinX = cfgc.options ().get <float >(" primary-vertex-min-x" );
362+ auto primaryVertexMaxX = cfgc.options ().get <float >(" primary-vertex-max-x" );
363+ auto primaryVertexMinY = cfgc.options ().get <float >(" primary-vertex-min-y" );
364+ auto primaryVertexMaxY = cfgc.options ().get <float >(" primary-vertex-max-y" );
340365
341366 if (numberOfTracks == -1 ) {
342367 tracksSorting = false ; // do not sort if all tracks are allowed
@@ -354,7 +379,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
354379 " o2-eve-export" ,
355380 dataRequest->inputs ,
356381 {},
357- AlgorithmSpec{adaptFromTask<O2DPLDisplaySpec>(useMC, srcTrk, srcCl, dataRequest, ggRequest, jsonFolder, ext, timeInterval, numberOfFiles, numberOfTracks, eveHostNameMatch, minITSTracks, minTracks, filterITSROF, filterTime, timeBracket, removeTPCEta, etaBracket, tracksSorting, onlyNthEvent, primaryVertexMode, maxPrimaryVertices, primaryVertexTriggers)}});
382+ AlgorithmSpec{adaptFromTask<O2DPLDisplaySpec>(useMC, srcTrk, srcCl, dataRequest, ggRequest, jsonFolder, ext, timeInterval, numberOfFiles, numberOfTracks, eveHostNameMatch, minITSTracks, minTracks, filterITSROF, filterTime, timeBracket, removeTPCEta, etaBracket, tracksSorting, onlyNthEvent, primaryVertexMode, maxPrimaryVertices, primaryVertexTriggers, primaryVertexMinZ, primaryVertexMaxZ, primaryVertexMinX, primaryVertexMaxX, primaryVertexMinY, primaryVertexMaxY )}});
358383
359384 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
360385 o2::raw::HBFUtilsInitializer hbfIni (cfgc, specs);
0 commit comments