KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVIdentificationResult.h
1#ifndef KVIDENTIFICATIONRESULT_H
2#define KVIDENTIFICATIONRESULT_H
3
4#include "KVBase.h"
5#include "TString.h"
6#include <unordered_map>
7
40public:
52
53 using grid_infos = std::unordered_map<std::string, std::vector<TString>>; //infos from each grid used to identify particle
55
56 enum {
57 deltaEpedestal_UNKNOWN, // status unknown, case not treated
58 deltaEpedestal_YES, // the particle to identify has a delta-E consistent with pedestal
59 deltaEpedestal_NO // the particle to identify has a delta-E > pedestal
60 };
61
63 IDattempted(0), IDOK(0), IDcode(-1),
64 Zident(0), Aident(0), IDquality(-1), Z(-1), A(-1), PID(-1.0), deltaEpedestal(deltaEpedestal_UNKNOWN)
65 {};
66
68 {
70 id.Copy(*this);
71 }
72 void Clear(Option_t* opt = "");
73 void Copy(TObject&) const;
74 void Print(Option_t* opt = "") const;
76 {
77 i.Copy(*this);
78 return *this;
79 }
80
81 void SetIDType(const Char_t* t)
82 {
84 SetType(t);
85 }
86 const Char_t* GetIDType() const
87 {
89 return GetType();
90 }
91 void SetComment(const Char_t* c)
92 {
94 SetLabel(c);
95 }
96 const Char_t* GetComment() const
97 {
99 return GetLabel();
100 }
101 void SetGridName(const Char_t* n)
102 {
104 SetName(n);
105 }
106 const Char_t* GetGridName() const
107 {
109 return GetName();
110 }
111
112 void AddFlag(std::string grid_name, TString flag)
113 {
115 flags[grid_name].push_back(flag);
116 }
117
118 Bool_t HasFlag(std::string grid_name, TString flag)
119 {
121 auto fv = flags.find(grid_name);
122 if (fv != flags.end()) return (std::find(fv->second.begin(), fv->second.end(), flag) != fv->second.end());
123 return kFALSE;
124 }
125
126 Bool_t HasFlagWhichBegins(std::string grid_name, TString flag_beginning)
127 {
129 auto fv = flags.find(grid_name);
130 if (fv != flags.end()) {
131 for (auto& f : fv->second) {
132 if (f.BeginsWith(flag_beginning)) return kTRUE;
133 }
134 }
135 return kFALSE;
136 }
137
138 TString GetFlagWhichBegins(std::string grid_name, TString flag_beginning)
139 {
141 auto fv = flags.find(grid_name);
142 if (fv != flags.end()) {
143 for (auto& f : fv->second) {
144 if (f.BeginsWith(flag_beginning)) return f;
145 }
146 }
147 return "";
148 }
149
151 {
154 return HasFlag(GetGridName(), flag);
155 }
156
158 {
161 return HasFlagWhichBegins(GetGridName(), flag_beginning);
162 }
163
165 {
168 return GetFlagWhichBegins(GetGridName(), flag_beginning);
169 }
170
171 Bool_t HasFlag_AnyGrid(TString flag, std::string& grid_name)
172 {
175
176 for (auto& fv : flags) {
177 grid_name = fv.first;
178 if (HasFlag(grid_name, flag)) return kTRUE;
179 }
180 return kFALSE;
181 }
182
183 Bool_t HasFlagWhichBegins_AnyGrid(TString flag_beginning, std::string& grid_name)
184 {
187 for (auto& fv : flags) {
188 grid_name = fv.first;
189 if (HasFlagWhichBegins(grid_name, flag_beginning)) return kTRUE;
190 }
191 return kFALSE;
192 }
193
194 TString GetFlagWhichBegins_AnyGrid(TString flag_beginning, std::string& grid_name)
195 {
198 for (auto& fv : flags) {
199 grid_name = fv.first;
200 auto f = GetFlagWhichBegins(grid_name, flag_beginning);
201 if (f.Length()) return f;
202 }
203 return "";
204 }
205
206 ClassDef(KVIdentificationResult, 5) //Full result of one attempted particle identification
207};
208
209#endif
int Int_t
#define f(i)
#define c(i)
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition KVBase.h:142
void SetLabel(const Char_t *lab)
Definition KVBase.h:195
virtual void SetType(const Char_t *str)
Definition KVBase.h:173
const Char_t * GetLabel() const
Definition KVBase.h:199
virtual void Copy(TObject &) const
Make a copy of this object.
Definition KVBase.cpp:394
virtual const Char_t * GetType() const
Definition KVBase.h:177
Full result of one attempted particle identification.
Bool_t IDattempted
=kTRUE if identification was attempted
Bool_t HasFlagWhichBegins(std::string grid_name, TString flag_beginning)
const Char_t * GetComment() const
const Char_t * GetIDType() const
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetGridName(const Char_t *n)
void Print(Option_t *opt="") const
void Copy(TObject &) const
Copy this to obj.
void SetComment(const Char_t *c)
void AddFlag(std::string grid_name, TString flag)
const Char_t * GetGridName() const
void Clear(Option_t *opt="")
Reset to initial values.
Bool_t IdentifyingGridHasFlagWhichBegins(TString flag_beginning)
TString Rejecting_Cut
name of cut in grid which rejected particle for identification
Bool_t HasFlagWhichBegins_AnyGrid(TString flag_beginning, std::string &grid_name)
std::unordered_map< std::string, std::vector< TString > > grid_infos
Bool_t Aident
= kTRUE if A of particle established
Double_t PID
= "real" Z if Zident==kTRUE and Aident==kFALSE, "real" A if Zident==Aident==kTRUE
Bool_t IdentifyingGridHasFlag(TString flag)
Int_t deltaEpedestal
special code for handling particles which give no signal in deltaE
Bool_t HasFlag_AnyGrid(TString flag, std::string &grid_name)
TString GetFlagWhichBegins_AnyGrid(TString flag_beginning, std::string &grid_name)
TString IdentifyingGridGetFlagWhichBegins(TString flag_beginning)
KVIdentificationResult(const KVIdentificationResult &id)
Int_t A
A of particle found (if Aident==kTRUE)
Int_t Z
Z of particle found (if Zident==kTRUE)
Int_t IDquality
specific quality code returned by identification procedure
Int_t IDcode
a general identification code for this type of identification
KVIdentificationResult & operator=(const KVIdentificationResult &i)
TString GetFlagWhichBegins(std::string grid_name, TString flag_beginning)
Bool_t HasFlag(std::string grid_name, TString flag)
void SetIDType(const Char_t *t)
Bool_t Zident
=kTRUE if Z of particle established
const char * GetName() const override
virtual void SetName(const char *name)
const Int_t n