R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BUcesbSource.h
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3
* Copyright (C) 2019-2025 Members of R3B Collaboration *
4
* *
5
* This software is distributed under the terms of the *
6
* GNU General Public Licence (GPL) version 3, *
7
* copied verbatim in the file "LICENSE". *
8
* *
9
* In applying this license GSI does not waive the privileges and immunities *
10
* granted to it by virtue of its status as an Intergovernmental Organization *
11
* or submit itself to any jurisdiction. *
12
******************************************************************************/
13
14
/* R3BUcesbSource.h
15
* R3BROOT
16
*
17
* Author: Bastian Löher <b.loeher@gsi.de>
18
* Date: 29/05/15
19
* */
20
21
#pragma once
22
23
#include "
R3BReader.h
"
24
25
#include <FairSource.h>
26
#include <Rtypes.h>
27
#include <TObjArray.h>
28
#include <TString.h>
29
30
#include <fstream>
31
#include <list>
32
33
/* External data client interface (ucesb) */
34
#include "ext_data_clnt.hh"
35
#include "ext_data_struct_info.hh"
36
37
/* External data structure
38
* This structure is produced using ucesb in the following way:
39
* ./ucesb --ntuple=RAW,STRUCT_HH,ext_h101.h
40
* */
41
struct
EXT_STR_h101_t
;
42
typedef
struct
EXT_STR_h101_t
EXT_STR_h101
;
43
44
class
R3BEventHeader
;
45
46
class
R3BUcesbSource
:
public
FairSource
47
{
48
public
:
49
R3BUcesbSource
(
const
TString&,
const
TString&,
const
TString&,
EXT_STR_h101
*,
size_t
);
50
virtual
~R3BUcesbSource
();
51
52
Source_Type
GetSourceType
() {
return
kONLINE; }
53
54
/* Init() will fork a ucesb instance to deliver the unpacked data for
55
* R3BRoot. It makes use of the ext_data_ interface of ucesb.
56
* */
57
virtual
Bool_t
Init
();
58
59
virtual
Bool_t
SpecifyRunId
();
60
61
virtual
Bool_t
InitUnpackers
();
62
virtual
void
SetParUnpackers
();
63
virtual
Bool_t
ReInitUnpackers
();
64
/* A wrapper for ext_data_fetch_event() */
65
Int_t
ReadEvent
(UInt_t);
66
/* Close the ext_data_ interface */
67
virtual
void
Close
();
68
/* Reset the readers */
69
virtual
void
Reset
();
70
/* The reader interface */
71
void
AddReader
(
R3BReader
* a_reader) {
fReaders
->Add(a_reader); }
72
/* Limit the number of events */
73
void
SetMaxEvents
(
int
a_max) {
fLastEventNo
= a_max; }
74
/* Get readers */
75
const
TObjArray*
GetReaders
()
const
{
return
fReaders
; }
76
77
virtual
void
FillEventHeader
(FairEventHeader* feh);
78
79
inline
void
SetInputFileName
(TString tstr) {
fInputFileName
= std::move(tstr); }
80
81
inline
void
SetFullDataStructureValidation
() {
fFullDataStructureValidation
=
true
; }
82
83
private
:
84
/* File descriptor returned from popen() */
85
FILE*
fFd
;
86
/* The ucesb interface class */
87
ext_data_clnt
fClient
;
88
/* The ucesb structure info class */
89
ext_data_struct_info
fStructInfo
;
90
/* The filename to read */
91
const
TString
fFileName
;
92
/* Ucesb output options */
93
const
TString
fNtupleOptions
;
94
/* The location of the unpacker */
95
const
TString
fUcesbPath
;
96
/* The event counter */
97
unsigned
int
fNEvent
;
98
/* The full event structure */
99
EXT_STR_h101
*
fEvent
;
100
size_t
fEventSize
;
101
/* Last event requested */
102
int
fLastEventNo
;
103
/* The array of readers */
104
TObjArray*
fReaders
;
105
/* R3B header */
106
R3BEventHeader
*
fEventHeader
;
107
Int_t
ReadIntFromString
(
const
std::string& wholestr,
const
std::string& pattern);
108
TString
fInputFileName
;
109
std::ifstream
fInputFile
;
110
Int_t
fEntryMax
;
111
bool
fFullDataStructureValidation
=
false
;
112
113
public
:
114
// Create dictionary
115
ClassDef(
R3BUcesbSource
, 1)
116
};
R3BReader.h
EXT_STR_h101
struct EXT_STR_h101_t EXT_STR_h101
Definition
R3BUcesbSource.h:42
R3BEventHeader
Definition
R3BEventHeader.h:23
R3BReader
Definition
R3BReader.h:26
R3BUcesbSource::fClient
ext_data_clnt fClient
Definition
R3BUcesbSource.h:87
R3BUcesbSource::ReadEvent
Int_t ReadEvent(UInt_t)
Definition
R3BUcesbSource.cxx:233
R3BUcesbSource::R3BUcesbSource
R3BUcesbSource(const TString &, const TString &, const TString &, EXT_STR_h101 *, size_t)
Definition
R3BUcesbSource.cxx:28
R3BUcesbSource::Init
virtual Bool_t Init()
Definition
R3BUcesbSource.cxx:62
R3BUcesbSource::GetSourceType
Source_Type GetSourceType()
Definition
R3BUcesbSource.h:52
R3BUcesbSource::InitUnpackers
virtual Bool_t InitUnpackers()
Definition
R3BUcesbSource.cxx:129
R3BUcesbSource::fFileName
const TString fFileName
Definition
R3BUcesbSource.h:91
R3BUcesbSource::SetParUnpackers
virtual void SetParUnpackers()
Definition
R3BUcesbSource.cxx:202
R3BUcesbSource::fEventHeader
R3BEventHeader * fEventHeader
Definition
R3BUcesbSource.h:106
R3BUcesbSource::Reset
virtual void Reset()
Definition
R3BUcesbSource.cxx:355
R3BUcesbSource::SetFullDataStructureValidation
void SetFullDataStructureValidation()
Definition
R3BUcesbSource.h:81
R3BUcesbSource::FillEventHeader
virtual void FillEventHeader(FairEventHeader *feh)
Definition
R3BUcesbSource.cxx:371
R3BUcesbSource::AddReader
void AddReader(R3BReader *a_reader)
Definition
R3BUcesbSource.h:71
R3BUcesbSource::fInputFileName
TString fInputFileName
Definition
R3BUcesbSource.h:108
R3BUcesbSource::fUcesbPath
const TString fUcesbPath
Definition
R3BUcesbSource.h:95
R3BUcesbSource::SetMaxEvents
void SetMaxEvents(int a_max)
Definition
R3BUcesbSource.h:73
R3BUcesbSource::fFullDataStructureValidation
bool fFullDataStructureValidation
Definition
R3BUcesbSource.h:111
R3BUcesbSource::fReaders
TObjArray * fReaders
Definition
R3BUcesbSource.h:104
R3BUcesbSource::fEntryMax
Int_t fEntryMax
Definition
R3BUcesbSource.h:110
R3BUcesbSource::ReInitUnpackers
virtual Bool_t ReInitUnpackers()
Definition
R3BUcesbSource.cxx:210
R3BUcesbSource::GetReaders
const TObjArray * GetReaders() const
Definition
R3BUcesbSource.h:75
R3BUcesbSource::fNtupleOptions
const TString fNtupleOptions
Definition
R3BUcesbSource.h:93
R3BUcesbSource::fStructInfo
ext_data_struct_info fStructInfo
Definition
R3BUcesbSource.h:89
R3BUcesbSource::fEvent
EXT_STR_h101 * fEvent
Definition
R3BUcesbSource.h:99
R3BUcesbSource::fEventSize
size_t fEventSize
Definition
R3BUcesbSource.h:100
R3BUcesbSource::SpecifyRunId
virtual Bool_t SpecifyRunId()
Definition
R3BUcesbSource.cxx:363
R3BUcesbSource::fNEvent
unsigned int fNEvent
Definition
R3BUcesbSource.h:97
R3BUcesbSource::fLastEventNo
int fLastEventNo
Definition
R3BUcesbSource.h:102
R3BUcesbSource::ReadIntFromString
Int_t ReadIntFromString(const std::string &wholestr, const std::string &pattern)
Definition
R3BUcesbSource.cxx:225
R3BUcesbSource::Close
virtual void Close()
Definition
R3BUcesbSource.cxx:326
R3BUcesbSource::fFd
FILE * fFd
Definition
R3BUcesbSource.h:85
R3BUcesbSource::fInputFile
std::ifstream fInputFile
Definition
R3BUcesbSource.h:109
R3BUcesbSource::SetInputFileName
void SetInputFileName(TString tstr)
Definition
R3BUcesbSource.h:79
EXT_STR_h101_t
Definition
neuland_lmd_to_map.cxx:39
r3bsource
base
R3BUcesbSource.h
Generated by
1.18.0