R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BUnpackReader.cxx
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#include "FairRootManager.h"
15#include "R3BLogger.h"
16
17#include "R3BEventHeader.h"
18#include "R3BUnpackReader.h"
19
20extern "C"
21{
22#include "ext_data_client.h"
23#include "ext_h101_unpack.h"
24}
25#include <iostream>
26
28 : R3BReader("R3BUnpackReader")
29 , fNEvent(0)
30 , fData(data)
31 , fOffset(offset)
32 , fHeader(NULL)
33{
34}
35
36Bool_t R3BUnpackReader::Init(ext_data_struct_info* a_struct_info)
37{
38 Int_t ok;
39 R3BLOG(info, "");
40 EXT_STR_h101_unpack_ITEMS_INFO(ok, *a_struct_info, fOffset, EXT_STR_h101_unpack, 0);
41 if (!ok)
42 {
43 R3BLOG(error, "Failed to setup structure information.");
44 return kFALSE;
45 }
46
47 // Look for the R3BEventHeader
48 auto frm = FairRootManager::Instance();
49 fHeader = dynamic_cast<R3BEventHeader*>(frm->GetObject("EventHeader."));
50 if (!fHeader)
51 {
52 R3BLOG(warn, "EventHeader. not found");
53 }
54 else
55 R3BLOG(info, "EventHeader. found");
56
57 return kTRUE;
58}
59
61{
62 /* Display data */
63 // LOG(info) << " Event data:";
64 // char strMessage[1000];
65 // sprintf(strMessage, " %10d (d%10d): %2d\n",
66 // fData->EVENTNO,
67 // fData->EVENTNO - fNEvent,
68 // fData->TRIGGER);
69 // LOG(info) << strMessage;
70
71 // fNEvent = fData->EVENTNO;
72
73 if (0 == (fNEvent % 1000))
74 {
75 R3BLOG(debug1, "event : " << fNEvent << ", trigger : " << fData->TRIGGER);
76 }
77
78 if (fHeader)
79 {
80 fHeader->SetTrigger(fData->TRIGGER);
81 fHeader->SetEventno(fNEvent++);
82 }
83
84 return kTRUE;
85}
86
88
#define R3BLOG(severity, x)
Definition R3BLogger.h:35
ClassImp(R3B::Neuland::Cal2HitPar)
R3BReader(TString const &)
Definition R3BReader.cxx:16
virtual Bool_t R3BRead() override
R3BUnpackReader(EXT_STR_h101_unpack *, size_t)
virtual void Reset() override
virtual Bool_t Init(ext_data_struct_info *) override
struct EXT_STR_h101_unpack_t EXT_STR_h101_unpack
#define EXT_STR_h101_unpack_ITEMS_INFO(ok, si, offset, struct_t, printerr)