R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandTacquilaReader.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
15#include "FairLogger.h"
16#include "FairRootManager.h"
18#include "TClonesArray.h"
19#include "ext_data_struct_info.hh"
20
21extern "C"
22{
23#include "ext_data_client.h"
25}
26
28 : R3BReader("R3BNeulandTacquilaReader")
29 , fNEvent(0)
30 , fData(data)
31 , fOffset(offset)
32 , fLogger(FairLogger::GetLogger())
33 , fArray(new TClonesArray("R3BNeulandTacquilaMappedData"))
34{
35}
36
38
39Bool_t R3BNeulandTacquilaReader::Init(ext_data_struct_info* a_struct_info)
40{
41 // Initialize input UCESB structure
42 Int_t ok;
44 if (!ok)
45 {
46 // Throw error
47 perror("ext_data_struct_info_item");
48 LOG(error) << "Failed to setup structure information.";
49 return kFALSE;
50 }
51
52 // Register output array in tree
53 FairRootManager::Instance()->Register("NeulandTacquilaMappedData", "Neuland", fArray, kTRUE);
54
55 return kTRUE;
56}
57
59{
60 // Convert plain raw data to multi-dimensional array
61 auto* data = reinterpret_cast<EXT_STR_h101_raw_nnp_tacquila_onion*>(fData);
62
63 // Loop over all planes, bars and PMT's
64 Int_t bar;
65 Int_t barId;
66 for (Int_t p = 0; p < 8; p++)
67 {
68 for (Int_t pmt = 0; pmt < 2; pmt++)
69 {
70 for (Int_t k = 0; k < data->NNP[p]._[pmt]._; k++)
71 {
72 // Signal channel
73 UInt_t tdc1 = data->NNP[p]._[pmt].TAC[k];
74 UInt_t clock1 = data->NNP[p]._[pmt].CLK[k];
75 UInt_t qdc = data->NNP[p]._[pmt].ADC[k];
76
77 // Stop signal (17-th channel)
78 UInt_t tdc2 = data->NNP[p]._[pmt].T[k];
79 // UInt_t clock2 = data->NNP[p]._[pmt].S[k];
80
81 bar = data->NNP[p]._[pmt].I[k];
82
83 // Calculate global bar index
84 barId = p * 50 + bar;
85
86 // Store data in output
87 if (tdc1 && tdc2)
88 {
89 new ((*fArray)[fArray->GetEntriesFast()])
90 R3BNeulandTacquilaMappedData(63 - clock1, 4095 - tdc1, 4095 - tdc2, qdc, p + 1, bar, pmt + 1);
91 }
92 }
93 }
94 }
95
96 fNEvent += 1;
97
98 return kTRUE;
99}
100
102{
103 // Reset the output array
104 fArray->Clear();
105}
106
ClassImp(R3B::Neuland::Cal2HitPar)
A reader of NeuLAND Tacquila data with UCESB.
R3BNeulandTacquilaReader(EXT_STR_h101_raw_nnp_tacquila *, UInt_t)
Standard constructor.
void Reset()
Method for clearing the output array.
Bool_t R3BRead()
Method for reading the data.
Bool_t Init(ext_data_struct_info *)
Method for reader initialization.
R3BReader(TString const &)
Definition R3BReader.cxx:16
struct EXT_STR_h101_raw_nnp_tacquila_onion_t EXT_STR_h101_raw_nnp_tacquila_onion
struct EXT_STR_h101_raw_nnp_tacquila_t EXT_STR_h101_raw_nnp_tacquila
#define EXT_STR_h101_raw_nnp_tacquila_ITEMS_INFO(ok, si, struct_t, offset, printerr)