Skip to content

Commit b6adf2a

Browse files
jmyrchaJulian Myrcha
andauthored
o2-eve: implementation of *.eve binary format, many fixes (#13241)
* o2-eve: implementation of *.eve binary format, many fixes * formatting * remove std::quick_exit * clang format * missed call to quick_exit removed * clang * clang * requested changes * clang --------- Co-authored-by: Julian Myrcha <jmyrcha@cern.ch>
1 parent 68770ca commit b6adf2a

31 files changed

+1310
-375
lines changed

EventVisualisation/Base/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
o2_add_library(EventVisualisationBase
1313
SOURCES src/ConfigurationManager.cxx
14+
src/DataSource.cxx
1415
src/DataSourceOnline.cxx
1516
src/DataSourceOffline.cxx
1617
src/GeometryManager.cxx

EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace o2
2525
namespace event_visualisation
2626
{
2727
/// Version of the software
28-
const static std::string o2_eve_version = "1.70";
28+
const static int o2_eve_version = 171;
2929

3030
/// Configuration Manager allows an easy access to the config file.
3131
///

EventVisualisation/Base/include/EventVisualisationBase/DataSource.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class DataSource
3535
DataReader* mDataReader = nullptr;
3636
float mTimeFrameMinTrackTime = 0;
3737
float mTimeFrameMaxTrackTime = 0;
38+
framework::DataProcessingHeader::CreationTime mCreationTime;
3839

3940
public:
4041
float getTimeFrameMinTrackTime() const
@@ -76,8 +77,9 @@ class DataSource
7677
virtual std::string getEventAbsoluteFilePath() { return ""; };
7778
virtual int getFirstTForbit() const { return 0; }
7879
virtual void setFirstTForbit(int) {}
79-
virtual std::string getCollisionTime() const { return "not specified"; }
80-
virtual void setCollisionTime(std::string) {}
80+
void setCreationTime(framework::DataProcessingHeader::CreationTime mCreationTime) { this->mCreationTime = mCreationTime; }
81+
framework::DataProcessingHeader::CreationTime getCreationTime() const { return mCreationTime; }
82+
std::string getCreationTimeAsString() const;
8183
virtual std::string getFileTime() const { return "not specified"; }
8284
virtual void setFileTime(std::string) {}
8385
virtual int getTrackMask() const { return 0; }

EventVisualisation/Base/include/EventVisualisationBase/DataSourceOnline.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class DataSourceOnline : public DataSource
3939
int mFirstTForbit;
4040
int mTrackMask;
4141
int mClusterMask;
42-
std::string mCollisionTime;
42+
43+
protected:
4344
std::string mFileTime;
4445

4546
public:
@@ -69,8 +70,6 @@ class DataSourceOnline : public DataSource
6970
std::string getEventAbsoluteFilePath() override { return mFileWatcher.currentFilePath(); };
7071
int getFirstTForbit() const override { return this->mFirstTForbit; }
7172
void setFirstTForbit(int firstTForbit) override { this->mFirstTForbit = firstTForbit; }
72-
std::string getCollisionTime() const override { return this->mCollisionTime; }
73-
void setCollisionTime(std::string collisionTime) override { this->mCollisionTime = collisionTime; }
7473
std::string getFileTime() const override { return this->mFileTime; }
7574
void setFileTime(std::string fileTime) override { this->mFileTime = fileTime; }
7675
int getTrackMask() const override { return this->mTrackMask; }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file DataSource.cxx
13+
/// \brief reading from file(s) base class
14+
/// \author j.myrcha@cern.ch
15+
16+
#include <EventVisualisationBase/DataSource.h>
17+
18+
#include <fairlogger/Logger.h>
19+
// #include <time.h>
20+
21+
namespace o2::event_visualisation
22+
{
23+
24+
std::string DataSource::getCreationTimeAsString() const
25+
{
26+
char buffer[90];
27+
time_t time = this->mCreationTime;
28+
const char* format = "%a %b %-d %H:%M:%S %Y";
29+
struct tm* timeinfo = localtime(&time);
30+
strftime(buffer, sizeof(buffer), format, timeinfo);
31+
return buffer;
32+
}
33+
34+
} // namespace o2::event_visualisation

EventVisualisation/Base/src/DataSourceOnline.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace o2
3030
{
3131
namespace event_visualisation
3232
{
33-
std::vector<std::string> DataSourceOnline::sourceFilextensions = {".json", ".root"};
33+
std::vector<std::string> DataSourceOnline::sourceFilextensions = {".json", ".root", ".eve"};
3434

3535
std::vector<std::pair<VisualisationEvent, EVisualisationGroup>>
3636
DataSourceOnline::getVisualisationList(int no, float minTime, float maxTime, float range)
@@ -51,7 +51,8 @@ std::vector<std::pair<VisualisationEvent, EVisualisationGroup>>
5151
this->setRunNumber(vEvent.getRunNumber());
5252
this->setRunType(vEvent.getRunType());
5353
this->setFirstTForbit(vEvent.getFirstTForbit());
54-
this->setCollisionTime(vEvent.getCollisionTime());
54+
this->setCreationTime(vEvent.getCreationTime());
55+
5556
this->setTrackMask(vEvent.getTrkMask());
5657
this->setClusterMask(vEvent.getClMask());
5758

EventVisualisation/DataConverter/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ o2_add_library(EventVisualisationDataConverter
1717
src/VisualisationEventSerializer.cxx
1818
src/VisualisationEventJSONSerializer.cxx
1919
src/VisualisationEventROOTSerializer.cxx
20+
src/VisualisationEventOpenGLSerializer.cxx
2021
PUBLIC_LINK_LIBRARIES RapidJSON::RapidJSON
2122
O2::ReconstructionDataFormats
2223
O2::DataFormatsParameters
@@ -28,6 +29,7 @@ o2_add_executable(eve-convert
2829
src/VisualisationEventSerializer.cxx
2930
src/VisualisationEventJSONSerializer.cxx
3031
src/VisualisationEventROOTSerializer.cxx
32+
src/VisualisationEventOpenGLSerializer.cxx
3133
src/VisualisationTrack.cxx
3234
src/VisualisationCluster.cxx
3335
src/VisualisationCalo.cxx

EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCalo.h

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -20,98 +20,47 @@
2020
#include "rapidjson/document.h"
2121
#include "ReconstructionDataFormats/GlobalTrackID.h"
2222

23-
namespace o2
24-
{
25-
namespace event_visualisation
23+
namespace o2::event_visualisation
2624
{
25+
2726
class VisualisationCalo
2827
{
2928
friend class VisualisationEventJSONSerializer;
3029
friend class VisualisationEventROOTSerializer;
3130

3231
public:
33-
// Default constructor
3432
VisualisationCalo();
3533

3634
/// constructor parametrisation (Value Object) for VisualisationCalo class
37-
///
38-
/// Simplifies passing parameters to constructor of VisualisationCalo
39-
/// by providing their names
4035
struct VisualisationCaloVO {
4136
float time = 0;
4237
float energy = 0.0f;
4338
float phi = 0;
4439
float eta = 0;
4540
int PID = 0;
46-
std::string gid = "";
47-
o2::dataformats::GlobalTrackID::Source source;
41+
o2::dataformats::GlobalTrackID gid = 0;
4842
};
49-
50-
// Constructor with properties initialisation
5143
explicit VisualisationCalo(const VisualisationCaloVO& vo);
5244

5345
VisualisationCalo(const VisualisationCalo& src);
5446

55-
// Energy getter
56-
float getEnergy() const
57-
{
58-
return mEnergy;
59-
}
60-
61-
// Time getter
62-
float getTime() const
63-
{
64-
return mTime;
65-
}
66-
67-
// PID (particle identification code) getter
68-
int getPID() const
69-
{
70-
return mPID;
71-
}
72-
73-
// GID getter
74-
std::string getGIDAsString() const
75-
{
76-
return mGID;
77-
}
78-
79-
// Source Getter
80-
o2::dataformats::GlobalTrackID::Source getSource() const
81-
{
82-
return mSource;
83-
}
84-
85-
// Phi getter
86-
float getPhi() const
87-
{
88-
return mPhi;
89-
}
90-
91-
// Theta getter
92-
float getEta() const
93-
{
94-
return mEta;
95-
}
47+
[[nodiscard]] float getEnergy() const { return mEnergy; }
48+
[[nodiscard]] float getTime() const { return mTime; }
49+
[[nodiscard]] int getPID() const { return mPID; }
50+
[[nodiscard]] o2::dataformats::GlobalTrackID getGID() const { return mBGID; }
51+
[[nodiscard]] o2::dataformats::GlobalTrackID::Source getSource() const { return static_cast<o2::dataformats::GlobalTrackID::Source>(mBGID.getSource()); }
52+
[[nodiscard]] float getPhi() const { return mPhi; }
53+
[[nodiscard]] float getEta() const { return mEta; }
9654

9755
private:
98-
// Set coordinates of the beginning of the track
99-
void addStartCoordinates(const float xyz[3]);
100-
10156
float mTime; /// time
10257
float mEnergy; /// Energy of the particle
103-
104-
int mPID; /// PDG code of the particle
105-
std::string mGID; /// String representation of gid
106-
107-
float mEta; /// An angle from Z-axis to the radius vector pointing to the particle
108-
float mPhi; /// An angle from X-axis to the radius vector pointing to the particle
109-
110-
// std::vector<int> mChildrenIDs; /// Unique IDs of children particles
111-
o2::dataformats::GlobalTrackID::Source mSource; /// data source of the track (debug)
58+
int mPID; /// PDG code of the particle
59+
float mEta; /// An angle from Z-axis to the radius vector pointing to the particle
60+
float mPhi; /// An angle from X-axis to the radius vector pointing to the particle
61+
o2::dataformats::GlobalTrackID mBGID;
11262
};
11363

114-
} // namespace event_visualisation
115-
} // namespace o2
64+
} // namespace o2::event_visualisation
11665

11766
#endif // O2EVE_VISUALISATIONCALO_H

EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationCluster.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
#include <vector>
2525
#include <ctime>
2626

27-
namespace o2
28-
{
29-
namespace event_visualisation
27+
namespace o2::event_visualisation
3028
{
3129

3230
/// Minimalistic description of a cluster
@@ -39,33 +37,32 @@ class VisualisationCluster
3937
{
4038
friend class VisualisationEventJSONSerializer;
4139
friend class VisualisationEventROOTSerializer;
40+
friend class VisualisationEventOpenGLSerializer;
41+
friend class VisualisationEvent;
4242

4343
public:
4444
// Default constructor
45-
VisualisationCluster(float XYZ[], float time);
45+
VisualisationCluster(const float XYZ[], float time, o2::dataformats::GlobalTrackID gid);
4646
VisualisationCluster(TVector3 xyz)
4747
{
4848
mTime = 0;
49+
mBGID = 0;
4950
mCoordinates[0] = xyz[0];
5051
mCoordinates[1] = xyz[1];
5152
mCoordinates[2] = xyz[2];
52-
mSource = o2::dataformats::GlobalTrackID::HMP;
5353
}
5454

5555
float X() const { return mCoordinates[0]; }
5656
float Y() const { return mCoordinates[1]; }
5757
float Z() const { return mCoordinates[2]; }
5858
float Time() const { return mTime; }
5959

60-
// GID getter
61-
int getSource() const { return mSource; }
62-
6360
private:
64-
void setCoordinates(float xyz[3]);
61+
void setCoordinates(const float xyz[3]);
6562
float mCoordinates[3]; /// Vector of cluster's coordinates
6663
float mTime; /// time asociated with cluster
67-
o2::dataformats::GlobalTrackID::Source mSource; /// data source of the cluster (debug)
64+
o2::dataformats::GlobalTrackID mBGID;
6865
};
69-
} // namespace event_visualisation
70-
} // namespace o2
66+
} // namespace o2::event_visualisation
67+
7168
#endif // ALICE_O2_DATACONVERTER_VISUALISATIONCLUSTER_H

0 commit comments

Comments
 (0)