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 "DigiData.h"
9
10#include <FairSource.h>
11
12#include <cstdint>
13#include <memory>
14#include <string>
15#include <vector>
16
17class CbmTimeSlice;
19class FairRootManager;
20
32class CbmSourceDigiTimeslice : public FairSource {
33
34 public:
40 CbmSourceDigiTimeslice(const char* fileName = "");
41
44
47
50
52 virtual void Close();
53
57 virtual Source_Type GetSourceType() { return fSourceType; }
58
60 virtual Bool_t Init();
61
63 virtual Bool_t InitUnpackers() { return kTRUE; }
64
66 Int_t ReadEvent(UInt_t = 0);
67
69 virtual Bool_t ReInitUnpackers() { return kTRUE; }
70
72 virtual void Reset() {}
73
75 virtual void SetParUnpackers() {}
76
80 void SetSourceType(Source_Type type) { fSourceType = type; }
81
83 Bool_t SpecifyRunId() { return kTRUE; }
84
85
86 private:
88 std::string fInputFileName = {};
89
91 std::unique_ptr<cbm::algo::RecoResultsInputArchive> fArchive = nullptr;
92
94 std::vector<CbmBmonDigi>* fBmonDigis = nullptr;
95 std::vector<CbmStsDigi>* fStsDigis = nullptr;
96 std::vector<CbmMuchDigi>* fMuchDigis = nullptr;
97 std::vector<CbmTrdDigi>* fTrdDigis = nullptr;
98 std::vector<CbmTofDigi>* fTofDigis = nullptr;
99 std::vector<CbmRichDigi>* fRichDigis = nullptr;
100
105 Source_Type fSourceType = Source_Type::kONLINE;
106
111
114
115
117 size_t fNumTs = 0;
118
119 template<typename TVecobj>
120 Bool_t RegisterVector(FairRootManager* ioman, std::vector<TVecobj>*& vec);
121
122 template<typename TVecobj>
123 typename std::enable_if<std::is_member_function_pointer<decltype(&TVecobj::GetTime)>::value, void>::type
124 Timesort(std::vector<TVecobj>* vec = nullptr)
125 {
126 if (vec == nullptr) return;
127 std::sort(vec->begin(), vec->end(),
128 [](const TVecobj& a, const TVecobj& b) -> bool { return a.GetTime() < b.GetTime(); });
129 }
130
131
132 ClassDef(CbmSourceDigiTimeslice, 1)
133};
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< 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::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.