diff --git a/EventVisualisation/Base/include/EventVisualisationBase/DataSource.h b/EventVisualisation/Base/include/EventVisualisationBase/DataSource.h index f62bf5c08e142..5edcbc1ffb832 100644 --- a/EventVisualisation/Base/include/EventVisualisationBase/DataSource.h +++ b/EventVisualisation/Base/include/EventVisualisationBase/DataSource.h @@ -70,12 +70,16 @@ class DataSource virtual void saveCurrentEvent(std::string /*targetFolder*/){}; virtual int getRunNumber() const { return 0; } virtual void setRunNumber(int) {} + virtual o2::parameters::GRPECS::RunType getRunType() { return o2::parameters::GRPECS::RunType::NONE; } + virtual void setRunType(o2::parameters::GRPECS::RunType) {} virtual std::string getEventName() { return "event"; }; virtual std::string getEventAbsoluteFilePath() { return ""; }; virtual int getFirstTForbit() const { return 0; } virtual void setFirstTForbit(int) {} virtual std::string getCollisionTime() const { return "not specified"; } virtual void setCollisionTime(std::string) {} + virtual std::string getFileTime() const { return "not specified"; } + virtual void setFileTime(std::string) {} virtual int getTrackMask() const { return 0; } virtual void setTrackMask(int) {} virtual int getClusterMask() const { return 0; } diff --git a/EventVisualisation/Base/include/EventVisualisationBase/DataSourceOnline.h b/EventVisualisation/Base/include/EventVisualisationBase/DataSourceOnline.h index 281ea84c53f70..6ebce36d63f31 100644 --- a/EventVisualisation/Base/include/EventVisualisationBase/DataSourceOnline.h +++ b/EventVisualisation/Base/include/EventVisualisationBase/DataSourceOnline.h @@ -35,10 +35,12 @@ class DataSourceOnline : public DataSource static std::vector sourceFilextensions; FileWatcher mFileWatcher; int mRunNumber; + o2::parameters::GRPECS::RunType mRunType; int mFirstTForbit; int mTrackMask; int mClusterMask; std::string mCollisionTime; + std::string mFileTime; public: DataSourceOnline(const std::string path); @@ -61,12 +63,16 @@ class DataSourceOnline : public DataSource void saveCurrentEvent(std::string targetFolder) override { mFileWatcher.saveCurrentFileToFolder(targetFolder); }; int getRunNumber() const override { return this->mRunNumber; } void setRunNumber(int runNumber) override { this->mRunNumber = runNumber; } + parameters::GRPECS::RunType getRunType() override { return mRunType; } + void setRunType(parameters::GRPECS::RunType runType) override { this->mRunType = runType; } std::string getEventName() override { return mFileWatcher.currentItem(); }; std::string getEventAbsoluteFilePath() override { return mFileWatcher.currentFilePath(); }; int getFirstTForbit() const override { return this->mFirstTForbit; } void setFirstTForbit(int firstTForbit) override { this->mFirstTForbit = firstTForbit; } std::string getCollisionTime() const override { return this->mCollisionTime; } void setCollisionTime(std::string collisionTime) override { this->mCollisionTime = collisionTime; } + std::string getFileTime() const override { return this->mFileTime; } + void setFileTime(std::string fileTime) override { this->mFileTime = fileTime; } int getTrackMask() const override { return this->mTrackMask; } void setTrackMask(int trackMask) override { this->mTrackMask = trackMask; } int getClusterMask() const override { return this->mClusterMask; } diff --git a/EventVisualisation/Base/src/DataSourceOnline.cxx b/EventVisualisation/Base/src/DataSourceOnline.cxx index d6758b1caca29..2dbce853bee61 100644 --- a/EventVisualisation/Base/src/DataSourceOnline.cxx +++ b/EventVisualisation/Base/src/DataSourceOnline.cxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include namespace o2 { @@ -42,11 +44,21 @@ std::vector> DataSourceOnline VisualisationEvent vEvent = this->mDataReader->getEvent(mFileWatcher.currentFilePath()); this->setRunNumber(vEvent.getRunNumber()); + this->setRunType(vEvent.getRunType()); this->setFirstTForbit(vEvent.getFirstTForbit()); this->setCollisionTime(vEvent.getCollisionTime()); this->setTrackMask(vEvent.getTrkMask()); this->setClusterMask(vEvent.getClMask()); + auto write_time = std::filesystem::last_write_time(mFileWatcher.currentFilePath()); + auto duration = std::chrono::time_point_cast(write_time - std::filesystem::file_time_type::clock::now() + std::chrono::system_clock::now()); + auto duration_time = std::chrono::system_clock::to_time_t(duration); + + char time_str[100]; + std::strftime(time_str, sizeof(time_str), "%a %b %d %H:%M:%S %Y", std::localtime(&duration_time)); + + this->setFileTime(time_str); + double period = vEvent.getMaxTimeOfTracks() - vEvent.getMinTimeOfTracks(); if (period > 0) { this->mTimeFrameMinTrackTime = minTime * period / range + vEvent.getMinTimeOfTracks(); diff --git a/EventVisualisation/DataConverter/CMakeLists.txt b/EventVisualisation/DataConverter/CMakeLists.txt index 51b6507bff093..15d838fe18226 100644 --- a/EventVisualisation/DataConverter/CMakeLists.txt +++ b/EventVisualisation/DataConverter/CMakeLists.txt @@ -19,6 +19,7 @@ o2_add_library(EventVisualisationDataConverter src/VisualisationEventROOTSerializer.cxx PUBLIC_LINK_LIBRARIES RapidJSON::RapidJSON O2::ReconstructionDataFormats + O2::DataFormatsParameters ) o2_add_executable(eve-convert diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h index e611bc118c479..85e0c1a7a3c47 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h @@ -23,6 +23,7 @@ #include "EventVisualisationDataConverter/VisualisationCluster.h" #include "EventVisualisationDataConverter/VisualisationCalo.h" #include "EventVisualisationDataConverter/VisualisationConstants.h" +#include "DataFormatsParameters/ECSDataAdapters.h" #include #include #include @@ -187,6 +188,9 @@ class VisualisationEvent o2::header::DataHeader::RunNumberType getRunNumber() const { return this->mRunNumber; } void setRunNumber(o2::header::DataHeader::RunNumberType runNumber) { this->mRunNumber = runNumber; } + o2::parameters::GRPECS::RunType getRunType() const { return this->mRunType; } + void setRunType(o2::parameters::GRPECS::RunType runType) { this->mRunType = runType; } + o2::header::DataHeader::TFCounterType getTfCounter() const { return this->mTfCounter; } void setTfCounter(o2::header::DataHeader::TFCounterType value) { this->mTfCounter = value; } @@ -201,6 +205,7 @@ class VisualisationEvent o2::header::DataHeader::RunNumberType mRunNumber; /// run number o2::header::DataHeader::TFCounterType mTfCounter; o2::header::DataHeader::TForbitType mFirstTForbit; + o2::parameters::GRPECS::RunType mRunType; std::size_t mPrimaryVertex; float mMinTimeOfTracks; /// minimum time of tracks in the event diff --git a/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx b/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx index 2c73e86f76062..c3663bf141f7f 100644 --- a/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx +++ b/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx @@ -64,6 +64,7 @@ std::string VisualisationEventJSONSerializer::toJson(const VisualisationEvent& e // compatibility verification tree.AddMember("runNumber", rapidjson::Value().SetInt(event.mRunNumber), allocator); + tree.AddMember("runType", rapidjson::Value().SetInt(event.mRunType), allocator); tree.AddMember("clMask", rapidjson::Value().SetInt(event.mClMask), allocator); tree.AddMember("trkMask", rapidjson::Value().SetInt(event.mTrkMask), allocator); tree.AddMember("tfCounter", rapidjson::Value().SetInt(event.mTfCounter), allocator); @@ -147,6 +148,7 @@ void VisualisationEventJSONSerializer::fromJson(VisualisationEvent& event, std:: tree.Parse(json.c_str()); event.setRunNumber(getIntOrDefault(tree, "runNumber", 0)); + event.setRunType(static_cast(getIntOrDefault(tree, "runType", 0))); event.setClMask(getIntOrDefault(tree, "clMask")); event.setTrkMask(getIntOrDefault(tree, "trkMask")); event.setTfCounter(getIntOrDefault(tree, "tfCounter")); diff --git a/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx b/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx index 799259b8484b7..38da87d8bed51 100644 --- a/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx +++ b/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx @@ -70,6 +70,7 @@ void VisualisationEventROOTSerializer::toFile(const VisualisationEvent& event, s TFile f(fileName.c_str(), "recreate"); save("runNumber", event.mRunNumber); + save("runType", event.mRunType); save("clMask", event.mClMask); save("trkMask", event.mTrkMask); save("tfCounter", event.mTfCounter); @@ -195,6 +196,7 @@ bool VisualisationEventROOTSerializer::fromFile(VisualisationEvent& event, std:: TFile f(fileName.c_str()); event.setRunNumber(readInt(f, "runNumber")); + event.setRunType(static_cast(readInt(f, "runType"))); event.setClMask(readInt(f, "clMask")); event.setTrkMask(readInt(f, "trkMask")); event.setTfCounter(readInt(f, "tfCounter")); diff --git a/EventVisualisation/View/src/EventManager.cxx b/EventVisualisation/View/src/EventManager.cxx index 0cf029458e165..5710e20ba6c13 100644 --- a/EventVisualisation/View/src/EventManager.cxx +++ b/EventVisualisation/View/src/EventManager.cxx @@ -24,6 +24,7 @@ #include "EventVisualisationDataConverter/VisualisationEvent.h" #include #include "EventVisualisationBase/ConfigurationManager.h" +#include "DataFormatsParameters/ECSDataAdapters.h" #include #include #include @@ -117,7 +118,7 @@ void EventManager::displayCurrentEvent() if (this->mShowDate) { multiView->getAnnotationTop()->SetText( - TString::Format("Run %d\n%s", dataSource->getRunNumber(), dataSource->getCollisionTime().c_str())); + TString::Format("Run %d %s\n%s", dataSource->getRunNumber(), std::string(parameters::GRPECS::RunTypeNames[dataSource->getRunType()]).c_str(), dataSource->getFileTime().c_str())); } else { multiView->getAnnotationTop()->SetText(TString::Format("Run %d", dataSource->getRunNumber())); } diff --git a/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h b/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h index de815030fb109..b6eb49d19750f 100644 --- a/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h +++ b/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h @@ -59,7 +59,7 @@ class O2DPLDisplaySpec : public o2::framework::Task bool eveHostNameMatch, int minITSTracks, int minTracks, bool filterITSROF, bool filterTime, const EveWorkflowHelper::Bracket& timeBracket, bool removeTPCEta, const EveWorkflowHelper::Bracket& etaBracket, bool trackSorting, int onlyNthEvent, bool primaryVertex, int maxPrimaryVertices, bool primaryVertexTriggers, float primaryVertexMinZ, float primaryVertexMaxZ, float primaryVertexMinX, float primaryVertexMaxX, float primaryVertexMinY, float primaryVertexMaxY) - : mDisableWrite(disableWrite), mUseMC(useMC), mTrkMask(trkMask), mClMask(clMask), mDataRequest(dataRequest), mGGCCDBRequest(gr), mJsonPath(jsonPath), mExt(ext), mTimeInterval(timeInterval), mNumberOfFiles(numberOfFiles), mNumberOfTracks(numberOfTracks), mEveHostNameMatch(eveHostNameMatch), mMinITSTracks(minITSTracks), mMinTracks(minTracks), mFilterITSROF(filterITSROF), mFilterTime(filterTime), mTimeBracket(timeBracket), mRemoveTPCEta(removeTPCEta), mEtaBracket(etaBracket), mTrackSorting(trackSorting), mOnlyNthEvent(onlyNthEvent), mPrimaryVertexMode(primaryVertex), mMaxPrimaryVertices(maxPrimaryVertices), mPrimaryVertexTriggers(primaryVertexTriggers), mPrimaryVertexMinZ(primaryVertexMinZ), mPrimaryVertexMaxZ(primaryVertexMaxZ), mPrimaryVertexMinX(primaryVertexMinX), mPrimaryVertexMaxX(primaryVertexMaxX), mPrimaryVertexMinY(primaryVertexMinY), mPrimaryVertexMaxY(primaryVertexMaxY) + : mDisableWrite(disableWrite), mUseMC(useMC), mTrkMask(trkMask), mClMask(clMask), mDataRequest(dataRequest), mGGCCDBRequest(gr), mJsonPath(jsonPath), mExt(ext), mTimeInterval(timeInterval), mNumberOfFiles(numberOfFiles), mNumberOfTracks(numberOfTracks), mEveHostNameMatch(eveHostNameMatch), mMinITSTracks(minITSTracks), mMinTracks(minTracks), mFilterITSROF(filterITSROF), mFilterTime(filterTime), mTimeBracket(timeBracket), mRemoveTPCEta(removeTPCEta), mEtaBracket(etaBracket), mTrackSorting(trackSorting), mOnlyNthEvent(onlyNthEvent), mPrimaryVertexMode(primaryVertex), mMaxPrimaryVertices(maxPrimaryVertices), mPrimaryVertexTriggers(primaryVertexTriggers), mPrimaryVertexMinZ(primaryVertexMinZ), mPrimaryVertexMaxZ(primaryVertexMaxZ), mPrimaryVertexMinX(primaryVertexMinX), mPrimaryVertexMaxX(primaryVertexMaxX), mPrimaryVertexMinY(primaryVertexMinY), mPrimaryVertexMaxY(primaryVertexMaxY), mRunType(o2::parameters::GRPECS::NONE) { this->mTimeStamp = std::chrono::high_resolution_clock::now() - timeInterval; // first run meets condition @@ -105,6 +105,7 @@ class O2DPLDisplaySpec : public o2::framework::Task o2::dataformats::GlobalTrackID::mask_t mTrkMask; o2::dataformats::GlobalTrackID::mask_t mClMask; DetectorData mData; + o2::parameters::GRPECS::RunType mRunType; std::shared_ptr mDataRequest; std::shared_ptr mGGCCDBRequest; }; diff --git a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx index 05f9f61457992..b6510184fd900 100644 --- a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx +++ b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx @@ -176,6 +176,7 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc) helper.mEvent.setRunNumber(tinfo.runNumber); helper.mEvent.setTfCounter(tinfo.tfCounter); helper.mEvent.setFirstTForbit(tinfo.firstTForbit); + helper.mEvent.setRunType(this->mRunType); helper.mEvent.setPrimaryVertex(pv); helper.save(this->mJsonPath, this->mExt, this->mNumberOfFiles, this->mTrkMask, this->mClMask, tinfo.runNumber, tinfo.creation); filesSaved++; @@ -233,6 +234,7 @@ void O2DPLDisplaySpec::updateTimeDependentParams(ProcessingContext& pc) if (!initOnceDone) { // this params need to be queried only once initOnceDone = true; auto grpECS = o2::base::GRPGeomHelper::instance().getGRPECS(); // RS + mRunType = grpECS->getRunType(); mData.init(); } // pc.inputs().get("cldictITS"); // called by the RecoContainer