Project
Loading...
Searching...
No Matches
ClusterReaderSpec.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_CLUSTERREADER
15#define O2_ITSMFT_CLUSTERREADER
16
17#include "TFile.h"
18#include "TTree.h"
19
21#include "Framework/Task.h"
22#include "Headers/DataHeader.h"
29
30using namespace o2::framework;
31
32namespace o2::itsmft
33{
34
35template <int N>
36class ClusterReader : public Task
37{
38 public:
42
43 ClusterReader() = delete;
44 ClusterReader(bool useMC, bool usePatterns = true, bool triggers = true);
45 ~ClusterReader() override = default;
46 void init(InitContext& ic) final;
47 void run(ProcessingContext& pc) final;
48
49 protected:
50 void connectTree(const std::string& filename);
51 template <typename Ptr>
52 void setBranchAddress(const std::string& base, Ptr& addr, int layer);
53 std::string getBranchName(const std::string& base, int index) const;
54
55 std::array<std::vector<o2::itsmft::ROFRecord>*, NLayers> mClusROFRec;
56 std::array<std::vector<o2::itsmft::CompClusterExt>*, NLayers> mClusterCompArray;
57 std::array<std::vector<unsigned char>*, NLayers> mPatternsArray;
58 std::array<o2::dataformats::MCTruthContainer<o2::MCCompLabel>*, NLayers> mClusterMCTruth;
59 std::array<std::vector<o2::itsmft::MC2ROFRecord>*, NLayers> mClusMC2ROFs;
60
61 std::unique_ptr<TFile> mFile;
62 std::unique_ptr<TTree> mTree;
63
64 bool mUseMC = true; // use MC truth
65 bool mUsePatterns = true; // send patterns
66 bool mTriggerOut = true; // send dummy triggers vector
67
68 std::string mDetName;
69 std::string mDetNameLC;
70 std::string mFileName;
71 std::string mClusTreeName = "o2sim";
72 std::string mClusROFBranchName = "ClustersROF";
73 std::string mClusterPattBranchName = "ClusterPatt";
74 std::string mClusterCompBranchName = "ClusterComp";
75 std::string mClustMCTruthBranchName = "ClusterMCTruth";
76 std::string mClustMC2ROFBranchName = "ClustersMC2ROF";
77};
78
79class ITSClusterReader : public ClusterReader<o2::detectors::DetID::ITS>
80{
81 public:
82 ITSClusterReader(bool useMC = true, bool usePatterns = true, bool triggerOut = true)
83 : ClusterReader(useMC, usePatterns, triggerOut) {}
84};
85
86class MFTClusterReader : public ClusterReader<o2::detectors::DetID::MFT>
87{
88 public:
89 MFTClusterReader(bool useMC = true, bool usePatterns = true, bool triggerOut = true)
90 : ClusterReader(useMC, usePatterns, triggerOut) {}
91};
92
95framework::DataProcessorSpec getITSClusterReaderSpec(bool useMC = true, bool usePatterns = true, bool useTriggers = true);
96framework::DataProcessorSpec getMFTClusterReaderSpec(bool useMC = true, bool usePatterns = true, bool useTriggers = true);
97
98} // namespace o2::itsmft
99
100#endif /* O2_ITSMFT_CLUSTERREADER */
Definition of the ITSMFT compact cluster.
Definition of the ITSMFT ROFrame (trigger) record.
Definition of a container to keep Monte Carlo truth external to simulation objects.
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 run(ProcessingContext &pc) final
std::string getBranchName(const std::string &base, int index) const
void connectTree(const std::string &filename)
static constexpr int NLayers
std::array< std::vector< unsigned char > *, NLayers > mPatternsArray
void init(InitContext &ic) final
void setBranchAddress(const std::string &base, Ptr &addr, int layer)
static constexpr o2::header::DataOrigin Origin
std::array< std::vector< o2::itsmft::CompClusterExt > *, NLayers > mClusterCompArray
static constexpr o2::detectors::DetID ID
std::array< std::vector< o2::itsmft::MC2ROFRecord > *, NLayers > mClusMC2ROFs
std::unique_ptr< TTree > mTree
std::array< std::vector< o2::itsmft::ROFRecord > *, NLayers > mClusROFRec
std::unique_ptr< TFile > mFile
std::array< o2::dataformats::MCTruthContainer< o2::MCCompLabel > *, NLayers > mClusterMCTruth
~ClusterReader() override=default
ITSClusterReader(bool useMC=true, bool usePatterns=true, bool triggerOut=true)
MFTClusterReader(bool useMC=true, bool usePatterns=true, bool triggerOut=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 getMFTClusterReaderSpec(bool useMC=true, bool usePatterns=true, bool useTriggers=true)
framework::DataProcessorSpec getITSClusterReaderSpec(bool useMC=true, bool usePatterns=true, bool useTriggers=true)
std::string filename()
static constexpr int getNLayers()
static constexpr bool supportsStaggering() noexcept