Project
Loading...
Searching...
No Matches
MCEventHeader.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
13
14#ifndef ALICEO2_DATAFORMATS_MCEVENTHEADER_H_
15#define ALICEO2_DATAFORMATS_MCEVENTHEADER_H_
16
17#include "FairMCEventHeader.h"
20#include <string>
21#include <Framework/Logger.h>
22
23namespace o2
24{
25namespace dataformats
26{
27
28class GeneratorHeader;
29
31struct MCInfoKeys {
34 static constexpr const char* impactParameter = "Bimpact";
35 static constexpr const char* nPart = "Npart";
36 static constexpr const char* nPartProjectile = "Npart_proj";
37 static constexpr const char* nPartTarget = "Npart_targ";
38 static constexpr const char* nColl = "Ncoll";
39 static constexpr const char* nCollHard = "Ncoll_hard";
40 static constexpr const char* nCollNNWounded = "NColl_NNw";
41 static constexpr const char* nCollNWoundedN = "NColl_NwN";
42 static constexpr const char* nCollNWoundedNwounded = "NColl_NwNW";
43 static constexpr const char* planeAngle = "eventPsi";
44 static constexpr const char* sigmaInelNN = "sigmaInelNN";
45 static constexpr const char* centrality = "centrality";
46 static constexpr const char* nSpecProjectileProton = "Nspec_proj_p";
47 static constexpr const char* nSpecProjectileNeutron = "Nspec_proj_n";
48 static constexpr const char* nSpecTargetProton = "Nspec_targ_p";
49 static constexpr const char* nSpecTargetNeutron = "Nspec_targ_n";
58 static constexpr const char* pdfParton1Id = "pdf_parton_1_id";
59 static constexpr const char* pdfParton2Id = "pdf_parton_2_id";
60 static constexpr const char* pdfX1 = "pdf_x1";
61 static constexpr const char* pdfX2 = "pdf_x2";
62 static constexpr const char* pdfScale = "pdf_scale";
63 static constexpr const char* pdfXF1 = "pdf_par_x1";
64 static constexpr const char* pdfXF2 = "pdf_par_x2";
65 static constexpr const char* pdfCode1 = "pdf_lhc_1_id";
66 static constexpr const char* pdfCode2 = "pdf_lhc_2_id";
76 static constexpr const char* acceptedEvents = "accepted_events";
77 static constexpr const char* attemptedEvents = "attempted_events";
78 static constexpr const char* xSection = "cross_section";
79 static constexpr const char* xSectionError = "cross_section_error";
83 static constexpr const char* generator = "generator";
84 static constexpr const char* generatorVersion = "version";
85 static constexpr const char* processName = "processName";
86 static constexpr const char* processCode = "processCode";
87 static constexpr const char* weight = "weight";
91 static constexpr const char* processID = "signal_process_id";
92 static constexpr const char* eventScale = "event_scale";
93 static constexpr const char* mpi = "mpi";
95};
96
97/*****************************************************************/
98/*****************************************************************/
99
100// AliceO2 specialization of EventHeader class
102{
103
104 public:
105 MCEventHeader() = default;
106 MCEventHeader(const MCEventHeader& rhs) = default;
107 MCEventHeader& operator=(const MCEventHeader& rhs) = default;
108 ~MCEventHeader() override = default;
109
111 void setEmbeddingFileName(std::string const& value) { mEmbeddingFileName = value; };
114
118 {
120 };
121
122 template <typename T>
123 void putInfo(std::string const& key, T const& value)
124 {
125 mEventInfo.put<T>(key, value);
126 };
127
128 bool hasInfo(std::string const& key) const
129 {
130 return mEventInfo.has(key);
131 }
132
133 template <typename T>
134 const T& getInfo(std::string const& key, bool& isvalid) const
135 {
137 auto& ref = mEventInfo.getRef<T>(key, state);
139 if (!isvalid) {
140 LOG(warning) << "problem retrieving info '" << key << "': " << o2::utils::RootSerializableKeyValueStore::getStateString(state);
141 }
142 return ref;
143 };
144
145 void print() const;
146
148 void printInfo() const
149 {
151 }
152
155 {
156 mEventInfo.copyFrom(other.mEventInfo);
157 }
158
160 virtual void Reset();
161
163
164 void setDetId2HitBitLUT(std::vector<int> const& v) { mDetId2HitBitIndex = v; }
165 std::vector<int> const& getDetId2HitBitLUT() const { return mDetId2HitBitIndex; }
166
168 static void extractFileFromKinematics(std::string_view kinefilename, std::string_view targetfilename);
169
170 protected:
173
174 // store a few global properties that this event
175 // had in the current simulation (which can be used quick filtering/searching)
177 std::vector<int> mDetId2HitBitIndex;
179
181
182};
184/*****************************************************************/
185/*****************************************************************/
186
187} /* namespace dataformats */
188} /* namespace o2 */
189
190#endif /* ALICEO2_DATAFORMATS_MCEVENTHEADER_H_ */
benchmark::State & state
StringRef key
void setEmbeddingEventIndex(Int_t value)
std::vector< int > const & getDetId2HitBitLUT() const
void setEmbeddingFileName(std::string const &value)
bool hasInfo(std::string const &key) const
~MCEventHeader() override=default
MCEventHeader(const MCEventHeader &rhs)=default
const T & getInfo(std::string const &key, bool &isvalid) const
void copyInfoFrom(MCEventHeader const &other)
inits info fields from another Event header
void putInfo(std::string const &key, T const &value)
void printInfo() const
prints a summary of info keys/types attached to this header
ClassDefOverride(MCEventHeader, 4)
std::vector< int > mDetId2HitBitIndex
o2::utils::RootSerializableKeyValueStore mEventInfo
MCEventHeader & operator=(const MCEventHeader &rhs)=default
void setDetId2HitBitLUT(std::vector< int > const &v)
static void extractFileFromKinematics(std::string_view kinefilename, std::string_view targetfilename)
create a standalone ROOT file/tree with only the MCHeader branch
const T & getRef(std::string const &key, GetState &state) const
void put(std::string const &key, T const &value)
static const char * getStateString(GetState state)
void copyFrom(RootSerializableKeyValueStore const &other)
resets store to the store of another object
void print(bool includetypeinfo=false) const
print list of keys, values (and optionally type information)
bool has(std::string const &key) const
checks if a key exists
const GLdouble * v
Definition glcorearb.h:832
GLuint GLuint GLfloat weight
Definition glcorearb.h:5477
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLint ref
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static constexpr const char * impactParameter
static constexpr const char * xSection
static constexpr const char * planeAngle
static constexpr const char * nPartTarget
static constexpr const char * nSpecTargetProton
static constexpr const char * pdfCode2
static constexpr const char * pdfScale
static constexpr const char * processName
static constexpr const char * pdfXF2
static constexpr const char * nSpecProjectileNeutron
static constexpr const char * sigmaInelNN
static constexpr const char * processID
static constexpr const char * nPart
static constexpr const char * attemptedEvents
static constexpr const char * nPartProjectile
static constexpr const char * processCode
static constexpr const char * nCollNWoundedNwounded
static constexpr const char * pdfX2
static constexpr const char * nSpecTargetNeutron
static constexpr const char * pdfParton1Id
static constexpr const char * pdfParton2Id
static constexpr const char * generatorVersion
static constexpr const char * xSectionError
static constexpr const char * nSpecProjectileProton
static constexpr const char * pdfCode1
static constexpr const char * acceptedEvents
static constexpr const char * centrality
static constexpr const char * nCollNNWounded
static constexpr const char * nColl
static constexpr const char * eventScale
static constexpr const char * pdfXF1
static constexpr const char * mpi
static constexpr const char * generator
static constexpr const char * nCollHard
static constexpr const char * pdfX1
static constexpr const char * nCollNWoundedN
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"