54 LOG(info) <<
"initializing track sampler";
56 auto inputFileName = ic.
options().
get<std::string>(
"infile");
59 throw invalid_argument(
"cannot open input file" + inputFileName);
62 throw length_error(
"input file is empty");
67 throw invalid_argument(
"number of events per time frame must be >= 1");
70 auto stop = [
this]() {
72 LOG(info) <<
"stop track sampler";
83 static uint32_t
event(0);
106 std::vector<
Cluster, o2::pmr::polymorphic_allocator<Cluster>>&
clusters)
112 int nTracksAtVtx(-1);
113 mInputFile.read(
reinterpret_cast<char*
>(&nTracksAtVtx),
sizeof(
int));
115 throw length_error(
"invalid input");
118 mInputFile.read(
reinterpret_cast<char*
>(&nMCHTracks),
sizeof(
int));
120 throw length_error(
"invalid input");
125 throw length_error(
"invalid input");
128 if (nTracksAtVtx < 0 || nMCHTracks < 0 ||
nClusters < 0) {
129 throw length_error(
"invalid input");
132 throw length_error(
"clusters are missing");
136 if (nTracksAtVtx > 0) {
139 throw length_error(
"invalid input");
143 if (nMCHTracks > 0) {
146 int trackOffset = tracks.size();
147 tracks.resize(trackOffset + nMCHTracks);
148 mInputFile.read(
reinterpret_cast<char*
>(&tracks[trackOffset]), nMCHTracks *
sizeof(
TrackMCH));
150 throw length_error(
"invalid input");
154 int clusterOffset =
clusters.size();
158 throw length_error(
"invalid input");
162 for (
auto itTrack = tracks.begin() + trackOffset; itTrack < tracks.end(); ++itTrack) {
163 itTrack->setClusterRef(clusterOffset, itTrack->getNClusters());
164 clusterOffset += itTrack->getNClusters();
166 if (clusterOffset !=
clusters.size()) {
167 throw length_error(
"inconsistent cluster references");
182 if (forTrackFitter) {
183 outputs.emplace_back(
OutputLabel{
"rofs"},
"MCH",
"TRACKROFSIN", 0, Lifetime::Timeframe);
184 outputs.emplace_back(
OutputLabel{
"tracks"},
"MCH",
"TRACKSIN", 0, Lifetime::Timeframe);
185 outputs.emplace_back(
OutputLabel{
"clusters"},
"MCH",
"TRACKCLUSTERSIN", 0, Lifetime::Timeframe);
187 outputs.emplace_back(
OutputLabel{
"rofs"},
"MCH",
"TRACKROFS", 0, Lifetime::Timeframe);
188 outputs.emplace_back(
OutputLabel{
"tracks"},
"MCH",
"TRACKS", 0, Lifetime::Timeframe);
189 outputs.emplace_back(
OutputLabel{
"clusters"},
"MCH",
"TRACKCLUSTERS", 0, Lifetime::Timeframe);
197 Options{{
"infile", VariantType::String,
"", {
"input filename"}},
198 {
"nEventsPerTF", VariantType::Int, 1, {
"number of events per time frame"}}}};
Definition of the MCH track parameters minimal structure.
Definition of the MCH track.
Definition of a data processor to read and send tracks.
T get(const char *key) const
decltype(auto) make(const Output &spec, Args... args)
ServiceRegistryRef services()
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
MCH track external format.
void run(framework::ProcessingContext &pc)
void init(framework::InitContext &ic)
int mNEventsPerTF
number of events per time frame
std::ifstream mInputFile
input file
int readOneEvent(std::vector< TrackMCH, o2::pmr::polymorphic_allocator< TrackMCH > > &tracks, std::vector< Cluster, o2::pmr::polymorphic_allocator< Cluster > > &clusters)
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
o2::framework::DataProcessorSpec getTrackSamplerSpec(const char *specName, bool forTrackFitter)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
cluster minimal structure
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters