KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVEventReconstructor.cpp
1#include "KVEventReconstructor.h"
2#include "KVDetectorEvent.h"
3#include "KVGroupReconstructor.h"
4#include "KVTarget.h"
5
6#include <iostream>
7using namespace std;
8
10
11
12
22
24 : KVBase("KVEventReconstructor", Form("Reconstruction of events in array %s", a->GetName())),
25 fArray(a), fEvent(e), fGroupReconstructor(a->GetNumberOfGroups(), 1)
26{
27 // Default constructor
28 // Set up group reconstructor for every group of the array.
29 // It is assumed that these are all numbered uniquely & sensibly ;)
30 //
31 // Identification & calibration are enabled or not depending on the following
32 // (possibly-dataset-dependent) variables:
33 //
34 // EventReconstruction.DoIdentification
35 // EventReconstruction.DoCalibration
36
37 fGroupReconstructor.SetOwner();
38 unique_ptr<KVSeqCollection> gr_list(a->GetStructureTypeList("GROUP"));
39 KVGroup* gr;
40 TIter it(gr_list.get());
41 unsigned int N = gr_list->GetEntries();
42 while ((gr = (KVGroup*)it())) {
43 UInt_t i = gr->GetNumber();
44 if (i > N || i < 1) {
45 Warning("KVEventReconstructor", "Groups in array %s are not numbered the way I like...%u", a->GetName(), i);
46 gr->Print();
47 }
48 else {
49 if (fGroupReconstructor[i]) {
50 Warning("KVEventReconstructor", "%s array has non-unique group numbers!!!", a->GetName());
51 }
52 else {
53 fGroupReconstructor[i] = a->GetReconstructorForGroup(gr);
54 if (fGroupReconstructor[i]) {
55 ((KVGroupReconstructor*)fGroupReconstructor[i])->SetReconEventClass(e->IsA());
56 ((KVGroupReconstructor*)fGroupReconstructor[i])->SetGroup(gr);
57 }
58 }
59 }
60 }
61
62 KVGroupReconstructor::SetDoIdentification(GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoIdentification", kTRUE));
63 KVGroupReconstructor::SetDoCalibration(GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoCalibration", kTRUE));
64 Info("KVEventReconstructor", "Initialised for %u groups of multidetector %s", N, fArray->GetName());
65 if (GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoIdentification", kTRUE) || GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoCalibration", kTRUE)) {
66 if (GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoIdentification", kTRUE)) {
67 Info("KVEventReconstructor", " -- identification of events will be performed");
68 fArray->PrintStatusOfIDTelescopes();
69 }
70 if (GetDataSetEnv(fArray->GetDataSet(), "EventReconstruction.DoCalibration", kTRUE)) {
71 Info("KVEventReconstructor", " -- calibration of events will be performed");
72 fArray->PrintCalibStatusOfDetectors();
73 }
74 }
75 else
76 Info("KVEventReconstructor", " -- no identification or calibration will be performed");
77}
78
79
80
81
89
91{
92 // This method copies the current state of 'this' object into 'obj'
93 // You should add here any member variables, for example:
94 // (supposing a member variable KVEventReconstructor::fToto)
95 // CastedObj.fToto = fToto;
96 // or
97 // CastedObj.SetToto( GetToto() );
98
99 KVBase::Copy(obj);
100 //KVEventReconstructor& CastedObj = (KVEventReconstructor&)obj;
101}
102
103
104
110
112{
113 // Reconstruct current event based on state of detectors in array
114 //
115 // The list pointer, if given, can be used to supply a list of fired
116 // acquisition parameters to KVMultiDetArray::GetDetectorEvent
117
118 if (GetArray()->GetTarget()) {
119 // for target energy loss correction calculation
122 }
123
124 GetEvent()->Clear("N");// No Group Reset (would not reset groups with no reconstructed particles)
125 detev.Clear("N");// reset all groups (but not acquisition parameters), even if no particles were reconstructed in them
126
127 GetArray()->GetDetectorEvent(&detev, fired);
128
129 fNGrpRecon = 0;
130 fHitGroups.clear();
131 fHitGroups.reserve(detev.GetGroups()->GetEntries());
132 TIter it(detev.GetGroups());
133 KVGroup* group;
134 while ((group = (KVGroup*)it())) {
136 if (grec) {
137 fHitGroups[fNGrpRecon] = group->GetNumber();
138 grec->Process();
139 ++fNGrpRecon;
140 }
141 }
142
143 // merge resulting event fragments
145
146 // copy any parameters stocked in the detector(s) during reconstruction in the reconstructed event
148}
149
150
151
155
157{
158 // After processing has finished in groups, call this method to produce
159 // a final merged event containing particles from all groups
160
161 TList to_merge;
162
163 for (int k = 0; k < fNGrpRecon; ++k) {
164 int i = fHitGroups[k];
165 to_merge.Add(((KVGroupReconstructor*)fGroupReconstructor[i])->GetEventFragment());
166 }
167 GetEvent()->MergeEventFragments(&to_merge, "N");// "N" = no group reset
168}
169
170
unsigned int UInt_t
#define e(i)
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
#define N
Base class for KaliVeda framework.
Definition KVBase.h:142
virtual void Copy(TObject &) const
Make a copy of this object.
Definition KVBase.cpp:394
KVUniqueNameList * GetGroups()
virtual void Clear(Option_t *opt="")
Base class for event reconstruction from array data.
KVDetectorEvent detev
list of hit groups in event
TObjArray fGroupReconstructor
array of group reconstructors
KVReconstructedEvent * GetEvent()
void Copy(TObject &obj) const
KVMultiDetArray * GetArray()
Int_t fNGrpRecon
number of group reconstructors for current event
void ReconstructEvent(const TSeqCollection *=nullptr)
std::vector< int > fHitGroups
group indices in current event
void Clear(Option_t *opt="")
Definition KVEvent.h:238
Base class for particle reconstruction in one group of a detector array.
static void SetDoCalibration(bool on=kTRUE)
static void SetDoIdentification(bool on=kTRUE)
Group of detectors which can be treated independently of all others in array.
Definition KVGroup.h:20
Base class for describing the geometry of a detector array.
virtual void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *fired_params=0)
virtual void SetReconParametersInEvent(KVReconstructedEvent *) const
Copy any parameters in fReconParameters in to the reconstructed event parameter list.
KVTarget * GetTarget()
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
void MergeEventFragments(TCollection *, Option_t *opt="")
void SetIncoming(Bool_t r=kTRUE)
Definition KVTarget.h:217
void SetOutgoing(Bool_t r=kTRUE)
Definition KVTarget.h:237
virtual Int_t GetEntries() const
void Print(Option_t *chopt="") const override
void Add(TObject *obj) override
virtual const char * GetName() const
TGraphErrors * gr
void Info(const char *location, const char *fmt,...)
void Warning(const char *location, const char *fmt,...)
TArc a
ClassImp(TPyArg)