CbmRoot
Loading...
Searching...
No Matches
event_data_struct.h
Go to the documentation of this file.
1/* Copyright (C) 2021 Institute for Nuclear Research, Moscow
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Nikolay Karpushkin [committer] */
4
5#ifndef EVENT_DATA_STRUCT
6#define EVENT_DATA_STRUCT
7
8#include <TMath.h>
9#include <TObject.h>
10#include <TString.h>
11#include <TTree.h>
12
13#include <fstream>
14
15
16//data processed from waveform
18
19 Float_t EdepFPGA;
20 Float_t EdepWfm;
21 Float_t Ampl;
22 Float_t Minimum;
23 Float_t ZL;
24 Float_t Time;
25 Int_t TimeMax;
26 Float_t TimeHalf;
27 Float_t TimeInEvent;
28
29 Float_t FitEdep;
30 Float_t FitAmpl;
31 Float_t FitZL;
32 Float_t FitR2;
33 Float_t FitTimeMax;
34
35 ULong64_t EventTime;
36
37
38 void reset()
39 {
40 EdepFPGA = 0.;
41 EdepWfm = 0.;
42 Ampl = 0.;
43 Minimum = 0.;
44 ZL = 0.;
45 Time = 0.;
46 TimeMax = -1;
47 TimeHalf = -1.;
48 TimeInEvent = -1.;
49
50 FitEdep = 0.;
51 FitAmpl = 0.;
52 FitZL = 0.;
53 FitR2 = 999.;
54 FitTimeMax = -1.;
55
56 EventTime = 0;
57 }
58
59 void Print()
60 {
61 printf("[EdepFPGA %.0f; EdepWfm %.0f; Ampl %.0f; Minumum %.0f; ZL %.2f; Time %.2f; TimeMax %i; TimeHalf %.2f; "
62 "TimeInEvent %.2f; FitEdep %.2f; FitAmpl %.2f; FitZL %.2f; FitR2 %.2f; FitTimeMax %.2f; EventTime %llu]",
65 }
66
67 static TString GetChName(Int_t channel_num) { return TString::Format("channel_%i", channel_num); }
68
69 TBranch* CreateBranch(TTree* tree, Int_t channel_num)
70 {
71 return tree->Branch(GetChName(channel_num).Data(), this,
72 "EdepFPGA/F:EdepWfm/F:Ampl/F:Minimum/F:ZL/F:Time/F:TimeMax/I:TimeHalf/F:TimeInEvent/F:FitEdep/"
73 "F:FitAmpl/F:FitZL/F:FitR2/F:FitTimeMax/F:EventTime/l");
74 }
75
76
77 Int_t SetBranch(TTree* tree, Int_t channel_num)
78 {
79 return tree->SetBranchAddress(GetChName(channel_num).Data(), this);
80 }
81};
82
83
84#endif // EVENT_DATA_STRUCT
static TString GetChName(Int_t channel_num)
Int_t SetBranch(TTree *tree, Int_t channel_num)
TBranch * CreateBranch(TTree *tree, Int_t channel_num)