|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// \file BaseDPLDigitizer.h |
| 12 | +/// \brief Definition of the base digitizer task class |
| 13 | + |
| 14 | +#ifndef ALICEO2_BASE_BASEDPLDIGITIZER_H_ |
| 15 | +#define ALICEO2_BASE_BASEDPLDIGITIZER_H_ |
| 16 | + |
| 17 | +#include <Framework/InitContext.h> |
| 18 | +#include "DetectorsBase/Propagator.h" |
| 19 | +#include "DataFormatsParameters/GRPObject.h" |
| 20 | +#include <cstdint> |
| 21 | + |
| 22 | +namespace o2 |
| 23 | +{ |
| 24 | +namespace base |
| 25 | +{ |
| 26 | + |
| 27 | +/// class listing possible services |
| 28 | +struct InitServices { |
| 29 | + using Type = std::uint32_t; |
| 30 | + static constexpr Type FIELD = 1 << 0; |
| 31 | + static constexpr Type GEOM = 1 << 1; |
| 32 | +}; |
| 33 | + |
| 34 | +/// Class trying to reduce boilerplate (initialization) work/code for |
| 35 | +/// digitizer tasks. In particular it will try to provide/initialize field and geometry |
| 36 | +/// when needed. Also providing some common data members. |
| 37 | +/// |
| 38 | +/// Deriving classes need to implement a function initDigitizerTask instead of just init. |
| 39 | +class BaseDPLDigitizer |
| 40 | +{ |
| 41 | + public: |
| 42 | + BaseDPLDigitizer() = default; |
| 43 | + virtual ~BaseDPLDigitizer() = default; |
| 44 | + |
| 45 | + /// a constructor accepting a service code encoding the asked |
| 46 | + /// services in bits. Example: |
| 47 | + /// BaseDPLDigitizer(InitServices::FIELD | InitServices::GEOM) |
| 48 | + BaseDPLDigitizer(InitServices::Type servicecode); |
| 49 | + |
| 50 | + virtual void init(o2::framework::InitContext&) final; |
| 51 | + |
| 52 | + virtual void initDigitizerTask(o2::framework::InitContext& ic) = 0; |
| 53 | + |
| 54 | + private: |
| 55 | + bool mNeedField = false; |
| 56 | + bool mNeedGeom = false; |
| 57 | +}; |
| 58 | + |
| 59 | +} // namespace base |
| 60 | +} // namespace o2 |
| 61 | + |
| 62 | +#endif |
0 commit comments