|
| 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 | +#include "ALICE3GlobalReconstructionWorkflow/MagneticFieldHelper.h" |
| 13 | + |
| 14 | +#include "DetectorsBase/Propagator.h" |
| 15 | +#include "Field/MagFieldParam.h" |
| 16 | +#include "Field/MagneticField.h" |
| 17 | +#include "Framework/Logger.h" |
| 18 | + |
| 19 | +#include <TGeoGlobalMagField.h> |
| 20 | + |
| 21 | +namespace o2::trk |
| 22 | +{ |
| 23 | + |
| 24 | +void ensureAlice3Field(float bz) |
| 25 | +{ |
| 26 | + auto* globalField = TGeoGlobalMagField::Instance(); |
| 27 | + if (globalField->GetField() == nullptr) { |
| 28 | + auto* field = new o2::field::MagneticField("ALICE3Mag", "ALICE 3 Magnetic Field", bz / 5.f, 0.0, o2::field::MagFieldParam::k5kGUniform); |
| 29 | + globalField->SetField(field); |
| 30 | + globalField->Lock(); |
| 31 | + LOGP(info, "Installed ALICE3 magnetic field with Bz={} kG", bz); |
| 32 | + } |
| 33 | + auto* propagator = o2::base::Propagator::Instance(false); |
| 34 | + propagator->updateField(); |
| 35 | + propagator->setNominalBz(bz); |
| 36 | +} |
| 37 | + |
| 38 | +} // namespace o2::trk |
0 commit comments