20 #include "KVIDTelescope.h"
22 #include "KVNucleus.h"
23 #include "KVReconstructedNucleus.h"
24 #include "KVIDGraph.h"
28 #include "KVMultiDetArray.h"
29 #include "KVDataSet.h"
30 #include "KVIDGridManager.h"
31 #include "KVIDZALine.h"
32 #include "KVIDCutLine.h"
33 #include "KVIdentificationResult.h"
37 #include "KVParticleCondition.h"
39 #include <KVDetectorSignalExpression.h>
40 #include <KVIDZAGrid.h>
146 while ((det = (KVDetector*)it()))
if (!det->IsOK()) {
156 bool mass_id =
false;
159 if (
gr->HasMassIDCapability()) mass_id =
true;
165 "ID tel. %s: grid %s has undefined VarX(%s:%p) or VarY(%s:%p) - WILL NOT USE",
176 Warning(
"Initialize",
"ID telescope %s has %d grids but no %s variable defined",
179 Warning(
"Initialize",
"ID telescope %s has %d grids but %d grids appear in variable %s",
183 grid_list.
Begin(
",");
184 while (!grid_list.
End()) {
185 auto gr_name = grid_list.
Next();
188 Info(
"Initialize",
"IDtel=%s grid %s missing",
GetName(), gr_name.Data());
244 Warning(
"AddDetector",
"Called with null pointer");
262 if (!strcmp(opt,
"fired")) {
263 while ((obj = (KVDetector*) next())) {
265 if (obj->Fired() || obj->GetEnergy())
270 cout <<
"\n" << opt <<
"Structure of KVIDTelescope object: " <<
273 "--------------------------------------------------------" <<
275 while ((obj = (KVDetector*) next())) {
276 cout << opt <<
"Detector: " << obj->GetName() << endl;
293 Warning(
"GetDetector(const Char_t *name)",
294 "Detector %s not found in telescope %s",
name,
GetName());
388 if (idr->
IDOK)
break;
479 KVString det_labels_x, det_labels_y;
484 gc.fDetLabelsX = det_labels_x;
486 gc.fDetLabelsY = det_labels_y;
592 Warning(
"GetSignalFromGridVar",
593 "No VAR%s defined for grid for telescope %s. KVIDTelescope-derived class handling identification must override GetIDMapX/GetIDMapY",
599 KVDetector* det =
nullptr;
608 bool explicit_det_ref =
false;
609 bool multidetexpr =
false;
616 det_label = t.
Next();
619 explicit_det_ref =
true;
622 if (_det->GetDetectorSignal(sig_type)) {
623 if (det_labels.
Length()) {
624 if (!det_labels.
Contains(det_label)) det_labels +=
Form(
",%s", det_label.
Data());
627 det_labels = det_label;
630 Warning(
"GetSignalFromGridVar",
"signal '%s' not found in det '%s' -> replaced by '0'", sig_type.
Data(), _det->GetName());
634 if (det && (_det != det)) multidetexpr =
true;
639 if (explicit_det_ref) {
642 if (!is_expression) {
644 return det->GetDetectorSignal(sig_type);
660 Error(
"GetSignalFromGridVar",
661 "Problem initialising ID-grid %s coordinate for telescope %s."
662 " Check definition of VAR%s for grid (=%s)",
676 det_labels = det->GetLabel();
678 ds = det->GetDetectorSignal(sig_type);
681 if (!det->AddDetectorSignalExpression(sig_type, sig_type)) {
682 Error(
"GetSignalFromGridVar",
683 "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)",
688 ds = det->GetDetectorSignal(sig_type);
700 if (!cl || !cl->InheritsFrom(
"KVIDZAGrid")) cl =
TClass::GetClass(
"KVIDZAGrid");
708 Int_t npoi_bragg = 0;
750 Double_t E1min = SeuilE, E1max = det_de->GetEIncOfMaxDeltaE(zz, aa);
751 E1 = (E1min + E1max) / 2.;
753 while ((E1max - E1min) > SeuilE) {
759 det_de->DetectParticle(&part);
760 det_eres->DetectParticle(&part);
761 if (det_eres->GetEnergy() > SeuilE) {
764 E1 = (E1max + E1min) / 2.;
769 E1 = (E1max + E1min) / 2.;
774 Double_t dE_B = det_de->GetMaxDeltaE(zz, aa);
775 Double_t E_B = det_de->GetEIncOfMaxDeltaE(zz, aa);
776 Double_t Eres_B = det_de->GetERes(zz, aa, E_B);
779 if (B_line) B_line->
SetPoint(B_line->
GetN(), Eres_B, dE_B);
783 Double_t E2min = E1, E2max = det_eres->GetEmaxValid(part.
GetZ(), part.
GetA());
784 E2 = (E2min + E2max) / 2.;
786 while ((E2max - E2min > SeuilE)) {
792 det_de->DetectParticle(&part);
793 det_eres->DetectParticle(&part);
797 E2 = (E2max + E2min) / 2.;
802 E2 = (E2max + E2min) / 2.;
806 if ((!strcmp(det_eres->GetType(),
"CSI")) && (E2 > 5000)) E2 = 5000;
815 Double_t dLog = (logE2 - logE1) / (npoints - 1.);
817 for (
Int_t i = 0; i < npoints; i++) {
823 while (Eres < SeuilE && niter <= 20) {
829 det_de->DetectParticle(&part);
830 det_eres->DetectParticle(&part);
832 Eres = det_eres->GetEnergy();
839 line->GetPoint(i - 1, gEres, gdE);
840 line->SetPoint(i, Eres, dE);
873 if (_axis !=
"X" && _axis !=
"Y") {
874 Error(
"GetDetectorLabelsForGridCoord",
"Called with illegal axis name '%s'", axis.
Data());
881 if (_axis ==
"X") labs = __gc.second.fDetLabelsX;
882 else labs = __gc.second.fDetLabelsY;
883 if (lab_list.
Length() && lab_list != labs) {
884 Error(
"GetDetectorLabelsForGridCoord",
"Grids for telescope %s use different detector types for %s-coordinate: "
917 Error(
"GetIDGrid(int)",
"Index must be >=1!");
1082 if (!(ph =
LoadPlugin(
"KVIDTelescope", uri)))
1159 Warning(
"SetIdentificationParameters",
1160 "No filename defined. Should be given by %s.IdentificationParameterFile.%s or %s.IdentificationParameterFile.%s",
1215 Error(
"LoadIdentificationParameters",
1216 "File %s not found. Should be in %s",
1222 Info(
"LoadIdentificationParameters",
"Using file %s", path.
Data());
1256 while ((grid = (
KVIDGrid*)next_grid())) {
1469 specific.
Form(
"KVIDTelescope.DefaultGrid.%s",
GetLabel());
1490 double thickness =
GetDetector(2)->GetThickness();
1491 GetDetector(2)->SetThickness(thickness * xfactor);
1493 Info(
"CalculateDeltaE_EGrid",
"called with KVNameValueList");
1497 for (
auto par : AperZ) {
1499 int zz = tmp.
Atoi();
1501 for (
auto aa : alist) {
1533 double thickness =
GetDetector(2)->GetThickness();
1534 GetDetector(2)->SetThickness(thickness * xfactor);
1536 Info(
"CalculateDeltaE_EGrid",
"called with KVNumberList");
1542 while (!Zrange.
End()) {
1544 part.
SetZ(zz, massformula);
1546 for (
Int_t aa = aref - deltaA; aa <= aref + deltaA; aa += 1) {
1575 double thickness =
GetDetector(2)->GetThickness();
1577 Info(
"CalculateDeltaE_EGrid",
"called with TH2");
1599 Warning(
"CalculateDeltaE_EGrid",
"no count for Z=%d", zz);
1615 while (!nlA.
End()) {
1667 while ((grid = (
KVIDGrid*)next())) {
1687 return idline->
Eval(
x);
1716 if (EINC > 0.0)
return (EINC > emin);
1782 if (!
test.IsKnown()) {
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)
virtual const Char_t * GetType() const
const Char_t * GetLabel() const
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
const Char_t * GetDataSetDir() const
Bool_t HasCalibIdentInfos() const
KVString 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
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.
void SetName(const char *name) override
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)
void SetName(const char *name) override
void AddIDTelescope(KVBase *t)
KVIDentifier * GetCut(const Char_t *name) const
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
const Char_t * GetName() const override
KVIDentifier * GetIdentifier(Int_t Z, Int_t A) const
virtual Bool_t IsIdentifiable(Double_t, Double_t, TString *rejected_by=nullptr) 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)
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 *)
KVDetector * GetDetector(UInt_t n) const
void ReadIdentificationParameterFiles(const Char_t *filename, const KVMultiDetArray *multidet)
virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus *, Double_t=0.0)
void addLineToGrid(KVIDGrid *gg, int zz, int aa, int npoints)
KVGroup * GetGroup() const
virtual Double_t GetPedestalX(Option_t *opt="")
virtual void AddDetector(KVDetector *d)
virtual Double_t GetMeanDEFromID(Int_t &status, Int_t Z, Int_t A=-1, Double_t Eres=-1.0)
const KVList * GetDetectors() const
KVDetectorSignal * GetSignalFromGridVar(const KVString &var, const KVString &axe, KVString &det_labels)
void Print(Option_t *opt="") const override
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()
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 * GetListOfIDGrids() 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 SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *)
virtual void RemoveGrids()
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)
TString Rejecting_Cut
name of cut in grid which rejected particle for identification
Bool_t Aident
= kTRUE if A of particle established
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
void Clear(Option_t *opt="") override
Reset to initial values.
Int_t IDcode
a general identification code for this type of identification
void SetIDType(const Char_t *t)
Bool_t Zident
=kTRUE if Z of particle established
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 Clear(Option_t *="") override
Empty number list, reset it to initial state.
void Add(Int_t)
Add value 'n' to the list.
Int_t Last() const
Returns largest number included in list.
Double_t GetEnergy() const
void SetEnergy(Double_t e)
virtual TObject * FindObjectByLabel(const Char_t *) const
TObject * First() const override
void Add(TObject *obj) override
TObject * FindObject(const char *name) const override
void Clear(Option_t *option="") override
virtual void SetCleanup(Bool_t enable=kTRUE)
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
Int_t GetNValues(TString delim) const
Optimised list in which named objects can only be placed once.
void Add(TObject *obj) override
virtual void SetLineColor(Color_t lcolor)
virtual Double_t GetBinCenter(Int_t bin) const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
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)