31std::vector<o2::dcs::DataPointCompositeObject>
generate(std::vector<std::string> aliases,
int val)
33 std::vector<o2::dcs::DataPointCompositeObject> dataPoints;
53 void fillAliasesStrobeDuration();
56 uint64_t mMaxTF = 1e6;
58 uint64_t mMaxCyclesNoFullMap;
59 uint64_t changeAfterTF = 0;
62 bool isStrobeDurationData =
false;
63 std::vector<std::string> mAliases;
64 std::vector<o2::dcs::test::HintType> mDataPointHints;
70void ITSDCSDataGenerator::fillAliasesStrobeDuration()
75 int nStaves[] = {12, 16, 20, 24, 30, 42, 48};
76 for (
int iL = 0; iL < 7; iL++) {
77 for (
int iS = 0; iS < nStaves[iL]; iS++) {
79 mAliases.push_back(
"ITS_L" +
std::to_string(iL) +
"_" + stv +
"_STROBE");
86 mMaxTF = ic.
options().
get<int64_t>(
"max-timeframes");
87 mMaxCyclesNoFullMap = ic.
options().
get<int64_t>(
"max-cycles-no-full-map");
88 isStrobeDurationData = ic.
options().
get<
bool>(
"generate-strobe-duration-data");
89 changeAfterTF = ic.
options().
get<int64_t>(
"change-after-n-timeframes");
93 if (isStrobeDurationData) {
94 fillAliasesStrobeDuration();
101 uint64_t tfid = o2::header::get<o2::framework::DataProcessingHeader*>((*input).header)->startTime;
102 if (tfid >= mMaxTF) {
103 LOG(info) <<
"ITS DCS Data generator reached TF " << tfid <<
", stopping";
109 bool doGen = mTFs % mMaxCyclesNoFullMap == 0;
110 std::vector<o2::dcs::DataPointCompositeObject> dpcoms;
112 dpcoms =
generate(mAliases, mTFs > changeAfterTF ? valueB : valueA);
115 LOG(info) <<
"TF " << tfid <<
" has generated " << dpcoms.size() <<
" DPs";
117 auto timeNow = std::chrono::system_clock::now();
118 timingInfo.creation = std::chrono::duration_cast<std::chrono::milliseconds>(timeNow.time_since_epoch()).count();
129 std::string desc{detName};
130 desc +=
"DATAPOINTS";
137 "its-dcs-data-generator",
139 Outputs{{{
"outputDCS"},
"ITS", dd}},
142 {
"change-after-n-timeframes", VariantType::Int64, 99999999999ll, {
"change value generated after n timeframes: do not change val by default"}},
143 {
"value-a", VariantType::Int, 0, {
"First value to be generated, will change to value-b after nTF = change-after-n-timeframes"}},
144 {
"value-b", VariantType::Int, 1, {
"Second value to be generated, will be after value-a once nTF = change-after-n-timeframes has been reached"}},
145 {
"max-timeframes", VariantType::Int64, 99999999999ll, {
"max TimeFrames to generate"}},
146 {
"max-cycles-no-full-map", VariantType::Int64, 6000ll, {
"max num of cycles between the sending of 2 full maps"}},
147 {
"generate-strobe-duration-data", VariantType::Bool,
false, {
"enable generation of DCS data containing the strobe duration in BCs"}}}};
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void init(InitContext &context)
virtual void run(ProcessingContext &context)=0
GLsizei const GLchar *const * string
o2::dcs::DataPointCompositeObject createDataPointCompositeObject(const std::string &alias, T val, uint32_t seconds, uint16_t msec, uint16_t flags=0)
@ Me
Only quit this data processor.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
o2::framework::DataProcessorSpec getITSDCSDataGeneratorSpec(const char *detName="ITS")
std::vector< std::string > aliases(std::vector< MeasurementType > types={ MeasurementType::HV_V, MeasurementType::HV_I, MeasurementType::LV_V_FEE_ANALOG, MeasurementType::LV_V_FEE_DIGITAL, MeasurementType::LV_V_SOLAR})
void append(const char *msg, std::string &to)
TLorentzVector generate(Vec3D &vtx, std::vector< o2::track::TrackParCov > &vctr, float bz, TGenPhaseSpace &genPHS, double parMass, const std::vector< double > &dtMass, std::vector< int > forceQ)
Defining DataPointCompositeObject explicitly as copiable.
std::string to_string(gsl::span< T, Size > span)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"