Project
Loading...
Searching...
No Matches
WaveformCalib.cxx
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
12#include <TROOT.h>
13#include <TFile.h>
14#include <TH1.h>
15#include <TString.h>
16#include <TStyle.h>
17#include <TDirectory.h>
21#include "Framework/Logger.h"
23#include "CCDB/CcdbApi.h"
24
25using namespace o2::zdc;
26
28{
29 if (mConfig == nullptr) {
30 LOG(fatal) << "o2::zdc::WaveformCalib: missing configuration object";
31 return -1;
32 }
33
34 auto* cfg = mConfig;
35 if (mVerbosity > DbgZero) {
36 mConfig->print();
37 }
38
39 // Inspect reconstruction parameters
40 const auto& opt = CalibParamZDC::Instance();
41 opt.print();
42
43 if (opt.rootOutput == true) {
45 }
46
47 clear();
48 mData.setN(mConfig->nbun);
49 mData.mPeak = WaveformCalibQueue::peak(-(mConfig->ibeg));
50 mInitDone = true;
51 return 0;
52}
53
54//______________________________________________________________________________
56{
57 mData.clear();
58}
59
60//______________________________________________________________________________
62{
63 if (!mInitDone) {
64 init();
65 }
66 // Add checks before addition
67 if ((mData.mN != data.mN) || (mData.mPeak != data.mPeak)) {
68 LOG(fatal) << "WaveformCalib::process adding inconsistent data mN cfg=" << mData.mN << " vs data=" << data.mN << " mPeak cfg=" << mData.mPeak << " vs data=" << data.mPeak;
69 return -1;
70 }
71 mData += data;
72 return 0;
73}
74
75//______________________________________________________________________________
76// Create calibration object
78{
79 if (mVerbosity > DbgZero) {
80 LOGF(info, "Finalizing WaveformCalibData object");
81 }
82 auto clName = o2::utils::MemFileHelper::getClassName(mData);
83 mInfo.setObjectType(clName);
84 auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
85 mInfo.setFileName(flName);
87 std::map<std::string, std::string> md;
88 md["config"] = mConfig->desc;
89 mInfo.setMetaData(md);
90 uint64_t starting = mData.mCTimeBeg;
91 if (starting >= 10000) {
92 starting = starting - 10000; // start 10 seconds before
93 }
94 uint64_t stopping = mData.mCTimeEnd + 10000; // stop 10 seconds after
95 mInfo.setStartValidityTimestamp(starting);
96 mInfo.setEndValidityTimestamp(stopping);
97 mInfo.setAdjustableEOV();
98
99 if (mSaveDebugHistos) {
101 }
102 return 0;
103}
104
105//______________________________________________________________________________
106int WaveformCalib::saveDebugHistos(const std::string fn)
107{
108 return mData.saveDebugHistos(fn);
109}
ZDC calibration common parameters.
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
Waveform calibration intermediate data queue.
static std::string generateFileName(const std::string &inp)
Definition CcdbApi.cxx:905
void setStartValidityTimestamp(long start)
void setFileName(const std::string &nm)
void setPath(const std::string &path)
void setEndValidityTimestamp(long end)
void setObjectType(const std::string &tp)
void setMetaData(const std::map< std::string, std::string > &md)
int saveDebugHistos(const std::string fn="ZDCWaveformCalib.root")
int process(const WaveformCalibData &data)
const std::string CCDBPathWaveformCalib
Definition Constants.h:227
constexpr int DbgZero
Definition Constants.h:207
static std::string getClassName(const T &obj)
get the class name of the object
std::string desc
TDC cut high.
int mPeak
Number of bunches in waveform.
int mN
Time of processed time frame.
uint64_t mCTimeEnd
Time of processed time frame.
int saveDebugHistos(const std::string fn)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"