15#include <TStopwatch.h>
53 : mDataRequest(dr), mGGCCDBRequest(gr), mTrackSrc(
src), mSkip(skip), mUseMC(useMC), mValidateWithIR(validateWithIR) {}
62 std::shared_ptr<DataRequest> mDataRequest;
63 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
68 bool mValidateWithIR{
false};
69 float mITSROFrameLengthMUS = 0.;
70 float mITSROFBiasMUS = 0.;
80 auto dumpDir = ic.
options().
get<std::string>(
"pool-dumps-directory");
82 throw std::runtime_error(fmt::format(
"directory {} for raw data dumps does not exist", dumpDir));
90 double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
92 std::vector<PVertex> vertices;
93 std::vector<GIndex> vertexTrackIDs;
94 std::vector<V2TRef> v2tRefs;
95 std::vector<o2::MCEventLabel> lblVtx;
100 updateTimeDependentParams(pc);
102 std::vector<TrackWithTimeStamp> tracks;
103 std::vector<o2::MCCompLabel> tracksMCInfo;
104 std::vector<o2d::GlobalTrackID> gids;
108 auto halfROFITS = 0.5 * mITSROFrameLengthMUS + mITSROFBiasMUS;
109 auto hw2ErrITS = 2.f / std::sqrt(12.f) * mITSROFrameLengthMUS;
111 auto creator = [maxTrackTimeError, hw2ErrITS, halfROFITS, trackMaxX, minIBHits, &tracks, &gids, &recoData](
auto& _tr,
GTrackID _origID,
float t0,
float terr) {
112 if constexpr (isBarrelTrack<decltype(_tr)>()) {
113 if (!_origID.includesDet(
DetID::ITS) || _tr.getX() > trackMaxX) {
117 if ((itsID.getSource() ==
GTrackID::ITS && o2::math_utils::numberOfBitsSet(recoData.
getITSTrack(itsID).getPattern() & 7) < minIBHits) ||
121 if constexpr (isITSTrack<decltype(_tr)>()) {
126 if (terr < maxTrackTimeError) {
128 gids.emplace_back(_origID);
140 static std::vector<InteractionCandidate> ft0Data;
141 if (mValidateWithIR) {
145 for (
const auto& ftRP : ft0all) {
149 float(ftRP.getTrigger().getAmplA() + ftRP.getTrigger().getAmplC()),
154 mVertexer.
process(tracks, gids, ft0Data, vertices, vertexTrackIDs, v2tRefs, tracksMCInfo, lblVtx);
158 std::vector<bool> itsTrUPC(recoData.
getITSTracks().size());
159 for (
auto& rof : itsrofs) {
160 if (rof.getFlag(o2::itsmft::ROFRecord::VtxUPCMode)) {
161 for (
int i = rof.getFirstEntry();
i < rof.getFirstEntry() + rof.getNEntries();
i++) {
166 int nv = vertices.size();
167 for (
int iv = 0; iv < nv; iv++) {
168 int idMin = v2tRefs[iv].getFirstEntry(), idMax = idMin + v2tRefs[iv].getEntries();
169 int nits = 0, nitsUPC = 0;
170 for (
int id = idMin;
id < idMax;
id++) {
174 if (itsTrUPC[gid.getIndex()]) {
179 if (nitsUPC > nits / 2) {
194 LOGP(info,
"Found {} PVs, Time CPU/Real:{:.3f}/{:.3f} (DBScan: {:.4f}, Finder:{:.4f}, MADSel:{:.4f}, Rej.Debris:{:.4f}, Reattach:{:.4f}) | {} trials for {} TZ-clusters, max.trials: {}, Slowest TZ-cluster: {} ms of mult {} | NInitial:{}, Rejections: NoFilledBC:{}, NoIntCand:{}, Debris:{}, Quality:{}, ITSOnly:{}",
195 vertices.size(), mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0,
201 static bool first =
true;
213 LOGF(info,
"Primary vertexing total timing: Cpu: %.3e Real: %.3e s in %d slots",
214 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
224 LOG(info) <<
"ITS Alpide param updated";
226 par.printKeyValues();
239 static bool initOnceDone =
false;
245 if (!grp->isDetContinuousReadOut(
DetID::ITS)) {
246 mITSROFrameLengthMUS = alpParams.roFrameLengthTrig / 1.e3;
266 std::vector<OutputSpec> outputs;
267 auto dataRequest = std::make_shared<DataRequest>();
269 dataRequest->requestTracks(
src, useMC);
271 dataRequest->requestFT0RecPoints(
false);
274 outputs.emplace_back(
"GLO",
"PVTX", 0, Lifetime::Timeframe);
275 outputs.emplace_back(
"GLO",
"PVTX_CONTID", 0, Lifetime::Timeframe);
276 outputs.emplace_back(
"GLO",
"PVTX_CONTIDREFS", 0, Lifetime::Timeframe);
279 outputs.emplace_back(
"GLO",
"PVTX_MCTR", 0, Lifetime::Timeframe);
282 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
290 dataRequest->inputs.emplace_back(
"meanvtx",
"GLO",
"MEANVERTEX", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Calib/MeanVertex", {}, 1));
296 AlgorithmSpec{adaptFromTask<PrimaryVertexingSpec>(dataRequest, ggRequest,
src, skip, validateWithFT0, useMC)},
297 Options{{
"pool-dumps-directory", VariantType::String,
"", {
"Destination directory for the tracks pool dumps"}}}};
Definition of the GeometryManager class.
Helper for geometry and GRP related CCDB requests.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of the Names Generator class.
Wrapper container for different reconstructed object types.
Result of refitting TPC-ITS matched track.
Reference on ITS/MFT clusters set.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static std::string getConfigOutputFileName(const std::string &procName, const std::string &confName="", bool json=true)
static const PVertexerParams & Instance()
static void write(std::string const &filename, std::string const &keyOnly="")
Static class with identifiers, bitmasks and names for ALICE detectors.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
void setTrackSources(GTrackID::mask_t s)
auto getNIniFound() const
int process(const TR &tracks, const gsl::span< o2d::GlobalTrackID > gids, const gsl::span< InteractionCandidate > intCand, std::vector< PVertex > &vertices, std::vector< o2d::VtxTrackIndex > &vertexTrackIDs, std::vector< V2TRef > &v2tRefs, const gsl::span< const o2::MCCompLabel > lblTracks, std::vector< o2::MCEventLabel > &lblVtx)
auto getTotTrials() const
void setStartIR(const o2::InteractionRecord &ir)
set InteractionRecods for the beginning of the TF
auto getLongestClusterMult() const
auto getLongestClusterTimeMS() const
TStopwatch & getTimeDebris()
auto getMaxTrialsPerCluster() const
auto getNKilledITSOnly() const
TStopwatch & getTimeVertexing()
TStopwatch & getTimeMADSel()
auto getNKilledQuality() const
void setPoolDumpDirectory(const std::string &d)
auto getNTZClusters() const
auto getNKilledDebris() const
void setBunchFilling(const o2::BunchFilling &bf)
void setValidateWithIR(bool v)
TStopwatch & getTimeReAttach()
TStopwatch & getTimeDBScan()
auto getNKilledBCValid() const
void setMeanVertex(const o2d::MeanVertexObject *v)
void setITSROFrameLength(float v)
auto getNKilledIntCand() const
void run(ProcessingContext &pc) final
PrimaryVertexingSpec(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, GTrackID::mask_t src, bool skip, bool validateWithIR, bool useMC)
~PrimaryVertexingSpec() override=default
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
void init(InitContext &ic) final
void endOfStream(EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
constexpr double LHCBunchSpacingMUS
constexpr double LHCBunchSpacingNS
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getPrimaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool skip, bool validateWithFT0, bool useMC, bool useGeom)
create a processor spec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string name
The name of the associated DataProcessorSpec.
size_t inputTimesliceId
The time pipelining id of this particular device.
bool isSelected(const RecPoints &rp) const
auto getITSTracks() const
GTrackID getITSContributorGID(GTrackID source) const
o2::InteractionRecord startIR
void createTracksVariadic(T creator, GTrackID::mask_t srcSel=GTrackID::getSourcesMask("all")) const
const o2::itsmft::TrkClusRef & getITSABRef(GTrackID gid) const
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
void fillTrackMCLabels(const gsl::span< GTrackID > gids, std::vector< o2::MCCompLabel > &mcinfo) const
const o2::its::TrackITS & getITSTrack(GTrackID gid) const
auto getFT0RecPoints() const
auto getITSTracksROFRecords() const
uint16_t pattern
layers pattern
static bool pathIsDirectory(const std::string_view p)
generic track with timestamp
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"