Project
Loading...
Searching...
No Matches
SimFieldUtils.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
13#include <Field/MagneticField.h>
15#include <SimConfig/SimConfig.h>
18
19using namespace o2::base;
20
22{
23 if (getenv("ALICE3_SIM_FIELD")) {
25 }
26
27 auto& confref = o2::conf::SimConfig::Instance();
28 // a) take field from CDDB
29 const auto fieldmode = confref.getConfigData().mFieldMode;
30 o2::field::MagneticField* field = nullptr;
31 if (fieldmode == o2::conf::SimFieldMode::kCCDB) {
32 LOG(info) << "Fetching magnetic field from CCDB";
34 auto grpmagfield = ccdb.get<o2::parameters::GRPMagField>("GLO/Config/GRPMagField");
35 // TODO: clarify if we need to pass other params such as beam energy/type etc.
36 field = o2::field::MagneticField::createFieldMap(grpmagfield->getL3Current(), grpmagfield->getDipoleCurrent(), grpmagfield->getFieldUniformity());
37 }
38 // b) using the given values on the command line
39 else {
40 field = o2::field::MagneticField::createNominalField(confref.getConfigData().mField, confref.getConfigData().mFieldMode == o2::conf::SimFieldMode::kUniform);
41 }
42 return field;
43}
A simple magnetic field class for ALICE3 R&D.
Header of the General Run Parameters object for B field values.
Definition of the MagF class.
Methods to create simulation mag field.
static FairField *const createMagField()
static BasicCCDBManager & instance()
static SimConfig & Instance()
Definition SimConfig.h:111
static MagneticField * createFieldMap(float l3Current=-30000., float diCurrent=-6000., Int_t convention=0, Bool_t uniform=kFALSE, float beamenergy=7000, const Char_t *btype="pp", const std::string path=std::string(gSystem->Getenv("VMCWORKDIR"))+std::string("/Common/maps/mfchebKGI_sym.root"))
static MagneticField * createNominalField(int fld, bool uniform=false)
create field from rounded value, i.e. +-5 or +-2 kGauss
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"