28 TFile out(
file,
"RECREATE");
31 tree.Branch(
"TPCScaler",
this);
39 scaler.mIonDriftTimeMS = mIonDriftTimeMS;
41 scaler.mFirstTFOrbit = (startTimeMS <= 0) ? mFirstTFOrbit : (mFirstTFOrbit + (startTimeMS - mTimeStampMS) / (o2::constants::lhc::LHCOrbitMUS * 0.001));
42 scaler.mTimeStampMS = (startTimeMS <= 0) ? mTimeStampMS : startTimeMS;
43 scaler.mIntegrationTimeMS = mIntegrationTimeMS;
45 const int dataIdx = (startTimeMS <= 0) ? 0 : getDataIdx(startTimeMS);
46 const int idxDataStart = (startTimeMS <= 0) ? 0 : dataIdx;
49 scaler.mScalerA = std::vector<float>(mScalerA.begin() + idxDataStart, mScalerA.begin() + idxDataEndA);
50 scaler.mScalerC = std::vector<float>(mScalerC.begin() + idxDataStart, mScalerC.begin() + idxDataEndC);
57 LOGP(
error,
"Number of points stored for A-side and C-side is different");
60 const long marginCCDBMS = marginCCDBMinutes * 60 * 1000;
61 const float msPerObjectTmp = minutesPerObject * 60 * 1000;
62 const int valuesPerSlice =
static_cast<int>(msPerObjectTmp / mIntegrationTimeMS);
63 const int marginPerSlice =
static_cast<int>(marginMS / mIntegrationTimeMS);
66 LOGP(info,
"Producing {} objects with a CCDB margin of {} ms and {} margin per slice", nSlices, marginCCDBMS, marginPerSlice);
71 for (
int i = 0;
i < nSlices; ++
i) {
72 const int idxDataStart = (
i == 0) ? 0 : (
i * valuesPerSlice - marginPerSlice);
73 int idxDataEnd = (
i == nSlices - 1) ?
getNValues(
Side::A) : ((
i + 1) * valuesPerSlice + marginPerSlice);
79 scaler.mIonDriftTimeMS = mIonDriftTimeMS;
81 scaler.mTimeStampMS = (
i == 0) ? mTimeStampMS : (mTimeStampMS + idxDataStart *
static_cast<double>(mIntegrationTimeMS));
82 scaler.mFirstTFOrbit = mFirstTFOrbit + (scaler.mTimeStampMS - mTimeStampMS) / (o2::constants::lhc::LHCOrbitMUS * 0.001);
83 scaler.mIntegrationTimeMS = mIntegrationTimeMS;
84 scaler.mScalerA = std::vector<float>(mScalerA.begin() + idxDataStart, mScalerA.begin() + idxDataEnd);
85 scaler.mScalerC = std::vector<float>(mScalerC.begin() + idxDataStart, mScalerC.begin() + idxDataEnd);
87 const long timePerSliceMS = valuesPerSlice * mIntegrationTimeMS;
88 const long tsCCDBStart = mTimeStampMS +
i * timePerSliceMS;
89 const long tsCCDBStartMargin = (
i == 0) ? (tsCCDBStart - marginCCDBMS) : tsCCDBStart;
91 const std::string fileOut = fmt::format(
"{}_{}_{}_{}.root",
file,
i, tsCCDBStartMargin, tsCCDBEnd);
98 TFile out(inpf,
"READ");
106 tpcScalerTree.SetBranchAddress(
"TPCScaler", &scalerTmp);
107 const int entries = tpcScalerTree.GetEntries();
109 tpcScalerTree.GetEntry(0);
111 LOGP(
error,
"TPCScaler not found in input file");
113 tpcScalerTree.SetBranchAddress(
"TPCScaler",
nullptr);
119 const int idxData = getDataIdx(timestamp);
122 if ((nVals == 0) || (nVals > nValues)) {
124 LOGP(
error,
"Empty data provided {}", nValues);
128 const int lastIdx = std::clamp(idxData, nVals, nValues);
129 const int firstIdx = (lastIdx == nValues) ? (nValues - nVals) : std::clamp(idxData - nVals, 0, nValues);
136 for (
int i = firstIdx;
i < lastIdx; ++
i) {
139 const double relTSMS = mTimeStampMS +
i * mIntegrationTimeMS - timestamp;
149 if (nOutOfRange > 0) {
150 constexpr int MaxOutOfRangeReports = 20;
151 static std::atomic<int> nReports{0};
152 const int report = nReports++;
153 if (
report < MaxOutOfRangeReports) {
154 LOGP(
error,
"{} of {} scaler values for timestamp {} outside the weights (first timestamp {} ms, sampling {} ms): weight 1 used{}", nOutOfRange,
156 (
report + 1 == MaxOutOfRangeReports) ?
", further messages suppressed" :
"");
169 return (idx >= 0) && (idx < static_cast<int>(
mWeights.size()));
175 const int idx = idxF;
181 if ((idxF == idx) || (idx ==
mWeights.size() - 1)) {
188 const float x0 = idx;
189 const float x1 = idx + 1;
190 const float x = idxF;
199 std::transform(std::begin(scaler), std::end(scaler), std::begin(scaler), [minThreshold, maxThreshold](
auto val) {
return std::clamp(
val, minThreshold, maxThreshold); });
std::vector< long > entries
std::vector< double > sum
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
char error[CURL_ERROR_SIZE]
Header to collect LHC related constants.
int getNValuesIonDriftTime() const
void dumpToFileSlices(const char *file, const char *name, int minutesPerObject, float marginMS=500, float marginCCDBMinutes=1)
float getScalers(unsigned int idx, o2::tpc::Side side) const
float getMeanScaler(double timestamp, o2::tpc::Side side) const
int getNValues(o2::tpc::Side side) const
void loadFromFile(const char *inpf, const char *name)
void clampScalers(float minThreshold, float maxThreshold, Side side)
double getEndTimeStampMS(o2::tpc::Side side) const
void dumpToFile(const char *file, const char *name)
void useWeights(bool useWeights)
enable usage of weights
void setFromTree(TTree &tpcScalerTree)
set this object from input tree
const auto & getScalerWeights() const
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLuint const GLchar * name
GLuint GLuint GLfloat weight
GLuint GLfloat GLfloat y0
void report(gsl::span< o2::InteractionTimeRecord > irs, int threshold, bool verbose)
Global TPC definitions and constants.
float mSamplingTimeMS
sampling of the stored weights
std::vector< float > mWeights
stored weights
float mFirstTimeStampMS
first timestamp
float getWeight(float deltaTime) const
bool isInRange(float deltaTime) const
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))