Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TF1Data_v5.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 18/08/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "v5/TF1Data.h"
13
14#include "TBuffer.h"
15#include "TH1.h"
16
18
19namespace ROOT {
20
21 namespace v5 {
22
23////////////////////////////////////////////////////////////////////////////////
24/// F1 default constructor.
25
27{
28 fXmin = 0;
29 fXmax = 0;
30 fNpx = 100;
31 fType = 0;
32 fNpfits = 0;
33 fNDF = 0;
34 fNsave = 0;
35 fChisquare = 0;
36 fParErrors = nullptr;
37 fParMin = nullptr;
38 fParMax = nullptr;
39 fSave = nullptr;
40 fMinimum = -1111;
41 fMaximum = -1111;
42 SetFillStyle(0);
43}
44
45////////////////////////////////////////////////////////////////////////////////
46/// TF1 default destructor.
47
49{
50 if (fParMin) delete [] fParMin;
51 if (fParMax) delete [] fParMax;
52 if (fParErrors) delete [] fParErrors;
53 if (fSave) delete [] fSave;
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Stream a class object.
58
60{
61 if (b.IsReading()) {
62 UInt_t R__s, R__c;
63 Version_t v = b.ReadVersion(&R__s, &R__c);
64 Streamer(b, v, R__s, R__c, nullptr);
65
66 } else {
67 // this will be needed if we want to write in old format
68 //Int_t saved = 0;
69 // if (fType > 0 && fNsave <= 0) { saved = 1; Save(fXmin,fXmax,0,0,0,0);}
70
71 b.WriteClassBuffer(TF1Data::Class(),this);
72
73 //if (saved) {delete [] fSave; fSave = 0; fNsave = 0;}
74 }
75
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// specialized streamer function being able to read old TF1 versions as TF1Data in memory
80
81void TF1Data::Streamer(TBuffer &b, Int_t v, UInt_t R__s, UInt_t R__c, const TClass *onfile_class)
82{
83 //printf("reading TF1Data ..- version %d..\n",v);
84 if (v > 4) {
85 b.ReadClassBuffer(ROOT::v5::TF1Data::Class(), this, v, R__s, R__c, onfile_class);
86 if (v == 5 && fNsave > 0) {
87 //correct badly saved fSave in 3.00/06
88 Int_t np = fNsave - 3;
89 fSave[np] = fSave[np-1];
90 fSave[np+1] = fXmin;
91 fSave[np+2] = fXmax;
92 }
93 return;
94 }
95 //====process old versions before automatic schema evolution
100 if (v < 4) {
102 b >> xmin; fXmin = xmin;
103 b >> xmax; fXmax = xmax;
104 } else {
105 b >> fXmin;
106 b >> fXmax;
107 }
108 b >> fNpx;
109 b >> fType;
110 b >> fChisquare;
111 b.ReadArray(fParErrors);
112 if (v > 1) {
113 b.ReadArray(fParMin);
114 b.ReadArray(fParMax);
115 } else {
116 fParMin = new Double_t[fNpar+1];
117 fParMax = new Double_t[fNpar+1];
118 }
119 b >> fNpfits;
120 if (v == 1) {
121 TH1 * histogram;
122 b >> histogram;
123 delete histogram; //fHistogram = 0;
124 }
125 if (v > 1) {
126 if (v < 4) {
127 Float_t minimum,maximum;
128 b >> minimum; fMinimum =minimum;
129 b >> maximum; fMaximum =maximum;
130 } else {
131 b >> fMinimum;
132 b >> fMaximum;
133 }
134 }
135 if (v > 2) {
136 b >> fNsave;
137 if (fNsave > 0) {
138 fSave = new Double_t[fNsave+10];
139 b.ReadArray(fSave);
140 //correct fSave limits to match new version
141 fSave[fNsave] = fSave[fNsave-1];
142 fSave[fNsave+1] = fSave[fNsave+2];
143 fSave[fNsave+2] = fSave[fNsave+3];
144 fNsave += 3;
145 } else fSave = nullptr;
146 }
147 b.CheckByteCount(R__s, R__c, TF1Data::IsA());
148 //====end of old versions
149}
150
151 } // end namespace v5
152} // end namespace ROOT
153
#define b(i)
Definition RSha256.hxx:100
short Version_t
Definition RtypesCore.h:65
float Float_t
Definition RtypesCore.h:57
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t SetFillStyle
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 np
float xmin
float xmax
The FORMULA class (ROOT version 5)
Definition TFormula.h:65
void Streamer(TBuffer &b, const TClass *onfile_class)
Stream a class object.
Fill Area Attributes class.
Definition TAttFill.h:19
virtual void Streamer(TBuffer &)
Line Attributes class.
Definition TAttLine.h:18
virtual void Streamer(TBuffer &)
Marker Attributes class.
Definition TAttMarker.h:19
virtual void Streamer(TBuffer &)
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TClass * IsA() const override
Definition TF1Data.h:60
Double_t * fParMin
Definition TF1Data.h:48
TF1Data()
F1 default constructor.
Double_t * fSave
Definition TF1Data.h:50
~TF1Data() override
TF1 default destructor.
void Streamer(TBuffer &b, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class=nullptr)
specialized streamer function being able to read old TF1 versions as TF1Data in memory
Double_t fXmin
Definition TF1Data.h:39
static TClass * Class()
Double_t * fParMax
Definition TF1Data.h:49
Double_t fMaximum
Definition TF1Data.h:51
Double_t fChisquare
Definition TF1Data.h:46
Double_t fMinimum
Definition TF1Data.h:52
Double_t * fParErrors
Definition TF1Data.h:47
Double_t fXmax
Definition TF1Data.h:40