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_ITS3_DIGITREADER
15#define O2_ITS3_DIGITREADER
16
17#include <array>
18
19#include <TFile.h>
20#include <TTree.h>
21
25#include "Framework/Task.h"
30
31using namespace o2::framework;
32
33namespace o2::its3
34{
35
36class ITS3DigitReader final : public Task
37{
38 public:
39 static constexpr int NLayers = 7;
40
41 ITS3DigitReader(bool useMC, bool doStag, bool useCalib);
42 ~ITS3DigitReader() override = default;
43 void init(InitContext& ic) final;
44 void run(ProcessingContext& pc) final;
45
46 protected:
47 void connectTree(const std::string& filename);
48
49 std::array<std::vector<o2::itsmft::Digit>*, NLayers> mDigits{};
50 std::array<std::vector<o2::itsmft::ROFRecord>*, NLayers> mDigROFRec{};
51 std::array<std::vector<o2::itsmft::MC2ROFRecord>*, NLayers> mDigMC2ROFs{};
52 std::vector<o2::dataformats::ConstMCTruthContainer<o2::MCCompLabel>> mConstLabels;
53 std::array<o2::dataformats::IOMCTruthContainerView*, NLayers> mPLabels{};
54
56
57 std::string getBranchName(const std::string& base, int index) const
58 {
59 if (mDoStaggering) {
60 return base + "_" + std::to_string(index);
61 }
62 return base;
63 }
64
65 template <typename Ptr>
66 void setBranchAddress(const std::string& base, Ptr& addr, int layer);
67
68 std::unique_ptr<TFile> mFile;
69 std::unique_ptr<TTree> mTree;
70
71 bool mUseMC = true; // use MC truth
72 bool mUseCalib = true; // send calib data
73 bool mDoStaggering = false;
74
75 std::string mDetName;
76 std::string mDetNameLC;
77 std::string mFileName;
78 std::string mDigTreeName = "o2sim";
79 std::string mDigBranchName = "Digit";
80 std::string mDigROFBranchName = "DigitROF";
81 std::string mDigMCTruthBranchName = "DigitMCTruth";
82};
83
86framework::DataProcessorSpec getITS3DigitReaderSpec(bool useMC = true, bool doStag = false, bool useCalib = false, std::string defname = "it3digits.root");
87
88} // namespace o2::its3
89
90#endif /* O2_ITS3_DigitREADER */
A const (ready only) version of MCTruthContainer.
Definition of the ITSMFT digit.
A special IO container - splitting a given vector to enable ROOT IO.
Definition of the ITSMFT ROFrame (trigger) record.
std::unique_ptr< TFile > mFile
std::array< std::vector< o2::itsmft::ROFRecord > *, NLayers > mDigROFRec
std::array< std::vector< o2::itsmft::MC2ROFRecord > *, NLayers > mDigMC2ROFs
std::unique_ptr< TTree > mTree
void run(ProcessingContext &pc) final
static constexpr int NLayers
void setBranchAddress(const std::string &base, Ptr &addr, int layer)
~ITS3DigitReader() override=default
std::array< o2::dataformats::IOMCTruthContainerView *, NLayers > mPLabels
void init(InitContext &ic) final
std::string getBranchName(const std::string &base, int index) const
std::array< std::vector< o2::itsmft::Digit > *, NLayers > mDigits
std::vector< o2::dataformats::ConstMCTruthContainer< o2::MCCompLabel > > mConstLabels
void connectTree(const std::string &filename)
const o2::header::DataOrigin mOrigin
GLuint index
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
constexpr o2::header::DataOrigin gDataOriginIT3
Definition DataHeader.h:582
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
framework::DataProcessorSpec getITS3DigitReaderSpec(bool useMC=true, bool doStag=false, bool useCalib=false, std::string defname="it3digits.root")
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
std::string filename()