17#include <fairlogger/Logger.h>
41 std::string
filename = mPath +
"CPVGains.root";
42 TFile filein(
filename.data(),
"READ");
43 if (filein.IsOpen()) {
44 mMean->Add(
static_cast<TH2F*
>(filein.Get(
"Gains")));
61 LOG(
error) <<
"Raw decoding error " << (int)
e;
82 unsigned short absId = ac.
Address;
83 mMean->Fill(absId, ac.
Charge);
92 LOG(info) <<
"[CPVGainCalibDevice - endOfStream]";
104 if (mUpdateCCDB || mForceUpdate) {
110 info.setPath(
"CPV/Calib/CalibParams");
111 info.setObjectType(
"CalibParams");
112 info.setFileName(flName);
114 time_t now =
time(
nullptr);
115 info.setStartValidityTimestamp(now);
117 std::map<std::string, std::string> md;
118 info.setMetaData(md);
120 LOG(info) <<
"Sending object CPV/Calib/CalibParams";
130 std::string
filename = mPath +
"CPVGains";
131 time_t now =
time(
nullptr);
132 tm* ltm = localtime(&now);
133 filename += TString::Format(
"_%d%d%d%d%d.root", 1 + ltm->tm_min, 1 + ltm->tm_hour, ltm->tm_mday, 1 + ltm->tm_mon, 1970 + ltm->tm_year);
135 TFile fout(
filename.data(),
"RECREATE");
139 std::string
filename = mPath +
"CPVGains.root";
140 LOG(info) <<
"statistics not sufficient yet: " << mMean->Integral() / mMean->GetNbinsX() <<
", writing file " <<
filename;
141 TFile fout(
filename.data(),
"RECREATE");
157 TF1* fitFunc =
new TF1(
"fitFunc",
"landau", 0., 4000.);
158 fitFunc->SetParameters(1., 200., 60.);
159 fitFunc->SetParLimits(1, 10., 2000.);
160 for (
int i = 1;
i <= mMean->GetNbinsX();
i++) {
161 TH1D* tmp = mMean->ProjectionY(Form(
"channel%d",
i),
i,
i);
162 fitFunc->SetParameters(1., 200., 60.);
163 if (tmp->Integral(20, 2000) < kMinimalStatistics) {
167 tmp->Fit(fitFunc,
"QL0",
"", 20., 2000.);
168 float a = fitFunc->GetParameter(1);
171 mCalibParams->setGain(
i - 1,
a);
216 std::vector<o2::framework::OutputSpec> outputs;
220 outputs.emplace_back(
"CPV",
"GAINDIFF", 0, o2::framework::Lifetime::Sporadic);
225 o2::framework::adaptFromTask<CPVGainCalibDevice>(useCCDB, forceUpdate,
path),
Utils and constants for calibration and related workflows.
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 e
char error[CURL_ERROR_SIZE]
static std::string generateFileName(const std::string &inp)
static std::unique_ptr< std::vector< char > > createObjectImage(const T *obj, CcdbObjectInfo *info=nullptr)
static constexpr long INFINITE_TIMESTAMP
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void sendOutput(DataAllocator &output)
void run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) final
static constexpr short kNCHANNELS
Decoder of the ALTRO data in the raw page.
const std::vector< uint32_t > & getDigits() const
Get the reference to the digits container.
RawErrorType_t decode()
Decode the raw cpv payload stream.
Reader for raw data produced by the Readout application in in-memory format.
RawErrorType_t next()
Read next payload from the stream.
bool hasNext() const
check if more pages are available in the raw file
DataAllocator & outputs()
GLsizei const GLchar *const * path
GLboolean GLboolean GLboolean GLboolean a
o2::framework::DataProcessorSpec getGainCalibSpec(bool useCCDB, bool forceUpdate, std::string path)
std::vector< InputSpec > select(char const *matcher="")
static constexpr o2::header::DataOrigin gDataOriginCDBWrapper
static constexpr o2::header::DataOrigin gDataOriginCDBPayload
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
uint32_t Charge
Bits 18 - 32 : charge.
uint32_t Address
Bits 0 - 17 : Address.