Project
Loading...
Searching...
No Matches
RawDataManager.h
Go to the documentation of this file.
1// Copyright 2019-2023 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
12#ifndef ALICEO2_TRD_RawDataManager_H_
13#define ALICEO2_TRD_RawDataManager_H_
14
19
23#include "DataFormatsTRD/Hit.h"
24
26
32
33// #include <TTreeReaderArray.h>
34
35#include <boost/range/iterator_range_core.hpp>
36#include <vector>
37#include <filesystem>
38#include <boost/range.hpp>
39
40class TFile;
41class TTree;
42
43namespace o2::trd
44{
45
52 public:
53 boost::iterator_range<std::vector<o2::trd::Digit>::iterator> digits;
54 boost::iterator_range<std::vector<o2::trd::Tracklet64>::iterator> tracklets;
55 boost::iterator_range<std::vector<HitPoint>::iterator> hits;
56
60 void sort();
61
64 // std::vector<RawDataSpan> ByMCM();
65
70 // stored in the raw data span.
71 template <typename keyfunc>
72 std::vector<RawDataSpan> iterateBy();
73
74 std::vector<RawDataSpan> iterateByMCM();
75 std::vector<RawDataSpan> iterateByPadRow();
76 // std::vector<RawDataSpan> iterateDetector();
77
78 std::vector<TrackSegment> makeMCTrackSegments();
79
80 // pair<int, int> getMaxADCsumAndChannel();
81 // int getMaxADCsum(){ return getMaxADCsumAndChannel().first; }
82
83 // int getDetector() { if (mDetector == -1) calculateCoordinates(); return mDetector; }
84 // int getPadRow() { if (mPadRow == -1) calculateCoordinates(); return mPadRow; }
85
86 // protected:
87 // // The following variables cache the calculations of raw coordinates:
88 // // non-negative values indicate the actual position
89 // // -1 indicates that the values has not been calculated yet
90 // // -2 indicates that the value is not unique in this span
91 // int mDetector{-1};
92 // int mPadRow{-1};
93
94 // void calculateCoordinates();
95};
96
113{
114
115 public:
116 RawDataManager(std::filesystem::path dir = ".");
117 // RawDataManager(std::string dir = "./");
118
119 // void SetMatchWindowTPC(float min, float max)
120 // { mMatchTimeMinTPC=min; mMatchTimeMaxTPC=max; }
121
122 bool nextTimeFrame();
123 bool nextEvent();
124
127
128 // TTreeReaderArray<o2::tpc::TrackTPC> *GetTimeFrameTPCTracks() {return mTpcTracks; }
129 std::vector<o2::dataformats::TrackTPCITS>* getTimeFrameTracks() { return mTracks; }
130
131 // access event info
133 float getTriggerTime();
134
135 size_t getTimeFrameNumber() { return mTimeFrameNo; }
136 size_t getEventNumber() { return mEventNo; }
137
139
140 std::string describeFiles();
141 std::string describeTimeFrame();
142 std::string describeEvent();
143
144 private:
145 // access to TRD digits and tracklets
146 TFile* mMainFile{0}; // the main trdtracklets.root file
147 TTree* mDataTree{0}; // tree and friends from digits, tracklets files
148 // TTreeReader* mDataReader{0};
149
150 std::vector<o2::trd::Digit>* mDigits{0};
151 std::vector<o2::trd::Tracklet64>* mTracklets{0};
152 std::vector<o2::trd::TriggerRecord>* mTrgRecords{0};
153
154 // access tracks
155 std::vector<o2::dataformats::TrackTPCITS>* mTracks{0};
156 // TTreeReaderArray<o2::tpc::TrackTPC> *mTpcTracks{0};
157
158 // access to Monte-Carlo events, tracks, hits
159 TFile* mMCFile{0};
160 TTree* mMCTree{0};
161 // TTreeReader* mMCReader{0};
162 std::vector<o2::dataformats::MCEventHeader>* mMCEventHeader{0};
163 std::vector<o2::MCTrackT<Float_t>>* mMCTracks{0};
164 std::vector<o2::trd::Hit>* mHits{0};
165
166 // MC hits, converted to chamber coordinates
167 std::vector<o2::trd::HitPoint> mHitPoints;
168
169 // time frame information (for data only)
170 std::vector<o2::dataformats::TFIDInfo>* mTFIDs{0};
171
172 // collision context (for MC only)
173 o2::steer::DigitizationContext* mCollisionContext{0};
174
175 // current trigger record
176 o2::trd::TriggerRecord mTriggerRecord;
177
178 // time frame and event counters
179 size_t mTimeFrameNo{0}, mEventNo{0};
180
181 // matching parameters for tracks
182 // float mMatchTimeMinTPC{-10.0}, mMatchTimeMaxTPC{20.0};
183
184 // template <typename T>
185 // void addReaderArray(TTreeReaderArray<T>*& array, std::filesystem::path file, std::string tree, std::string branch);
186};
187
188} // namespace o2::trd
189
190#endif // ALICEO2_TRD_RawDataManager_H_
Definition of the MCTrack class.
Result of refitting TPC-ITS matched track.
o2::steer::DigitizationContext * getCollisionContext()
o2::dataformats::TFIDInfo getTimeFrameInfo()
access time frame info
std::vector< o2::dataformats::TrackTPCITS > * getTimeFrameTracks()
Header for data corresponding to the same hardware trigger adapted from DataFormatsITSMFT/ROFRecord.
std::vector< RawDataSpan > iterateByPadRow()
boost::iterator_range< std::vector< o2::trd::Tracklet64 >::iterator > tracklets
std::vector< TrackSegment > makeMCTrackSegments()
boost::iterator_range< std::vector< o2::trd::Digit >::iterator > digits
std::vector< RawDataSpan > iterateByMCM()
std::vector< RawDataSpan > iterateBy()
boost::iterator_range< std::vector< HitPoint >::iterator > hits