10 #include "KVIDGraph.h" 
   18 #include "KVIDGridManager.h" 
   24 #include "KVIdentificationResult.h" 
   35    cout << 
"The pad showing graph " << GetName() << 
" has been closed !" << endl;
 
   38       fPad->Disconnect(
"Closed()", 
this, 
"ResetPad()");
 
   39       if (fPad->GetCanvas()) fPad->GetCanvas()->Disconnect(
"Cleared(TVirtualPad*)", 
this, 
"ClearPad(TVirtualPad*)");
 
   52       cout << 
"The pad showing graph " << GetName() << 
" has been cleared" << endl;
 
   53       fPad->Disconnect(
"Closed()", 
this, 
"ResetPad()");
 
   54       if (fPad->GetCanvas()) fPad->GetCanvas()->Disconnect(
"Cleared(TVirtualPad*)", 
this, 
"ClearPad(TVirtualPad*)");
 
   72    fIdentifiers.SetCleanup();
 
   74    fInfoZones.SetCleanup();
 
   75    fXmin = fYmin = fXmax = fYmax = 0;
 
   82    if (fAutoAddGridManager && gIDGridManager) gIDGridManager->
AddGrid(
this);
 
   84    fLastSavedVersion = NULL;
 
  122    ((
TCutG&)obj).SetVarX(GetVarX());
 
  123    ((
TCutG&)obj).SetVarY(GetVarY());
 
  131    if (fLastScaleX != 1 || fLastScaleY != 1)
 
  132       const_cast < KVIDGraph* 
