KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVIDZALine.cpp
1/***************************************************************************
2$Id: KVIDZALine.cpp,v 1.10 2009/05/05 15:57:52 franklan Exp $
3 KVIDZALine.cpp - description
4 -------------------
5 begin : Nov 10 2004
6 copyright : (C) 2004 by J.D. Frankland
7 email : frankland@ganil.fr
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#include "KVIDZALine.h"
20#include "TVector2.h"
21#include "Riostream.h"
22#include "TMath.h"
23
24using namespace std;
25
27
28
29
33
35{
36 // Default ctor
37 // Line width is set to zero
38 // Default identification is set to proton
39
40 SetWidth(0.);
41 fLineWithWidth = 0;
42}
43
44
45
48
50 : KVIDLine()
51{
52 // copy constructor
54 obj.Copy(*this);
55}
56
57
60
61void KVIDZALine::Copy(TObject& obj) const
62{
63 // copy 'this' to 'obj'
64 KVIDLine::Copy(obj);
65 ((KVIDZALine&)obj).SetWidth(fWidth);
66}
67
68
69
72
74{
75 //Default dtor
76}
77
78
79
80
83
85 const Char_t* name_prefix)
86{
87 // Write Z & A of line
88
90 file << GetZ() << "\t" << GetA() << endl;
91}
92
93
94
95
98
100{
101 // Read Z & A of line
102
104 Int_t Z, A;
105 file >> Z >> A;
106 SetZ(Z);
107 SetA(A);
108}
109
110
111
112
125
127{
128 //************ BACKWARDS COMPATIBILITY FIX *************
129 // special read method for old KVIDZLines
130 //
131 //Read coordinates of line in file buffer stream
132 //Format is :
133 //Z
134 //number_of_points
135 //x1 y1
136 //x2 y2
137 //...
138 //etc. etc.
139 Int_t N, Z;
140 file >> Z;
141 SetZ(Z);
142 file >> N;
143 for (Int_t i = 0; i < N; i++) {
144 Double_t x, y;
145 file >> x >> y;
146 SetPoint(i, x, y);
147 }
148}
149
150
151
152
158
160{
161 //Print out for line
162 //The optional "opt" string, if given, is printed in parentheses after the line's name
163 //This is used by KVIDGrid in order to show which lines are "ID" lines and which are
164 //"OK" lines (i.e. used to define an identifiable area in a data map).
165 cout << ClassName() << " : " << GetName() << "(" << opt << ")" << endl;
166 cout << "Z=" << GetZ() << " A=" << GetA() << endl;
167 if (GetWidth() > 0.0) cout << "Natural Line Width : " << GetWidth() << endl;
169}
170
171
172
173
178
180{
181 //Return pointer to TGraphError object which can be used to visualise the natural width
182 //of this identification line.
183 //If line width = 16000, the error bar is set to 0
184
185 if (fLineWithWidth) {
186 delete fLineWithWidth;
187 }
197 for (int i = 0; i < GetN(); i++) {
198 fLineWithWidth->SetPointError(i, 0., 0.5 * (GetWidth() < 16000 ? GetWidth() : 0));
199 }
200 return fLineWithWidth;
201}
202
203
204
205
213
215{
216 // Set the natural width of the line depending on its asymptotic separation
217 // a gauche (d_l) and a droite (d_r) from a neighbouring line.
218 // This method is used by KVIDGrid::CalculateLineWidths
219 //
220 // For ordinary Z/(Z,A) lines in a dE-E grid, this is just the average of
221 // the two asymptotic distances.
222
223 SetWidth((d_l + d_r) / 2.);
224}
225
226
227
230
232{
233 // Stream an object of class KVIDZALine.
234
235 UInt_t R__s, R__c;
236 if (R__b.IsReading()) {
237 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
238 if (R__v < 2) {
239 R__b.ReadVersion(&R__s, &R__c);// read version of KVIDZLine
240 KVIDLine::Streamer(R__b);
241 UShort_t z;
242 R__b >> z;
243 R__b >> fWidth;
244 SetZ(z);
245 UShort_t a;
246 R__b >> a;
247 SetA(a);
248 }
249 else {
250 R__b.ReadClassBuffer(KVIDZALine::Class(), this, R__v, R__s, R__c);
251 }
252 }
253 else {
255 }
256}
257
258
260
262
263
264// This class is for backwards compatibility only
265// and must not be used.
267
268
269
271
273{
274 // This class is for backwards compatibility only
275}
276
277
278
281
283{
284 // Stream an object of class KVIDZLine
285
286 UInt_t R__s, R__c;
287 if (R__b.IsReading()) {
288 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
289 if (R__v != 2) {
290 Warning("Streamer", "Reading KVIDZLine with version=%d", R__v);
291 }
292 KVIDLine::Streamer(R__b);
293 UShort_t z;
294 R__b >> z;
295 R__b >> fWidth;
296 SetZ(z);
297 }
298}
299
300
int Int_t
unsigned int UInt_t
unsigned short UShort_t
short Version_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
const char Option_t
#define N
Base class for lines/cuts used for particle identification in 2D data maps.
Definition KVIDLine.h:143
Base class for identification ridge lines corresponding to different nuclear species.
Definition KVIDZALine.h:33
virtual void Print(Option_t *opt="") const
void Copy(TObject &obj) const
copy 'this' to 'obj'
void ReadAsciiFile_KVIDZLine(std::ifstream &)
virtual void SetAsymWidth(Double_t d_l, Double_t d_r)
TGraphErrors * GetLineWithWidth()
virtual ~KVIDZALine()
Default dtor.
void SetWidth(Double_t w)
Definition KVIDZALine.h:65
virtual void ReadAsciiFile_extras(std::ifstream &)
Read Z & A of line.
TGraphErrors * fLineWithWidth
used to display width of line
Definition KVIDZALine.h:40
Double_t GetWidth() const
Definition KVIDZALine.h:61
Double_t fWidth
the "width" of the line
Definition KVIDZALine.h:39
virtual void WriteAsciiFile_extras(std::ofstream &, const Char_t *name_prefix="")
Write Z & A of line.
virtual void ReadAsciiFile_extras(std::ifstream &)
virtual Int_t GetA() const
virtual void WriteAsciiFile_extras(std::ofstream &, const Char_t *="")
virtual Int_t GetZ() const
virtual void SetA(Int_t atnum)
virtual void SetZ(Int_t ztnum)
virtual void Streamer(TBuffer &)
void Copy(TAttFill &attfill) const
virtual void SetFillColor(Color_t fcolor)
static TClass * Class()
virtual void SetFillStyle(Style_t fstyle)
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetPointError(Double_t ex, Double_t ey)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Double_t * GetY() const
void Print(Option_t *chopt="") const override
Int_t GetN() const
Double_t * GetX() const
void SetName(const char *name="") override
virtual void SetEditable(Bool_t editable=kTRUE)
const char * GetName() const override
virtual const char * ClassName() const
Double_t y[n]
Double_t x[n]
TArc a
ClassImp(TPyArg)