Project
Loading...
Searching...
No Matches
MagFieldParam.cxx
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#include "Field/MagFieldParam.h"
17#include "Field/MagneticField.h"
18#include "FairParamList.h"
19#include "FairRun.h"
20#include "FairRuntimeDb.h"
21
22using namespace o2::field;
23
24//========================================
26
27MagFieldParam::MagFieldParam(const char* name, const char* title, const char* context)
28 : FairParGenericSet(name, title, context), mMapType(k5kG), mBeamType(kNoBeamField), mDefaultIntegration(0), mFactorSol(0.), mFactorDip(0.), mBeamEnergy(0.), mMaxField(0.), mMapPath()
29{
31}
32
34{
36 // SetName(field->GetName()); ? is this needed
37 // SetTitle(field->GetTitle());
38 mMapType = field->getMapType();
39 mBeamType = field->getBeamType();
40 mDefaultIntegration = field->Integral();
41 mFactorSol = field->getFactorSolenoid();
42 mFactorDip = field->getFactorDipole();
43 mBeamEnergy = field->getBeamEnergy();
44 mMaxField = field->Max();
45 mMapPath = field->getDataFileName();
46 //
47}
48
49void MagFieldParam::putParams(FairParamList* list)
50{
52 if (!list) {
53 return;
54 }
55 list->add("Map Type ID", int(mMapType));
56 list->add("Beam Type ID", int(mBeamType));
57 list->add("Integral Type", mDefaultIntegration);
58 list->add("Fact.Solenoid", mFactorSol);
59 list->add("Fact.Dipole ", mFactorDip);
60 list->add("Beam Energy ", mBeamEnergy);
61 list->add("Max. Field ", mMaxField);
62 list->add("Path to map ", mMapPath.Data());
63 //
64}
65
66Bool_t MagFieldParam::getParams(FairParamList* list)
67{
69 int int2enum = 0;
70 if (!list->fill("Map Type ID", &int2enum)) {
71 return kFALSE;
72 }
73 mMapType = static_cast<BMap_t>(int2enum);
74 if (!list->fill("Beam Type ID", &int2enum)) {
75 return kFALSE;
76 }
77 mBeamType = static_cast<BeamType_t>(int2enum);
78 //
79 if (!list->fill("Integral Type", &mDefaultIntegration)) {
80 return kFALSE;
81 }
82 if (!list->fill("Fact.Solenoid", &mFactorSol)) {
83 return kFALSE;
84 }
85 if (!list->fill("Fact.Dipole ", &mFactorDip)) {
86 return kFALSE;
87 }
88 if (!list->fill("Beam Energy ", &mBeamEnergy)) {
89 return kFALSE;
90 }
91 if (!list->fill("Max. Field ", &mMaxField)) {
92 return kFALSE;
93 }
94 FairParamObj* parpath = list->find("Path to map ");
95 if (!parpath) {
96 return kFALSE;
97 }
98 int lgt = parpath->getLength();
99 // RS: is there a bug in FairParamList::fill(const Text_t* name,Text_t* value,const Int_t length)?
100 // I think the "if (l<length-1)" should be "if (l<length)"
101 char cbuff[lgt + 2];
102 memset(cbuff, 0, sizeof(char) * (lgt + 2));
103 if (!list->fill("Path to map ", cbuff, lgt + 2)) {
104 return kFALSE;
105 }
106 mMapPath = cbuff;
107 return kTRUE;
108}
ClassImp(MagFieldParam)
Definition of the MagFieldParam: container for ALICE mag. field parameters.
Definition of the MagF class.
MagFieldParam(const char *name="", const char *title="", const char *context="")
void putParams(FairParamList *list) override
Bool_t getParams(FairParamList *list) override
void SetParam(const MagneticField *field)
Double_t getFactorDipole() const
Return the sign*scale of the current in the Dipole according to sPolarityConventionthe.
Char_t * getDataFileName() const
Double_t getBeamEnergy() const
Double_t getFactorSolenoid() const
Returns the sign*scale of the current in the Dipole according to sPolarityConventionthe.
MagFieldParam::BeamType_t getBeamType() const
MagFieldParam::BMap_t getMapType() const
GLuint const GLchar * name
Definition glcorearb.h:781
Definition list.h:40