39std::string getBranchNameLeft(
int sector)
41 std::stringstream branchnamestreamleft;
43 return branchnamestreamleft.str();
46std::string getBranchNameRight(
int sector)
48 std::stringstream branchnamestreamright;
49 branchnamestreamright <<
"TPCHitsShiftedSector" <<
sector;
50 return branchnamestreamright.str();
58 std::vector<dataformats::RangeReference<int, int>>
events;
67 size_t digitCounter = 0;
68 auto flush = [&](
bool finalFlush =
false) {
73 LOG(info) <<
"TPC: Flushed " <<
buffers.digits.size() <<
" digits, " <<
buffers.labels.getNElements() <<
" labels and " <<
buffers.commonMode.size() <<
" common mode entries";
75 digitCounter +=
buffers.digits.size();
82 if (!irecords.empty()) {
89 for (
int collID = 0; collID < irecords.size(); ++collID) {
90 const double eventTime = irecords[collID].getTimeNS() / 1000.f;
91 LOG(info) <<
"TPC: Event time " << eventTime <<
" us";
96 size_t startSize = digitCounter;
100 for (
auto& part : eventParts[collID]) {
101 const int eventID = part.entryID;
102 const int sourceID = part.sourceID;
105 std::vector<o2::tpc::HitGroup> hitsLeft;
106 std::vector<o2::tpc::HitGroup> hitsRight;
107 context.
retrieveHits(simChains, getBranchNameLeft(
sector).c_str(), part.sourceID, part.entryID, &hitsLeft);
108 context.
retrieveHits(simChains, getBranchNameRight(
sector).c_str(), part.sourceID, part.entryID, &hitsRight);
109 LOG(
debug) <<
"TPC: Found " << hitsLeft.size() <<
" hit groups left and " << hitsRight.size() <<
" hit groups right in collision " << collID <<
" eventID " << part.entryID;
124 LOG(info) <<
"TPC: Final flush";
126 events.emplace_back(0, digitCounter);
135 {
"TPCtriggered", VariantType::Bool,
false, {
"Impose triggered RO mode (default: continuous)"}},
136 {
"TPCuseCCDB", VariantType::Bool,
false, {
"true: load calibrations from CCDB; false: use random calibratoins"}},
137 {
"meanLumiDistortions", VariantType::Float, -1.f, {
"override lumi of distortion object if >=0"}},
138 {
"meanLumiDistortionsDerivative", VariantType::Float, -1.f, {
"override lumi of derivative distortion object if >=0"}},
139 {
"do-not-recalculate-distortions", VariantType::Bool,
false, {
"Do not recalculate the distortions"}},
140 {
"n-threads-distortions", VariantType::Int, 4, {
"Number of threads used for the calculation of the distortions"}},
150 if (distortionType) {
153 if (distortionType == 2) {
161 mDistortionType = distortionType;
162 mRecalcDistortions = !(ic.
options().
get<
bool>(
"do-not-recalculate-distortions"));
164 mUseCalibrationsFromCCDB = ic.
options().
get<
bool>(
"TPCuseCCDB");
165 mMeanLumiDistortions = ic.
options().
get<
float>(
"meanLumiDistortions");
166 mMeanLumiDistortionsDerivative = ic.
options().
get<
float>(
"meanLumiDistortionsDerivative");
167 LOG(info) <<
"TPC calibrations from CCDB: " << mUseCalibrationsFromCCDB;
178 LOGP(info,
"Updating distortion map");
179 digitizer.setUseSCDistortions(
static_cast<SC*
>(obj));
180 if (mMeanLumiDistortions >= 0) {
181 digitizer.setMeanLumiDistortions(mMeanLumiDistortions);
186 LOGP(info,
"Updating reference distortion map");
187 digitizer.setSCDistortionsDerivative(
static_cast<SC*
>(obj));
188 if (mMeanLumiDistortionsDerivative >= 0) {
189 digitizer.setMeanLumiDistortionsDerivative(mMeanLumiDistortionsDerivative);
194 LOGP(info,
"TPC gas param updated");
199 LOGP(info,
"TPC GEM param updated");
210 cdb.setUseDefaults(!mUseCalibrationsFromCCDB);
215 if (mDistortionType) {
217 if (mDistortionType == 2) {
220 if (mRecalcDistortions) {
228 LOGP(info,
"Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
229 vd.corrFact, vd.refVDrift, vd.timeOffsetCorr, vd.refTimeOffset, mVDriftHelper.
getSourceName());
230 setVDrift(vd.getVDrift(), vd.getTimeOffset());
234 if (std::filesystem::exists(
"ThresholdMap.root")) {
235 LOG(info) <<
"TPC: Using zero suppression map from 'ThresholdMap.root'";
236 cdb.setThresholdMapFromFile(
"ThresholdMap.root");
239 if (std::filesystem::exists(
"GainMap.root")) {
240 LOG(info) <<
"TPC: Using gain map from 'GainMap.root'";
241 cdb.setGainMapFromFile(
"GainMap.root");
Simple interface to the CDB manager.
CDB Type definitions for TPC.
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 sector
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 events
Timeframe settings Average distance in cm of events merged into timeframe
Definition of the parameter class for the GEM stack.
Definition of the parameter class for the detector gas.
This class contains the algorithms for calculation the distortions and corrections.
Definition of the ALICE TPC digitizer.
static const HBFUtils & Instance()
T get(const char *key) const
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
std::vector< o2::InteractionTimeRecord > & getEventRecords(bool withQED=false)
std::vector< std::vector< o2::steer::EventPart > > & getEventParts(bool withQED=false)
void retrieveHits(std::vector< TChain * > const &chains, const char *brname, int sourceID, int entryID, std::vector< T > *hits) const
function reading the hits from a chain (previously initialized with initSimChains
static CDBInterface & instance()
void setSeedingTimeframe(ULong64_t timeframe)
Set the timeframe identifier that enters the sector seeding.
void flush(std::vector< o2::tpc::Digit > &digits, o2::dataformats::MCTruthContainer< o2::MCCompLabel > &labels, std::vector< o2::tpc::CommonMode > &commonModeOutput, bool finalFlush=false)
void setSector(Sector sec)
void setOutputDigitTimeOffset(double offset)
Set mOutputDigitTimeOffset.
void setStartTime(double time)
void process(const std::vector< o2::tpc::HitGroup > &hits, const int eventID, const int sourceID=0)
void setEventTime(double time)
bool isContinuousReadout()
static Sector getLeft(const Sector s)
static void setNThreads(const int nThreads)
set the number of threads used for some of the calculations
static void addInputs(std::vector< framework::InputSpec > &inputs, int distortionType)
CCDB inputs common to the TPC digitizer devices.
bool finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj, Digitizer &digitizer)
pass a CCDB object to the digitizer; true if it was a TPC condition
static std::vector< framework::ConfigParamSpec > options()
options common to the TPC digitizer devices
void init(framework::InitContext &ic, int distortionType)
void update(framework::ProcessingContext &pc, Digitizer &digitizer, const std::function< void(float, float)> &setVDrift)
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs, bool laser=true, bool itstpcTgl=true)
void extractCCDBInputs(o2::framework::ProcessingContext &pc, bool laser=true, bool itstpcTgl=true)
const VDriftCorrFact & getVDriftObject() const
bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher &matcher, void *obj)
static std::string_view getSourceName(Source s)
constexpr o2::header::DataOrigin gDataOriginTPC
uint8_t int statusCode int
Lifetime
Possible Lifetime of objects being exchanged by the DPL.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
Global TPC definitions and constants.
std::vector< dataformats::RangeReference< int, int > > digitizeSector(Digitizer &digitizer, const steer::DigitizationContext &context, const std::vector< TChain * > &simChains, int sector, ULong64_t timeframe, SectorFlushBuffers &buffers, const std::function< void()> &onFlush)
const std::unordered_map< CDBType, const std::string > CDBTypeMap
Storage name in CCDB for each calibration and parameter type.
@ ParGas
Parameter for Gas.
@ DistortionMapDerivMC
derivative distortions for MC used in the digitizer for scaling
@ DistortionMapMC
full distortions (static + IR dependant) for MC used in the digitizer
Output buffers of one flush of a sector.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"