4 #include "KVIDZAFromZGrid.h"
6 #include "KVIDZALine.h"
27 fIgnoreMassID =
false;
117 double pidmin, pidmax, pid;
119 else if (
type == 2) {
124 itv->
add(aa, pid, pidmin, pidmax);
199 auto z_int = itvs->
GetZ();
232 for (
int ii = 1; ii < 50; ii++) {
265 if (it && it->
is_inside(pid))
return zint + 1;
270 if (it && it->
is_inside(pid))
return zint - 1;
305 for (
auto z : zlist) {
309 fitparams.
Set(massfit);
330 auto massfits_copy = massfits;
331 massfits.
Inter(pidrange);
332 if(massfits != massfits_copy)
334 KVError::Error(
this,
"KVIDZAFromZGrid::check_pidranges_and_massfits",
335 "Grid %s has inconsistent MASSFITS (%s) and PIDRANGE (%s) - correcting...",
339 for(
auto z : massfits)
344 "Grid %s : removing fit for Z=%d...",
353 for (
auto z : massfits) {
359 fitparams.
Set(massfit);
366 auto pipi = pidr.
Next();
368 pidalist.
Add(pipi.Next().Atoi());
370 auto alist_orig = alist;
371 alist.
Inter(pidalist);
372 if(alist != alist_orig)
375 "Grid %s has inconsistent masses for Z=%d for MASSFIT (%s) and PIDRANGE (%s)",
390 auto A = fitfunc->GetA(idr->
PID, P);
393 idr->
PID = fitfunc->GetInterpolatedA(idr->
PID);
436 if (!idr->
IDOK)
return;
440 bool have_mass_fit_for_Z = (mass_fit_for_Z !=
nullptr);
441 bool mass_id_success =
false;
443 if ((have_mass_fit_for_Z || have_pid_range_for_Z)
446 if (have_mass_fit_for_Z)
450 if (mass_id_success) {
475 if (mass_id_success) idr->
SetComment(
"slight ambiguity of A, which could be larger");
476 else idr->
SetComment(
"slight ambiguity of Z, which could be larger");
479 if (mass_id_success) idr->
SetComment(
"slight ambiguity of A, which could be smaller");
480 else idr->
SetComment(
"slight ambiguity of Z, which could be smaller");
483 if (mass_id_success) idr->
SetComment(
"slight ambiguity of A, which could be larger or smaller");
484 else idr->
SetComment(
"slight ambiguity of Z, which could be larger or smaller");
487 if (mass_id_success) idr->
SetComment(
"point is outside of mass identification range");
488 else idr->
SetComment(
"Z identification correct but no mass identification");
491 if (mass_id_success) idr->
SetComment(
"point is in between two isotopes A & A+2 (e.g. 5He, 8Be, 9B)");
492 else idr->
SetComment(
"point is in between two lines of different Z, too far from either to be considered well-identified");
495 idr->
SetComment(
"(x,y) is below first line in grid");
498 idr->
SetComment(
"(x,y) is above last line in grid");
501 idr->
SetComment(
"no identification: (x,y) out of range covered by grid");
522 if (!zint)
return -1;
523 if (zint != idr->
Z) idr->
Z = zint;
527 if (it) res = it->
eval(idr);
543 if (!itvs->
GetNPID())
continue;
551 if (!itvs->
GetNPID())
continue;
566 auto massfits_copy = massfits;
568 if(massfits != massfits_copy)
570 ::Info(
"KVIDZAFromZGrid::ExportToGrid()",
571 "Grid %s : will correct MASSFITS(%s) to be same as PIDRANGE(%s)",
577 for(
auto z : massfits)
581 ::Info(
"KVIDZAFromZGrid::ExportToGrid()",
582 "Grid %s : removing fit for Z=%d for which no PIDRANGE exists (%s)",
598 double pid = idr->
PID;
599 if (pid < 0.5)
return 0.;
609 interval* left_int(
nullptr), *right_int(
nullptr);
614 ares = inter->
GetA();
637 if (!right_int || !left_int) {
645 int dA = right_int->
GetA() - left_int->GetA();
735 std::map<double,int> toto;
739 auto it = std::begin(toto);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
KVNameValueList fPar
parameters associated to grid
virtual void WriteToAsciiFile(std::ofstream &gridfile)
const Char_t * GetName() const override
const KVNameValueList * GetParameters() const
const KVList * GetIdentifiers() const
Hybrid charge & mass identification grid.
void check_pidranges_and_massfits()
Check for inconsistencies between 'PIDRANGE' and 'MASSFIT' parameters.
const KVList * GetIntervalSets() const
bool MassIdentificationFromMultiGaussFit(KVMultiGaussIsotopeFit *, KVIdentificationResult *) const
void Initialize() override
KVList fTables
intervals for mass id
interval_set * GetIntervalSet(int zint) const
void WriteToAsciiFile(std::ofstream &gridfile) override
void Identify(Double_t x, Double_t y, KVIdentificationResult *) const override
virtual double DeduceAfromPID(KVIdentificationResult *idr) const
void AddIntervalSet(interval_set *)
add an interval set to the grid, updating the corresponding parameters
KVUniqueNameList fFits
multi-gaussian fits for mass id
KVMultiGaussIsotopeFit * GetMultiGaussFit(int z) const
void SetOnlyZId(Bool_t=kTRUE) override
void RemoveIntervalSet(int zint)
Remove interval set for given Z from grid.
void ReadFromAsciiFile(std::ifstream &gridfile) override
KVNumberList fPIDRangeZList
void Copy(TObject &obj) const override
int is_inside(double pid) const
void ReadFromAsciiFile(std::ifstream &gridfile) override
void Copy(TObject &) const override
Copy this to 'obj'.
Int_t fICode
code de retour
void Initialize() override
void Identify(Double_t x, Double_t y, KVIdentificationResult *) const override
Base class for graphical cuts used in particle identification.
Full result of one attempted particle identification.
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetComment(const Char_t *c)
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
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
Bool_t HasFlag(std::string grid_name, TString flag)
Bool_t Zident
=kTRUE if Z of particle established
Function for fitting PID mass spectra.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
void RemoveParameter(const Char_t *name)
const Char_t * GetStringValue(const Char_t *name) const
bool Set(const KVString &)
Bool_t HasParameter(const Char_t *name) const
TString GetTStringValue(const Char_t *name) const
Strings used to represent a set of ranges of values.
void Inter(const KVNumberList &list)
Bool_t Contains(Int_t val) const
returns kTRUE if the value 'val' is contained in the ranges defined by the number list
void Clear(Option_t *="") override
Empty number list, reset it to initial state.
const Char_t * AsString(Int_t maxchars=0) const
void Remove(Int_t)
Remove value 'n' from the list.
void Add(Int_t)
Add value 'n' to the list.
void Copy(TObject &obj) const override
TObject * Remove(TObject *obj) override
Remove object from list.
void Add(TObject *obj) override
void AddLast(TObject *obj) override
void Clear(Option_t *option="") override
TObject * At(Int_t idx) const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
void Add(TObject *obj) override
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
virtual Double_t Eval(Double_t x, TSpline *spline=nullptr, Option_t *option="") const
virtual void SetName(const char *name)
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
Bool_t IsWhitespace() const
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
TString GetListOfMasses()
bool is_inside(double pid)
bool is_above(double pid)
void add(int aa, double pid, double pidmin=-1., double pidmax=-1.)
double eval(KVIdentificationResult *idr)
interval_set(int zz, int type)
bool is_right_of(double pid)
bool is_left_of(double pid)
bool is_inside(double pid)
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)