Project
Loading...
Searching...
No Matches
DigitReaderSpec.h
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
14#ifndef O2_ITSMFT_DIGITREADER
15#define O2_ITSMFT_DIGITREADER
16
17#include "TFile.h"
18#include "TTree.h"
24#include "Framework/Task.h"
25#include "Headers/DataHeader.h"
30
31using namespace o2::framework;
32
33namespace o2
34{
35namespace itsmft
36{
37
38template <int N>
39class DigitReader : public Task
40{
41 public:
46
47 DigitReader() = delete;
48 DigitReader(bool useMC, bool useCalib, bool triggerOut);
49 ~DigitReader() override = default;
50 void init(InitContext& ic) final;
51 void run(ProcessingContext& pc) final;
52
53 protected:
54 void connectTree(const std::string& filename);
55 template <typename Ptr>
56 void setBranchAddress(const std::string& base, Ptr& addr, int layer = -1);
57 std::string getBranchName(const std::string& base, int index);
58
59 std::array<std::vector<o2::itsmft::Digit>*, NLayers> mDigits;
60 std::vector<o2::itsmft::GBTCalibData> mCalib, *mCalibPtr = &mCalib;
61 std::array<std::vector<o2::itsmft::ROFRecord>*, NLayers> mDigROFRec;
62 std::array<std::vector<o2::itsmft::MC2ROFRecord>*, NLayers> mDigMC2ROFs;
63 std::array<o2::dataformats::ConstMCTruthContainer<o2::MCCompLabel>, NLayers> mConstLabels;
64 std::array<o2::dataformats::IOMCTruthContainerView*, NLayers> mPLabels;
65
66 std::unique_ptr<TFile> mFile;
67 std::unique_ptr<TTree> mTree;
68 bool mUseMC = true; // use MC truth
69 bool mUseCalib = true; // send calib data
70 bool mTriggerOut = true; // send dummy triggers vector
71 bool mUseIRFrames = false; // selected IRFrames modes
72 int mROFBiasInBC = 0;
74 int mNRUs = 0;
75 std::string mDetName;
76 std::string mDetNameLC;
77 std::string mFileName;
78 std::string mDigTreeName = "o2sim";
79 std::string mDigitBranchName = "Digit";
80 std::string mDigitROFBranchName = "DigitROF";
81 std::string mCalibBranchName = "Calib";
82
83 std::string mDigitMCTruthBranchName = "DigitMCTruth";
84 std::string mDigitMC2ROFBranchName = "DigitMC2ROF";
85};
86
87class ITSDigitReader : public DigitReader<o2::detectors::DetID::ITS>
88{
89 public:
90 ITSDigitReader(bool useMC = true, bool useCalib = false, bool useTriggers = true)
91 : DigitReader<o2::detectors::DetID::ITS>(useMC, useCalib, useTriggers) {}
92};
93
94class MFTDigitReader : public DigitReader<o2::detectors::DetID::MFT>
95{
96 public:
97 MFTDigitReader(bool useMC = true, bool useCalib = false, bool useTriggers = true)
98 : DigitReader<o2::detectors::DetID::MFT>(useMC, useCalib, useTriggers) {}
99};
100
103framework::DataProcessorSpec getITSDigitReaderSpec(bool useMC = true, bool useCalib = false, bool useTriggers = true, std::string defname = "o2_itsdigits.root");
104framework::DataProcessorSpec getMFTDigitReaderSpec(bool useMC = true, bool useCalib = false, bool useTriggers = true, std::string defname = "o2_mftdigits.root");
105
106} // namespace itsmft
107} // namespace o2
108
109#endif /* O2_ITSMFT_DigitREADER */
A const (ready only) version of MCTruthContainer.
Definition of the ITSMFT digit.
Calibration data from GBT data.
A special IO container - splitting a given vector to enable ROOT IO.
Definition of the ITSMFT ROFrame (trigger) record.
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr ID ITS
Definition DetID.h:63
static constexpr ID MFT
Definition DetID.h:71
void setBranchAddress(const std::string &base, Ptr &addr, int layer=-1)
std::vector< o2::itsmft::GBTCalibData > * mCalibPtr
std::string getBranchName(const std::string &base, int index)
std::array< std::vector< o2::itsmft::ROFRecord > *, NLayers > mDigROFRec
static constexpr int NLayers
void run(ProcessingContext &pc) final
std::array< o2::dataformats::IOMCTruthContainerView *, NLayers > mPLabels
void init(InitContext &ic) final
void connectTree(const std::string &filename)
std::unique_ptr< TTree > mTree
std::vector< o2::itsmft::GBTCalibData > mCalib
std::string mDigitMCTruthBranchName
static constexpr int RLayers
static constexpr o2::header::DataOrigin Origin
std::array< std::vector< o2::itsmft::Digit > *, NLayers > mDigits
std::array< o2::dataformats::ConstMCTruthContainer< o2::MCCompLabel >, NLayers > mConstLabels
std::array< std::vector< o2::itsmft::MC2ROFRecord > *, NLayers > mDigMC2ROFs
std::string mDigitMC2ROFBranchName
static constexpr o2::detectors::DetID ID
~DigitReader() override=default
std::unique_ptr< TFile > mFile
ITSDigitReader(bool useMC=true, bool useCalib=false, bool useTriggers=true)
MFTDigitReader(bool useMC=true, bool useCalib=false, bool useTriggers=true)
GLuint index
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
constexpr o2::header::DataOrigin gDataOriginMFT
Definition DataHeader.h:572
constexpr o2::header::DataOrigin gDataOriginITS
Definition DataHeader.h:570
Defining PrimaryVertex explicitly as messageable.
framework::DataProcessorSpec getITSDigitReaderSpec(bool useMC=true, bool useCalib=false, bool useTriggers=true, std::string defname="o2_itsdigits.root")
framework::DataProcessorSpec getMFTDigitReaderSpec(bool useMC=true, bool useCalib=false, bool useTriggers=true, std::string defname="o2_mftdigits.root")
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
static constexpr int getNLayers()
static constexpr bool supportsStaggering() noexcept