>(
this)->Scale(1. / fLastScaleX,
 
  136    fCuts.Copy(grid.
fCuts);
 
  142    for (
int i = 0; i < fPar.GetNpar(); i++) { 
 
  143       par = fPar.GetParameter(i);
 
  145       if (!parname.
Contains(
"ScaleFactor"))
 
  149    if (fLastScaleX != 1 || fLastScaleY != 1) {
 
  150       const_cast < KVIDGraph* 
>(
this)->Scale(fLastScaleX, fLastScaleY);
 
  318       TIter next(isotopes.get());
 
  469    gridfile << 
"# ASCII file generated by " << 
ClassName() <<
 
  470             "::WriteToAsciiFile" << endl;
 
  471    gridfile << 
"# ID Graph Name : " << 
GetName() << endl;
 
  472    gridfile << 
"# This file can be read using " << 
ClassName() <<
 
  473             "::ReadFromAsciiFile" << endl;
 
  474    gridfile << 
"# " << endl;
 
  480    gridfile << 
"<VARX> " << 
GetVarX() << endl;
 
  481    gridfile << 
"<VARY> " << 
GetVarY() << endl;
 
  487       gridfile << 
"<PARAMETER> " << par->
GetName() << 
"=" << par->
GetString() << endl;
 
  501       line->WriteAsciiFile(gridfile, 
"ID");
 
  506       line->WriteAsciiFile(gridfile, 
"OK");
 
  511       line->WriteAsciiFile(gridfile, 
"INFO");
 
  518    gridfile << 
"!" << endl;
 
  563       Info(
"RevertToLastSavedVersion", 
"No saved version to revert to! (Sorry)");
 
  626    Int_t mass_formula = -1;
 
  628    while (gridfile.good()) {
 
  630       s.ReadLine(gridfile);
 
  631       if (s.BeginsWith(
'!')) {
 
  635       else if (s.BeginsWith(
"++")) {    
 
  641             b.Warning(
"ReadFromAsciiFile(ofstream&)",
 
  642                       "Class name in file %s does not correspond to this class (%s)",
 
  646       else if (s.BeginsWith(
"<NAME>")) {
 
  652       else if (s.BeginsWith(
"<VARX>")) {
 
  658       else if (s.BeginsWith(
"<VARY>")) {
 
  664       else if (s.BeginsWith(
"<PARAMETER>")) {
 
  678                else if (
value.IsDigit())
 
  686       else if (s.BeginsWith(
"<LIST>")) {        
 
  703       else if (s.BeginsWith(
"OnlyZId")) {
 
  705          s.ReplaceAll(
"OnlyZId", 
"");
 
  708             mass_formula = s.Atoi();
 
  712       else if (s.BeginsWith(
'+')) {
 
  719          s.ReadLine(gridfile);
 
  730                b.Warning(
"ReadFromAsciiFile",
 
  731                          "In graph : %s\nIdentifier with no name. Identifier type = %s. Line number in graph = %d",
 
  768    line->ReadAsciiFile(gridfile);
 
  797    if (gridfile.good()) {
 
  802       b.Warning(
"ReadAsciiFile", 
"Could not find file %s. Check filename.", 
filename);
 
  821             "%s is not a valid classname. No known class.", id_class);
 
  826                "%s is not a valid class deriving from KVIDentifier",
 
  919    if (!
gPad->GetListOfPrimitives()->GetSize()) {
 
 1058    cout << 
"Title : " << 
GetTitle() << endl;
 
 1089       for (
int i = 0; i < 
line->GetN(); i++) {
 
 1099       for (
int i = 0; i < 
line->GetN(); i++) {
 
 1198       b.Warning(
"DrawAndAdd", 
"Changed active pad to pad containing this graph");
 
 1207    line->WaitForPrimitive();
 
 1251       if (
line->GetID() >= id1_min && 
line->GetID() <= id1_max)
 
 1258       if (
line->GetID() >= id2_min && 
line->GetID() <= id2_max)
 
 1294    if (rejected_by) *rejected_by = 
"";
 
 1296       if (!
id->TestPoint(
x, 
y)) {
 
 1297          if (rejected_by) *rejected_by = 
id->GetName();
 
 1316       if (
id->TestPoint(
x, 
y)) {
 
 1356          tel_list.
Begin(
",");
 
 1421       if (version == -1)  cout << 
"no file " + 
fPattern + 
"_v%d.grid" << endl;
 
 1422       else              cout << 
"no file " + 
fPattern + 
Form(
"_v%d.grid", version) << endl;
 
 1448       pbis = ((
TObjString*)(*tok)[nb - 1])->GetString();
 
 1450       for (
Int_t ii = 0; ii < nb - 1; ii += 1) chemin += ((
TObjString*)(*tok)[ii])->GetString();
 
 1453    gROOT->ProcessLine(
".! ls " + 
fPattern + 
"_v*.grid >> " + chemin + 
"listKVIDGraph_" + pbis);
 
 1454    ifstream f_in(chemin + 
"listKVIDGraph_" + pbis);
 
 1457    while (f_in.good() && num != version) {
 
 1458       line.ReadLine(f_in);
 
 1460          tok = 
line.Tokenize(
".");
 
 1463          tok = 
line.Tokenize(
"template");
 
 1464          num = ((
TObjString*)(*tok)[0])->GetString().Atoi();
 
 1465          if (num > temoin) temoin = num;
 
 1469    gROOT->ProcessLine(
".! rm -f " + chemin + 
"listKVIDGraph_" + pbis);
 
 1471    if (version == -1) 
return temoin;
 
 1472    else if (temoin != version) {
 
 1536    if (gIDGridManager) gIDGridManager->
Modified();
 
 1634          return tel_list.
Data();
 
 1639    if (
id) tel_list = 
id->GetName();
 
 1640    while ((
id = next())) tel_list += 
Form(
",%s", 
id->GetName());
 
 1671       while ((
id = (
KVIDentifier*)nxt_id())) 
id->fParent = 
this;
 
 1673       while ((
id = (
KVIDentifier*)nxt_cut())) 
id->fParent = 
this;
 
 1675       while ((
id = (
KVIDentifier*)nxt_info())) 
id->fParent = 
this;
 
 1693    void fill(
const char* name, 
double x, 
double y = 0., 
double w = 0.)
 
 1764    Int_t events_read = 0;
 
 1769    for (
int i = 1; i <= 
data->GetNbinsX(); ++i) {
 
 1770       for (
int j = 1; j <= 
data->GetNbinsY(); j++) {
 
 1776          Axis_t x0 = 
data->GetXaxis()->GetBinCenter(i);
 
 1777          Axis_t y0 = 
data->GetYaxis()->GetBinCenter(j);
 
 1778          Axis_t wx = 
data->GetXaxis()->GetBinWidth(i);
 
 1779          Axis_t wy = 
data->GetYaxis()->GetBinWidth(j);
 
 1785          Double_t weight = (kmax == 20 ? poids / 20. : 1.);
 
 1786          for (
int k = 0; k < kmax; k++) {
 
 1794                   if (idr.
Aident) PID = (idr.
Z + 0.1 * (idr.
PID - 2. * idr.
Z));
 
 1798                   idresults.
fill(
"ID_REAL", PID, weight);
 
 1799                   idresults.
fill(
"ID_REAL_VS_DE", 
y, PID, weight);
 
 1800                   idresults.
fill(
"ID_REAL_VS_ERES", 
x, PID, weight);
 
 1802                      idresults.
fill(
"Z_A_REAL", RealA - RealZ, 
gRandom->
Gaus(RealZ, 0.15), weight);
 
 1803                      idresults.
fill(
"ZADIST_AIDENT", idr.
Z, idr.
A, weight);
 
 1804                      idresults.
fill(
"ID_REAL_AIDENT", PID, weight);
 
 1805                      idresults.
fill(
"ID_REAL_VS_DE_AIDENT", 
y, PID, weight);
 
 1806                      idresults.
fill(
"ID_REAL_VS_ERES_AIDENT", 
x, PID, weight);
 
 1809                      idresults.
fill(
"ID_REAL_ZIDENT", PID, weight);
 
 1810                      idresults.
fill(
"ID_REAL_VS_DE_ZIDENT", 
y, PID, weight);
 
 1811                      idresults.
fill(
"ID_REAL_VS_ERES_ZIDENT", 
x, PID, weight);
 
 1816          events_read += (
Int_t) poids;
 
 1817          percent = (1. * events_read / tot_events) * 100.;
 
winID h TVirtualViewer3D vv
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint percent
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
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
char * Strip(const char *str, char c=' ')
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Extended version of ROOT THashList.
Base class for particle identification in a 2D map.
KVNumberList fRunList
runs for which grid is valid
void Add(TString, KVIDentifier *)
void SetName(const char *name) override
Double_t GetYScaleFactor()
TString fDyName
dynamically generated name
void Draw(Option_t *opt="") override
virtual void ReadAsciiFile_WP(Int_t version=-1)
lecture des grilles avec version suivant un modele de fichier
KVIDGraph * fLastSavedVersion
copy of last save version of grid, used for 'undo'
Int_t GetNumberOfCuts() const
void ExtendBeginningAllIdentLines(Double_t, Option_t *="")
KVNameValueList fPar
parameters associated to grid
void ReadAsciiFile(const Char_t *filename)
void RemoveIdentifier(KVIDentifier *)
Remove and destroy identifier.
Double_t GetXScaleFactor()
void Clear(Option_t *opt="") override
virtual void TestIdentification(TH2F *data, KVHashList &histos, KVNameValueList &histo_names)
KVList fCuts
cuts used to define area in which identification is possible
void SetNamesOfIDTelescopes(const TString &)
Set value of "IDTelescopes" parameter with comma-separated list of ID telescope names.
KVList fIdentifiers
list of identification objects
Double_t fLastScaleY
last applied scaling factor on Y
void SetVarY(const char *v) override
Double_t fLastScaleX
last applied scaling factor on X
void SetEditable(Bool_t editable=kTRUE) override
void UpdateLastSavedVersion()
update last saved version. mkae copy of current state of graph.
void Scale(Double_t sx=-1, Double_t sy=-1)
Called by SetX/YScaleFactor methods to rescale every point of every object in the grid.
void ExtendEndAllIdentLines(Double_t, Option_t *="")
void RemoveInfo(KVIDentifier *)
Remove and destroy cut.
virtual void WriteToAsciiFile(std::ofstream &gridfile)
static void SetAutoAdd(Bool_t yes=kTRUE)
virtual void AddInfo(KVIDentifier *info)
void Increment(Float_t x)
void AddIDTelescope(KVBase *t)
Int_t GetNumberOfIdentifiers() const
virtual void ReadIdentifierFromAsciiFile(TString &name, TString &type, TString &cl, std::ifstream &gridfile)
Read in new identifier object from file.
Int_t GetMassFormula() const
void MakeBestGuessForNewIDLineZandA(KVIDentifier *idline)
void RevertToLastSavedVersion()
void SetVarX(const char *v) override
virtual void ReadFromAsciiFile(std::ifstream &gridfile)
void ClearPad(TVirtualPad *)
void WriteParameterListOfIDTelescopes()
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
TString fPattern
pattern of filenames used to write or read grid
const Char_t * GetName() const override
virtual void WriteAsciiFile_WP(Int_t version=-1)
KVIDentifier * GetIdentifier(Int_t Z, Int_t A) const
virtual Bool_t IsIdentifiable(Double_t, Double_t, TString *rejected_by=nullptr) const
void FindAxisLimits()
Calculate X/Y min/max of all objects in graph.
static KVIDGraph * AddGraphs(KVIDGraph *g1, Int_t id1_min, Int_t id1_max, KVIDGraph *g2, Int_t id2_min, Int_t id2_max)
virtual void DrawAndAdd(const Char_t *type="ID", const Char_t *classname="KVIDentifier")
virtual void AddCut(KVIDentifier *cut)
void SetMassFormula(Int_t)
TList fTelescopes
ID telescopes for which grid is valid.
static Bool_t fAutoAddGridManager
if =kTRUE, grids are automatically added to ID grid manager on creation (default)
void WriteAsciiFile(const Char_t *filename)
Open, write and close ascii file containing this grid.
virtual KVIDentifier * New(const Char_t *)
Create new object of class "id_class" which derives from KVIDentifier.
virtual void BackwardsCompatibilityFix()
void AddIDTelescopes(const TList *)
Associate this graph with all ID telescopes in list.
virtual void AddIdentifier(KVIDentifier *id)
virtual void SetInfos(Double_t, Double_t, KVIdentificationResult *) const
loop over KVIDGraph::fInfoZones to set flags in KVIdentificationResult
static KVIDGraph * MakeIDGraph(const Char_t *)
void SetLineColor(Color_t lcolor) override
const Char_t * GetNamesOfIDTelescopes() const
void SetXScaleFactor(Double_t=0)
Int_t GetNumberOfInfos() const
TVirtualPad * fPad
pad in which graph is drawn
virtual Bool_t AcceptIDForTest(const KVIdentificationResult &idr)
Axis_t fYmax
min/max Y coordinates of graph
void SetRuns(const KVNumberList &nl)
Set list of runs for which grid is valid.
virtual Int_t CheckVersion(Int_t version)
void SetYScaleFactor(Double_t=0)
virtual void Initialize()=0
Axis_t fXmax
min/max X coordinates of graph
Bool_t fOnlyZId
set to kTRUE when only to be used to give Z identification of nuclei, no mass info
Int_t fMassFormula
OPTION={GetMethod="GetMassFormula";SetMethod="SetMassFormula";Items=(0="Beta-stability",...
void SetPattern(TString pattern)
void Copy(TObject &) const override
Copy this to 'obj'.
void RemoveCut(KVIDentifier *)
Remove and destroy cut.
void Print(Option_t *opt="") const override
Print out all objects in graph.
KVList fInfoZones
contours/lines used to add info to particles (ex: punch-through)
virtual void SetOnlyZId(Bool_t yes=kTRUE)
const KVList * GetIdentifiers() const
void AddGrid(KVIDGraph *)
Add a grid to the collection.
Base class for graphical cuts used in particle identification.
Full result of one attempted particle identification.
void AddFlag(std::string grid_name, TString flag)
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)
void Clear(Option_t *opt="") override
Reset to initial values.
Bool_t Zident
=kTRUE if Z of particle established
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
Int_t GetIntValue(const Char_t *name) const
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
void RemoveParameter(const Char_t *name)
Int_t GetNpar() const
return the number of stored parameters
void Clear(Option_t *opt="") override
const Char_t * GetStringValue(const Char_t *name) const
Bool_t HasParameter(const Char_t *name) const
void Print(Option_t *opt="") const override
A generic named parameter storing values of different types.
const Char_t * GetString() const
Strings used to represent a set of ranges of values.
void SetMinMax(Int_t min, Int_t max, Int_t pas=1)
Set list with all values from 'min' to 'max'.
const Char_t * AsString(Int_t maxchars=0) const
void Execute(const char *method, const char *params, Int_t *error=0) override
KVSeqCollection * GetSubListWithMethod(const Char_t *retvalue, const Char_t *method) const
T * get_object(const TString &name) const
TObject * Remove(TObject *obj) override
Remove object from list.
void RecursiveRemove(TObject *obj) override
void Delete(Option_t *option="") 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 Copy(TAttFill &attfill) const
void Copy(TAttLine &attline) const
void Copy(TAttMarker &attmarker) const
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
Bool_t InheritsFrom(const char *cl) const override
virtual Int_t GetEntries() const
void Streamer(TBuffer &) override
const char * GetVarX() const
TClass * IsA() const override
const char * GetVarY() const
Bool_t GetEditable() const
virtual void SetEditable(Bool_t editable=kTRUE)
virtual Int_t Fill(const char *name, Double_t w)
void ls(Option_t *option="") const override
TObject * At(Int_t idx) const override
void Copy(TObject &named) const override
const char * GetName() const override
const char * GetTitle() const override
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
virtual const char * GetName() const
virtual TObject * Clone(const char *newname="") const
virtual const char * ClassName() 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)
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
virtual Double_t Uniform(Double_t x1, Double_t x2)
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t ProcessEvents()
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
Double_t Min(Double_t a, Double_t b)
void fill(const char *name, double x, double y=0., double w=0.)
KVNameValueList & histo_names
kvidgraph_idresult_filler(KVHashList &h, KVNameValueList &n)