Project
Loading...
Searching...
No Matches
GRPMagField.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
15
16#ifndef ALICEO2_DATA_GRPMAGFIELDOBJECT_H_
17#define ALICEO2_DATA_GRPMAGFIELDOBJECT_H_
18
19#include <Rtypes.h>
20#include "CommonTypes/Units.h"
21
22namespace o2
23{
24namespace parameters
25{
26/*
27 * Collects parameters describing the run that are related to the B field only.
28*/
29
31{
32 public:
33 GRPMagField() = default;
34 ~GRPMagField() = default;
35
37 o2::units::Current_t getL3Current() const
38 {
39 static float v = checkL3Override();
40 return v == NOOVERRIDEVAL ? mL3Current : v;
41 }
42
43 o2::units::Current_t getDipoleCurrent() const
44 {
45 static float v = checkDipoleOverride();
46 return v == NOOVERRIDEVAL ? mDipoleCurrent : v;
47 }
48
49 bool getFieldUniformity() const { return mUniformField; }
50 int8_t getNominalL3Field();
51 void setL3Current(o2::units::Current_t v) { mL3Current = v; }
52 void setDipoleCurrent(o2::units::Current_t v) { mDipoleCurrent = v; }
53 void setFieldUniformity(bool v) { mUniformField = v; }
54
56 void print() const;
57
58 static GRPMagField* loadFrom(const std::string& grpMagFieldFileName = "");
59
60 private:
61 o2::units::Current_t mL3Current = 0.f;
62 o2::units::Current_t mDipoleCurrent = 0.f;
63 bool mUniformField = false;
64 int8_t mNominalL3Field = 0;
65 bool mNominalL3FieldValid = false;
66
67 static constexpr float NOOVERRIDEVAL = 1e99;
68 static float checkL3Override();
69 static float checkDipoleOverride();
70
71 ClassDefNV(GRPMagField, 2);
72};
73
75{
76 // compute nominal L3 field in kG
77
78 if (mNominalL3FieldValid == false) {
79 mNominalL3Field = std::lround(5.f * getL3Current() / 30000.f);
80 mNominalL3FieldValid = true;
81 }
82 return mNominalL3Field;
83}
84
85} // namespace parameters
86} // namespace o2
87
88#endif
Header to collect definitions for different units.
o2::units::Current_t getDipoleCurrent() const
Definition GRPMagField.h:43
bool getFieldUniformity() const
Definition GRPMagField.h:49
o2::units::Current_t getL3Current() const
getters/setters for magnets currents
Definition GRPMagField.h:37
static GRPMagField * loadFrom(const std::string &grpMagFieldFileName="")
void setDipoleCurrent(o2::units::Current_t v)
Definition GRPMagField.h:52
void print() const
print itself
void setL3Current(o2::units::Current_t v)
Definition GRPMagField.h:51
void setFieldUniformity(bool v)
Definition GRPMagField.h:53
const GLdouble * v
Definition glcorearb.h:832
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...