23 #ifndef ADF_DataHandling
24 #define ADF_DataHandling
25 #define ADF_DATAHANDLING_H ADF_DataHandling
102 virtual void Link(
void *,
void *)
132 Data_T fDefault; Data_T *fA1, *fA2;
141 DataLink(), fDefault(d), fA1(0x0), fA2(0x0) {;}
145 virtual void Link(
void *a1,
void *a2)
146 { fA1 = (Data_T *)a1; fA2 = (Data_T *)a2; };
154 { (*fA1) = fDefault; }
156 { (*fA2) = fDefault; }
159 { (*fA2) = (*fA1) = fDefault; }
234 {
return fType.compare(type) == 0 ; }
247 virtual void Print(std::ostream & = std::cout)
const
254 Data_T fDefault; Data_T fData;
289 link->
Link(&fData,extern_add);
293 virtual void Set(Data_T t)
296 virtual Data_T
Get()
const
315 { fData = fDefault; }
317 virtual void Print(std::ostream & = std::cout)
const
344 NamedItem<Data_T>(name,d),fRealItem(0x0) { fRealItem =
this; }
367 {
return fRealItem->MakeADataLink(extern_add); }
370 {
return fRealItem->Set(t) ; }
371 virtual void Set(Data_T t)
372 { fRealItem->Set(t) ; }
373 virtual Data_T
Get()
const
374 {
return fRealItem->Get(); }
377 { fRealItem->SetDefault(t) ; }
379 {
return fRealItem->GetDefault(); }
383 {fRealItem->SetItem(buf);}
386 {fRealItem->GetItem(buf);}
390 { fRealItem->Reset(); }
410 Double_t fXmin, fXmax, fDeltaX;
416 Digitizer(Double_t xmin = 0., Double_t xmax = 1., UInt_t bins = 1u);
419 virtual void Init(Double_t xmin = 0., Double_t xmax = 1., UInt_t bins = 1u);
435 if ( x <= fXmin )
return 0u;
436 if ( x > fXmax )
return fNBins2;
return UShort_t(fNBins2*(x-fXmin)/fDeltaX) ;
443 if ( x <= fXmin )
return 0u;
444 if ( x > fXmax )
return fNBins4;
return UInt_t(fNBins4*(x-fXmin)/fDeltaX) ;
451 {
if ( i > fNBins4 )
return fXmax;
return fXmin + (i+Double_t(::rand())/RAND_MAX) * fDeltaX / fNBins4; }
457 {
if ( i > fNBins2 )
return fXmax;
return fXmin + (i+Double_t(::rand())/RAND_MAX) * fDeltaX / fNBins2; }
463 {
if ( i > fNBins4 )
return fXmax;
return fXmin + (i) * fDeltaX / fNBins4; }
469 {
if ( i > fNBins2 )
return fXmax;
return fXmin + (i) * fDeltaX / fNBins2; }
475 {
if ( i > fNBins4 )
return fXmax;
return fXmin + (i+0.5) * fDeltaX / fNBins4; }
481 {
if ( i > fNBins2 )
return fXmax;
return fXmin + (i+0.5) * fDeltaX / fNBins2; }
Interface to digitise real values.
virtual ANamedItem * MakeAProxy()
ask this to create a proxy for it
A DataLink links too variables in memory.
virtual Bool_t Set(const ANamedItem *)=0
change value of this nmaed item using the passed one. it checks if asked, it check first if of the sa...
virtual Double_t UndigitR(UInt_t i) const
returns a randomized value corresponding to the given bin
virtual void Reset()
set the item to the default value
Implementation of a concrete DataLink.
virtual void CopyA2_to_A1()
Copy a2 into a1.
virtual void ResetA1()
set A1 to default
virtual void Reset()
both linked data to default
virtual ANamedItem * MakeAClone() const =0
clone that named item
virtual void CopyA2_to_A1()
Copy a2 into a1.
virtual void Reset()
set the item to the default value
virtual Double_t UndigitC(UInt_t i) const
returns a non-randomized value corresponding to the given bin (center)
virtual void Reset()
set the item to the default value
virtual ~ProxyNamedItem()
virtual void GetItem(const BufferIO &buf)
read the value of this item from the buffer
virtual DataLink * MakeADataLink(void *)=0
check is the passed DataLink is linked to the internal value of this NamaedItem
virtual ANamedItem * MakeAClone() const
clone that named item
virtual DataLink * MakeADataLink(void *extern_add)
ask this to create a suitable DataLink
virtual Double_t Undigit(UInt_t i) const
returns a non-randomized value corresponding to the given bin
virtual ANamedItem * MakeAProxy()
ask this to create a proxy for that item
Base class for a Global Object.
virtual void ResetA2()
set A2 to default
std::string GetName() const
change value of this nmaed item using the passed one. it checks if asked, it check first if of the sa...
virtual void SetItem(BufferIO &buf) const
write the value of this item to the buffer
virtual void Link(void *a1, void *a2)
test if the given address is one of the Link
virtual void Init(Double_t xmin=0., Double_t xmax=1., UInt_t bins=1u)
ANamedItem(const char *name, const char *type)
Constructor for a NamedItem.
std::string GetType() const
Type of the Item.
virtual ~AProxyNamedItem()
virtual Bool_t Set(const ANamedItem *t)
change value of this named item using the passed one. It has to be of the same type ! returns false i...
virtual Bool_t Set(const ANamedItem *item)
change value of this named item using the passed one. It has to be of the same type ! returns false i...
virtual Data_T GetDefault() const
Get the data.
virtual UInt_t D4Bytes(Double_t x) const
returns (as UInt_t) the bin corresponding to x
header file for BufferIO.cpp
virtual void ResetA1()
set A1 to default
virtual void GetItem(const BufferIO &buf)
read the value of this item from the buffer
virtual void CopyA1_to_A2()
Copy a1 into a2.
virtual void SetProxy(ANamedItem *)
the passed item becomes the real item
virtual Double_t UndigitC(UShort_t i) const
returns a non-randomized value corresponding to the given bin (center)
virtual Data_T Get() const
Get the data.
to set informations about the ADF configuration
virtual void Link(void *, void *)
test if the given address is one of the Link
virtual DataLink * MakeADataLink(void *extern_add)
ask this to create a suitable DataLink
virtual void SetDefault(Data_T t)
Set the data.
Bool_t IsType(const char *type)
Check if this is of type 'type'.
virtual Data_T GetDefault() const
Get the data.
virtual void ResetA2()
set A2 to default
virtual void GetItem(const BufferIO &)
read the value of this item from the buffer
virtual void Set(Data_T t)
Set the data.
NamedItem(const char *name, Data_T d=0)
virtual void Reset()
both linked data to default
virtual Data_T Get() const
Get the data.
virtual void SetProxy(ANamedItem *ritem)
the passed item becomes the real item
UShort_t GetBins2() const
virtual void Print(std::ostream &=std::cout) const
virtual UShort_t D2Bytes(Double_t x) const
returns (as UShort_t) the bin corresponding to x
virtual Double_t Undigit(UShort_t i) const
returns a non-randomized value corresponding to the given bin
virtual void Print(std::ostream &=std::cout) const
virtual void SetDefault(Data_T t)
Set the data.
virtual ANamedItem * MakeAProxy()=0
ask this to create a proxy for that item
std::string & Name()
Name of the Item.
virtual void SetItem(BufferIO &buf) const
write the value of this item to the buffer
virtual Double_t UndigitR(UShort_t i) const
returns a randomized value corresponding to the given bin
virtual void SetItem(BufferIO &) const
write the value of this item to the buffer
const char * NamedItemTypeOf(Bool_t)
ProxyNamedItem(const char *name, Data_T d=0)
std::string & Type()
Type of the Item.
Digitizer(Double_t xmin=0., Double_t xmax=1., UInt_t bins=1u)
virtual void Set(Data_T t)
Set the data.
virtual void CopyA1_to_A2()
Copy a1 into a2.