BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnHodoEvent.cxx
Go to the documentation of this file.
1#include "BmnHodoEvent.h"
2
3#include <algorithm>
4
6 : TNamed()
7 , fTotalSignal(0.f)
9 , fPileUpStatus(BmnHodoStrip::PileUp::No)
10 , fStrips(new TClonesArray("BmnHodoStrip"))
11{}
12
14{
15 if (fStrips) {
16 fStrips->Delete();
17 delete fStrips;
18 fStrips = nullptr;
19 }
20}
21
23{
24 int idx = fStrips->GetEntriesFast();
25 auto* strip = new ((*fStrips)[idx]) BmnHodoStrip();
26 strip->SetStripId(strip_id);
27 return strip;
28}
29
31{
32 for (int i = 0, n = fStrips->GetEntriesFast(); i < n; ++i) {
33 auto* s = static_cast<BmnHodoStrip*>(fStrips->At(i));
34 if (s && s->GetStripId() == strip_id)
35 return s;
36 }
37 return nullptr;
38}
39
41{
42 auto* s = GetStrip(strip_id);
43 return s ? s : AddStrip(strip_id);
44}
45
47{
48 fTotalSignal = 0.f;
51 fStrips->Clear("C"); // destroys objects
52}
53
55{
56 fTotalSignal = 0.f;
59
60 for (int i = 0, n = fStrips->GetEntriesFast(); i < n; ++i) {
61 auto* strip = static_cast<BmnHodoStrip*>(fStrips->At(i));
62 if (!strip)
63 continue;
64
65 strip->clear();
66 }
67}
68
70{
71 fTotalSignal = 0.f;
74
75 for (int i = 0, n = fStrips->GetEntriesFast(); i < n; ++i) {
76 auto* strip = static_cast<BmnHodoStrip*>(fStrips->At(i));
77 if (!strip)
78 continue;
79
80 fTotalSignal += strip->GetSignal();
81 fTotalSignalIntegral += strip->GetIntegral();
82 fPileUpStatus = std::max(fPileUpStatus, strip->GetPileUpStatus());
83 }
84}
85
86void BmnHodoEvent::Print(Option_t* option) const {}
int i
Definition P4_F32vec4.h:22
const char Option_t
float fTotalSignal
void SummarizeEvent()
TClonesArray * fStrips
BmnHodoStrip * AddStrip(uint8_t strip_id)
float fTotalSignalIntegral
virtual ~BmnHodoEvent()
BmnHodoStrip::PileUp fPileUpStatus
BmnHodoStrip * GetStrip(uint8_t strip_id)
virtual void Print(Option_t *option="") const
BmnHodoStrip * GetOrAddStrip(uint8_t strip_id)
void SetStripId(int stripId)
friend friend class TClonesArray
*brief user defined string literal for JSON values *sa std::size_t n
Definition json.hpp:20362