20#include "KVIDTelescope.h"
21#include "KVTelescope.h"
24#include "KVReconstructedNucleus.h"
29#include "KVMultiDetArray.h"
31#include "KVIDGridManager.h"
32#include "KVIDZALine.h"
33#include "KVIDCutLine.h"
34#include "KVIdentificationResult.h"
38#include "KVParticleCondition.h"
40#include <KVDetectorSignalExpression.h>
41#include <KVIDZAGrid.h>
157 bool mass_id =
false;
160 if (
gr->HasMassIDCapability()) mass_id =
true;
166 "ID tel. %s: grid %s has undefined VarX(%s:%p) or VarY(%s:%p) - WILL NOT USE",
177 Warning(
"Initialize",
"ID telescope %s has %d grids but no %s variable defined",
180 Warning(
"Initialize",
"ID telescope %s has %d grids but %d grids appear in variable %s",
184 grid_list.
Begin(
",");
185 while (!grid_list.
End()) {
186 auto gr_name = grid_list.
Next();
189 Info(
"Initialize",
"IDtel=%s grid %s missing",
GetName(), gr_name.Data());
245 Warning(
"AddDetector",
"Called with null pointer");
263 if (!strcmp(opt,
"fired")) {
271 cout <<
"\n" << opt <<
"Structure of KVIDTelescope object: " <<
274 "--------------------------------------------------------" <<
277 cout << opt <<
"Detector: " << obj->
GetName() << endl;
294 Warning(
"GetDetector(const Char_t *name)",
295 "Detector %s not found in telescope %s",
name,
GetName());
353 Estep = (Emax - Emin) / 100.;
355 Int_t nsteps = 1 + (
Int_t)((Emax - Emin) / Estep);
369 TIter next_det(detectors);
380 x[step] =
y[step] = -1;
392 if (E1 < 1.e-3)
break;
399 if (
x[step] > 0 &&
y[step] > 0) {
480 if (idr->
IDOK)
break;
571 KVString det_labels_x, det_labels_y;
576 gc.fDetLabelsX = det_labels_x;
578 gc.fDetLabelsY = det_labels_y;
684 Warning(
"GetSignalFromGridVar",
685 "No VAR%s defined for grid for telescope %s. KVIDTelescope-derived class handling identification must override GetIDMapX/GetIDMapY",
700 bool explicit_det_ref =
false;
701 bool multidetexpr =
false;
708 det_label = t.
Next();
711 explicit_det_ref =
true;
714 if (_det->GetDetectorSignal(sig_type)) {
715 if (det_labels.
Length()) {
716 if (!det_labels.
Contains(det_label)) det_labels +=
Form(
",%s", det_label.
Data());
719 det_labels = det_label;
722 Warning(
"GetSignalFromGridVar",
"signal '%s' not found in det '%s' -> replaced by '0'", sig_type.
Data(), _det->GetName());
726 if (det && (_det != det)) multidetexpr =
true;
731 if (explicit_det_ref) {
734 if (!is_expression) {
752 Error(
"GetSignalFromGridVar",
753 "Problem initialising ID-grid %s coordinate for telescope %s."
754 " Check definition of VAR%s for grid (=%s)",
774 Error(
"GetSignalFromGridVar",
775 "Problem initialising ID-grid %s coordinate for telescope %s. Request for unknown signal %s for detector %s. Check definition of VAR%s for grid (=%s)",
792 if (!cl || !cl->InheritsFrom(
"KVIDZAGrid")) cl = TClass::GetClass(
"KVIDZAGrid");
800 Int_t npoi_bragg = 0;
843 E1 = (E1min + E1max) / 2.;
845 while ((E1max - E1min) > SeuilE) {
856 E1 = (E1max + E1min) / 2.;
861 E1 = (E1max + E1min) / 2.;
871 if (B_line) B_line->
SetPoint(B_line->
GetN(), Eres_B, dE_B);
876 E2 = (E2min + E2max) / 2.;
878 while ((E2max - E2min > SeuilE)) {
889 E2 = (E2max + E2min) / 2.;
894 E2 = (E2max + E2min) / 2.;
898 if ((!strcmp(det_eres->
GetType(),
"CSI")) && (E2 > 5000)) E2 = 5000;
907 Double_t dLog = (logE2 - logE1) / (npoints - 1.);
909 for (
Int_t i = 0; i < npoints; i++) {
915 while (Eres < SeuilE && niter <= 20) {
931 line->GetPoint(i - 1, gEres, gdE);
932 line->SetPoint(i, Eres, dE);
965 if (_axis !=
"X" && _axis !=
"Y") {
966 Error(
"GetDetectorLabelsForGridCoord",
"Called with illegal axis name '%s'", axis.
Data());
973 if (_axis ==
"X") labs = __gc.second.fDetLabelsX;
974 else labs = __gc.second.fDetLabelsY;
975 if (lab_list.
Length() && lab_list != labs) {
976 Error(
"GetDetectorLabelsForGridCoord",
"Grids for telescope %s use different detector types for %s-coordinate: "
1009 Error(
"GetIDGrid(int)",
"Index must be >=1!");
1174 if (!(ph =
LoadPlugin(
"KVIDTelescope", uri)))
1251 Warning(
"SetIdentificationParameters",
1252 "No filename defined. Should be given by %s.IdentificationParameterFile.%s or %s.IdentificationParameterFile.%s",
1307 Error(
"LoadIdentificationParameters",
1308 "File %s not found. Should be in %s",
1314 Info(
"LoadIdentificationParameters",
"Using file %s", path.
Data());
1348 while ((grid = (
KVIDGrid*)next_grid())) {
1417 if ((d1 && d2) && !d1_cal && !d2_cal)
1434 e1 = e2 = einc = 0.0;
1450 if (e1 < 0.0) e1 = 0.0;
1465 if (d2 && !d2_cal) {
1475 if (e2 < 0.0) e2 = 0.0;
1496 if (coherence_tolerance < 1) coherence_tolerance += 1.00;
1508 while (idet < ndets) {
1518 if (e1 < 0.0) e1 = 0.0;
1527 if (e1 < 0.0) e1 = 0.0;
1582 specific.
Form(
"KVIDTelescope.DefaultGrid.%s",
GetLabel());
1606 Info(
"CalculateDeltaE_EGrid",
"called with KVNameValueList");
1610 for (
auto par : AperZ) {
1612 int zz = tmp.
Atoi();
1614 for (
auto aa : alist) {
1649 Info(
"CalculateDeltaE_EGrid",
"called with KVNumberList");
1655 while (!Zrange.
End()) {
1657 part.
SetZ(zz, massformula);
1659 for (
Int_t aa = aref - deltaA; aa <= aref + deltaA; aa += 1) {
1690 Info(
"CalculateDeltaE_EGrid",
"called with TH2");
1712 Warning(
"CalculateDeltaE_EGrid",
"no count for Z=%d", zz);
1728 while (!nlA.
End()) {
1780 while ((grid = (
KVIDGrid*)next())) {
1800 return idline->
Eval(
x);
1829 if (EINC > 0.0)
return (EINC > emin);
1894 double e =
n->GetE();
1900 else n->SetAMeasured();
1901 if (!
n->IsAMeasured()) {
1903 double e =
n->GetE();
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 filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
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 g
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
void SetLabel(const Char_t *lab)
const Char_t * GetLabel() const
virtual const Char_t * GetType() const
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
const Char_t * GetDataSetDir() const
Bool_t HasCalibIdentInfos() const
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
TString GetFullPathToDataSetFile(const Char_t *filename)
Signal output from a mathematical combination of other signals.
Base class for output signal data produced by a detector.
virtual Bool_t IsValid() const
virtual Double_t GetValue(const KVNameValueList ¶ms="") const
Base class for detector geometry description.
virtual Bool_t IsOK() const
virtual KVDetectorSignal * GetDetectorSignal(const KVString &type) const
virtual Double_t GetMaxDeltaE(Int_t Z, Int_t A)
virtual Double_t GetERes(Int_t Z, Int_t A, Double_t Einc)
virtual Double_t GetELostByParticle(KVNucleus *, TVector3 *norm=0)
virtual void SetEnergyLoss(Double_t e) const
virtual Double_t GetEnergy() const
Int_t GetNHits() const
Return the number of particles hitting this detector in an event.
virtual Double_t GetEIncOfMaxDeltaE(Int_t Z, Int_t A)
virtual void Clear(Option_t *opt="")
void SetThickness(Double_t thick)
virtual Bool_t Fired(Option_t *opt="any") const
Bool_t IsCalibrated() const
Bool_t AddDetectorSignalExpression(const KVString &type, const KVString &_expr)
virtual void SetEResAfterDetector(Double_t e)
virtual TList * GetAlignedDetectors(UInt_t direction=1)
virtual Double_t GetDeltaE(Int_t Z, Int_t A, Double_t Einc)
virtual Double_t GetDeltaEFromERes(Int_t Z, Int_t A, Double_t Eres)
virtual void DetectParticle(KVNucleus *, TVector3 *norm=0)
virtual void Print(Option_t *option="") const
virtual Double_t GetCorrectedEnergy(KVNucleus *, Double_t e=-1., Bool_t transmission=kTRUE)
Handle reading columns of numeric data in text files.
KVString GetCurrentLine()
ReadStatus ReadLine(const KVString &pattern="")
Bool_t OpenFileToRead(const KVString &filename)
Group of detectors which can be treated independently of all others in array.
Line in ID grid used to delimit regions where no identification is possible.
virtual void SetName(const char *name)
This is redeclared to make it appear in context menus for KVIDCutLines.
virtual void SetAcceptedDirection(const Char_t *dir)
Base class for particle identification in a 2D map.
void Add(TString, KVIDentifier *)
void SetRunList(const char *runlist)
virtual void SetName(const char *name)
void AddIDTelescope(KVBase *t)
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
KVIDentifier * GetIdentifier(Int_t Z, Int_t A) const
virtual Bool_t IsIdentifiable(Double_t, Double_t, TString *rejected_by=nullptr) const
const Char_t * GetName() const
KVIDentifier * GetCut(const Char_t *name) const
virtual void SetOnlyZId(Bool_t yes=kTRUE)
void DeleteGrid(KVIDGraph *, Bool_t update=kTRUE)
Abstract base class for 2D identification grids in e.g. (dE,E) maps.
Base class for lines/cuts used for particle identification in 2D data maps.
void GetStartPoint(Double_t &x, Double_t &y) const
void GetEndPoint(Double_t &x, Double_t &y) const
Base class for all detectors or associations of detectors in array which can identify charged particl...
KVIDGrid * newGrid(bool onlyZ)
void LoadIdentificationParameters(const Char_t *filename, const KVMultiDetArray *multidet)
This method add to the gIDGridManager list the identification grids.
virtual Double_t GetIDMapY(Option_t *opt="")
KVIDGrid * CalculateDeltaE_EGrid(const KVNameValueList &AperZ, Int_t npoints=30, Double_t xfactor=1.)
void SetGroup(KVGroup *kvg)
KVList fMultiDetExpressions
used to clean up any multi-detector signal expressions generated to calculate X/Y coordinates
void SetLabelFromURI(const Char_t *uri)
@ kCalibStatus_Calculated
@ kCalibStatus_NoCalibrations
Double_t GetIDGridYCoord(KVIDGraph *) const
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.)
virtual Double_t GetIDMapX(Option_t *opt="")
static KVIDTelescope * MakeIDTelescope(const Char_t *name)
virtual Double_t GetPedestalY(Option_t *opt="")
virtual Bool_t SetIdentificationParameters(const KVMultiDetArray *)
void SetIDGrid(KVIDGraph *)
void ReadIdentificationParameterFiles(const Char_t *filename, const KVMultiDetArray *multidet)
virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus *, Double_t=0.0)
const KVList * GetListOfIDGrids() const
void addLineToGrid(KVIDGrid *gg, int zz, int aa, int npoints)
KVGroup * GetGroup() const
Int_t fCalibStatus
temporary variable holding status code for last call to Calibrate(KVReconstructedNucleus*)
virtual Double_t GetPedestalX(Option_t *opt="")
KVDetector * GetDetector(UInt_t n) const
virtual void CalculateParticleEnergy(KVReconstructedNucleus *nuc)
virtual void AddDetector(KVDetector *d)
virtual Double_t GetMeanDEFromID(Int_t &status, Int_t Z, Int_t A=-1, Double_t Eres=-1.0)
KVDetectorSignal * GetSignalFromGridVar(const KVString &var, const KVString &axe, KVString &det_labels)
virtual void Print(Option_t *opt="") const
std::unordered_map< KVIDGraph *, GraphCoords > fGraphCoords
X/Y coordinates from detector signals for ID maps.
virtual UShort_t GetIDCode()
void CheckIdentificationBilan(const TString &system)
Set status of ID Telescope for given system.
virtual void RemoveIdentificationParameters()
static void OpenIdentificationBilan(const TString &path)
Open IdentificationBilan.dat file with given path.
void SetHasMassID(Bool_t yes=kTRUE)
virtual void Initialize(void)
Double_t GetIDGridXCoord(KVIDGraph *) const
const Char_t * GetDefaultIDGridClass()
virtual void SetIdentificationStatus(KVReconstructedNucleus *)
void GetIDGridCoords(Double_t &X, Double_t &Y, KVIDGraph *grid, Double_t x=-1, Double_t y=-1)
KVUnownedList fIDGrids
identification grid(s)
KVUnownedList fDetectors
list of detectors in telescope
KVString GetDetectorLabelsForGridCoord(const KVString &axis) const
const KVList * GetDetectors() const
std::unique_ptr< KVParticleCondition > fMassIDValidity
may be used to limit mass identification to certain Z and/or A range
KVGroup * fGroup
group to which telescope belongs
static TEnv * fgIdentificationBilan
virtual void RemoveGrids()
virtual TGraph * MakeIDLine(KVNucleus *nuc, Double_t Emin, Double_t Emax, Double_t Estep=0.0)
Base class for identification ridge lines corresponding to different nuclear species.
Full result of one attempted particle identification.
Bool_t IDattempted
=kTRUE if identification was attempted
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetGridName(const Char_t *n)
void Clear(Option_t *opt="")
Reset to initial values.
TString Rejecting_Cut
name of cut in grid which rejected particle for identification
Int_t IDquality
specific quality code returned by identification procedure
Int_t IDcode
a general identification code for this type of identification
void SetIDType(const Char_t *t)
virtual Double_t GetThickness() const
Double_t GetEmaxValid(Int_t Z, Int_t A)
virtual Double_t GetEResFromDeltaE(Int_t Z, Int_t A, Double_t dE=-1.0, enum SolType type=kEmax)
Base class for describing the geometry of a detector array.
Bool_t ReadGridsFromAsciiFile(const Char_t *) const
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Description of properties and kinematics of atomic nuclei.
Bool_t IsKnown(int z=-1, int a=-1) const
void SetZ(Int_t z, Char_t mt=-1)
Int_t GetZ() const
Return the number of proton / atomic number.
Double_t GetLifeTime(Int_t z=-1, Int_t a=-1) const
Strings used to represent a set of ranges of values.
void Add(Int_t)
Add value 'n' to the list.
void Clear(Option_t *="")
Empty number list, reset it to initial state.
Int_t Last() const
Returns largest number included in list.
Double_t GetEnergy() const
void SetEnergy(Double_t e)
Nuclei reconstructed from data measured by a detector array .
KVDetector * GetDetector(const TString &label) const
virtual TObject * FindObject(const char *name) const
virtual TObject * FindObjectByLabel(const Char_t *) const
virtual void Clear(Option_t *option="")
virtual TObject * First() const
virtual TObject * At(Int_t idx) const
virtual void SetCleanup(Bool_t enable=kTRUE)
virtual void Add(TObject *obj)
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
Int_t GetNValues(TString delim) const
Optimised list in which named objects can only be placed once.
virtual void Add(TObject *obj)
virtual void SetLineColor(Color_t lcolor)
virtual Double_t GetBinCenter(Int_t bin) const
const char * GetVarX() const
const char * GetVarY() const
virtual const char * GetValue(const char *name, const char *dflt) const
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 Int_t GetNbinsY() const
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
const char * GetName() const override
virtual void SetName(const char *name)
void AbstractMethod(const char *method) const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)