KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVTGIDGrid.cpp
1/*
2$Id: KVTGIDGrid.cpp,v 1.2 2009/03/03 14:27:15 franklan Exp $
3$Revision: 1.2 $
4$Date: 2009/03/03 14:27:15 $
5*/
6
7//Created by KVClassFactory on Fri Apr 25 15:55:08 2008
8//Author: franklan
9
10#include "KVTGIDGrid.h"
11#include "KVTGID.h"
12#include "KVIDGridManager.h"
13
14using namespace std;
15
17
18
19
21
23{
24 // Default constructor
25 fTGID = 0;
26}
27
28
29
33
35 : KVIDZAGrid()
36{
37 // Create a grid in order to visualize the results of a fit of an identification grid.
38 // We keep any "cuts" from the original grid and add them to the fitted grid
39
40 fTGID = tgid;
44
45// TList *idtels = (TList *)fTGID->GetIDTelescopes();
46// TObject *idt = NULL;
47// TIter next_idt( idtels );
48// while( (idt = next_idt()) ) fTelescopes.Add( idt );
49// delete idtels;
50
52 Int_t ver = 1;
53 if (gIDGridManager->GetGrid(name.Data())) {
54 do {
55 name.Form("%s_%d", fTGID->GetName(), ver);
56 ver++;
57 }
58 while (gIDGridManager->GetGrid(name.Data()));
59 }
60 SetName(name.Data());
61 if (original) original->GetCuts()->Copy(fCuts);
62
63 GetParameters()->SetValue("HasTGID", 1);
65}
66
67
68
71
73{
74 // Destructor
75}
76
77
78
79
82
83void KVTGIDGrid::WriteToAsciiFile(ofstream& gridfile)
84{
85 // Write parameters of LTG fit used to generate grid in gridfile.
87 if (fTGID) fTGID->WriteToAsciiFile(gridfile);
88}
89
90
91
92
95
96void KVTGIDGrid::ReadFromAsciiFile(ifstream& gridfile)
97{
98 // Read grid and parameters of LTG fit used to generate grid in gridfile.
101 if (fPar.GetIntValue("HasTGID")) {
102 line.ReadLine(gridfile);
103 if (line.BeginsWith("++KVTGID")) fTGID = KVTGID::ReadFromAsciiFile(GetName(), gridfile);
104 }
106}
107
108
109
110
130
131void KVTGIDGrid::Generate(Double_t xmax, Double_t xmin, Int_t ID_min, Int_t ID_max, Int_t npoints, Bool_t logscale)
132{
133 //(Re)generate ID grid from the functional using current values of parameters.
134 //
135 // xmin, xmax - min and max values of 'x' coordinate used in corresponding
136 // identification map
137 // ID_min, ID_max - min and max 'ID' of lines in grid
138 // npoints - number of points in each line
139 //
140 //DEFAULT ARGUMENT VALUES:
141 //=========================
142 // xmin = 0.
143 // If the grid gets "ugly" for small x, you might try setting xmin = fitted X-pedestal
144 // This is the value of parameter 7 in most cases....
145 //
146 // ID_min, ID_max = min and max ID of lines on which functional was fitted
147 // npoints = 100
148 //
149 // if logscale=kTRUE (default is kFALSE) lines are generated with more points at
150 // the beginning of the lines than at the end.
151
152 if (!GetTGID()) {
153 Error("Generate", "No parameter stored to initialize a functional !");
154 return;
155 }
156
157 ID_min = (ID_min ? ID_min : (Int_t) fTGID->GetIDmin());
158 ID_max = (ID_max ? ID_max : (Int_t) fTGID->GetIDmax());
159
160 // clear existing lines
161 Bool_t was_drawn = kFALSE;
162 TVirtualPad* last_pad = fPad;
163 if (fPad) {
164 UnDraw();
165 was_drawn = kTRUE;
166 }
167
168 // delete all previous identification lines
170 fXmin = fYmin = fXmax = fYmax = 0;
171
172 for (Int_t ID = ID_min; ID <= ID_max; ID++) {
173 fTGID->AddLineToGrid(this, ID, npoints, xmin, xmax, logscale);
174 }
175 if (was_drawn) {
176 last_pad->cd();
177 Draw();
178 }
180}
181
182
183
186
188{
189 // a completer mais j'ai la fleme...
190 return fTGID;
191}
192
193
194
196
198{
199 id->SetLineColor(kGray + 2);
200 id->SetLineStyle(2);
202}
203
204
int Int_t
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
kGray
char name[80]
float xmin
float xmax
const KVNameValueList * GetParameters() const
Definition KVIDGraph.h:288
KVNameValueList fPar
parameters associated to grid
Definition KVIDGraph.h:45
virtual void SetVarX(const char *v)
Definition KVIDGraph.h:525
KVList fCuts
cuts used to define area in which identification is possible
Definition KVIDGraph.h:41
KVList fIdentifiers
list of identification objects
Definition KVIDGraph.h:40
virtual void SetName(const char *name)
Definition KVIDGraph.h:140
virtual void WriteToAsciiFile(std::ofstream &gridfile)
void Draw(Option_t *opt="")
Axis_t fXmin
Definition KVIDGraph.h:43
void UnDraw()
virtual void ReadFromAsciiFile(std::ifstream &gridfile)
void FindAxisLimits()
Calculate X/Y min/max of all objects in graph.
virtual void SetVarY(const char *v)
Definition KVIDGraph.h:529
const Char_t * GetName() const
virtual void AddIdentifier(KVIDentifier *id)
Definition KVIDGraph.h:340
TVirtualPad * fPad
pad in which graph is drawn
Definition KVIDGraph.h:48
Axis_t fYmax
min/max Y coordinates of graph
Definition KVIDGraph.h:44
const KVList * GetCuts() const
Definition KVIDGraph.h:308
void SetRuns(const KVNumberList &nl)
Set list of runs for which grid is valid.
Axis_t fXmax
min/max X coordinates of graph
Definition KVIDGraph.h:43
Axis_t fYmin
Definition KVIDGraph.h:44
KVIDGraph * GetGrid(const Char_t *name)
Return pointer to grid with name "name".
Identification grid with lines corresponding to different nuclear isotopes (KVIDZALine)
Definition KVIDZAGrid.h:66
Base class for graphical cuts used in particle identification.
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
virtual void Copy(TObject &obj) const
virtual void Delete(Option_t *option="")
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition KVString.h:73
Grid representing result of fit.
Definition KVTGIDGrid.h:24
virtual ~KVTGIDGrid()
Destructor.
void WriteToAsciiFile(std::ofstream &)
Write parameters of LTG fit used to generate grid in gridfile.
KVTGIDGrid()
Default constructor.
void ReadFromAsciiFile(std::ifstream &)
Read grid and parameters of LTG fit used to generate grid in gridfile.
virtual void Generate(Double_t xmax, Double_t xmin, Int_t ID_min=0, Int_t ID_max=0, Int_t npoints=50, Bool_t logscale=kTRUE)
const KVTGID * GetTGID() const
a completer mais j'ai la fleme...
virtual void AddIdentifier(KVIDentifier *id)
KVTGID * fTGID
KVTGID used to generate grid.
Definition KVTGIDGrid.h:26
Abstract base class for particle identfication using functionals developed by L. Tassan-Got (IPN Orsa...
Definition KVTGID.h:44
virtual void AddLineToGrid(KVIDGrid *g, Int_t ID, Int_t npoints, Double_t xmin, Double_t xmax, Bool_t log_scale=kFALSE)
Definition KVTGID.cpp:241
Double_t GetIDmin() const
Definition KVTGID.h:129
const KVNumberList & GetValidRuns() const
Definition KVTGID.h:253
Double_t GetIDmax() const
Definition KVTGID.h:121
const Char_t * GetVarX() const
Definition KVTGID.h:267
void WriteToAsciiFile(std::ofstream &) const
Write parameters of LTG fit in file.
Definition KVTGID.cpp:758
const Char_t * GetVarY() const
Definition KVTGID.h:275
static KVTGID * ReadFromAsciiFile(const Char_t *name, std::ifstream &)
Definition KVTGID.cpp:813
virtual void SetLineColor(Color_t lcolor)
const char * GetName() const override
virtual void Error(const char *method, const char *msgfmt,...) const
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
TLine * line
ClassImp(TPyArg)