diff --git a/EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h b/EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h index 74783252dff2a..f9abc00774298 100644 --- a/EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h +++ b/EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h @@ -25,7 +25,7 @@ namespace o2 namespace event_visualisation { /// Version of the software -const static std::string o2_eve_version = "1.60"; +const static std::string o2_eve_version = "1.70"; /// Configuration Manager allows an easy access to the config file. /// diff --git a/EventVisualisation/Base/src/ConfigurationManager.cxx b/EventVisualisation/Base/src/ConfigurationManager.cxx index c6e2f5400f4ab..6205f3c2ab67e 100644 --- a/EventVisualisation/Base/src/ConfigurationManager.cxx +++ b/EventVisualisation/Base/src/ConfigurationManager.cxx @@ -38,21 +38,21 @@ void ConfigurationManager::getConfig(TEnv& settings) const return; // precise located options file name read succesfully } if (settings.ReadFile(fileName = ".o2eve_config", kEnvUser) < 0) { - LOG(warn) << "could not find .o2eve_config in working directory! Trying .o2eve_config in home directory"; + LOGF(warn, "could not find .o2eve_config in working directory! Trying .o2eve_config in home directory"); if (settings.ReadFile(fileName = Form("%s/.o2eve_config", gSystem->Getenv("HOME")), kEnvUser) < 0) { - LOG(warn) << "could not find .o2eve_config in home directory! Trying o2eve_config in home directory"; + LOGF(warn, "could not find .o2eve_config in home directory! Trying o2eve_config in home directory"); if (settings.ReadFile(fileName = Form("%s/o2eve_config", gSystem->Getenv("HOME")), kEnvUser) < 0) { - LOG(warn) << "could not find o2eve_config in home directory! Trying o2eve_config in O2/EventVisualisation"; + LOGF(warn, "could not find o2eve_config in home directory! Trying o2eve_config in O2/EventVisualisation"); if (settings.ReadFile(fileName = Form("%s/EventVisualisation/o2eve_config", gSystem->Getenv("ALICEO2_INSTALL_PATH")), kEnvUser) < 0) { - LOG(fatal) << "could not find .o2eve_config or o2eve_config file!."; + LOGF(fatal, "could not find .o2eve_config or o2eve_config file!."); exit(0); } } } } - LOG(info) << Form("using %s config settings", fileName.Data()); + LOGF(info, Form("using %s config settings", fileName.Data())); } const ConfigurationManager* ConfigurationManager::loadSettings() diff --git a/EventVisualisation/Base/src/DataSourceOnline.cxx b/EventVisualisation/Base/src/DataSourceOnline.cxx index 35d6b8c8b7f0e..d6ed7c9adcb72 100644 --- a/EventVisualisation/Base/src/DataSourceOnline.cxx +++ b/EventVisualisation/Base/src/DataSourceOnline.cxx @@ -83,7 +83,7 @@ std::vector> } auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(stop - start); - LOG(info) << "getVisualisationList: " << duration.count(); + LOGF(info, "getVisualisationList: ", duration.count()); return res; } diff --git a/EventVisualisation/Base/src/DirectoryLoader.cxx b/EventVisualisation/Base/src/DirectoryLoader.cxx index fd4186bf6bde7..6bfe6f50d4b0a 100644 --- a/EventVisualisation/Base/src/DirectoryLoader.cxx +++ b/EventVisualisation/Base/src/DirectoryLoader.cxx @@ -104,10 +104,10 @@ std::string DirectoryLoader::getLatestFile(std::string& path, std::vector& ext, int remaining) +void DirectoryLoader::removeOldestFiles(std::string& path, std::vector& ext, const int remaining) { while (getNumberOfFiles(path, ext) > remaining) { - LOG(info) << "removing oldest file in folder: " << path << " : " << getLatestFile(path, ext); + LOGF(info, "removing oldest file in folder: ", path, " : ", getLatestFile(path, ext)); filesystem::remove(path + "/" + getLatestFile(path, ext)); } } diff --git a/EventVisualisation/Base/src/FileWatcher.cxx b/EventVisualisation/Base/src/FileWatcher.cxx index 7cc04d79d4130..99b27c706a793 100644 --- a/EventVisualisation/Base/src/FileWatcher.cxx +++ b/EventVisualisation/Base/src/FileWatcher.cxx @@ -143,8 +143,8 @@ int FileWatcher::getPos() const bool FileWatcher::refresh() { string previous = this->currentItem(); - LOG(info) << "previous:" << previous; - LOG(info) << "currentFile:" << this->mCurrentFile; + LOGF(info, "previous:", previous); + LOGF(info, "currentFile:", this->mCurrentFile); this->mFiles = DirectoryLoader::load(this->mDataFolders, "_", this->mExt); // already sorted according part staring with marker if (this->mCurrentFile != mEndGuard) { @@ -165,17 +165,17 @@ bool FileWatcher::refresh() this->mFiles.push_front(mLowGuard); this->mFiles.push_back(mEndGuard); - LOG(info) << "this->mFiles.size() = " << this->mFiles.size(); - LOG(info) << "this->mCurrentFile = " << this->mCurrentFile; - LOG(info) << "current:" << this->currentItem(); + LOGF(info, "this->mFiles.size() = ", this->mFiles.size()); + LOGF(info, "this->mCurrentFile = ", this->mCurrentFile); + LOGF(info, "current:", this->currentItem()); return previous != this->currentItem(); } void FileWatcher::setCurrentItem(int no) { this->mCurrentFile = this->mFiles[no]; - LOG(info) << "this->setCurrentItem(" << no << ")"; - LOG(info) << "this->mCurrentFile = " << this->mCurrentFile; + LOGF(info, "this->setCurrentItem(", no, ")"); + LOGF(info, "this->mCurrentFile = ", this->mCurrentFile); } std::string FileWatcher::currentFilePath() const diff --git a/EventVisualisation/Base/src/GeometryManager.cxx b/EventVisualisation/Base/src/GeometryManager.cxx index d41733c017de0..59f91ce097974 100644 --- a/EventVisualisation/Base/src/GeometryManager.cxx +++ b/EventVisualisation/Base/src/GeometryManager.cxx @@ -47,13 +47,13 @@ TEveGeoShape* GeometryManager::getGeometryForDetector(string detectorName) // load ROOT file with geometry TFile* f = TFile::Open(Form("%s/simple_geom_%s.root", geomPath.c_str(), detectorName.c_str())); if (!f) { - LOG(error) << "GeometryManager::GetSimpleGeom -- no file with geometry found for: " << detectorName << "!"; + LOGF(error, "GeometryManager::GetSimpleGeom -- no file with geometry found for: ", detectorName, "!"); return nullptr; } - LOG(info) << "GeometryManager::GetSimpleGeom for: " << detectorName << " from " - << Form("%s/simple_geom_%s.root", geomPath.c_str(), detectorName.c_str()); + LOGF(info, "GeometryManager::GetSimpleGeom for: ", detectorName, " from ", + Form("%s/simple_geom_%s.root", geomPath.c_str(), detectorName.c_str())); - TEveGeoShapeExtract* geomShapreExtract = static_cast(f->Get(detectorName.c_str())); + auto geomShapreExtract = dynamic_cast(f->Get(detectorName.c_str())); TEveGeoShape* geomShape = TEveGeoShape::ImportShapeExtract(geomShapreExtract); f->Close(); diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCalo.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCalo.h index 1d79897e57942..e7c00064a909b 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCalo.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCalo.h @@ -46,8 +46,9 @@ class VisualisationCalo std::string gid = ""; o2::dataformats::GlobalTrackID::Source source; }; + // Constructor with properties initialisation - VisualisationCalo(const VisualisationCaloVO& vo); + explicit VisualisationCalo(const VisualisationCaloVO& vo); VisualisationCalo(const VisualisationCalo& src); @@ -103,8 +104,6 @@ class VisualisationCalo int mPID; /// PDG code of the particle std::string mGID; /// String representation of gid - float mStartCoordinates[3]; /// Vector of track's start coordinates - float mEta; /// An angle from Z-axis to the radius vector pointing to the particle float mPhi; /// An angle from X-axis to the radius vector pointing to the particle diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCluster.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCluster.h index f70dc8cefd0b1..da07dcf39ce68 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCluster.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCluster.h @@ -19,6 +19,7 @@ #include "ReconstructionDataFormats/GlobalTrackID.h" #include "rapidjson/document.h" +#include #include #include @@ -42,6 +43,14 @@ class VisualisationCluster public: // Default constructor VisualisationCluster(float XYZ[], float time); + VisualisationCluster(TVector3 xyz) + { + mTime = 0; + mCoordinates[0] = xyz[0]; + mCoordinates[1] = xyz[1]; + mCoordinates[2] = xyz[2]; + mSource = o2::dataformats::GlobalTrackID::HMP; + } float X() const { return mCoordinates[0]; } float Y() const { return mCoordinates[1]; } @@ -59,4 +68,4 @@ class VisualisationCluster }; } // namespace event_visualisation } // namespace o2 -#endif // ALICE_O2_DATACONVERTER_VISUALISATIONCLUSTER_H \ No newline at end of file +#endif // ALICE_O2_DATACONVERTER_VISUALISATIONCLUSTER_H diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationConstants.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationConstants.h index 3b9d0750b89d6..b118c19f00621 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationConstants.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationConstants.h @@ -36,6 +36,7 @@ enum EVisualisationGroup { EMC, PHS, CPV, + HMP, NvisualisationGroups }; @@ -49,7 +50,8 @@ const std::string gVisualisationGroupName[NvisualisationGroups] = { "MID", "EMC", "PHS", - "CPV"}; + "CPV", + "HMP"}; const bool R3Visualisation[NvisualisationGroups] = { true, //"ITS", @@ -61,7 +63,8 @@ const bool R3Visualisation[NvisualisationGroups] = { true, //"MID", true, //"EMC", true, //"PHS", - true, // "CPV" + true, //"CPV" + true, //"HMP" }; enum EVisualisationDataType { diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h index 85e0c1a7a3c47..5e01e665a0f93 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h @@ -89,6 +89,11 @@ class VisualisationEvent return mTracks.back().addCluster(pos); } + VisualisationCluster& addGlobalCluster(const TVector3& xyz) + { + return mClusters.emplace_back(xyz); + } + VisualisationCalo* addCalo(VisualisationCalo::VisualisationCaloVO vo) { mCalo.emplace_back(vo); diff --git a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventJSONSerializer.h b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventJSONSerializer.h index 6b26a0d615789..233d43651db67 100644 --- a/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventJSONSerializer.h +++ b/EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventJSONSerializer.h @@ -28,10 +28,12 @@ namespace event_visualisation class VisualisationEventJSONSerializer : public VisualisationEventSerializer { + public: static int getIntOrDefault(rapidjson::Value& tree, const char* key, int defaultValue = 0); - float getFloatOrDefault(rapidjson::Value& tree, const char* key, float defaultValue = 0.0f); - std::string getStringOrDefault(rapidjson::Value& tree, const char* key, const char* defaultValue = ""); + static float getFloatOrDefault(rapidjson::Value& tree, const char* key, float defaultValue = 0.0f); + static std::string getStringOrDefault(rapidjson::Value& tree, const char* key, const char* defaultValue = ""); + private: std::string toJson(const VisualisationEvent& event) const; void fromJson(VisualisationEvent& event, std::string json); diff --git a/EventVisualisation/DataConverter/src/VisualisationEvent.cxx b/EventVisualisation/DataConverter/src/VisualisationEvent.cxx index 188c087e715b5..24448ae5e88dd 100644 --- a/EventVisualisation/DataConverter/src/VisualisationEvent.cxx +++ b/EventVisualisation/DataConverter/src/VisualisationEvent.cxx @@ -86,6 +86,9 @@ VisualisationEvent::GIDVisualisation VisualisationEvent::mVis = [] { if (filter == o2::event_visualisation::EVisualisationGroup::PHS) { res.contains[o2::dataformats::GlobalTrackID::PHS][filter] = true; } + if (filter == o2::event_visualisation::EVisualisationGroup::HMP) { + res.contains[o2::dataformats::GlobalTrackID::HMP][filter] = true; + } } return res; }(); diff --git a/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx b/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx index c3663bf141f7f..e9de16551303d 100644 --- a/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx +++ b/EventVisualisation/DataConverter/src/VisualisationEventJSONSerializer.cxx @@ -18,10 +18,8 @@ #include #include #include -#include #include "rapidjson/document.h" -#include "rapidjson/writer.h" #include "rapidjson/prettywriter.h" #include "rapidjson/stringbuffer.h" @@ -40,7 +38,7 @@ void VisualisationEventJSONSerializer::toFile(const VisualisationEvent& event, s bool VisualisationEventJSONSerializer::fromFile(VisualisationEvent& event, std::string fileName) { - LOG(info) << "VisualisationEventJSONSerializer <- " << fileName; + LOGF(info, "VisualisationEventJSONSerializer <- ", fileName); if (FILE* file = fopen(fileName.c_str(), "r")) { fclose(file); // file exists } else { @@ -195,7 +193,7 @@ VisualisationCluster VisualisationEventJSONSerializer::clusterFromJSON(rapidjson XYZ[2] = jsonZ.GetDouble(); VisualisationCluster cluster(XYZ, 0); - cluster.mSource = o2::dataformats::GlobalTrackID::TPC; // temporary + cluster.mSource = o2::dataformats::GlobalTrackID::HMP; return cluster; } diff --git a/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx b/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx index 38da87d8bed51..fd9e70aa02153 100644 --- a/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx +++ b/EventVisualisation/DataConverter/src/VisualisationEventROOTSerializer.cxx @@ -188,7 +188,7 @@ void VisualisationEventROOTSerializer::toFile(const VisualisationEvent& event, s bool VisualisationEventROOTSerializer::fromFile(VisualisationEvent& event, std::string fileName) { - LOG(info) << "VisualisationEventROOTSerializer <- " << fileName; + LOGF(info, "VisualisationEventROOTSerializer <- ", fileName); event.mTracks.clear(); event.mClusters.clear(); event.mCalo.clear(); diff --git a/EventVisualisation/DataConverter/src/converter.cxx b/EventVisualisation/DataConverter/src/converter.cxx index 3ba11be3c3b9c..f33638f686d5c 100644 --- a/EventVisualisation/DataConverter/src/converter.cxx +++ b/EventVisualisation/DataConverter/src/converter.cxx @@ -26,9 +26,9 @@ int main(int argc, char** argv) { - LOG(info) << "Welcome in O2 event conversion tool"; + LOGF(info, "Welcome in O2 event conversion tool"); if (argc != 3) { - LOG(error) << "two filename required, second should point to not existent file"; + LOGF(error, "two filename required, second should point to not existent file"); exit(-1); } @@ -45,13 +45,13 @@ int main(int argc, char** argv) srcSerializer->fromFile(vEvent, src); endTime = std::chrono::high_resolution_clock::now(); - LOG(info) << "read took " - << std::chrono::duration_cast(endTime - currentTime).count() * 1e-6; + LOGF(info, "read took ", + std::chrono::duration_cast(endTime - currentTime).count() * 1e-6); currentTime = std::chrono::high_resolution_clock::now(); dstSerializer->toFile(vEvent, dst); endTime = std::chrono::high_resolution_clock::now(); - LOG(info) << "write took " - << std::chrono::duration_cast(endTime - currentTime).count() * 1e-6; + LOGF(info, "write took ", + std::chrono::duration_cast(endTime - currentTime).count() * 1e-6); return 0; } diff --git a/EventVisualisation/Geometry/simple_geom_HMP.root b/EventVisualisation/Geometry/simple_geom_HMP.root new file mode 100644 index 0000000000000..af37d833a4aa8 Binary files /dev/null and b/EventVisualisation/Geometry/simple_geom_HMP.root differ diff --git a/EventVisualisation/Geometry/simple_geom_ITS.root b/EventVisualisation/Geometry/simple_geom_ITS.root old mode 100755 new mode 100644 diff --git a/EventVisualisation/View/src/EventManager.cxx b/EventVisualisation/View/src/EventManager.cxx index 3f57d603cc4d4..0c0756583aa83 100644 --- a/EventVisualisation/View/src/EventManager.cxx +++ b/EventVisualisation/View/src/EventManager.cxx @@ -22,6 +22,7 @@ #include "EventVisualisationView/MultiView.h" #include "EventVisualisationView/Options.h" #include "EventVisualisationDataConverter/VisualisationEvent.h" +#include "EventVisualisationDataConverter/VisualisationEventJSONSerializer.h" #include #include "EventVisualisationBase/ConfigurationManager.h" #include "DataFormatsParameters/ECSDataAdapters.h" @@ -59,7 +60,7 @@ EventManager& EventManager::getInstance() EventManager::EventManager() : TEveEventManager("Event", "") { - LOG(info) << "Initializing TEveManager"; + LOGF(info, "Initializing TEveManager"); ConfigurationManager::getInstance().getConfig(settings); @@ -141,7 +142,6 @@ void EventManager::displayCurrentEvent() multiView->redraw3D(); auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(stop - start); - LOG(info) << "+++ displayCurrentEvent: " << duration.count(); } void EventManager::GotoEvent(Int_t no) @@ -221,7 +221,7 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st { double eta = 0.1; size_t trackCount = event.getTrackCount(); - LOG(info) << "displayVisualisationEvent: " << trackCount << " detector: " << detectorName; + // tracks auto* list = new TEveTrackList(detectorName.c_str()); list->IncDenyDestroy(); @@ -266,7 +266,6 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st if (trackCount != 0) { dataTypeLists[EVisualisationDataType::Tracks]->AddElement(list); if (detectorName != "MCH" && detectorName != "MFT" && detectorName != "MID") { - // LOG(info) << "phi: " << trackCount << " detector: " << detectorName; dataTypeListsPhi[EVisualisationDataType::Tracks]->AddElement(list); } } @@ -283,15 +282,14 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st if (clusterCount != 0) { dataTypeLists[EVisualisationDataType::Clusters]->AddElement(point_list); if (detectorName != "MCH" && detectorName != "MFT" && detectorName != "MID") { - // LOG(info) << "phi: " << clusterCount << " detector: " << detectorName; dataTypeListsPhi[EVisualisationDataType::Clusters]->AddElement(point_list); } } - LOG(info) << "tracks: " << trackCount << " detector: " << detectorName << ":" - << dataTypeLists[EVisualisationDataType::Tracks]->NumChildren(); - LOG(info) << "clusters: " << clusterCount << " detector: " << detectorName << ":" - << dataTypeLists[EVisualisationDataType::Clusters]->NumChildren(); + LOGF(info, "tracks: ", trackCount, " detector: ", detectorName, ":", + dataTypeLists[EVisualisationDataType::Tracks]->NumChildren()); + LOGF(info, "clusters: ", clusterCount, " detector: ", detectorName, ":", + dataTypeLists[EVisualisationDataType::Clusters]->NumChildren()); } void EventManager::displayCalorimeters(VisualisationEvent& event, const std::string& detectorName) @@ -428,7 +426,7 @@ void EventManager::saveVisualisationSettings() return arr; }; - + d.AddMember("version", rapidjson::Value().SetString(o2_eve_version.c_str(), o2_eve_version.length()), allocator); d.AddMember("trackVisibility", jsonArray(vizSettings.trackVisibility, allocator), allocator); d.AddMember("trackColor", jsonArray(vizSettings.trackColor, allocator), allocator); d.AddMember("trackStyle", jsonArray(vizSettings.trackStyle, allocator), allocator); @@ -479,6 +477,11 @@ void EventManager::restoreVisualisationSettings() Document d; d.Parse(json.c_str()); + if (VisualisationEventJSONSerializer::getStringOrDefault(d, "version", "0.0") != o2_eve_version) { + LOGF(info, "visualisation settings has wrong version and was not restored"); + return; + } + auto updateArray = [](auto& array, const auto& document, const char* name, const auto& accessor) { for (size_t i = 0; i < elemof(array); ++i) { array[i] = accessor(document[name][i]); diff --git a/EventVisualisation/View/src/EventManagerFrame.cxx b/EventVisualisation/View/src/EventManagerFrame.cxx index d1ca190ab6475..ff5ee59047abb 100644 --- a/EventVisualisation/View/src/EventManagerFrame.cxx +++ b/EventVisualisation/View/src/EventManagerFrame.cxx @@ -382,10 +382,9 @@ void EventManagerFrame::checkMemory() if (success == 1) { // properly readed size = 4 * size / 1024; // in MB this->memoryUsedInfo = size; - LOG(info) << "Memory used: " << size << " memory allowed: " << memoryLimit; + LOGF(info, "Memory used: ", size, " memory allowed: ", memoryLimit); if (size > memoryLimit) { - LOG(error) << "Memory used: " << size << " exceeds memory allowed: " - << memoryLimit; + LOGF(error, "Memory used: ", size, " exceeds memory allowed: ", memoryLimit); exit(-1); } } @@ -412,7 +411,7 @@ void EventManagerFrame::createOutreachScreenshot() if (!std::filesystem::is_regular_file(fileName)) { std::vector ext = {".png"}; DirectoryLoader::removeOldestFiles(imageFolder, ext, (int)ConfigurationManager::getOutreachFilesMax()); - LOG(info) << "Outreach screenshot: " << fileName; + LOGF(info, "Outreach screenshot: ", fileName); Screenshot::perform("outreach", fileName, this->mEventManager->getDataSource()->getDetectorsMask(), this->mEventManager->getDataSource()->getRunNumber(), diff --git a/EventVisualisation/View/src/Initializer.cxx b/EventVisualisation/View/src/Initializer.cxx index f11d9bb22701a..e9572e24f991d 100644 --- a/EventVisualisation/View/src/Initializer.cxx +++ b/EventVisualisation/View/src/Initializer.cxx @@ -54,7 +54,7 @@ void Initializer::setup() false); // hide left and bottom tabs const string ocdbStorage = settings.GetValue("OCDB.default.path", o2::base::NameConf::getCCDBServer().c_str()); // default path to OCDB - LOG(info) << "Initializer -- OCDB path:" << ocdbStorage; + LOGF(info, "Initializer -- OCDB path:", ocdbStorage); auto& eventManager = EventManager::getInstance(); eventManager.setCdbPath(ocdbStorage); @@ -132,7 +132,7 @@ void Initializer::setupGeometry() } EVisualisationGroup det = static_cast(iDet); string detName = gVisualisationGroupName[det]; - LOG(info) << detName; + LOGF(info, detName); if (detName == "TPC" || detName == "MCH" || detName == "MID" || detName == "MFT") { // don't load MUON+MFT and AD and standard TPC to R-Phi view diff --git a/EventVisualisation/View/src/MultiView.cxx b/EventVisualisation/View/src/MultiView.cxx index a2f1beed99abf..e651a328dac2b 100644 --- a/EventVisualisation/View/src/MultiView.cxx +++ b/EventVisualisation/View/src/MultiView.cxx @@ -186,7 +186,7 @@ void MultiView::drawGeometryForDetector(string detectorName, bool threeD, bool r void MultiView::registerGeometry(TEveGeoShape* geom, bool threeD, bool rPhi, bool zy) { if (!geom) { - LOG(error) << "MultiView::registerGeometry -- geometry is NULL!"; + LOGF(error, "MultiView::registerGeometry -- geometry is NULL!"); exit(-1); } TEveProjectionManager* projection; diff --git a/EventVisualisation/View/src/Options.cxx b/EventVisualisation/View/src/Options.cxx index 56f44baa7e358..8fad13cc5686e 100644 --- a/EventVisualisation/View/src/Options.cxx +++ b/EventVisualisation/View/src/Options.cxx @@ -84,8 +84,7 @@ bool Options::processCommandLine(int argc, char* argv[]) } if (varmap.count("help")) { - LOG(info) << eveOptions << std::endl - << " default values are always taken from o2eve.json in current folder if present" << std::endl; + LOGF(info, printOptions()); return false; } diff --git a/EventVisualisation/View/src/Screenshot.cxx b/EventVisualisation/View/src/Screenshot.cxx index ed99463987f47..0391b52108f7e 100644 --- a/EventVisualisation/View/src/Screenshot.cxx +++ b/EventVisualisation/View/src/Screenshot.cxx @@ -252,7 +252,6 @@ std::string auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(stop - start); - LOG(info) << "++++++ Screenshot::perform: " << duration.count(); return fileName; // saved screenshod file name } diff --git a/EventVisualisation/View/src/main.cxx b/EventVisualisation/View/src/main.cxx index fd9ab254c93bb..7b13838446246 100644 --- a/EventVisualisation/View/src/main.cxx +++ b/EventVisualisation/View/src/main.cxx @@ -33,7 +33,7 @@ using namespace o2::event_visualisation; int main(int argc, char** argv) { - LOG(info) << "Welcome in O2 event visualisation tool (" << o2_eve_version << ")"; + LOGF(info, "Welcome in O2 event visualisation tool (", o2_eve_version, ")"); if (!Options::Instance()->processCommandLine(argc, argv)) { exit(-1); @@ -54,18 +54,16 @@ int main(int argc, char** argv) } // create ROOT application environment - TApplication* app = new TApplication("o2eve", &argc, argv); + auto app = new TApplication("o2eve", &argc, argv); gApplication = app; //app->Connect("TEveBrowser", "CloseWindow()", "TApplication", app, "Terminate()"); - LOG(info) << "Initializing TEveManager"; + LOGF(info, "Initializing TEveManager"); if (!TEveManager::Create(kTRUE, "FI")) { - LOG(fatal) << "Could not create TEveManager!!"; + LOGF(fatal, "Could not create TEveManager!!"); exit(0); } - //gEve->SpawnNewViewer("3D View", ""); exit(0); - // Initialize o2 Event Visualisation Initializer::setup(); @@ -76,6 +74,6 @@ int main(int argc, char** argv) TEveManager::Terminate(); app->Terminate(0); - LOG(info) << "O2 event visualisation tool terminated properly"; + LOGF(info, "O2 event visualisation tool terminated properly"); return 0; } diff --git a/EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h b/EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h index 1c3a50d6a7131..83b448568bbff 100644 --- a/EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h +++ b/EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h @@ -160,6 +160,7 @@ class EveWorkflowHelper void drawMCHMID(GID gid, float trackTime); void drawPHS(GID gid); void drawEMC(GID gid); + void drawHMP(GID gid); void drawAODBarrel(AODBarrelTrack const& track, float trackTime); void drawAODMFT(AODMFTTrack const& track, float trackTime); @@ -175,6 +176,7 @@ class EveWorkflowHelper void drawTRDClusters(const o2::trd::TrackTRD& trc, float trackTime); void drawTOFClusters(GID gid, float trackTime); void drawPoint(float x, float y, float z, float trackTime) { mEvent.addCluster(x, y, z, trackTime); } + void drawGlobalPoint(const TVector3& xyx) { mEvent.addGlobalCluster(xyx); } void prepareITSClusters(const o2::itsmft::TopologyDictionary* dict); // fills mITSClustersArray void prepareMFTClusters(const o2::itsmft::TopologyDictionary* dict); // fills mMFTClustersArray void clear() { mEvent.clear(); } diff --git a/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h b/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h index b6eb49d19750f..b3431951ed41f 100644 --- a/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h +++ b/EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h @@ -47,8 +47,8 @@ class TPCFastTransform; class O2DPLDisplaySpec : public o2::framework::Task { public: - static constexpr auto allowedTracks = "ITS,TPC,MFT,MCH,MID,ITS-TPC,TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD,ITS-TPC-TRD-TOF,MCH-MID,MFT-MCH,MFT-MCH-MID,PHS,EMC"; - static constexpr auto allowedClusters = "ITS,TPC,TRD,TOF,MFT,MCH,MID,PHS,EMC"; + static constexpr auto allowedTracks = "ITS,TPC,MFT,MCH,MID,ITS-TPC,TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD,ITS-TPC-TRD-TOF,MCH-MID,MFT-MCH,MFT-MCH-MID,PHS,EMC,HMP"; + static constexpr auto allowedClusters = "ITS,TPC,TRD,TOF,MFT,MCH,MID,PHS,EMC,HMP"; O2DPLDisplaySpec(bool disableWrite, bool useMC, o2::dataformats::GlobalTrackID::mask_t trkMask, o2::dataformats::GlobalTrackID::mask_t clMask, diff --git a/EventVisualisation/Workflow/src/AO2DConverter.cxx b/EventVisualisation/Workflow/src/AO2DConverter.cxx index 488e0ce28034e..a1ae1b1c5623f 100644 --- a/EventVisualisation/Workflow/src/AO2DConverter.cxx +++ b/EventVisualisation/Workflow/src/AO2DConverter.cxx @@ -48,7 +48,7 @@ struct AO2DConverter { void init(o2::framework::InitContext& ic) { - LOG(info) << "------------------------ AO2DConverter::init version " << mWorkflowVersion << " ------------------------------------"; + LOGF(info, "------------------------ AO2DConverter::init version ", mWorkflowVersion, " ------------------------------------"); mData.init(); mHelper = std::make_shared(); diff --git a/EventVisualisation/Workflow/src/EveWorkflowHelper.cxx b/EventVisualisation/Workflow/src/EveWorkflowHelper.cxx index ad10ae9e9b6cb..3b1b40df9aba3 100644 --- a/EventVisualisation/Workflow/src/EveWorkflowHelper.cxx +++ b/EventVisualisation/Workflow/src/EveWorkflowHelper.cxx @@ -258,6 +258,7 @@ void EveWorkflowHelper::selectTowers() { const auto& allTriggersPHOS = mRecoCont->getPHOSTriggers(); const auto& allTriggersEMCAL = mRecoCont->getEMCALTriggers(); + const auto& allTriggersHMP = mRecoCont->getHMPClusterTriggers(); auto filterTrigger = [&](const auto& trig) { const auto time = bcDiffToTFTimeMUS(trig.getBCData()); @@ -281,14 +282,22 @@ void EveWorkflowHelper::selectTowers() for (std::size_t iv = 0; iv < totalPrimaryVertices; iv++) { const auto& vtref = vtxRefs[iv]; + // to be improved to recognize PV + for (std::size_t i = 0; i < allTriggersHMP.size(); i++) { + mTotalDataTypes[GID::HMP]++; + const auto& trig = allTriggersHMP[i]; + mPrimaryVertexTriggerGIDs[iv].emplace_back(GID{static_cast(i), GID::HMP}); + } + const auto triggersPHOS = gsl::span(trackIndex.data() + vtref.getFirstEntryOfSource(GID::PHS), vtref.getEntriesOfSource(GID::PHS)); for (const auto& tvid : triggersPHOS) { mTotalDataTypes[GID::PHS]++; - const auto& trig = allTriggersPHOS[tvid.getIndex()]; - - if (filterTrigger(trig)) { - mPrimaryVertexTriggerGIDs[iv].emplace_back(tvid); + if (tvid.getIndex() < allTriggersPHOS.size()) { + const auto& trig = allTriggersPHOS[tvid.getIndex()]; + if (filterTrigger(trig)) { + mPrimaryVertexTriggerGIDs[iv].emplace_back(tvid); + } } } @@ -296,14 +305,23 @@ void EveWorkflowHelper::selectTowers() for (const auto& tvid : triggersEMCAL) { mTotalDataTypes[GID::EMC]++; - const auto& trig = allTriggersEMCAL[tvid.getIndex()]; + if (tvid.getIndex() < allTriggersEMCAL.size()) { + const auto& trig = allTriggersEMCAL[tvid.getIndex()]; - if (filterTrigger(trig)) { - mPrimaryVertexTriggerGIDs[iv].emplace_back(tvid); + if (filterTrigger(trig)) { + mPrimaryVertexTriggerGIDs[iv].emplace_back(tvid); + } } } } } else { + + for (std::size_t i = 0; i < allTriggersHMP.size(); i++) { + mTotalDataTypes[GID::HMP]++; + const auto& trig = allTriggersHMP[i]; + mPrimaryVertexTriggerGIDs[0].emplace_back(GID{static_cast(i), GID::HMP}); + } + for (std::size_t i = 0; i < allTriggersPHOS.size(); i++) { mTotalDataTypes[GID::PHS]++; const auto& trig = allTriggersPHOS[i]; @@ -432,6 +450,9 @@ void EveWorkflowHelper::draw(std::size_t primaryVertexIdx, bool sortTracks) case GID::EMC: drawEMC(gid); break; + case GID::HMP: + drawHMP(gid); + break; default: LOGF(info, "Trigger type %s not handled", gid.getSourceName()); break; @@ -565,6 +586,27 @@ void EveWorkflowHelper::prepareMFTClusters(const o2::itsmft::TopologyDictionary* } } +void EveWorkflowHelper::drawHMP(GID gid) +{ + o2::hmpid::Param* pParam = o2::hmpid::Param::instance(); + const auto& trig = mRecoCont->getHMPClusterTriggers()[gid.getIndex()]; + const auto& clusters = mRecoCont->getHMPClusters(); + + auto bc = trig.getBc(); + auto orbit = trig.getOrbit(); + auto time = o2::InteractionTimeRecord::bc2ns(bc, orbit); // in ns absolute time + + for (int j = trig.getFirstEntry(); j <= trig.getLastEntry(); j++) { + auto cluster = clusters[j]; + auto module = cluster.ch(); + double x = cluster.x(); + double y = cluster.y(); + + TVector3 vec3 = pParam->lors2Mars(module, x, y); + drawGlobalPoint(vec3); + } +} + void EveWorkflowHelper::drawPHS(GID gid) { const auto& cells = mRecoCont->getPHOSCells(); diff --git a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx index 653ba00941a1c..3885bbce959a8 100644 --- a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx +++ b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx @@ -90,7 +90,7 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" // main method must be included here (otherwise customize not used) void O2DPLDisplaySpec::init(InitContext& ic) { - LOG(info) << "------------------------ O2DPLDisplay::init version " << o2_eve_version << " ------------------------------------"; + LOGF(info, "------------------------ O2DPLDisplay::init version ", o2_eve_version, " ------------------------------------"); mData.mConfig.configProcessing.runMC = mUseMC; o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest); } @@ -103,7 +103,7 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc) if (this->mOnlyNthEvent && this->mEventCounter++ % this->mOnlyNthEvent != 0) { return; } - LOG(info) << "------------------------ O2DPLDisplay::run version " << o2_eve_version << " ------------------------------------"; + LOGF(info, "------------------------ O2DPLDisplay::run version ", o2_eve_version, " ------------------------------------"); // filtering out any run which occur before reaching next time interval auto currentTime = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = currentTime - this->mTimeStamp; @@ -114,28 +114,23 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc) o2::globaltracking::RecoContainer recoCont; recoCont.collectData(pc, *mDataRequest); updateTimeDependentParams(pc); // Make sure that this is called after the RecoContainer collect data, since some condition objects are fetched there - EveWorkflowHelper::FilterSet enabledFilters; enabledFilters.set(EveWorkflowHelper::Filter::ITSROF, this->mFilterITSROF); enabledFilters.set(EveWorkflowHelper::Filter::TimeBracket, this->mFilterTime); enabledFilters.set(EveWorkflowHelper::Filter::EtaBracket, this->mRemoveTPCEta); enabledFilters.set(EveWorkflowHelper::Filter::TotalNTracks, this->mNumberOfTracks != -1); - EveWorkflowHelper helper(enabledFilters, this->mNumberOfTracks, this->mTimeBracket, this->mEtaBracket, this->mPrimaryVertexMode); helper.setRecoContainer(&recoCont); - helper.setITSROFs(); helper.selectTracks(&(mData.mConfig.configCalib), mClMask, mTrkMask, mTrkMask); helper.selectTowers(); - helper.prepareITSClusters(mData.mITSDict); helper.prepareMFTClusters(mData.mMFTDict); const auto& tinfo = pc.services().get(); std::size_t filesSaved = 0; - auto processData = [&](const auto& dataMap) { for (const auto& keyVal : dataMap) { if (filesSaved >= mMaxPrimaryVertices) { @@ -185,7 +180,6 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc) helper.clear(); } }; - if (mPrimaryVertexTriggers) { processData(helper.mPrimaryVertexTriggerGIDs); } else { @@ -247,12 +241,12 @@ void O2DPLDisplaySpec::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) return; } if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) { - LOG(info) << "ITS cluster dictionary updated"; + LOGF(info, "ITS cluster dictionary updated"); mData.setITSDict((const o2::itsmft::TopologyDictionary*)obj); return; } if (matcher == ConcreteDataMatcher("MFT", "CLUSDICT", 0)) { - LOG(info) << "MFT cluster dictionary updated"; + LOGF(info, "MFT cluster dictionary updated"); mData.setMFTDict((const o2::itsmft::TopologyDictionary*)obj); return; } @@ -260,17 +254,17 @@ void O2DPLDisplaySpec::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - LOG(info) << "------------------------ defineDataProcessing " << o2_eve_version << " ------------------------------------"; + LOGF(info, "------------------------ defineDataProcessing ", o2_eve_version, " ------------------------------------"); WorkflowSpec specs; - std::string jsonFolder = cfgc.options().get("jsons-folder"); + auto jsonFolder = cfgc.options().get("jsons-folder"); std::string ext = ".root"; // root files are default format auto useJsonFormat = cfgc.options().get("use-json-format"); if (useJsonFormat) { ext = ".json"; } - std::string eveHostName = cfgc.options().get("eve-hostname"); + auto eveHostName = cfgc.options().get("eve-hostname"); o2::conf::ConfigurableParam::updateFromString(cfgc.options().get("configKeyValues")); bool useMC = !cfgc.options().get("disable-mc"); bool disableWrite = cfgc.options().get("disable-write"); @@ -284,9 +278,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) char* colIdx = getenv("DDS_COLLECTION_INDEX"); int myIdx = colIdx ? atoi(colIdx) : -1; if (myIdx == eveDDSColIdx) { - LOG(important) << "Restricting DPL Display to collection index, my index " << myIdx << ", enabled " << int(myIdx == eveDDSColIdx); + LOGF(important, "Restricting DPL Display to collection index, my index ", myIdx, ", enabled ", int(myIdx == eveDDSColIdx)); } else { - LOG(info) << "Restricting DPL Display to collection index, my index " << myIdx << ", enabled " << int(myIdx == eveDDSColIdx); + LOGF(info, "Restricting DPL Display to collection index, my index ", myIdx, ", enabled ", int(myIdx == eveDDSColIdx)); } eveHostNameMatch &= myIdx == eveDDSColIdx; } @@ -310,7 +304,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) if (!srcTrk.any() && !srcCl.any()) { if (cfgc.options().get("skipOnEmptyInput")) { - LOG(info) << "No valid inputs for event display, disabling event display"; + LOGF(info, "No valid inputs for event display, disabling event display"); return std::move(specs); } throw std::runtime_error("No input configured");