Project
Loading...
Searching...
No Matches
TPCScaler.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
14
15#ifndef ALICEO2_TPC_TPCSCALER
16#define ALICEO2_TPC_TPCSCALER
17
18#include "DataFormatsTPC/Defs.h"
19#include <vector>
20
21class TTree;
22
23namespace o2::tpc
24{
25
26/*
27Class for storing the scalers which are used to calculate an estimate for the mean space-charge density for the last ion drift time
28*/
29
32 float getWeight(float deltaTime) const;
34 bool isInRange(float deltaTime) const;
35 bool isValid() const { return (mSamplingTimeMS > 0 && !mWeights.empty()); }
36 float getDurationMS() const { return mSamplingTimeMS * mWeights.size(); }
37 float mSamplingTimeMS = -1;
39 std::vector<float> mWeights;
40
42};
43
45{
46 public:
48 TPCScaler() = default;
49
52
54 int getNValues(o2::tpc::Side side) const { return (side == o2::tpc::Side::A ? mScalerA.size() : mScalerC.size()); }
55
58 void setScaler(const std::vector<float>& values, const o2::tpc::Side side) { (side == o2::tpc::Side::A ? (mScalerA = values) : (mScalerC = values)); }
59
61 void setIonDriftTimeMS(float ionDriftTimeMS) { mIonDriftTimeMS = ionDriftTimeMS; }
62
64 void setRun(int run) { mRun = run; }
65
67 void setFirstTFOrbit(unsigned int firstTFOrbit) { mFirstTFOrbit = firstTFOrbit; }
68
70 void setStartTimeStampMS(double timeStampMS) { mTimeStampMS = timeStampMS; }
71
73 void setIntegrationTimeMS(float integrationTimeMS) { mIntegrationTimeMS = integrationTimeMS; }
74
77 void dumpToFile(const char* file, const char* name);
78
83 void dumpToFile(const char* file, const char* name, double startTimeMS, double endTimeMS);
84
90 void dumpToFileSlices(const char* file, const char* name, int minutesPerObject, float marginMS = 500, float marginCCDBMinutes = 1);
91
94 void loadFromFile(const char* inpf, const char* name);
95
97 void setFromTree(TTree& tpcScalerTree);
98
100 float getScalers(unsigned int idx, o2::tpc::Side side) const { return (side == o2::tpc::Side::A) ? mScalerA[idx] : mScalerC[idx]; }
101
103 const auto& getScalers(o2::tpc::Side side) const { return (side == o2::tpc::Side::A) ? mScalerA : mScalerC; }
104
106 float getIonDriftTimeMS() const { return mIonDriftTimeMS; }
107
109 int getRun() const { return mRun; }
110
112 unsigned int getFirstTFOrbit() const { return mFirstTFOrbit; }
113
115 double getStartTimeStampMS() const { return mTimeStampMS; }
116
118 double getEndTimeStampMS(o2::tpc::Side side) const { return mTimeStampMS + getDurationMS(side); }
119
121 float getIntegrationTimeMS() const { return mIntegrationTimeMS; }
122
124 int getNValuesIonDriftTime() const { return mIonDriftTimeMS / mIntegrationTimeMS + 0.5; }
125
128 float getMeanScaler(double timestamp, o2::tpc::Side side) const;
129
131 float getDurationMS(o2::tpc::Side side) const { return mIntegrationTimeMS * getNValues(side); }
132
136 void clampScalers(float minThreshold, float maxThreshold, Side side);
137
139 void setScalerWeights(const TPCScalerWeights& weights) { mScalerWeights = weights; }
140
142 const auto& getScalerWeights() const { return mScalerWeights; }
143
145 void useWeights(bool useWeights) { mUseWeights = useWeights; }
146
148 bool weightsUsed() const { return mUseWeights; }
149
150 private:
151 float mIonDriftTimeMS{200};
152 int mRun{};
153 unsigned int mFirstTFOrbit{};
154 double mTimeStampMS{};
155 float mIntegrationTimeMS{1.};
156 std::vector<float> mScalerA{};
157 std::vector<float> mScalerC{};
158 TPCScalerWeights mScalerWeights{};
159 bool mUseWeights{false};
160
161 // get index to data for given timestamp
162 int getDataIdx(double timestamp) const { return (timestamp - mTimeStampMS) / mIntegrationTimeMS + 0.5; }
163
164 ClassDefNV(TPCScaler, 2);
165};
166
167} // namespace o2::tpc
168#endif
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
uint32_t side
Definition RawData.h:0
unsigned int getFirstTFOrbit() const
Definition TPCScaler.h:112
bool weightsUsed() const
return if weights are used
Definition TPCScaler.h:148
int getNValuesIonDriftTime() const
Definition TPCScaler.h:124
void dumpToFileSlices(const char *file, const char *name, int minutesPerObject, float marginMS=500, float marginCCDBMinutes=1)
Definition TPCScaler.cxx:54
TPCScaler()=default
default constructor
float getScalers(unsigned int idx, o2::tpc::Side side) const
Definition TPCScaler.h:100
float getMeanScaler(double timestamp, o2::tpc::Side side) const
void setScaler(const std::vector< float > &values, const o2::tpc::Side side)
Definition TPCScaler.h:58
void setIonDriftTimeMS(float ionDriftTimeMS)
Definition TPCScaler.h:61
TPCScaler & operator=(TPCScaler &&other)=default
default move assignment
int getNValues(o2::tpc::Side side) const
Definition TPCScaler.h:54
float getIntegrationTimeMS() const
Definition TPCScaler.h:121
float getDurationMS(o2::tpc::Side side) const
Definition TPCScaler.h:131
float getIonDriftTimeMS() const
Definition TPCScaler.h:106
double getStartTimeStampMS() const
Definition TPCScaler.h:115
void loadFromFile(const char *inpf, const char *name)
Definition TPCScaler.cxx:96
const auto & getScalers(o2::tpc::Side side) const
Definition TPCScaler.h:103
int getRun() const
Definition TPCScaler.h:109
void clampScalers(float minThreshold, float maxThreshold, Side side)
double getEndTimeStampMS(o2::tpc::Side side) const
Definition TPCScaler.h:118
void dumpToFile(const char *file, const char *name)
Definition TPCScaler.cxx:26
void setFirstTFOrbit(unsigned int firstTFOrbit)
Definition TPCScaler.h:67
void setStartTimeStampMS(double timeStampMS)
Definition TPCScaler.h:70
void setRun(int run)
Definition TPCScaler.h:64
void useWeights(bool useWeights)
enable usage of weights
Definition TPCScaler.h:145
void setFromTree(TTree &tpcScalerTree)
set this object from input tree
const auto & getScalerWeights() const
Definition TPCScaler.h:142
void setIntegrationTimeMS(float integrationTimeMS)
Definition TPCScaler.h:73
void setScalerWeights(const TPCScalerWeights &weights)
setting the weights for the scalers
Definition TPCScaler.h:139
GLsizei const GLuint const GLfloat * weights
Definition glcorearb.h:5475
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
Global TPC definitions and constants.
Side
TPC readout sidE.
Definition Defs.h:37
@ A
Definition Defs.h:37
float getDurationMS() const
Definition TPCScaler.h:36
float mSamplingTimeMS
sampling of the stored weights
Definition TPCScaler.h:37
std::vector< float > mWeights
stored weights
Definition TPCScaler.h:39
float mFirstTimeStampMS
first timestamp
Definition TPCScaler.h:38
ClassDefNV(TPCScalerWeights, 1)
float getWeight(float deltaTime) const
bool isInRange(float deltaTime) const
VectorOfTObjectPtrs other