16#ifndef O2_TPC_TPCCALIBRATORPADGAINTRACKSSPEC_H_
17#define O2_TPC_TPCCALIBRATORPADGAINTRACKSSPEC_H_
39 CalibratorPadGainTracksDevice(std::shared_ptr<o2::base::GRPGeomRequest> req,
const bool useLastExtractedMapAsReference) : mUseLastExtractedMapAsReference(useLastExtractedMapAsReference), mCCDBRequest(req) {}
43 const auto slotLength = ic.options().get<
uint32_t>(
"tf-per-slot");
44 const auto maxDelay = ic.options().get<
uint32_t>(
"max-delay");
45 const int minEntries = ic.options().get<
int>(
"min-entries");
46 const int gainNorm = ic.options().get<
int>(
"gainNorm");
47 const bool debug = ic.options().get<
bool>(
"file-dump");
48 const bool storeNClCCDB = ic.options().get<
bool>(
"store-NCl-CCDB");
49 const bool storeRMSCCDB = ic.options().get<
bool>(
"store-RMS-CCDB");
50 const auto lowTrunc = ic.options().get<
float>(
"lowTrunc");
51 const auto upTrunc = ic.options().get<
float>(
"upTrunc");
52 const auto minAcceptedRelgain = ic.options().get<
float>(
"minAcceptedRelgain");
53 const auto maxAcceptedRelgain = ic.options().get<
float>(
"maxAcceptedRelgain");
54 const int minEntriesMean = ic.options().get<
int>(
"minEntriesMean");
55 const auto disableLogTransform = ic.options().get<
bool>(
"disable-log-transform");
57 mCalibrator = std::make_unique<CalibratorPadGainTracks>();
58 mCalibrator->setLogTransformQ(!disableLogTransform);
59 mCalibrator->setMinEntries(minEntries);
60 mCalibrator->setSlotLength(slotLength);
61 mCalibrator->setMaxSlotsDelay(maxDelay);
62 mCalibrator->setTruncationRange(lowTrunc, upTrunc);
63 mCalibrator->setRelGainRange(minAcceptedRelgain, maxAcceptedRelgain);
64 mCalibrator->setWriteDebug(
debug);
66 mCalibrator->setUseLastExtractedMapAsReference(mUseLastExtractedMapAsReference);
67 mCalibrator->setMinEntriesMean(minEntriesMean);
68 mCalibrator->setStoreNClCCDB(storeNClCCDB);
69 mCalibrator->setStoreRMSCCDB(storeRMSCCDB);
82 mCalibrator->process(*histomaps.get());
83 const auto& infoVec = mCalibrator->getTFinterval();
84 LOGP(detail,
"Created {} objects for TF {} and time stamp {}", infoVec.size(), mCalibrator->getCurrentTFInfo().tfCounter, mCalibrator->getCurrentTFInfo().creation);
86 if (mCalibrator->hasCalibrationData()) {
87 mRunNumber = mCalibrator->getCurrentTFInfo().runNumber;
88 sendOutput(pc.outputs());
94 LOGP(info,
"Finalizing calibration");
96 sendOutput(eos.outputs());
102 auto calibrations = std::move(*mCalibrator).getCalibs();
103 const auto& intervals = mCalibrator->getTimeIntervals();
105 assert(calibrations.size() == intervals.size());
106 for (uint32_t iCalib = 0; iCalib < calibrations.size(); ++iCalib) {
107 const auto& calib = calibrations[iCalib];
108 const auto& infoVec = mCalibrator->getTFinterval();
109 const auto firstTF = infoVec[iCalib].first;
110 const auto lastTF = infoVec[iCalib].second;
111 LOGP(info,
"Writing pad-by-pad gain map to CCDB for TF {} to {}", firstTF, lastTF);
114 LOGP(info,
"Sending object {} / {} of size {} bytes, valid for {} : {} ", ccdbInfo.getPath(), ccdbInfo.getFileName(), imageIDCDelta->size(), ccdbInfo.getStartValidityTimestamp(), ccdbInfo.getEndValidityTimestamp());
118 mCalibrator->initOutput();
121 const bool mUseLastExtractedMapAsReference{
false};
122 std::unique_ptr<CalibratorPadGainTracks> mCalibrator;
123 std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
130 std::vector<OutputSpec> outputs;
134 std::vector<InputSpec> inputs{{
"gainhistos",
"TPC",
"TRACKGAINHISTOS", 0, Lifetime::Sporadic}};
135 auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(
true,
143 "tpc-calibrator-gainmap-tracks",
146 adaptFromTask<CalibratorPadGainTracksDevice>(ccdbRequest, useLastExtractedMapAsReference),
148 {
"tf-per-slot", VariantType::UInt32, 100u, {
"number of TFs per calibration time slot"}},
149 {
"max-delay", VariantType::UInt32, 0u, {
"number of slots in past to consider"}},
150 {
"min-entries", VariantType::Int, 40, {
"minimum entries per pad-by-pad histogram which are required"}},
151 {
"lowTrunc", VariantType::Float, 0.05f, {
"lower truncation range for calculating the rel gain"}},
152 {
"upTrunc", VariantType::Float, 0.6f, {
"upper truncation range for calculating the rel gain"}},
153 {
"minAcceptedRelgain", VariantType::Float, 0.1f, {
"minimum accpeted relative gain (if the gain is below this value it will be set to 1)"}},
154 {
"maxAcceptedRelgain", VariantType::Float, 2.f, {
"maximum accpeted relative gain (if the gain is above this value it will be set to 1)"}},
155 {
"gainNorm", VariantType::Int, 1, {
"normalization method for the extracted gain map: 0=no normalization, 1=median per stack, 2=median per region"}},
156 {
"minEntriesMean", VariantType::Int, 40, {
"minEntries minimum number of entries in pad-by-pad histogram to calculate the mean"}},
157 {
"store-NCl-CCDB", VariantType::Bool,
false, {
"store the CalDet containing the number of clusters per pad in the CCDB"}},
158 {
"store-RMS-CCDB", VariantType::Bool,
false, {
"store the RMS of each pad-by-pad histogram containing the number of clusters per pad in the CCDB"}},
159 {
"disable-log-transform", VariantType::Bool,
false, {
"Disable the transformation of q/dedx -> log(1 + q/dedx)"}},
160 {
"file-dump", VariantType::Bool,
false, {
"directly write calibration to a file"}}}};
Simple interface to the CDB manager.
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 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
Helper for geometry and GRP related CCDB requests.
Definition of the Names Generator class.
void checkUpdates(o2::framework::ProcessingContext &pc)
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static std::unique_ptr< std::vector< char > > createObjectImage(const T *obj, CcdbObjectInfo *info=nullptr)
static constexpr long INFINITE_TIMESTAMP
NormType
normalization type of the extracted gain map
void init(framework::InitContext &ic) final
CalibratorPadGainTracksDevice(std::shared_ptr< o2::base::GRPGeomRequest > req, const bool useLastExtractedMapAsReference)
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void run(ProcessingContext &pc) final
void endOfStream(EndOfStreamContext &eos) final
constexpr o2::header::DataOrigin gDataOriginTPC
constexpr TFType INFINITE_TF
Defining ITS Vertex explicitly as messageable.
Global TPC definitions and constants.
o2::framework::DataProcessorSpec getTPCCalibPadGainTracksSpec(const bool useLastExtractedMapAsReference)
create a processor spec
const std::unordered_map< CDBType, const std::string > CDBTypeMap
Storage name in CCDB for each calibration and parameter type.
@ CalPadGainResidual
ResidualpPad gain calibration (e.g. from tracks)
static void fillTFIDInfo(o2::framework::ProcessingContext &pc, o2::dataformats::TFIDInfo &ti)
static constexpr o2::header::DataOrigin gDataOriginCDBWrapper
static constexpr o2::header::DataOrigin gDataOriginCDBPayload