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
17
18namespace ROOT {
19
20 namespace v5 {
21
22////////////////////////////////////////////////////////////////////////////////
23/// F1 default constructor.
24
26{
27 fXmin = 0;
28 fXmax = 0;
29 fNpx = 100;
30 fType = 0;
31 fNpfits = 0;
32 fNDF = 0;
33 fNsave = 0;
34 fChisquare = 0;
35 fParErrors = nullptr;
36 fParMin = nullptr;
37 fParMax = nullptr;
38 fSave = nullptr;
39 fMinimum = -1111;
40 fMaximum = -1111;
41 SetFillStyle(0);
42}
43
44////////////////////////////////////////////////////////////////////////////////
45/// TF1 default destructor.
46
48{
49 if (fParMin) delete [] fParMin;
50 if (fParMax) delete [] fParMax;
51 if (fParErrors) delete [] fParErrors;
52 if (fSave) delete [] fSave;
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// Stream a class object.
57
59{
60 if (b.IsReading()) {
62 Version_t v = b.ReadVersion(&R__s, &R__c);
63 Streamer(b, v, R__s, R__c, nullptr);
64
65 } else {
66 // this will be needed if we want to write in old format
67 //Int_t saved = 0;
68 // if (fType > 0 && fNsave <= 0) { saved = 1; Save(fXmin,fXmax,0,0,0,0);}
69
70 b.WriteClassBuffer(TF1Data::Class(),this);
71
72 //if (saved) {delete [] fSave; fSave = 0; fNsave = 0;}
73 }
74
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// specialized streamer function being able to read old TF1 versions as TF1Data in memory
79
81{
82 //printf("reading TF1Data ..- version %d..\n",v);
83 if (v > 4) {
84 b.ReadClassBuffer(ROOT::v5::TF1Data::Class(), this, v, R__s, R__c, onfile_class);
85 if (v == 5 && fNsave > 0) {
86 //correct badly saved fSave in 3.00/06
87 Int_t np = fNsave - 3;
88 fSave[np] = fSave[np-1];
89 fSave[np+1] = fXmin;
90 fSave[np+2] = fXmax;
91 }
92 return;
93 }
94 //====process old versions before automatic schema evolution
99 if (v < 4) {
101 b >> xmin; fXmin = xmin;
102 b >> xmax; fXmax = xmax;
103 } else {
104 b >> fXmin;
105 b >> fXmax;
106 }
107 b >> fNpx;
108 b >> fType;
109 b >> fChisquare;
110 b.ReadArray(fParErrors);
111 if (v > 1) {
112 b.ReadArray(fParMin);
113 b.ReadArray(fParMax);
114 } else {
115 fParMin = new Double_t[fNpar+1];
116 fParMax = new Double_t[fNpar+1];
117 }
118 b >> fNpfits;
119 if (v == 1) {
120 TH1 * histogram;
121 b >> histogram;
122 delete histogram; //fHistogram = 0;
123 }
124 if (v > 1) {
125 if (v < 4) {
129 } else {
130 b >> fMinimum;
131 b >> fMaximum;
132 }
133 }
134 if (v > 2) {
135 b >> fNsave;
136 if (fNsave > 0) {
137 fSave = new Double_t[fNsave+10];
138 b.ReadArray(fSave);
139 //correct fSave limits to match new version
140 fSave[fNsave] = fSave[fNsave-1];
141 fSave[fNsave+1] = fSave[fNsave+2];
142 fSave[fNsave+2] = fSave[fNsave+3];
143 fNsave += 3;
144 } else fSave = nullptr;
145 }
146 b.CheckByteCount(R__s, R__c, TF1Data::IsA());
147 //====end of old versions
148}
149
150 } // end namespace v5
151} // end namespace ROOT
#define b(i)
Definition RSha256.hxx:100
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
void Streamer(TBuffer &b, const TClass *onfile_class)
Stream a class object.
virtual void Streamer(TBuffer &)
virtual void Streamer(TBuffer &)
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:84
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
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