Project
Loading...
Searching...
No Matches
BaseDPLDigitizer.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
17#include <fairlogger/Logger.h>
18#include <TGeoGlobalMagField.h>
19#include <TRandom.h>
20
21using namespace o2::base;
22
24{
25 mNeedGeom = servicecode & InitServices::GEOM;
26 mNeedField = servicecode & InitServices::FIELD;
27}
28
30{
31 // init basic stuff when this was asked for
32 if (mNeedGeom) {
33 LOG(info) << "Initializing geometry service";
34 if (!gGeoManager) {
35 o2::base::GeometryManager::loadGeometry(o2::conf::DigiParams::Instance().digitizationgeometry_prefix, true, true /* read from existing aligned file */);
36 }
37 }
38
39 if (mNeedField) {
40 if (TGeoGlobalMagField::Instance()->GetField() == nullptr) {
41 LOG(info) << "Initializing field service";
42 // load from GRP
44 if (inputGRP.empty()) {
45 LOG(error) << "GRP filename not initialized in DigiParams";
46 }
47 auto grp = o2::parameters::GRPObject::loadFrom(inputGRP);
48 if (!grp) {
49 LOG(error) << "This workflow needs a valid GRP file to start";
50 }
51 // init magnetic field
53 } else {
54 LOG(info) << "Field exists; Not reinitializing";
55 }
56 }
57
58 // initialize the global ROOT random number generator (needed or not)
59 LOG(info) << "Initializing ROOT digitizer random with seed " << o2::conf::DigiParams::Instance().seed;
60 gRandom->SetSeed(o2::conf::DigiParams::Instance().seed);
61
62 // finally call specific init
63 this->initDigitizerTask(ic);
64}
Definition of the base digitizer task class.
Definition of the GeometryManager class.
Header of the General Run Parameters object.
virtual void init(o2::framework::InitContext &) final
virtual void initDigitizerTask(o2::framework::InitContext &ic)=0
static void loadGeometry(std::string_view geomFilePath="", bool applyMisalignment=false, bool preferAlignedFile=true)
static int initFieldFromGRP(const o2::parameters::GRPMagField *grp, bool verbose=false)
static GRPObject * loadFrom(const std::string &grpFileName="")
static constexpr Type FIELD
static constexpr Type GEOM
std::string grpfile
Definition DigiParams.h:31
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"