Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test files
  • Loading branch information
zzxuanyuan committed Jan 30, 2017
commit fbe481a76eadec3564248cfb5d17c748103e163a
168 changes: 168 additions & 0 deletions test/Localcompression.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
// @(#)root/test:$Id$
// Author: Rene Brun 19/08/96

#include "RVersion.h"
#include "TRandom.h"
#include "TDirectory.h"
#include "TProcessID.h"

#include "Localcompression.h"


ClassImp(TLarge)
ClassImp(TSmall)
ClassImp(TInt)

////////////////////////////////////////////////////////////////////////////////
/// Create an TLarge.
TLarge::TLarge(Int_t size)
{
fSize = size;
fLarge = new Float_t[fSize];
for(int i=0;i<fSize;++i) {
if (i%60==0) fLarge[i] = gRandom->Rndm(1);
else fLarge[i] = fLarge[i-1];
}
}

////////////////////////////////////////////////////////////////////////////////
/// Create an TLarge.
TLarge::TLarge(const TLarge& large) : TObject(large)
{
Float_t *intermediate = large.GetLarge();
Int_t size = large.GetSize();
fLarge = new Float_t[size];
for(int i=0;i<size;++i)
fLarge[i] = intermediate[i];
}

////////////////////////////////////////////////////////////////////////////////

TLarge::~TLarge()
{
Clear();
delete fLarge;
fSize = 0;
}

////////////////////////////////////////////////////////////////////////////////

void TLarge::Clear(Option_t * /*option*/)
{
TObject::Clear();
for(int i=0;i<fSize;++i)
fLarge[i] = 0;
}

/////////////////////////////////////////////////////////////////////////////////

void TLarge::Build()
{
for(int i=0;i<fSize;++i) {
if (i%6==0) fLarge[i] = gRandom->Rndm(1);
else fLarge[i] = fLarge[i-1];
}
}

///////////////////////////////////////////////////////////////////////////////
/// Create an TSmall.
TSmall::TSmall(Int_t size)
{
fSize = size;
fSmall = new Float_t[fSize];
for(int i=0;i<fSize;++i) {
if (i%6==0) fSmall[i] = gRandom->Rndm(1);
fSmall[i] = fSmall[i-1];
}
}

////////////////////////////////////////////////////////////////////////////////
/// Create an TSmall.
TSmall::TSmall(const TSmall& small) : TObject(small)
{
Float_t *intermediate = small.GetSmall();
Int_t size = small.GetSize();
fSmall = new Float_t[size];
for(int i=0;i<size;++i)
fSmall[i] = intermediate[i];
}

////////////////////////////////////////////////////////////////////////////////

TSmall::~TSmall()
{
Clear();
delete fSmall;
fSize = 0;
}

//////////////////////////////////////////////////////////////////////////////////

void TSmall::Build()
{
for(int i=0;i<fSize;++i) {
if (i%6==0) fSmall[i] = gRandom->Rndm(1);
else fSmall[i] = fSmall[i-1];
}
}

///////////////////////////////////////////////////////////////////////////////

void TSmall::Clear(Option_t * /*option*/)
{
TObject::Clear();
for(int i=0;i<fSize;++i)
fSmall[i] = 0;
}

///////////////////////////////////////////////////////////////////////////////
/// Create an TFloat.
TInt::TInt(Int_t size)
{
fSize = size;
fInt = new Int_t[fSize];
fInt[0] = Int_t(gRandom->Rndm(1));
for(int i=1;i<fSize;++i) {
fInt[i] = fInt[0];
}
}

////////////////////////////////////////////////////////////////////////////////
/// Create an TSmall.
TInt::TInt(const TInt& aint) : TObject(aint)
{
Int_t *intermediate = aint.GetInt();
Int_t size = aint.GetSize();
fInt = new Int_t[size];
for(int i=0;i<size;++i)
fInt[i] = intermediate[i];
}

////////////////////////////////////////////////////////////////////////////////

TInt::~TInt()
{
Clear();
delete fInt;
fSize = 0;
}

//////////////////////////////////////////////////////////////////////////////////

void TInt::Build()
{
fInt[0] = Int_t(gRandom->Rndm(1));
for(int i=1;i<fSize;++i) {
fInt[i] = fInt[0];
}
}

///////////////////////////////////////////////////////////////////////////////

void TInt::Clear(Option_t * /*option*/)
{
TObject::Clear();
for(int i=0;i<fSize;++i)
fInt[i] = 0;
}

83 changes: 83 additions & 0 deletions test/Localcompression.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#ifndef ROOT_Localcompression
#define ROOT_Localcompression

//////////////////////////////////////////////////////////////////////////
// //
// Local Compression //
// //
// Description of the event and track parameters //
// //
//////////////////////////////////////////////////////////////////////////

#include "TObject.h"
#include "TClonesArray.h"
#include "TRefArray.h"
#include "TRef.h"
#include "TH1.h"
#include "TBits.h"
#include "TMath.h"

#define LARGESIZE 1000000
#define SMALLSIZE 1000

class TLarge : public TObject {

private:
Int_t fSize;
Float_t *fLarge; //[fSize]

public:
TLarge(Int_t size = LARGESIZE);
TLarge(const TLarge& large);
virtual ~TLarge();
TLarge &operator=(const TLarge &large);

void Clear(Option_t *option ="");
void Build();
Int_t GetSize() const { return fSize; }
Float_t *GetLarge() const { return fLarge; }

ClassDef(TLarge,1)
};

class TSmall : public TObject {

private:
Int_t fSize;
Float_t *fSmall; //[fSize]

public:
TSmall(Int_t size = SMALLSIZE);
TSmall(const TSmall& small);
virtual ~TSmall();
TSmall &operator=(const TSmall &small);

void Clear(Option_t *option ="");
void Build();
Int_t GetSize() const { return fSize; }
Float_t *GetSmall() const { return fSmall; }

ClassDef(TSmall,1)
};

class TInt : public TObject {

private:
Int_t fSize;
Int_t *fInt; //[fSize]

public:
TInt(Int_t size = 1);
TInt(const TInt& aint);
virtual ~TInt();
TInt &operator=(const TInt &aint);

void Clear(Option_t *option ="");
void Build();
Int_t GetSize() const { return fSize; }
Int_t *GetInt() const { return fInt; }

ClassDef(TInt,1)
};

#endif
11 changes: 11 additions & 0 deletions test/LocalcompressionLinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class TLarge+;
#pragma link C++ class TSmall+;
#pragma link C++ class TInt+;

#endif
Loading