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 <vector>
18
19#include <TFile.h>
20#include <TTree.h>
21
23#include "Framework/Task.h"
24#include "Headers/DataHeader.h"
31
32using namespace o2::framework;
33
34namespace o2::itsmft
35{
36
37template <int N>
38class ClusterReader : public Task
39{
40 public:
43
44 ClusterReader() = delete;
45 ClusterReader(bool useMC = true, bool doStag = false, bool usePatterns = true, bool triggers = true);
46 ~ClusterReader() override = default;
47 void init(InitContext& ic) final;
48 void run(ProcessingContext& pc) final;
49
50 protected:
51 void connectTree(const std::string& filename);
52 template <typename Ptr>
53 void setBranchAddress(const std::string& base, Ptr& addr, int layer);
54 std::string getBranchName(const std::string& base, int index) const;
55
56 std::vector<std::vector<o2::itsmft::ROFRecord>*> mClusROFRec{nullptr};
57 std::vector<std::vector<o2::itsmft::CompClusterExt>*> mClusterCompArray{nullptr};
58 std::vector<std::vector<unsigned char>*> mPatternsArray{nullptr};
59 std::vector<o2::dataformats::MCTruthContainer<o2::MCCompLabel>*> mClusterMCTruth{nullptr};
60
61 std::unique_ptr<TFile> mFile;
62 std::unique_ptr<TTree> mTree;
63
64 int mLayers = 1;
65 bool mUseMC = true; // use MC truth
66 bool mDoStaggering = false; // read staggered data
67 bool mUsePatterns = true; // send patterns
68 bool mTriggerOut = true; // send dummy triggers vector
69
70 std::string mDetName;
71 std::string mDetNameLC;
72 std::string mFileName;
73 std::string mClusTreeName = "o2sim";
74 std::string mClusROFBranchName = "ClustersROF";
75 std::string mClusterPattBranchName = "ClusterPatt";
76 std::string mClusterCompBranchName = "ClusterComp";
77 std::string mClustMCTruthBranchName = "ClusterMCTruth";
78};
79
80class ITSClusterReader : public ClusterReader<o2::detectors::DetID::ITS>
81{
82 public:
83 ITSClusterReader(bool useMC = true, bool doStag = false, bool usePatterns = true, bool triggerOut = true)
84 : ClusterReader(useMC, doStag, usePatterns, triggerOut) {}
85};
86
87class MFTClusterReader : public ClusterReader<o2::detectors::DetID::MFT>
88{
89 public:
90 MFTClusterReader(bool useMC = true, bool doStag = false, bool usePatterns = true, bool triggerOut = true)
91 : ClusterReader(useMC, doStag, usePatterns, triggerOut) {}
92};
93
96framework::DataProcessorSpec getITSClusterReaderSpec(bool useMC = true, bool doStag = false, bool usePatterns = true, bool useTriggers = true);
97framework::DataProcessorSpec getMFTClusterReaderSpec(bool useMC = true, bool doStag = false, bool usePatterns = true, bool useTriggers = true);
98
99} // namespace o2::itsmft
100
101#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
std::vector< std::vector< o2::itsmft::CompClusterExt > * > mClusterCompArray
void connectTree(const std::string &filename)
std::vector< std::vector< unsigned char > * > mPatternsArray
void init(InitContext &ic) final
void setBranchAddress(const std::string &base, Ptr &addr, int layer)
static constexpr o2::header::DataOrigin Origin
std::vector< std::vector< o2::itsmft::ROFRecord > * > mClusROFRec
static constexpr o2::detectors::DetID ID
std::vector< o2::dataformats::MCTruthContainer< o2::MCCompLabel > * > mClusterMCTruth
std::unique_ptr< TTree > mTree
std::unique_ptr< TFile > mFile
~ClusterReader() override=default
ITSClusterReader(bool useMC=true, bool doStag=false, bool usePatterns=true, bool triggerOut=true)
MFTClusterReader(bool useMC=true, bool doStag=false, 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 ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
framework::DataProcessorSpec getMFTClusterReaderSpec(bool useMC=true, bool doStag=false, bool usePatterns=true, bool useTriggers=true)
framework::DataProcessorSpec getITSClusterReaderSpec(bool useMC=true, bool doStag=false, bool usePatterns=true, bool useTriggers=true)
std::string filename()