Project
Loading...
Searching...
No Matches
CalibLaserTracks.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
21
22#ifndef TPC_CalibLaserTracks_H_
23#define TPC_CalibLaserTracks_H_
24
25#include <gsl/span>
26#include <string_view>
27
32
33namespace o2::tpc
34{
35
38
39struct TimePair {
40 float x1{0.f};
41 float x2{0.f};
43};
44
46{
47 public:
48 static constexpr size_t MinTrackPerSidePerTF = 50;
49
51 {
52 mLaserTracks.loadTracksFromFile();
53 updateParameters();
54 }
55
56 CalibLaserTracks(const CalibLaserTracks& other) : mTriggerPos{other.mTriggerPos},
57 mBz{other.mBz},
58 mDriftV{other.mDriftV},
59 mZbinWidth{other.mZbinWidth},
60 mTFstart{other.mTFstart},
61 mTFend{other.mTFend},
62 mCalibDataTF{other.mCalibDataTF},
63 mCalibData{other.mCalibData},
64 mZmatchPairsTFA{other.mZmatchPairsTFA},
65 mZmatchPairsTFC{other.mZmatchPairsTFC},
66 mZmatchPairsA{other.mZmatchPairsA},
67 mZmatchPairsC{other.mZmatchPairsC},
68 mWriteDebugTree{other.mWriteDebugTree},
69 mFinalized{other.mFinalized}
70 {
71 }
72
73 ~CalibLaserTracks() = default;
74
77 void fill(const gsl::span<const TrackTPC> tracks, float tp = 0);
78
81 void fill(std::vector<TrackTPC> const& tracks, float tp = 0);
82
84 void processTrack(const TrackTPC& track);
85
88 int findLaserTrackID(TrackPar track, int side = -1);
89
91 static float getPhiNearbyLaserRod(const TrackPar& param, int side);
92
94 static bool hasNearbyLaserRod(const TrackPar& param, int side);
95
97 void setTriggerPos(int triggerPos) { mTriggerPos = triggerPos; }
98
100 void merge(const CalibLaserTracks* other);
101
103 void endTF();
104
106 void finalize();
107
109 void print() const;
110
113 bool hasEnoughData(size_t numTFs = 1) const { return mCalibData.processedTFs >= numTFs && mZmatchPairsA.size() > MinTrackPerSidePerTF * numTFs && mZmatchPairsC.size() > MinTrackPerSidePerTF * numTFs; }
114
116 size_t getMatchedPairs() const { return getMatchedPairsA() + getMatchedPairsC(); }
117
119 size_t getMatchedPairsA() const { return mZmatchPairsA.size(); }
120
122 size_t getMatchedPairsC() const { return mZmatchPairsC.size(); }
123
125 size_t getMatchedPairsTFA() const { return mZmatchPairsTFA.size(); }
126
128 size_t getMatchedPairsTFC() const { return mZmatchPairsTFC.size(); }
129
132 void setTFtimes(uint64_t tfStart, uint64_t tfEnd = 0)
133 {
134 mTFstart = tfStart;
135 mTFend = tfEnd;
136 }
137
138 uint64_t getTFstart() const { return mTFstart; }
139 uint64_t getTFend() const { return mTFend; }
140
141 void setWriteDebugTree(bool write) { mWriteDebugTree = write; }
142 bool getWriteDebugTree() const { return mWriteDebugTree; }
143
145 TimePair fit(const std::vector<TimePair>& trackMatches, std::string_view info) const;
146
148 void sort(std::vector<TimePair>& trackMatches);
149
151 const LtrCalibData& getCalibDataTF() { return mCalibDataTF; }
152
154 const LtrCalibData& getCalibData() { return mCalibData; }
155
157 void setDebugOutputName(std::string_view name) { mDebugOutputName = name; }
158
159 void setVDriftRef(float v) { mDriftV = v; }
160
161 private:
162 int mTriggerPos{0};
163 float mBz{0.5};
164 float mDriftV{0};
165 float mTOffsetMUS{0};
166 float mZbinWidth{0};
167 float mAvgTP{0};
168 float mAvgDriftV{0};
169 uint64_t mTFstart{0};
170 uint64_t mTFend{0};
171 LtrCalibData mCalibDataTF{};
172 LtrCalibData mCalibData{};
173 std::vector<TimePair> mZmatchPairsTFA;
174 std::vector<TimePair> mZmatchPairsTFC;
175 std::vector<TimePair> mZmatchPairsA;
176 std::vector<TimePair> mZmatchPairsC;
177 bool mWriteDebugTree{false};
178 bool mFinalized{false};
179 std::string mDebugOutputName{"CalibLaserTracks_debug.root"};
180
181 LaserTrackContainer mLaserTracks;
182 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStream;
183
185 void updateParameters();
186
188 void fillCalibData(LtrCalibData& calibData, const std::vector<TimePair>& pairsA, const std::vector<TimePair>& pairsC);
189
190 ClassDefNV(CalibLaserTracks, 2);
191};
192
193} // namespace o2::tpc
194#endif
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
std::vector< o2::its::TrackITS > tracks
calibration data from laser track calibration
uint32_t side
Definition RawData.h:0
void finalize()
Finalize full processing.
const LtrCalibData & getCalibDataTF()
drift velocity fit information for presently processed time frame
static float getPhiNearbyLaserRod(const TrackPar &param, int side)
calculate phi of nearest laser rod
void endTF()
End processing of this TF.
size_t getMatchedPairs() const
number of associated laser tracks on both sides for all processed TFs
size_t getMatchedPairsC() const
number of associated laser tracks for all processed TFs on the C-Side
bool hasEnoughData(size_t numTFs=1) const
static constexpr size_t MinTrackPerSidePerTF
CalibLaserTracks(const CalibLaserTracks &other)
static bool hasNearbyLaserRod(const TrackPar &param, int side)
check if param is closer to a laser rod than 1/4 of a sector width
void setTriggerPos(int triggerPos)
trigger position for track z position correction
void fill(const gsl::span< const TrackTPC > tracks, float tp=0)
void processTrack(const TrackTPC &track)
process single track
void setWriteDebugTree(bool write)
size_t getMatchedPairsTFC() const
number of associated laser tracks presently processed TFs on the C-Side
void setDebugOutputName(std::string_view name)
name of the debug output tree
void print() const
print information
void merge(const CalibLaserTracks *other)
merge data with other calibration object
size_t getMatchedPairsA() const
number of associated laser tracks for all processed TFs on the A-Side
void setTFtimes(uint64_t tfStart, uint64_t tfEnd=0)
const LtrCalibData & getCalibData()
drift velocity fit information for full data set
void sort(std::vector< TimePair > &trackMatches)
sort TimePoint vectors
int findLaserTrackID(TrackPar track, int side=-1)
size_t getMatchedPairsTFA() const
number of associated laser tracks presently processed TFs on the A-Side
void loadTracksFromFile()
load laser tracks from file
const GLdouble * v
Definition glcorearb.h:832
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLfloat param
Definition glcorearb.h:271
Global TPC definitions and constants.
TrackParCovF TrackParCov
Definition Track.h:33
size_t processedTFs
number of processed TFs with laser track candidates
VectorOfTObjectPtrs other