CbmRoot
Loading...
Searching...
No Matches
CbmSourceDigiTimeslice.h
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5#pragma once // include this header only once per compilation unit
6
7#include "CbmMvdDigi.h"
10
11#include <FairSource.h>
12
13#include <cstdint>
14#include <memory>
15#include <string>
16#include <vector>
17
18class CbmTimeSlice;
20class FairRootManager;
21
33class CbmSourceDigiTimeslice : public FairSource {
34
35 public:
41 CbmSourceDigiTimeslice(const char* fileName = "");
42
45
48
51
53 virtual void Close();
54
58 virtual Source_Type GetSourceType() { return fSourceType; }
59
61 virtual Bool_t Init();
62
64 virtual Bool_t InitUnpackers() { return kTRUE; }
65
67 Int_t ReadEvent(UInt_t = 0);
68
70 virtual Bool_t ReInitUnpackers() { return kTRUE; }
71
73 virtual void Reset() {}
74
76 virtual void SetParUnpackers() {}
77
81 void SetSourceType(Source_Type type) { fSourceType = type; }
82
84 Bool_t SpecifyRunId() { return kTRUE; }
85
86
87 private:
89 std::string fInputFileName = {};
90
92 std::unique_ptr<cbm::algo::RecoResultsInputArchive> fArchive = nullptr;
93
95 std::vector<CbmBmonDigi>* fBmonDigis = nullptr;
96 std::vector<CbmMvdDigi>* fMvdDigis = nullptr;
97 std::vector<CbmStsDigi>* fStsDigis = nullptr;
98 std::vector<CbmMuchDigi>* fMuchDigis = nullptr;
99 std::vector<CbmTrdDigi>* fTrdDigis = nullptr;
100 std::vector<CbmTofDigi>* fTofDigis = nullptr;
101 std::vector<CbmRichDigi>* fRichDigis = nullptr;
102 std::vector<CbmFsdDigi>* fFsdDigis = nullptr;
103
108 Source_Type fSourceType = Source_Type::kONLINE;
109
114
117
118
120 size_t fNumTs = 0;
121
122 template<typename TVecobj>
123 Bool_t RegisterVector(FairRootManager* ioman, std::vector<TVecobj>*& vec);
124
125 template<typename TVecobj>
126 typename std::enable_if<std::is_member_function_pointer<decltype(&TVecobj::GetTime)>::value, void>::type
127 Timesort(std::vector<TVecobj>* vec = nullptr)
128 {
129 if (vec == nullptr) return;
130 std::sort(vec->begin(), vec->end(),
131 [](const TVecobj& a, const TVecobj& b) -> bool { return a.GetTime() < b.GetTime(); });
132 }
133
134
135 ClassDef(CbmSourceDigiTimeslice, 1)
136};
int Int_t
bool Bool_t
Source class for reading from files resulting from online processing (containing raw Digis)
CbmSourceDigiTimeslice(const CbmSourceDigiTimeslice &)=delete
Copy constructor - not implemented.
CbmSourceDigiTimeslice & operator=(const CbmSourceDigiTimeslice &)=delete
Assignment operator - not implemented.
std::vector< CbmStsDigi > * fStsDigis
std::vector< CbmBmonDigi > * fBmonDigis
Source_Type fSourceType
type of source that is currently used
virtual void Close()
Close source after end of run.
virtual ~CbmSourceDigiTimeslice()
Destructor.
virtual void SetParUnpackers()
Set unpacker parameters (forced by base class, not relevant here)
virtual Bool_t InitUnpackers()
Initialise unpackers (forced by base class, not relevant here)
CbmSourceDigiTimeslice(const char *fileName="")
Constructor.
Bool_t RegisterVector(FairRootManager *ioman, std::vector< TVecobj > *&vec)
std::vector< CbmFsdDigi > * fFsdDigis
std::vector< CbmTofDigi > * fTofDigis
Bool_t SpecifyRunId()
Set Run ID (forced by base class, not relevant here)
Int_t ReadEvent(UInt_t=0)
Read one time slice from file.
std::vector< CbmMvdDigi > * fMvdDigis
std::enable_if< std::is_member_function_pointer< decltype(&TVecobj::GetTime)>::value, void >::type Timesort(std::vector< TVecobj > *vec=nullptr)
void SetSourceType(Source_Type type)
Set the Source Type.
virtual Bool_t ReInitUnpackers()
Re-Initialise unpackers (forced by base class, not relevant here)
std::vector< CbmMuchDigi > * fMuchDigis
std::vector< CbmRichDigi > * fRichDigis
virtual void Reset()
Reset (forced by base class, not relevant here)
std::vector< CbmTrdDigi > * fTrdDigis
CbmTsEventHeader * fTsEventHeader
virtual Bool_t Init()
Initialisation.
virtual Source_Type GetSourceType()
Source type.
std::unique_ptr< cbm::algo::RecoResultsInputArchive > fArchive
Bookkeeping of time-slice content.