Project
Loading...
Searching...
No Matches
VisualisationEventJSONSerializer.h
Go to the documentation of this file.
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
16
17#ifndef O2EVE_VISUALISATIONEVENTJSONSERIALIZER_H
18#define O2EVE_VISUALISATIONEVENTJSONSERIALIZER_H
19
22#include <string>
23
24namespace o2
25{
26namespace event_visualisation
27{
28
30{
31 public:
32 const std::string serializerName() const override { return std::string("VisualisationEventJSONSerializer"); }
33 static int getIntOrDefault(rapidjson::Value& tree, const char* key, int defaultValue = 0);
34 static uint64_t getUIntOrDefault(rapidjson::Value& tree, const char* key, uint64_t defaultValue = 0);
35
36 static float getFloatOrDefault(rapidjson::Value& tree, const char* key, float defaultValue = 0.0f);
37 static std::string getStringOrDefault(rapidjson::Value& tree, const char* key, const char* defaultValue = "");
38
39 private:
40 std::string toJson(const VisualisationEvent& event) const;
41 void fromJson(VisualisationEvent& event, std::string json);
42
43 // create calo from their JSON representation
44 VisualisationCalo caloFromJSON(rapidjson::Value& tree);
45 // create JSON representation of the calo
46 rapidjson::Value jsonTree(const VisualisationCalo& calo, rapidjson::Document::AllocatorType& allocator) const;
47
48 // create cluster from their JSON representation
49 VisualisationCluster clusterFromJSON(rapidjson::Value& tree, const VisualisationTrack* track);
50 rapidjson::Value jsonTree(const VisualisationCluster& cluster, rapidjson::Document::AllocatorType& allocator, const VisualisationTrack* track) const;
51
52 // create track from their JSON representation
53 VisualisationTrack trackFromJSON(rapidjson::Value& tree);
54 // create JSON representation of the track
55 rapidjson::Value jsonTree(const VisualisationTrack& track, rapidjson::Document::AllocatorType& allocator) const;
56
57 public:
58 bool fromFile(VisualisationEvent& event, std::string fileName) override;
59 void toFile(const VisualisationEvent& event, Location& location) override;
61};
62
63} // namespace event_visualisation
64} // namespace o2
65
66#endif // O2EVE_VISUALISATIONEVENTJSONSERIALIZER_H
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
StringRef key
void toFile(const VisualisationEvent &event, Location &location) override
static int getIntOrDefault(rapidjson::Value &tree, const char *key, int defaultValue=0)
static std::string getStringOrDefault(rapidjson::Value &tree, const char *key, const char *defaultValue="")
static uint64_t getUIntOrDefault(rapidjson::Value &tree, const char *key, uint64_t defaultValue=0)
static float getFloatOrDefault(rapidjson::Value &tree, const char *key, float defaultValue=0.0f)
bool fromFile(VisualisationEvent &event, std::string fileName) override
struct _cl_event * event
Definition glcorearb.h:2982
GLint location
Definition glcorearb.h:800
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
nlohmann::json json
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))