Commit 24c593ac authored by Stezowski Olivier's avatar Stezowski Olivier
Browse files

VertexFrame added ... not yet tested !

git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@935 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent d7cd642b
......@@ -62,13 +62,14 @@ conf:crystal 0xFA010201 0xFFFFFFFF
conf:psa 0xFA010202 0xFFFFFFFF
data 0xFA000100 0xFF00FF00
data:crystal 0xFA010101 0xFFFFFFFF
data:prepsa 0xFA010111 0xFFFFFFFF
data:ccrystal 0xFA010111 0xFFFFFFFF
data:psa 0xFA010102 0xFFFFFFFF
event:data:psa 0xFA010103 0xFFFFFFFF
event:data 0xFA010104 0xFFFFFFFF
data:tracked 0xFA010105 0xFFFFFFFF
data:ranc0 0xFA0201A0 0xFFFFFFFF
data:ranc1 0xFA0201A1 0xFFFFFFFF
data:ranc2 0xFA0201A2 0xFFFFFFFF
meta:vertex 0xFA010300 0xFFFFFFFF
#
#////ADF::AgataKeyFactory_end////
......
......@@ -20,30 +20,18 @@
/** \file AgataFrameFactory.cpp compiled in libGWADF.so */
#ifndef ADF_AgataFrameFactory
#include "AgataFrameFactory.h"
#endif
#ifndef ADF_AgataKeyFactory
#include "AgataKeyFactory.h"
#endif
#ifndef ADF_AgataCompositeFrame
#include "AgataCompositeFrame.h"
#endif
#ifndef ADF_PSAFrame
#include "PSAFrame.h"
#endif
#ifndef ADF_CrystalFrame
#include "CrystalFrame.h"
#endif
#ifndef ADF_TrackedFrame
#include "TrackedFrame.h"
#endif
#ifndef ADF_AgataConfigurationFrame
#include "AgataConfigurationFrame.h"
#endif
#ifndef ADF_AgataRawFrame
#include "AgataRawFrame.h"
#endif
#include "MetaFrame.h"
using namespace ADF;
// To help managing the various kind of Frame,
// each file of type icpp (for 'include in .cpp') contains one implementation
......@@ -56,8 +44,8 @@
#include "CrystalFrame_dev.icpp"
#include "TrackedFrame_dev.icpp"
#include "MetaFrame.icpp"
using namespace ADF;
AgataFrameFactory::AgataFrameFactory(): AFrameFactory<AgataFrameFactory>("Agata")
{
......@@ -180,7 +168,21 @@ Frame *AgataFrameFactory::NewImp(const Char_t *which_frame, Version version)
if ( frametype.find("data:ranc") != std::string::npos ) {
frame = new AgataRawFrame(GetPrimaryKey());
}
// PSA --------------------------------------------------------------------------- //
// RawAncillaries --------------------------------------------------------------------------- //
// meta --------------------------------------------------------------------------- //
if ( frametype == "meta:vertex" ) {
if ( version == Version(0,0) )
frame = new VertexFrame_0_0(GetPrimaryKey());
if ( version == Version(0,1) )
frame = new VertexFrame_0_1(GetPrimaryKey());
if ( version == Version(1,0) )
frame = new VertexFrame_1_0(GetPrimaryKey());
if ( version == Version(1,1) )
frame = new VertexFrame_1_1(GetPrimaryKey());
}
// meta --------------------------------------------------------------------------- //
return frame;
}
......
......@@ -48,7 +48,6 @@ void CrystalFrame_65000_0::DataReset()
{ fSegment.At(i)->Reset(); }
}
CrystalFrame_65000_0::CrystalFrame_65000_0(const Key *akey) :
ACrystalFrame(akey), fCore(kNbCores), fSegment(kNbSegments)
{
......@@ -103,12 +102,6 @@ UInt_t CrystalFrame_65000_0::WriteImp()
Float_t energy;
Float_t t;
// compute the needed size in the buffer and expand it if required
// UInt_t needed = 4u /* ID and Status*/
// + kNbSegments /* the segments*/
// *(GetSegment(0u)->GetSignal()->SizeOf()+sizeof(length)+2u*sizeof(UShort_t)+sizeof(Float_t))
// + kNbCores /* the cores */
// *(GetCore(0u)->GetSignal()->SizeOf()+sizeof(length)+2u*sizeof(UShort_t)+2u*sizeof(Float_t));
UInt_t needed = ADF::aMByte;
if ( !fBuffer->Reserve(needed) )
......
......@@ -182,6 +182,7 @@ public:
template <typename Data_T>
class ConcreteDataFrame : public ConcreteFrame, public DataFrame<Data_T>, protected Data_T
//class ConcreteDataFrame : public ConcreteFrame, public DataFrame<Data_T>, public Data_T
{
public:
ConcreteDataFrame(const Key *key):
......
/***************************************************************************
* Copyright (C) 2004 by Olivier Stezowski *
* stezow(AT)ipnl.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* aLong_t with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/** \file MetaFrame.cpp compiled in libGWADF.so */
#include "MetaFrame.h"
using namespace ADF;
/***************************************************************************
* Copyright (C) 2004 by Olivier Stezowski *
* stezow(AT)ipnl.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* aLong_t with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/** @file MetaFrame.h header file for MetaFrame.cpp */
#ifndef ADF_MetaFrame
#define ADF_MetaFrame
#include "AgataDataFrame.h"
#include "GObject.h"
namespace ADF
{
//! A vertex
class VertexInterface : public DataInterface
{
protected:
//! Vertex definition for internal use
template<typename Precision_T> struct Vertex {
Vertex() { ::memset(this,0,sizeof(Vertex<Precision_T>)); }
Precision_T P[3];
Precision_T D[3];
Precision_T Beta;
Precision_T DP[3];
Precision_T DD[3];
Precision_T DBeta;
};
public:
VertexInterface() : DataInterface()
{;}
virtual ~VertexInterface()
{;}
//! Set the position of the source (last argument is used in case the position depends on time)
virtual void SetPosition(Double_t , Double_t , Double_t ,Double_t = 0.0) = 0;
//! get the position of the source (last argument is used in case the position depends on time)
virtual void GetPosition(Double_t &, Double_t &, Double_t & ,Double_t = 0.0) const = 0;
//! set the direction of the source (last argument is used in case the position depends on time)
virtual void SetDirection(Double_t , Double_t , Double_t ,Double_t = 0.0) = 0;
//! get the direction of the source (last argument is used in case the position depends on time)
virtual void GetDirection(Double_t &, Double_t &, Double_t &,Double_t = 0.0) const = 0;
//! set recoil velocity
virtual void SetBeta(Double_t, Double_t = 0.0) = 0;
//! get recoil velocity
virtual Double_t GetBeta(Double_t = 0.0) const = 0;
};
//!
class AVertexFrame : public AgataDataFrame< VertexInterface >
{
protected:
AVertexFrame(const Key *akey):
AgataDataFrame< VertexInterface >(akey) {;}
public:
virtual ~AVertexFrame()
{;}
};
typedef ProxyDataFrame<AVertexFrame,VertexInterface> VertexFrame;
} // namespace ADF
#endif
/***************************************************************************
* Copyright (C) 2004 by Olivier Stezowski *
* stezow(AT)ipnl.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* aLong_t with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/** \file MetaFrame.icpp compiled in libGWADF.so */
//!
class VertexFrame_0 : public AVertexFrame
{
protected:
Vertex<Float_t> fSource;
UInt_t fSizeIO;
protected:
virtual void DataReset()
{;}
virtual UInt_t ReadImp() ;
virtual UInt_t WriteImp() ;
protected:
VertexFrame_0(const Key *akey):
AVertexFrame(akey), fSource(), fSizeIO(3u*sizeof(Float_t)) {;}
public:
virtual ~VertexFrame_0()
{;}
virtual void SetPosition(Double_t x, Double_t y, Double_t z, Double_t /*t*/ = 0.0)
{ fSource.P[0] = x; fSource.P[1] = y; fSource.P[2] = z; }
virtual void GetPosition(Double_t &x, Double_t &y, Double_t &z, Double_t /*t*/ = 0.0) const
{ x = fSource.P[0]; y = fSource.P[1]; z = fSource.P[2]; }
virtual void SetDirection(Double_t x, Double_t y, Double_t z, Double_t /*t*/ = 0.0)
{ fSource.D[0] = x; fSource.D[1] = y; fSource.D[2] = z; }
virtual void GetDirection(Double_t &x, Double_t &y, Double_t &z, Double_t /*t*/ = 0.0) const
{ x = fSource.D[0]; y = fSource.D[1]; z = fSource.D[2]; }
virtual void SetBeta(Double_t b, Double_t /*t*/ = 0.0)
{ fSource.Beta = b; }
virtual Double_t GetBeta(Double_t /*t*/ = 0.0) const
{ return fSource.Beta ; }
};
UInt_t VertexFrame_0::ReadImp()
{
// read the global part first
Global()->GetItems((*fBuffer));
(*fBuffer).Export((Float_t*)(&fSource),fSizeIO);
return fBuffer->Offset();
}
UInt_t VertexFrame_0::WriteImp()
{
// max size for the frame
if ( !fBuffer->Reserve(aKByte) )
return 0u;
// fill the buffer with items
Global()->SetItems((*fBuffer));
(*fBuffer).Import((Float_t*)(&fSource),fSizeIO);
return fBuffer->Offset();
}
class VertexFrame_0_0 : public VertexFrame_0
{
public:
VertexFrame_0_0(const Key *akey):
VertexFrame_0(akey){;}
virtual ~VertexFrame_0_0()
{;}
};
class VertexFrame_0_1 : public VertexFrame_0
{
public:
VertexFrame_0_1(const Key *akey):
VertexFrame_0(akey){ fSizeIO = 7u*sizeof(Float_t); }
virtual ~VertexFrame_0_1()
{;}
};
//!
class VertexFrame_1 : public AVertexFrame
{
protected:
Vertex<Double_t> fSource;
UInt_t fSizeIO;
protected:
virtual UInt_t ReadImp() ;
virtual UInt_t WriteImp() ;
virtual void DataReset()
{;}
public:
VertexFrame_1(const Key *akey):
AVertexFrame(akey), fSource(), fSizeIO(3u*sizeof(Double_t)) {;}
virtual ~VertexFrame_1()
{;}
virtual void SetPosition(Double_t x, Double_t y, Double_t z, Double_t /*t*/ = 0.0)
{ fSource.P[0] = x; fSource.P[1] = y; fSource.P[2] = z; }
virtual void GetPosition(Double_t &x, Double_t &y, Double_t &z, Double_t /*t*/ = 0.0) const
{ x = fSource.P[0]; y = fSource.P[1]; z = fSource.P[2]; }
virtual void SetDirection(Double_t x, Double_t y, Double_t z, Double_t /*t*/ = 0.0)
{ fSource.D[0] = x; fSource.D[1] = y; fSource.D[2] = z; }
virtual void GetDirection(Double_t &x, Double_t &y, Double_t &z, Double_t /*t*/ = 0.0) const
{ x = fSource.D[0]; y = fSource.D[1]; z = fSource.D[2]; }
virtual void SetBeta(Double_t b, Double_t /*t*/ = 0.0)
{ fSource.Beta = b; }
virtual Double_t GetBeta(Double_t /*t*/ = 0.0) const
{ return fSource.Beta ; }
};
UInt_t VertexFrame_1::ReadImp()
{
// read the global part first
Global()->GetItems((*fBuffer));
(*fBuffer).Export((Double_t*)(&fSource),fSizeIO);
return fBuffer->Offset();
}
UInt_t VertexFrame_1::WriteImp()
{
// max size for the frame
if ( !fBuffer->Reserve(aKByte) )
return 0u;
// fill the buffer with items
Global()->SetItems((*fBuffer));
(*fBuffer).Import((Double_t*)(&fSource),fSizeIO);
return fBuffer->Offset();
}
class VertexFrame_1_0 : public VertexFrame_1
{
public:
VertexFrame_1_0(const Key *akey):
VertexFrame_1(akey){;}
virtual ~VertexFrame_1_0()
{;}
};
class VertexFrame_1_1 : public VertexFrame_1
{
public:
VertexFrame_1_1(const Key *akey):
VertexFrame_1(akey){ fSizeIO = 7u*sizeof(Double_t); }
virtual ~VertexFrame_1_1()
{;}
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment