Skip to content

Commit 795c737

Browse files
Merge pull request #7287 from chiarazampolli/GRPECS
Splitting of GRP object
1 parent 731efaf commit 795c737

19 files changed

Lines changed: 803 additions & 132 deletions

File tree

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/NameConf.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class NameConf : public o2::conf::ConfigurableParamHelper<NameConf>
4949
// Filename of general run parameters (GRP)
5050
static std::string getGRPFileName(const std::string_view prefix = STANDARDSIMPREFIX);
5151

52+
// Filename of general run parameters from ECS (GRPECS)
53+
static std::string getGRPECSFileName(const std::string_view prefix = STANDARDSIMPREFIX);
54+
55+
// Filename of general run parameters fof B field (GRPMagField)
56+
static std::string getGRPMagFieldFileName(const std::string_view prefix = STANDARDSIMPREFIX);
57+
5258
// Filename to store kinematics + TrackRefs
5359
static std::string getMCKinematicsFileName(const std::string_view prefix = STANDARDSIMPREFIX)
5460
{
@@ -126,6 +132,8 @@ class NameConf : public o2::conf::ConfigurableParamHelper<NameConf>
126132
static constexpr std::string_view HITS_STRING = "Hits"; // hardcoded
127133
static constexpr std::string_view DIGITS_STRING = "Digits"; // hardcoded
128134
static constexpr std::string_view GRP_STRING = "grp"; // hardcoded
135+
static constexpr std::string_view GRPECS_STRING = "grpecs"; // hardcoded
136+
static constexpr std::string_view GRPMAGFIELD_STRING = "grpMagField"; // hardcoded
129137
static constexpr std::string_view KINE_STRING = "Kine"; // hardcoded
130138
static constexpr std::string_view MCHEADER_STRING = "MCHeader"; // hardcoded
131139
static constexpr std::string_view GEOM_FILE_STRING = "geometry";
@@ -142,6 +150,8 @@ class NameConf : public o2::conf::ConfigurableParamHelper<NameConf>
142150

143151
// these are configurable paths for some commonly used files
144152
std::string mDirGRP = "none"; // directory for GRP file ("none" == "")
153+
std::string mDirGRPECS = "none"; // directory for GRPECS file ("none" == "")
154+
std::string mDirGRPMagField = "none"; // directory for GRPMagField file ("none" == "")
145155
std::string mDirGeom = "none"; // directory for geometry file
146156
std::string mDirMatLUT = "none"; // directory for material LUT
147157
std::string mDirCollContext = "none"; // directory for collision context

DataFormats/Detectors/Common/src/NameConf.cxx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ std::string NameConf::getGRPFileName(const std::string_view prefix)
5555
return buildFileName(prefix, "_", STANDARDSIMPREFIX, GRP_STRING, ROOT_EXT_STRING, Instance().mDirGRP);
5656
}
5757

58+
// Filename to store general run parameters from ECS (GRPECS)
59+
std::string NameConf::getGRPECSFileName(const std::string_view prefix)
60+
{
61+
return buildFileName(prefix, "_", STANDARDSIMPREFIX, GRPECS_STRING, ROOT_EXT_STRING, Instance().mDirGRPECS);
62+
}
63+
64+
// Filename to store general run parameters from ECS (GRPECS)
65+
std::string NameConf::getGRPMagFieldFileName(const std::string_view prefix)
66+
{
67+
return buildFileName(prefix, "_", STANDARDSIMPREFIX, GRPMAGFIELD_STRING, ROOT_EXT_STRING, Instance().mDirGRPMagField);
68+
}
69+
5870
// Filename to store simulation cuts/process summary
5971
std::string NameConf::getCutProcFileName(std::string_view prefix)
6072
{

DataFormats/Parameters/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111

1212
o2_add_library(DataFormatsParameters
1313
SOURCES src/GRPObject.cxx
14-
src/LHCIFData.cxx
14+
src/GRPLHCIFData.cxx
15+
src/GRPECSObject.cxx
16+
src/GRPMagField.cxx
1517
PUBLIC_LINK_LIBRARIES FairRoot::Base O2::CommonConstants
1618
O2::CommonTypes
1719
O2::DetectorsCommonDataFormats)
1820

1921
o2_target_root_dictionary(DataFormatsParameters
2022
HEADERS include/DataFormatsParameters/GRPObject.h
21-
include/DataFormatsParameters/LHCIFData.h
23+
include/DataFormatsParameters/GRPLHCIFData.h
24+
include/DataFormatsParameters/GRPECSObject.h
25+
include/DataFormatsParameters/GRPMagField.h
2226
LINKDEF src/ParametersDataLinkDef.h)
2327

2428

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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 GRPECSObject.h
13+
/// \brief Header of the General Run Parameters object
14+
/// \author ruben.shahoyan@cern.ch
15+
16+
#ifndef ALICEO2_DATA_GRPECSOBJECT_H_
17+
#define ALICEO2_DATA_GRPECSOBJECT_H_
18+
19+
#include <Rtypes.h>
20+
#include <cstdint>
21+
#include <ctime>
22+
#include "DetectorsCommonDataFormats/DetID.h"
23+
24+
namespace o2
25+
{
26+
namespace parameters
27+
{
28+
/*
29+
* Collects parameters describing the run that come from ECS only.
30+
*/
31+
32+
class GRPECSObject
33+
{
34+
using DetID = o2::detectors::DetID;
35+
36+
public:
37+
using timePoint = std::time_t;
38+
39+
enum ROMode : int { ABSENT = 0,
40+
PRESENT = 0x1,
41+
CONTINUOUS = PRESENT + (0x1 << 1),
42+
TRIGGERING = PRESENT + (0x1 << 2) };
43+
44+
GRPECSObject() = default;
45+
~GRPECSObject() = default;
46+
47+
/// getters/setters for Start and Stop times according to logbook
48+
timePoint getTimeStart() const { return mTimeStart; }
49+
void setTimeStart(timePoint t) { mTimeStart = t; }
50+
51+
void setNHBFPerTF(uint32_t n) { mNHBFPerTF = n; }
52+
uint32_t getNHBFPerTF() const { return mNHBFPerTF; }
53+
54+
/// getter/setter for data taking period name
55+
const std::string& getDataPeriod() const { return mDataPeriod; }
56+
void setDataPeriod(const std::string v) { mDataPeriod = v; }
57+
// getter/setter for run identifier
58+
void setRun(int r) { mRun = r; }
59+
int getRun() const { return mRun; }
60+
/// getter/setter for masks of detectors in the readout
61+
DetID::mask_t getDetsReadOut() const { return mDetsReadout; }
62+
void setDetsReadOut(DetID::mask_t mask) { mDetsReadout = mask; }
63+
/// getter/setter for masks of detectors with continuos readout
64+
DetID::mask_t getDetsContinuousReadOut() const { return mDetsContinuousRO; }
65+
void setDetsContinuousReadOut(DetID::mask_t mask) { mDetsContinuousRO = mask; }
66+
/// getter/setter for masks of detectors providing the trigger
67+
DetID::mask_t getDetsTrigger() const { return mDetsTrigger; }
68+
void setDetsTrigger(DetID::mask_t mask) { mDetsTrigger = mask; }
69+
/// add specific detector to the list of readout detectors
70+
void addDetReadOut(DetID id) { mDetsReadout |= id.getMask(); }
71+
/// remove specific detector from the list of readout detectors
72+
void remDetReadOut(DetID id)
73+
{
74+
mDetsReadout &= ~id.getMask();
75+
remDetContinuousReadOut(id);
76+
remDetTrigger(id);
77+
}
78+
/// add specific detector to the list of continuously readout detectors
79+
void addDetContinuousReadOut(DetID id) { mDetsContinuousRO |= id.getMask(); }
80+
/// remove specific detector from the list of continuouslt readout detectors
81+
void remDetContinuousReadOut(DetID id) { mDetsContinuousRO &= ~id.getMask(); }
82+
/// add specific detector to the list of triggering detectors
83+
void addDetTrigger(DetID id) { mDetsTrigger |= id.getMask(); }
84+
/// remove specific detector from the list of triggering detectors
85+
void remDetTrigger(DetID id) { mDetsTrigger &= ~id.getMask(); }
86+
/// test if detector is read out
87+
bool isDetReadOut(DetID id) const { return (mDetsReadout & id.getMask()) != 0; }
88+
/// test if detector is read out
89+
bool isDetContinuousReadOut(DetID id) const { return (mDetsContinuousRO & id.getMask()) != 0; }
90+
/// test if detector is triggering
91+
bool isDetTriggers(DetID id) const { return (mDetsTrigger & id.getMask()) != 0; }
92+
/// set detector readout mode status
93+
void setDetROMode(DetID id, ROMode status);
94+
ROMode getDetROMode(DetID id) const;
95+
96+
/// extra selections
97+
/// mask of readout detectors with addition selections. "only" overrides "skip"
98+
DetID::mask_t getDetsReadOut(DetID::mask_t only, DetID::mask_t skip = 0) const { return only.any() ? (mDetsReadout & only) : (mDetsReadout ^ skip); }
99+
/// same with comma-separate list of detector names
100+
DetID::mask_t getDetsReadOut(const std::string& only, const std::string& skip = "") const { return getDetsReadOut(DetID::getMask(only), DetID::getMask(skip)); }
101+
102+
/// print itself
103+
void print() const;
104+
105+
static GRPECSObject* loadFrom(const std::string& grpecsFileName = "", const std::string& grpecsName = "GRPECS");
106+
107+
private:
108+
timePoint mTimeStart = 0; ///< DAQ_time_start entry from DAQ logbook
109+
110+
uint32_t mNHBFPerTF = 128; /// Number of HBFrames per TF
111+
112+
DetID::mask_t mDetsReadout; ///< mask of detectors which are read out
113+
DetID::mask_t mDetsContinuousRO; ///< mask of detectors read out in continuos mode
114+
DetID::mask_t mDetsTrigger; ///< mask of detectors which provide trigger
115+
116+
int mRun = 0; ///< run identifier
117+
std::string mDataPeriod = ""; ///< name of the period
118+
119+
ClassDefNV(GRPECSObject, 1);
120+
};
121+
122+
} // namespace parameters
123+
} // namespace o2
124+
125+
#endif
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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 GRPLHCIFData.h
13+
/// \brief container for the LHC InterFace data
14+
15+
#ifndef O2_GRP_LHCIFDATA_H
16+
#define O2_GRP_LHCIFDATA_H
17+
18+
#include <Rtypes.h>
19+
#include <string>
20+
#include <unordered_map>
21+
#include <cstdint>
22+
#include "CommonTypes/Units.h"
23+
#include "CommonConstants/LHCConstants.h"
24+
#include "CommonDataFormat/BunchFilling.h"
25+
26+
namespace o2
27+
{
28+
namespace parameters
29+
{
30+
31+
class GRPLHCIFData
32+
{
33+
34+
using beamDirection = o2::constants::lhc::BeamDirection;
35+
36+
public:
37+
GRPLHCIFData() = default;
38+
~GRPLHCIFData() = default;
39+
40+
static const std::unordered_map<unsigned int, unsigned int> mZtoA;
41+
42+
std::pair<long, int32_t> getBeamEnergyPerZWithTime() const { return mBeamEnergyPerZ; }
43+
int32_t getBeamEnergyPerZ() const { return mBeamEnergyPerZ.second; }
44+
long getBeamEnergyPerZTime() const { return mBeamEnergyPerZ.first; }
45+
void setBeamEnergyPerZWithTime(std::pair<long, int32_t> p) { mBeamEnergyPerZ = p; }
46+
void setBeamEnergyPerZWithTime(long t, int32_t v) { mBeamEnergyPerZ = std::make_pair(t, v); }
47+
48+
std::pair<long, int32_t> getFillNumberWithTime() const { return mFillNumber; }
49+
int32_t getFillNumber() const { return mFillNumber.second; }
50+
long getFillNumberTime() const { return mFillNumber.first; }
51+
void setFillNumberWithTime(std::pair<long, int32_t> p) { mFillNumber = p; }
52+
void setFillNumberWithTime(long t, int32_t v) { mFillNumber = std::make_pair(t, v); }
53+
54+
std::pair<long, std::string> getInjectionSchemeWithTime() const { return mInjectionScheme; }
55+
std::string getInjectionScheme() const { return mInjectionScheme.second; }
56+
long getInjectionSchemeTime() const { return mInjectionScheme.first; }
57+
void setInjectionSchemeWithTime(std::pair<long, std::string> p) { mInjectionScheme = p; }
58+
void setInjectionSchemeWithTime(long t, std::string v) { mInjectionScheme = std::make_pair(t, v); }
59+
60+
std::pair<long, int32_t> getAtomicNumberB1WithTime() const { return mAtomicNumberB1; }
61+
int32_t getAtomicNumberB1() const { return mAtomicNumberB1.second; }
62+
long getAtomicNumberB1Time() const { return mAtomicNumberB1.first; }
63+
void setAtomicNumberB1WithTime(std::pair<long, int32_t> p) { mAtomicNumberB1 = p; }
64+
void setAtomicNumberB1WithTime(long t, int32_t v) { mAtomicNumberB1 = std::make_pair(t, v); }
65+
66+
std::pair<long, int32_t> getAtomicNumberB2WithTime() const { return mAtomicNumberB2; }
67+
int32_t getAtomicNumberB2() const { return mAtomicNumberB2.second; }
68+
long getAtomicNumberB2Time() const { return mAtomicNumberB2.first; }
69+
void setAtomicNumberB2WithTime(std::pair<long, int32_t> p) { mAtomicNumberB2 = p; }
70+
void setAtomicNumberB2WithTime(long t, int32_t v) { mAtomicNumberB2 = std::make_pair(t, v); }
71+
72+
std::pair<long, o2::units::AngleRad_t> getCrossingAngleWithTime() const { return mCrossingAngle; }
73+
o2::units::AngleRad_t getCrossingAngle() const { return mCrossingAngle.second; }
74+
long getCrossingAngleTime() const { return mCrossingAngle.first; }
75+
void setCrossingAngleWithTime(std::pair<long, o2::units::AngleRad_t> p) { mCrossingAngle = p; }
76+
void setCrossingAngleWithTime(long t, o2::units::AngleRad_t v) { mCrossingAngle = std::make_pair(t, v); }
77+
78+
std::pair<long, o2::BunchFilling> getBunchFillingWithTime() const { return mBunchFilling; }
79+
o2::BunchFilling getBunchFilling() const { return mBunchFilling.second; }
80+
long getBunchFillingTime() const { return mBunchFilling.first; }
81+
void setBunchFillingWithTime(std::pair<long, o2::BunchFilling> p) { mBunchFilling = p; }
82+
void setBunchFillingWithTime(long t, o2::BunchFilling v) { mBunchFilling = std::make_pair(t, v); }
83+
84+
/// getters/setters for given beam A and Z info, encoded as A<<16+Z
85+
int getBeamZ(beamDirection beam) const { return mBeamAZ[static_cast<int>(beam)] & 0xffff; }
86+
int getBeamA(beamDirection beam) const { return mBeamAZ[static_cast<int>(beam)] >> 16; }
87+
float getBeamZoverA(beamDirection beam) const;
88+
void setBeamAZ(int a, int z, beamDirection beam) { mBeamAZ[static_cast<int>(beam)] = (a << 16) + z; }
89+
void setBeamAZ(beamDirection beam);
90+
void setBeamAZ();
91+
/// getters/setters for beam energy per charge and per nucleon
92+
float getBeamEnergyPerNucleon(beamDirection beam) const { return mBeamEnergyPerZ.second * getBeamZoverA(beam); }
93+
/// calculate center of mass energy per nucleon collision
94+
float getSqrtS() const;
95+
/// helper function for BunchFilling
96+
void translateBucketsToBCNumbers(std::vector<int32_t>& bcNb, std::vector<int32_t>& buckets, int beam);
97+
98+
private:
99+
std::pair<long, int32_t> mBeamEnergyPerZ; // beam energy per charge
100+
std::pair<long, int32_t> mFillNumber;
101+
std::pair<long, std::string> mInjectionScheme;
102+
std::pair<long, int32_t> mAtomicNumberB1; // clockwise
103+
std::pair<long, int32_t> mAtomicNumberB2; // anticlockwise
104+
std::pair<long, o2::units::AngleRad_t> mCrossingAngle;
105+
int mBeamAZ[beamDirection::NBeamDirections] = {0, 0}; ///< A<<16+Z for each beam
106+
std::pair<long, o2::BunchFilling> mBunchFilling; ///To hold bunch filling information
107+
108+
ClassDefNV(GRPLHCIFData, 1);
109+
};
110+
111+
//______________________________________________
112+
inline float GRPLHCIFData::getBeamZoverA(beamDirection b) const
113+
{
114+
// Z/A of beam 0 or 1
115+
int a = getBeamA(b);
116+
return a ? getBeamZ(b) / static_cast<float>(a) : 0.f;
117+
}
118+
119+
} // namespace parameters
120+
} // namespace o2
121+
#endif
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 GRPMagField.h
13+
/// \brief Header of the General Run Parameters object for B field values
14+
/// \author ruben.shahoyan@cern.ch
15+
16+
#ifndef ALICEO2_DATA_GRPMAGFIELDOBJECT_H_
17+
#define ALICEO2_DATA_GRPMAGFIELDOBJECT_H_
18+
19+
#include <Rtypes.h>
20+
#include <cstdint>
21+
#include "CommonTypes/Units.h"
22+
23+
namespace o2
24+
{
25+
namespace parameters
26+
{
27+
/*
28+
* Collects parameters describing the run that are related to the B field only.
29+
*/
30+
31+
class GRPMagField
32+
{
33+
public:
34+
GRPMagField() = default;
35+
~GRPMagField() = default;
36+
37+
/// getters/setters for magnets currents
38+
o2::units::Current_t getL3Current() const { return mL3Current; }
39+
o2::units::Current_t getDipoleCurrent() const { return mDipoleCurrent; }
40+
bool getFieldUniformity() const { return mUniformField; }
41+
void setL3Current(o2::units::Current_t v) { mL3Current = v; }
42+
void setDipoleCurrent(o2::units::Current_t v) { mDipoleCurrent = v; }
43+
void setFieldUniformity(bool v) { mUniformField = v; }
44+
45+
/// print itself
46+
void print() const { printf("magnet currents (A) L3 = %.3f, Dipole = %.f; uniformity = %s\n", getL3Current(), getDipoleCurrent(), mUniformField ? "true" : "false"); }
47+
48+
static GRPMagField* loadFrom(const std::string& grpMagFieldFileName = "", const std::string& grpMagFieldName = "GRPMAGFIELD");
49+
50+
private:
51+
o2::units::Current_t mL3Current = 0.f; ///< signed current in L3
52+
o2::units::Current_t mDipoleCurrent = 0.f; ///< signed current in Dipole
53+
bool mUniformField = false; ///< uniformity of magnetic field
54+
55+
ClassDefNV(GRPMagField, 1);
56+
};
57+
58+
} // namespace parameters
59+
} // namespace o2
60+
61+
#endif

0 commit comments

Comments
 (0)