Index: /trunk/Utilities/frog/Base.h
===================================================================
--- /trunk/Utilities/frog/Base.h	(revision 583)
+++ /trunk/Utilities/frog/Base.h	(revision 583)
@@ -0,0 +1,143 @@
+#ifndef _FROG_Base_H__
+#define _FROG_Base_H__
+
+#include "Utils.h"
+
+namespace FROG{
+
+class Base{
+protected :
+	std::vector<Base*> daughters_;
+	Base* mother_;
+	unsigned int detId_;
+	char* Name_;
+	unsigned short NameLength_;
+
+public :
+	virtual unsigned int chunkId(){ return 55556;}
+	virtual bool         isCompactible() { return true; }
+
+	class cmp {
+	public:
+		bool operator () (Base* a, Base* b) {return (a->chunkId() < b->chunkId());}
+	};
+
+	Base(){
+		mother_        = NULL;
+	}
+
+	virtual ~Base(){		
+		for(unsigned int i=0;i<daughters_.size();i++){if(daughters_[i]){
+			delete daughters_[i];
+			daughters_[i]=NULL;}
+		}
+	}
+
+	virtual ByteBuffer writeData(){		
+		return ByteBuffer(0);
+	}	
+	
+	virtual ByteBuffer writeDaughtersData(){		
+		if(daughters_.size()==0)return ByteBuffer(0);
+				
+		ByteBuffer* daughterBuffer = new ByteBuffer[daughters_.size()];
+		int daughterBufferSize = 0;
+		for(unsigned int i=0;i<daughters_.size();i++){
+			daughterBuffer[i]   = (daughters_[i])->write();
+			daughterBufferSize += daughterBuffer[i].position(); 
+		}
+		
+		ByteBuffer toReturn = ByteBuffer(daughterBufferSize);
+		unsigned int PreviousChunkId = -1;  int PreviousSizeBlock = 2; 
+		int Size = 0;  
+		for(unsigned int i=0;i<daughters_.size();i++){
+			bool Compacting = daughters_[i]->chunkId() == PreviousChunkId && daughters_[i]->isCompactible();			
+			//printf("Compacting = %i\n",(int)Compacting);
+			//printf("pos = %i\n",(int)daughterBuffer[i].position());
+			daughterBuffer[i].flip();
+			//printf("pos = %i\n",(int)daughterBuffer[i].position());
+			if(Compacting){	daughterBuffer[i].position(6);	
+			}else{			PreviousSizeBlock = toReturn.position()+2;		}
+			Size += daughterBuffer[i].remaining();
+			//printf("ToReturnpos = %i  (%i)\n",toReturn.position(), daughterBuffer[i].position());	
+			toReturn.put(daughterBuffer[i]);
+			//printf("ToReturnpos = %i  (%i)\n",toReturn.position(), daughterBuffer[i].position());	
+			if(Compacting)toReturn.putInt(PreviousSizeBlock, Size );
+			PreviousChunkId = daughters_[i]->chunkId();
+		}
+		//printf("DaughtersData size = %i - position =%i\n",toReturn.capacity(), toReturn.position());
+		return toReturn;
+	}			
+
+	ByteBuffer write(){		
+		ByteBuffer data 		= writeData();
+		ByteBuffer daughterData = writeDaughtersData();	
+		ByteBuffer toReturn = ByteBuffer(6 + data.position() + daughterData.position());
+		toReturn.putUShort(chunkId());
+		toReturn.putInt(0);
+		data.flip();
+		toReturn.put(data);
+		data.clear();
+		daughterData.flip();
+		toReturn.put(daughterData);
+		daughterData.clear();
+		toReturn.putInt(2,toReturn.position());
+		return toReturn;
+	}
+
+	void save(std::string fileName){
+		ByteBuffer data = write();
+		FILE* pFile = fopen(fileName.c_str(), "wb");
+		fwrite(data.buffer,data.position(),1,pFile);
+		fclose(pFile);
+		data.clear();
+	}
+
+
+	const std::vector<Base*>& daughters() const { return daughters_; }
+	void setMother(Base* mother){ mother_ = mother;}
+    Base* getMother(){
+       	return mother_;
+    }
+	
+    void addDaughter( Base* dau){
+		dau->setMother(this);
+       	daughters_.push_back(dau);
+    }
+
+    Base* getDaughter(unsigned int i){		
+       	return daughters_[i];
+    }
+
+    unsigned int getDaughterSize(){
+       	return daughters_.size();
+    }
+
+	void deleteDaughter(unsigned int i){
+		if(i>=daughters_.size())return;
+
+		daughters_[i]->deleteDaughters();
+		delete daughters_[i];		
+		daughters_.erase(daughters_.begin()+i);
+	}
+
+	void deleteDaughters(){
+		for(unsigned int i=0;i<daughters_.size();i++){
+			daughters_[i]->deleteDaughters();
+			delete daughters_[i];
+		}
+		daughters_.clear();
+	}
+
+    unsigned int DetId(){return detId_;}
+    Base* getDaughterWithDetId(unsigned int detid) const {
+		for(unsigned int i=0;i<daughters_.size();i++){
+		   if(daughters_[i]->DetId()==detid)return daughters_[i];
+		}
+		return NULL;
+    }
+
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/BaseColl.h
===================================================================
--- /trunk/Utilities/frog/BaseColl.h	(revision 583)
+++ /trunk/Utilities/frog/BaseColl.h	(revision 583)
@@ -0,0 +1,23 @@
+// FROG_Element_Base.h: Contains everything related to an element to be written in a file :
+//                     type, size, data
+//                     And a vector of daughters
+//////////////////////////////////////////////////////////////////////
+
+#ifndef _FROG_BASECOLL_H__
+#define _FROG_BASECOLL_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class BaseColl : public Base{
+public:
+	virtual unsigned int chunkId(){ return 55555;}
+	virtual bool         isCompactible() { return false; }
+
+	BaseColl(){
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/BaseColl_Id.h
===================================================================
--- /trunk/Utilities/frog/BaseColl_Id.h	(revision 583)
+++ /trunk/Utilities/frog/BaseColl_Id.h	(revision 583)
@@ -0,0 +1,25 @@
+#ifndef _FROG_BaseColl_Id_H__
+#define _FROG_BaseColl_Id_H__
+
+#include "BaseColl.h"
+
+namespace FROG{
+
+class BaseColl_Id : public BaseColl {
+public :
+	virtual unsigned int chunkId(){ return 1000;}
+	virtual bool        isCompactible(){ return false; }
+
+	BaseColl_Id(unsigned int detId=0){
+		detId_ = detId;
+	}
+
+	virtual ByteBuffer writeData(){		
+		ByteBuffer toReturn(4);
+		toReturn.putUInt(detId_);
+		return toReturn;
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/BaseColl_Name.h
===================================================================
--- /trunk/Utilities/frog/BaseColl_Name.h	(revision 583)
+++ /trunk/Utilities/frog/BaseColl_Name.h	(revision 583)
@@ -0,0 +1,38 @@
+#ifndef _FROG_BaseColl_Name_H__
+#define _FROG_BaseColl_Name_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class BaseColl_Name : public BaseColl_Id {
+public :
+	virtual unsigned int chunkId(){ return 3000;}
+	virtual bool        isCompactible(){ return false; }
+
+	BaseColl_Name(){}
+	BaseColl_Name(unsigned int detId, const char* name, ...) : 
+	BaseColl_Id(detId){
+		char FullName[512];
+		va_list args;
+		va_start(args,name);
+		vsprintf(FullName,name,args);
+		va_end(args);
+		NameLength_ = strlen(FullName);
+		Name_ = new char[NameLength_+1];		
+		sprintf(Name_,"%s",FullName);
+	}
+	~BaseColl_Name() {delete [] Name_;}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn = ByteBuffer(6 + NameLength_);		
+		toReturn.putUInt(detId_);
+		toReturn.putUShort((unsigned short)NameLength_);
+		for(int c=0;c<NameLength_;c++)toReturn.putByte(Name_[c]);
+		return toReturn;
+	}
+};
+
+}//FROG Namespace
+#endif
+
Index: /trunk/Utilities/frog/CMS_Geom_Calo.h
===================================================================
--- /trunk/Utilities/frog/CMS_Geom_Calo.h	(revision 583)
+++ /trunk/Utilities/frog/CMS_Geom_Calo.h	(revision 583)
@@ -0,0 +1,47 @@
+#ifndef _FROG_CMS_Geom_Calo_H__
+#define _FROG_CMS_Geom_Calo_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class CMS_Geom_Calo : public BaseColl_Id {
+public :
+	float ProjFactor;
+	float PosX;    float PosY;    float PosZ;					
+	float WX;	   float WY;      float WZ;
+	float HX;	   float HY;      float HZ;		
+	
+	virtual unsigned int chunkId(){ return 11999;}
+	virtual bool isCompactible(){ return true; }
+
+	CMS_Geom_Calo(){}
+	CMS_Geom_Calo(unsigned int detId, float projFactor,
+	float posX,		float posY,		float posZ,
+	float wX,		float wY,		float wZ,
+	float hX,		float hY,		float hZ) :
+	BaseColl_Id(detId),
+	ProjFactor(projFactor),
+	PosX(posX),		PosY(posY),		PosZ(posZ),
+	WX(wX),			WY(wY),			WZ(wZ),
+	HX(hX),			HY(hY),			HZ(hZ){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(44);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(ProjFactor);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(WX);
+		toReturn.putFloat(WY);
+		toReturn.putFloat(WZ);
+		toReturn.putFloat(HX);
+		toReturn.putFloat(HY);
+		toReturn.putFloat(HZ);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/CMS_Geom_Tracking.h
===================================================================
--- /trunk/Utilities/frog/CMS_Geom_Tracking.h	(revision 583)
+++ /trunk/Utilities/frog/CMS_Geom_Tracking.h	(revision 583)
@@ -0,0 +1,54 @@
+#ifndef _FROG_CMS_Geom_Tracking_H__
+#define _FROG_CMS_Geom_Tracking_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class CMS_Geom_Tracking : public BaseColl_Id {
+public :
+	float TrapezoidalParam;
+	float PosX;    float PosY;    float PosZ;
+	float WidthX;  float WidthY;  float WidthZ;
+	float LengthX; float LengthY; float LengthZ;
+	float ThickX;  float ThickY;  float ThickZ;
+
+	virtual unsigned int chunkId(){ return 21100;}
+	virtual bool isCompactible(){ return true; }
+
+	CMS_Geom_Tracking(){};
+	CMS_Geom_Tracking(unsigned int detId, float trapezoidalParam,
+	float posX,    float posY,    float posZ,
+	float widthX,  float widthY,  float widthZ,
+	float lengthX, float lengthY, float lengthZ,
+	float thickX,  float thickY,  float thickZ) : 
+	BaseColl_Id(detId),
+	TrapezoidalParam(trapezoidalParam),
+	PosX(posX), PosY(posY), PosZ(posZ),
+	WidthX(widthX), WidthY(widthY), WidthZ(widthZ),
+	LengthX(lengthX), LengthY(lengthY), LengthZ(lengthZ),
+	ThickX(thickX),  ThickY(thickY), ThickZ(thickZ){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(56);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(TrapezoidalParam);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(WidthX);
+		toReturn.putFloat(WidthY);
+		toReturn.putFloat(WidthZ);
+		toReturn.putFloat(LengthX);
+		toReturn.putFloat(LengthY);
+		toReturn.putFloat(LengthZ);
+		toReturn.putFloat(ThickX);
+		toReturn.putFloat(ThickY);
+		toReturn.putFloat(ThickZ);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
+
Index: /trunk/Utilities/frog/Event.h
===================================================================
--- /trunk/Utilities/frog/Event.h	(revision 583)
+++ /trunk/Utilities/frog/Event.h	(revision 583)
@@ -0,0 +1,34 @@
+#ifndef _FROG_EVENT_H__
+#define _FROG_EVENT_H__
+
+#include "BaseColl.h"
+
+namespace FROG{
+
+class Event : public Base {
+public :
+	unsigned int       NRun_;
+	unsigned int       NEvent_;
+	unsigned long long TimeStamp_;
+
+	virtual unsigned int chunkId(){ return 10002;}
+	virtual bool isCompactible(){ return false; }
+
+	Event(){NRun_=0;NEvent_=0;TimeStamp_=0;}	
+	Event(unsigned int Run, unsigned int Event, unsigned long long TimeStamp = 0){
+		NRun_     = Run;
+		NEvent_   = Event;
+		TimeStamp_= TimeStamp;
+	}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16);
+		toReturn.putUInt(NRun_);
+		toReturn.putUInt(NEvent_);
+		toReturn.putULong(TimeStamp_);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Beam.h
===================================================================
--- /trunk/Utilities/frog/Event_Beam.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Beam.h	(revision 583)
@@ -0,0 +1,48 @@
+#ifndef _FROG_EVENT_BEAM_H__
+#define _FROG_EVENT_BEAM_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_Beam : public BaseColl_Id {
+public :
+    float x;      float y;      float z; 
+	float px;     float py;     float pz;
+	float sigmax; float sigmay; float sigmaz;
+	unsigned int N;
+	
+	virtual unsigned int chunkId(){ return 19001;}
+    virtual bool isCompactible(){ return true; }
+
+	Event_Beam(){}
+    Event_Beam( unsigned int DetId,
+    float x_,      float y_,      float z_,
+	float px_,     float py_,     float pz_,
+	float sigmax_, float sigmay_, float sigmaz_,
+	unsigned int N_):	
+    BaseColl_Id(DetId),
+    x(x_),y(y_),z(z_),
+	px(px_),py(py_),pz(pz_),
+	sigmax(sigmax_),sigmay(sigmay_),sigmaz(sigmaz_),
+	N(N_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(44);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(x);
+		toReturn.putFloat(y);
+		toReturn.putFloat(z);
+		toReturn.putFloat(px);
+		toReturn.putFloat(py);
+		toReturn.putFloat(pz);
+		toReturn.putFloat(sigmax);
+		toReturn.putFloat(sigmay);
+		toReturn.putFloat(sigmaz);
+		toReturn.putUInt(N);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_CaloHit.h
===================================================================
--- /trunk/Utilities/frog/Event_CaloHit.h	(revision 583)
+++ /trunk/Utilities/frog/Event_CaloHit.h	(revision 583)
@@ -0,0 +1,32 @@
+#ifndef _FROG_EVENT_CALOHIT_H__
+#define _FROG_EVENT_CALOHIT_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_CaloHit : public BaseColl_Id {
+public :
+    float E; float t; 
+
+	virtual unsigned int chunkId(){ return 12210;}
+    virtual bool isCompactible(){ return true; }
+
+	Event_CaloHit(){}
+    Event_CaloHit( unsigned int DetId, float E_, float t_):
+    BaseColl_Id(DetId),
+		E(E_),t(t_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(12);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(E);
+		toReturn.putFloat(t);
+		return toReturn;	
+	}
+
+
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_CaloTower.h
===================================================================
--- /trunk/Utilities/frog/Event_CaloTower.h	(revision 583)
+++ /trunk/Utilities/frog/Event_CaloTower.h	(revision 583)
@@ -0,0 +1,38 @@
+#ifndef _FROG_EVENT_CALOTOWER_H__
+#define _FROG_EVENT_CALOTOWER_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_CaloTower : public BaseColl_Id {
+public :
+    float Eem_; float Ehad_; 
+	unsigned int			  Components_CollEvtId_;
+	std::vector<unsigned int> Components_Vector_;
+
+	virtual unsigned int chunkId(){ return 12310;}
+    virtual bool isCompactible(){ return false; }
+
+	Event_CaloTower( ){}
+    Event_CaloTower( unsigned int DetId, float Eem, float Ehad):
+    BaseColl_Id(DetId),
+		Eem_(Eem),Ehad_(Ehad){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16+Components_Vector_.size()*4);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Eem_);
+		toReturn.putFloat(Ehad_);
+		if(Components_Vector_.size()>0){
+			toReturn.putUInt(Components_CollEvtId_);
+			for(unsigned int i=0;i<Components_Vector_.size();i++){
+				toReturn.putUInt(Components_Vector_[i]);
+			}
+		}
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Candidate.h
===================================================================
--- /trunk/Utilities/frog/Event_Candidate.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Candidate.h	(revision 583)
@@ -0,0 +1,31 @@
+#ifndef _FROG_EVENT_RECOCANDIDATE_H__
+#define _FROG_EVENT_RECOCANDIDATE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Candidate : public Base {
+public :
+	int PdgId_; float P_; float Eta_; float Phi_; 
+
+	virtual unsigned int chunkId(){ return 15100;}
+	virtual bool isCompactible(){ return true; }
+
+    Event_Candidate() {}
+	Event_Candidate(int PdgId, float P, float Eta, float Phi ) :		
+	PdgId_(PdgId), P_(P), Eta_(Eta),Phi_(Phi){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16);
+		toReturn.putInt(PdgId_);
+		toReturn.putFloat(P_);
+		toReturn.putFloat(Eta_);
+		toReturn.putFloat(Phi_);
+		return toReturn;	
+	}
+
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Cluster_SiStrip.h
===================================================================
--- /trunk/Utilities/frog/Event_Cluster_SiStrip.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Cluster_SiStrip.h	(revision 583)
@@ -0,0 +1,36 @@
+#ifndef _FROG_EVENT_CLUSTER_SISTRIP_H__
+#define _FROG_EVENT_CLUSTER_SISTRIP_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_Cluster_SiStrip : public BaseColl_Id{
+public :
+    unsigned short firstStrip_;	float pitch_;
+	std::vector<unsigned char> Ampl_;	
+	float charge_;
+
+	virtual unsigned int chunkId(){ return 12113;}
+	virtual bool isCompactible(){ return false; }
+
+	Event_Cluster_SiStrip(){}
+    Event_Cluster_SiStrip( unsigned int DetId,unsigned short firstStrip, float pitch):
+    BaseColl_Id(DetId),
+		firstStrip_(firstStrip),pitch_(pitch){}    
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16 + Ampl_.size());
+		toReturn.putUInt(detId_);
+		toReturn.putUShort(firstStrip_);
+		toReturn.putFloat(pitch_);
+		toReturn.putUShort(Ampl_.size());
+		for(unsigned int i=0;i<Ampl_.size();i++){				
+			toReturn.putByte(Ampl_[i]);				
+		}
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Electron.h
===================================================================
--- /trunk/Utilities/frog/Event_Electron.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Electron.h	(revision 583)
@@ -0,0 +1,43 @@
+#ifndef _EVENT_ELECTRON_H__
+#define _EVENT_ELECTRON_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Electron : public Base {
+public :
+       float p_, eta_, phi_, vx_, vy_, vz_, cx_, cy_, cz_;
+	unsigned int		  Components_CollEvtId_;
+	std::vector<unsigned int> Components_Vector_;
+	
+	virtual unsigned int chunkId(){ return 17100;}
+    virtual bool isCompactible(){ return false; }
+
+	Event_Electron(){}
+    Event_Electron(float p, float eta, float phi, float vx, float vy, float vz, float cx, float cy, float cz):
+    p_(p),eta_(eta), phi_(phi), vx_(vx), vy_(vy), vz_(vz), cx_(cx), cy_(cy), cz_(cz){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(40+4*Components_Vector_.size());
+		toReturn.putFloat(p_);
+		toReturn.putFloat(eta_);
+		toReturn.putFloat(phi_);
+		toReturn.putFloat(vx_);
+		toReturn.putFloat(vy_);
+		toReturn.putFloat(vz_);
+		toReturn.putFloat(cx_);
+		toReturn.putFloat(cy_);
+		toReturn.putFloat(cz_);
+		if(Components_Vector_.size()>0){
+			toReturn.putUInt(Components_CollEvtId_);
+			for(unsigned int i=0;i<Components_Vector_.size();i++){
+				toReturn.putUInt(Components_Vector_[i]);
+			}
+		}
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Hit.h
===================================================================
--- /trunk/Utilities/frog/Event_Hit.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Hit.h	(revision 583)
@@ -0,0 +1,33 @@
+#ifndef _EVENT_TRACKHIT_H__
+#define _EVENT_TRACKHIT_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_Hit : public BaseColl_Id {
+public :
+    float x; float y; float z; float Charge;
+	
+	virtual unsigned int chunkId(){ return 12111;}
+    virtual bool isCompactible(){ return true; }
+
+	Event_Hit(){}
+    Event_Hit( unsigned int DetId,
+    float x_, float y_, float z_, float Charge_):
+    BaseColl_Id(DetId),
+		x(x_),y(y_),z(z_),Charge(Charge_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(20);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(x);
+		toReturn.putFloat(y);
+		toReturn.putFloat(z);
+		toReturn.putFloat(Charge);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Jet.h
===================================================================
--- /trunk/Utilities/frog/Event_Jet.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Jet.h	(revision 583)
@@ -0,0 +1,37 @@
+#ifndef _FROG_EVENT_JET_H__
+#define _FROG_EVENT_JET_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Jet : public Base {
+public :
+	float P_; float Eta_; float Phi_; 
+	unsigned int              Components_CollEvtId_;
+	std::vector<unsigned int> Components_Vector_;
+
+	virtual unsigned int chunkId(){ return 13100;}
+	virtual bool isCompactible(){ return false; }
+
+	Event_Jet(){}
+	Event_Jet(float P, float Eta, float Phi):
+	P_(P), Eta_(Eta),Phi_(Phi){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16+Components_Vector_.size()*4);
+		toReturn.putFloat(P_);
+		toReturn.putFloat(Eta_);
+		toReturn.putFloat(Phi_);
+		if(Components_Vector_.size()>0){
+			toReturn.putUInt(Components_CollEvtId_);
+			for(unsigned int i=0;i<Components_Vector_.size();i++){
+				toReturn.putUInt(Components_Vector_[i]);
+			}
+		}
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_MET.h
===================================================================
--- /trunk/Utilities/frog/Event_MET.h	(revision 583)
+++ /trunk/Utilities/frog/Event_MET.h	(revision 583)
@@ -0,0 +1,31 @@
+#ifndef _FROG_EVENT_MET_H__
+#define _FROG_EVENT_MET_H__
+
+#include "Event_Candidate.h"
+
+namespace FROG{
+
+class Event_MET : public Event_Candidate {
+public :
+    float SumEt_;
+	
+	virtual unsigned int chunkId(){ return 14100;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_MET(){}
+	Event_MET(int PdgId, float P, float Eta, float Phi, float SumEt ) : 
+	Event_Candidate(PdgId,P,Eta,Phi), SumEt_(SumEt){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(20);
+		toReturn.putInt(PdgId_);
+		toReturn.putFloat(P_);
+		toReturn.putFloat(Eta_);
+		toReturn.putFloat(Phi_);
+		toReturn.putFloat(SumEt_);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Photon.h
===================================================================
--- /trunk/Utilities/frog/Event_Photon.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Photon.h	(revision 583)
@@ -0,0 +1,43 @@
+#ifndef _FROG_EVENT_PHOTON_H__
+#define _FROG_EVENT_PHOTON_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Photon : public Base {
+public :
+       float p_, eta_, phi_, vx_, vy_, vz_, cx_, cy_, cz_;
+	unsigned int		  Components_CollEvtId_;
+	std::vector<unsigned int> Components_Vector_;
+	
+	virtual unsigned int chunkId(){ return 16100;}
+    virtual bool isCompactible(){ return false; }
+
+	Event_Photon(){}
+    Event_Photon(float p, float eta, float phi, float vx, float vy, float vz, float cx, float cy, float cz):
+	p_(p),eta_(eta), phi_(phi), vx_(vx), vy_(vy), vz_(vz), cx_(cx), cy_(cy), cz_(cz){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(40+4*Components_Vector_.size());
+		toReturn.putFloat(p_);
+		toReturn.putFloat(eta_);
+		toReturn.putFloat(phi_);
+		toReturn.putFloat(vx_);
+		toReturn.putFloat(vy_);
+		toReturn.putFloat(vz_);
+		toReturn.putFloat(cx_);
+		toReturn.putFloat(cy_);
+		toReturn.putFloat(cz_);
+		if(Components_Vector_.size()>0){
+			toReturn.putUInt(Components_CollEvtId_);
+			for(unsigned int i=0;i<Components_Vector_.size();i++){
+				toReturn.putUInt(Components_Vector_[i]);
+			}
+		}
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Segment.h
===================================================================
--- /trunk/Utilities/frog/Event_Segment.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Segment.h	(revision 583)
@@ -0,0 +1,36 @@
+#ifndef _FROG_EVENT_SEGMENT_H__
+#define _FROG_EVENT_SEGMENT_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Event_Segment : public BaseColl_Id {
+public :
+    float x;  float y;  float z;  
+	float dx; float dy; float dz;
+
+	virtual unsigned int chunkId(){ return 12112;}
+    virtual bool isCompactible(){ return true; }
+
+	Event_Segment(){	}
+    Event_Segment( unsigned int DetId,
+    float x_, float y_, float z_, float dx_, float dy_, float dz_):
+    BaseColl_Id(DetId),
+		x(x_),y(y_),z(z_),dx(dx_), dy(dy_), dz(dz_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(28);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(x);
+		toReturn.putFloat(y);
+		toReturn.putFloat(z);
+		toReturn.putFloat(dx);
+		toReturn.putFloat(dy);
+		toReturn.putFloat(dz);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Sim_Hit.h
===================================================================
--- /trunk/Utilities/frog/Event_Sim_Hit.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Sim_Hit.h	(revision 583)
@@ -0,0 +1,31 @@
+#ifndef _FROG_EVENT_SIM_HIT_H__
+#define _FROG_EVENT_SIM_HIT_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Sim_Hit : public Base {
+public :
+    float x; float y; float z; float Charge; unsigned char ProcessType;	
+
+	virtual unsigned int chunkId(){ return 11010;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_Sim_Hit(){}
+    Event_Sim_Hit(float x_, float y_, float z_, float Charge_, unsigned char ProcessType_):
+	x(x_),y(y_),z(z_),Charge(Charge_), ProcessType(ProcessType_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(20);
+		toReturn.putFloat(x);
+		toReturn.putFloat(y);
+		toReturn.putFloat(z);
+		toReturn.putFloat(Charge);
+		toReturn.putInt(ProcessType);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Sim_Particle.h
===================================================================
--- /trunk/Utilities/frog/Event_Sim_Particle.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Sim_Particle.h	(revision 583)
@@ -0,0 +1,45 @@
+#ifndef _FROG_EVENT_SIM_PARTICLE_H__
+#define _FROG_EVENT_SIM_PARTICLE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Sim_Particle : public Base {
+public :	
+    float Px;float Py; float Pz; float E;int Type;float charge;
+	float V1x;float V1y;float V1z;
+	float V2x;float V2y;float V2z;
+	
+	virtual unsigned int chunkId(){ return 11040;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_Sim_Particle(){}
+	Event_Sim_Particle(
+	float Px_,float Py_, float Pz_, float E_,int Type_,float charge_,
+	float V1x_,float V1y_,float V1z_,
+	float V2x_,float V2y_,float V2z_):	
+        Px(Px_), Py(Py_), Pz(Pz_), E(E_), Type(Type_), charge(charge_),
+		V1x(V1x_),V1y(V1y_), V1z(V1z_),
+		V2x(V2x_),V2y(V2y_), V2z(V2z_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(48);
+		toReturn.putFloat(Px);
+		toReturn.putFloat(Py);
+		toReturn.putFloat(Pz);
+		toReturn.putFloat(E);
+		toReturn.putInt(Type);
+		toReturn.putFloat(charge);
+		toReturn.putFloat(V1x);
+		toReturn.putFloat(V1y);
+		toReturn.putFloat(V1z);
+		toReturn.putFloat(V2x);
+		toReturn.putFloat(V2y);
+		toReturn.putFloat(V2z);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Sim_Track.h
===================================================================
--- /trunk/Utilities/frog/Event_Sim_Track.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Sim_Track.h	(revision 583)
@@ -0,0 +1,36 @@
+#ifndef _FROG_EVENT_SIM_TRACK_H__
+#define _FROG_EVENT_SIM_TRACK_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Sim_Track : public Base {
+public :	
+    int track_id;float Px;float Py; float Pz; float E;int Type;int parent_vertex;float charge;
+		
+	virtual unsigned int chunkId(){ return 11030;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_Sim_Track(){}
+	Event_Sim_Track(
+	int track_id_,float Px_,float Py_, float Pz_, float E_,int Type_,int parent_vertex_,float charge_):
+	track_id(track_id_), Px(Px_), Py(Py_), Pz(Pz_), E(E_), Type(Type_),parent_vertex(parent_vertex_),charge(charge_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(48);
+		toReturn.putInt(track_id);
+		toReturn.putFloat(Px);
+		toReturn.putFloat(Py);
+		toReturn.putFloat(Pz);
+		toReturn.putFloat(E);
+		toReturn.putInt(Type);
+		toReturn.putInt(parent_vertex);
+		toReturn.putFloat(charge);
+
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Sim_Vertex.h
===================================================================
--- /trunk/Utilities/frog/Event_Sim_Vertex.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Sim_Vertex.h	(revision 583)
@@ -0,0 +1,31 @@
+#ifndef _FROG_EVENT_SIM_VERTEX_H__
+#define _FROG_EVENT_SIM_VERTEX_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Sim_Vertex : public Base {
+public :	
+    float x; float y; float z; int parentTrack_id;
+	
+	virtual unsigned int chunkId(){ return 11020;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_Sim_Vertex(){}
+	Event_Sim_Vertex(
+	float x_,float y_, float z_, int parentTrack_id_):
+	x(x_), y(y_), z(z_),parentTrack_id(parentTrack_id_){};
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16);
+		toReturn.putFloat(x);
+		toReturn.putFloat(y);
+		toReturn.putFloat(z);
+		toReturn.putInt(parentTrack_id);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_SingleStrip.h
===================================================================
--- /trunk/Utilities/frog/Event_SingleStrip.h	(revision 583)
+++ /trunk/Utilities/frog/Event_SingleStrip.h	(revision 583)
@@ -0,0 +1,42 @@
+//Code created by Maciej Zbigniew Besta
+//For the TOTEM Collaboration
+//Email: maciej.zbigniew.besta@cern.ch
+
+#ifndef _FROG_EVENT_SINGLESTRIP_H__
+#define _FROG_EVENT_SINGLESTRIP_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_SingleStrip : public BaseColl_Id {
+public :
+    float x1;  float y1;  float z1;
+    float x2;  float y2;  float z2;
+	BaseColl_Id* det;			
+
+	virtual unsigned int chunkId(){ return 11100;}
+    virtual bool isCompactible(){ return true; }
+
+	Event_SingleStrip(){}
+    Event_SingleStrip( unsigned int DetId,
+    float x1_, float y1_, float z1_, float x2_, float y2_, float z2_):
+    BaseColl_Id(DetId),
+		x1(x1_),y1(y1_),z1(z1_),x2(x2_), y2(y2_), z2(z2_){}
+
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(28);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(x1);
+		toReturn.putFloat(y1);
+		toReturn.putFloat(z1);
+		toReturn.putFloat(x2);
+		toReturn.putFloat(y2);
+		toReturn.putFloat(z2);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Track.h
===================================================================
--- /trunk/Utilities/frog/Event_Track.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Track.h	(revision 583)
@@ -0,0 +1,32 @@
+#ifndef _FROG_EVENT_TRACK_H__
+#define _FROG_EVENT_TRACK_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Track : public Base {
+public:
+	char coll_; float p_; float pt_; float chi2_;		
+	unsigned int NHits;
+
+	virtual unsigned int chunkId(){ return 12110;}
+	virtual bool isCompactible(){ return false; }
+
+	Event_Track(){}
+	Event_Track(char Coll, float P, float Pt, float Chi2) : 
+	coll_(Coll), p_(P),pt_(Pt),chi2_(Chi2){}
+
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(13);
+		toReturn.putByte(coll_);
+		toReturn.putFloat(p_);
+		toReturn.putFloat(pt_);
+		toReturn.putFloat(chi2_);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_Vertex.h
===================================================================
--- /trunk/Utilities/frog/Event_Vertex.h	(revision 583)
+++ /trunk/Utilities/frog/Event_Vertex.h	(revision 583)
@@ -0,0 +1,31 @@
+#ifndef _FROG_EVENT_VERTEX_H__
+#define _FROG_EVENT_VERTEX_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_Vertex :  public Base {
+public :	
+	float PosX;    float PosY;    float PosZ; float likelihood;
+        
+
+	virtual unsigned int chunkId(){ return 12500;}
+	virtual bool isCompactible(){ return true; }
+
+	Event_Vertex(){}
+	Event_Vertex(float posX,    float posY,    float posZ, float likeli):		
+	PosX(posX),	PosY(posY),	PosZ(posZ),	likelihood(likeli){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(16);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(likelihood);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Event_dEdX.h
===================================================================
--- /trunk/Utilities/frog/Event_dEdX.h	(revision 583)
+++ /trunk/Utilities/frog/Event_dEdX.h	(revision 583)
@@ -0,0 +1,28 @@
+#ifndef _EVENT_DEDX_H__
+#define _EVENT_DEDX_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Event_dEdX : public Base {
+public :
+    float dEdX;
+
+	virtual unsigned int chunkId(){ return 12115;}
+    virtual bool isCompactible(){ return false; }
+
+	Event_dEdX(){}
+    Event_dEdX( float dEdX_):
+	dEdX(dEdX_){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(4);
+		toReturn.putFloat(dEdX);
+		return toReturn;	
+	}
+
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Circle.h
===================================================================
--- /trunk/Utilities/frog/Prim_Circle.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Circle.h	(revision 583)
@@ -0,0 +1,47 @@
+#ifndef _FROG_Prim_CIRCLE_H__
+#define _FROG_Prim_CIRCLE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Circle :  public BaseColl_Id {
+public :
+	float Radius;
+	float PosX;    float PosY;  float PosZ;					
+	float DirX;	   float DirY;	float DirZ;	
+	unsigned short NPhi;
+	
+	virtual unsigned int chunkId(){ return 43030;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Circle(){}
+	Prim_Circle(
+	unsigned int detId,			  float radius,
+	float posX,    float posY,    float posZ,
+	float dirX,	   float dirY,    float dirZ,
+	unsigned short nPhi = 10):
+	BaseColl_Id(detId),
+	Radius(radius),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	DirX(dirX),			DirY(dirY),			DirZ(dirZ),
+	NPhi(nPhi){}
+	
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(34);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Radius);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(DirX);
+		toReturn.putFloat(DirY);
+		toReturn.putFloat(DirZ);
+		toReturn.putUShort(NPhi);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Cube.h
===================================================================
--- /trunk/Utilities/frog/Prim_Cube.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Cube.h	(revision 583)
@@ -0,0 +1,53 @@
+#ifndef _FROG_Prim_CUBE_H__
+#define _FROG_Prim_CUBE_H__
+
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Cube :  public BaseColl_Id {
+public :	
+	float PosX;    float PosY;    float PosZ;					
+	float WidthX;  float WidthY;  float WidthZ;
+	float LengthX; float LengthY; float LengthZ;
+	float ThickX;  float ThickY;  float ThickZ;
+	
+	virtual unsigned int chunkId(){ return 41020;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Cube(){}
+	Prim_Cube(
+	unsigned int detId,
+	float posX,    float posY,    float posZ,
+	float widthX,  float widthY,  float widthZ,
+	float lengthX, float lengthY, float lengthZ,
+	float thickX,  float thickY,  float thickZ) :
+	BaseColl_Id(detId),	
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	WidthX(widthX),		WidthY(widthY),		WidthZ(widthZ),
+	LengthX(lengthX),	LengthY(lengthY),	LengthZ(lengthZ),
+	ThickX(thickX),		ThickY(thickY),		ThickZ(thickZ){}
+	
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(52);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(WidthX);
+		toReturn.putFloat(WidthY);
+		toReturn.putFloat(WidthZ);
+		toReturn.putFloat(LengthX);
+		toReturn.putFloat(LengthY);
+		toReturn.putFloat(LengthZ);
+		toReturn.putFloat(ThickX);
+		toReturn.putFloat(ThickY);
+		toReturn.putFloat(ThickZ);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_CustomCube.h
===================================================================
--- /trunk/Utilities/frog/Prim_CustomCube.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_CustomCube.h	(revision 583)
@@ -0,0 +1,76 @@
+#ifndef _FROG_Prim_CUSTOMCUBE_H__
+#define _FROG_Prim_CUSTOMCUBE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_CustomCube :  public BaseColl_Id {
+public :	
+	float P1X;    float P1Y;  float P1Z;
+	float P2X;    float P2Y;  float P2Z;	
+	float P3X;    float P3Y;  float P3Z;
+	float P4X;    float P4Y;  float P4Z;	
+	float P5X;    float P5Y;  float P5Z;
+	float P6X;    float P6Y;  float P6Z;	
+	float P7X;    float P7Y;  float P7Z;
+	float P8X;    float P8Y;  float P8Z;	
+	
+	virtual unsigned int chunkId(){ return 41010;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_CustomCube(){}
+	Prim_CustomCube(
+	unsigned int detId,			  
+	float p1X,    float p1Y,    float p1Z,
+	float p2X,	  float p2Y,    float p2Z,
+	float p3X,    float p3Y,    float p3Z,
+	float p4X,	  float p4Y,    float p4Z,
+	float p5X,    float p5Y,    float p5Z,
+	float p6X,	  float p6Y,    float p6Z,
+	float p7X,    float p7Y,    float p7Z,
+	float p8X,	  float p8Y,    float p8Z	):
+	BaseColl_Id(detId),		
+	P1X(p1X),			P1Y(p1Y),			P1Z(p1Z),
+	P2X(p2X),			P2Y(p2Y),			P2Z(p2Z),
+	P3X(p3X),			P3Y(p3Y),			P3Z(p3Z),
+	P4X(p4X),			P4Y(p4Y),			P4Z(p4Z),
+	P5X(p5X),			P5Y(p5Y),			P5Z(p5Z),
+	P6X(p6X),			P6Y(p6Y),			P6Z(p6Z),
+	P7X(p7X),			P7Y(p7Y),			P7Z(p7Z),
+	P8X(p8X),			P8Y(p8Y),			P8Z(p8Z){}
+
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(100);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(P1X);
+		toReturn.putFloat(P1Y);
+		toReturn.putFloat(P1Z);
+		toReturn.putFloat(P2X);
+		toReturn.putFloat(P2Y);
+		toReturn.putFloat(P2Z);
+		toReturn.putFloat(P3X);
+		toReturn.putFloat(P3Y);
+		toReturn.putFloat(P3Z);
+		toReturn.putFloat(P4X);
+		toReturn.putFloat(P4Y);
+		toReturn.putFloat(P4Z);
+		toReturn.putFloat(P5X);
+		toReturn.putFloat(P5Y);
+		toReturn.putFloat(P5Z);
+		toReturn.putFloat(P6X);
+		toReturn.putFloat(P6Y);
+		toReturn.putFloat(P6Z);
+		toReturn.putFloat(P7X);
+		toReturn.putFloat(P7Y);
+		toReturn.putFloat(P7Z);
+		toReturn.putFloat(P8X);
+		toReturn.putFloat(P8Y);
+		toReturn.putFloat(P8Z);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_CustomSurface.h
===================================================================
--- /trunk/Utilities/frog/Prim_CustomSurface.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_CustomSurface.h	(revision 583)
@@ -0,0 +1,51 @@
+#ifndef _FROG_Prim_CUSTOMSURFACE_H__
+#define _FROG_Prim_CUSTOMSURFACE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_CustomSurface : public BaseColl_Id {
+public :	
+	float P1X;    float P1Y;  float P1Z;
+	float P2X;    float P2Y;  float P2Z;	
+	float P3X;    float P3Y;  float P3Z;
+	float P4X;    float P4Y;  float P4Z;	
+	
+	virtual unsigned int chunkId(){ return 42010;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_CustomSurface(){}
+	Prim_CustomSurface(
+	unsigned int detId,			  
+	float p1X,    float p1Y,    float p1Z,
+	float p2X,	  float p2Y,    float p2Z,
+	float p3X,    float p3Y,    float p3Z,
+	float p4X,	  float p4Y,    float p4Z):
+	BaseColl_Id(detId),
+	P1X(p1X),			P1Y(p1Y),			P1Z(p1Z),
+	P2X(p2X),			P2Y(p2Y),			P2Z(p2Z),
+	P3X(p3X),			P3Y(p3Y),			P3Z(p3Z),
+	P4X(p4X),			P4Y(p4Y),			P4Z(p4Z){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(52);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(P1X);
+		toReturn.putFloat(P1Y);
+		toReturn.putFloat(P1Z);
+		toReturn.putFloat(P2X);
+		toReturn.putFloat(P2Y);
+		toReturn.putFloat(P2Z);
+		toReturn.putFloat(P3X);
+		toReturn.putFloat(P3Y);
+		toReturn.putFloat(P3Z);
+		toReturn.putFloat(P4X);
+		toReturn.putFloat(P4Y);
+		toReturn.putFloat(P4Z);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Cylinder.h
===================================================================
--- /trunk/Utilities/frog/Prim_Cylinder.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Cylinder.h	(revision 583)
@@ -0,0 +1,47 @@
+#ifndef _FROG_Prim_CYLINDER_H__
+#define _FROG_Prim_CYLINDER_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Cylinder : public BaseColl_Id {
+public :
+	float Radius;		 
+	float PosX;			float PosY;    float PosZ;	
+	float LengthX;		float LengthY; float LengthZ;
+	unsigned short NPhi;unsigned char Endcap; 
+	
+	virtual unsigned int chunkId(){ return 41040;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Cylinder(){}
+	Prim_Cylinder(
+	unsigned int detId,	float radius,
+	float posX,			float posY,    float posZ,
+	float lengthX,		float lengthY, float lengthZ,
+	unsigned short nPhi=10, unsigned char endcap=0) :
+	BaseColl_Id(detId),	
+	Radius(radius),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	LengthX(lengthX),	LengthY(lengthY),	LengthZ(lengthZ),
+	NPhi(nPhi), Endcap(endcap){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(36);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Radius);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(LengthX);
+		toReturn.putFloat(LengthY);
+		toReturn.putFloat(LengthZ);
+		toReturn.putUShort(NPhi);
+		toReturn.putByte(Endcap);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Disc.h
===================================================================
--- /trunk/Utilities/frog/Prim_Disc.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Disc.h	(revision 583)
@@ -0,0 +1,47 @@
+#ifndef _FROG_Prim_DISC_H__
+#define _FROG_Prim_DISC_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Disc : public BaseColl_Id {
+public :
+	float Radius;
+	float PosX;    float PosY;  float PosZ;					
+	float DirX;	   float DirY;	float DirZ;	
+	unsigned short NPhi;
+	
+	virtual unsigned int chunkId(){ return 42030;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Disc(){}
+	Prim_Disc(
+	unsigned int detId,			  float radius,
+	float posX,    float posY,    float posZ,
+	float dirX,	   float dirY,    float dirZ,
+	unsigned short nPhi = 10):
+	BaseColl_Id(detId),
+	Radius(radius),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	DirX(dirX),			DirY(dirY),			DirZ(dirZ),
+	NPhi(nPhi){}
+
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(34);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Radius);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(DirX);
+		toReturn.putFloat(DirY);
+		toReturn.putFloat(DirZ);
+		toReturn.putUShort(NPhi);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_FiveSidedPolygon.h
===================================================================
--- /trunk/Utilities/frog/Prim_FiveSidedPolygon.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_FiveSidedPolygon.h	(revision 583)
@@ -0,0 +1,63 @@
+//Code created by Maciej Zbigniew Besta
+//For the TOTEM Collaboration
+//Email: maciej.zbigniew.besta@cern.ch
+
+#ifndef _FROG_Prim_FIVESIDEDPOLYGON_H__
+#define _FROG_Prim_FIVESIDEDPOLYGON_H__
+
+#include "BaseColl_Id.h"
+
+namespace FROG{
+
+class Prim_FiveSidedPolygon : public BaseColl_Id {
+public :	
+
+    float P1X;    float P1Y;  float P1Z;
+	float P2X;    float P2Y;  float P2Z;   
+	float P3X;    float P3Y;  float P3Z; 
+	float P4X;    float P4Y;  float P4Z;	
+	float P5X;    float P5Y;  float P5Z;
+	
+	
+	virtual unsigned int chunkId(){ return 42040;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_FiveSidedPolygon(){}
+	Prim_FiveSidedPolygon(
+	unsigned int detId,			  
+	float p1X,    float p1Y,    float p1Z,
+	float p2X,	  float p2Y,    float p2Z,
+	float p3X,    float p3Y,    float p3Z,
+	float p4X,	  float p4Y,    float p4Z,
+	float p5X,    float p5Y,    float p5Z):
+	BaseColl_Id(detId),
+    P1X(p1X),			P1Y(p1Y),			P1Z(p1Z),
+	P2X(p2X),			P2Y(p2Y),			P2Z(p2Z),
+	P3X(p3X),			P3Y(p3Y),			P3Z(p3Z),
+	P4X(p4X),			P4Y(p4Y),			P4Z(p4Z),
+	P5X(p5X),           P5Y(p5Y),           P5Z(p5Z){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(64);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(P1X);
+		toReturn.putFloat(P1Y);
+		toReturn.putFloat(P1Z);
+		toReturn.putFloat(P2X);
+		toReturn.putFloat(P2Y);
+		toReturn.putFloat(P2Z);
+		toReturn.putFloat(P3X);
+		toReturn.putFloat(P3Y);
+		toReturn.putFloat(P3Z);
+		toReturn.putFloat(P4X);
+		toReturn.putFloat(P4Y);
+		toReturn.putFloat(P4Z);
+		toReturn.putFloat(P5X);
+		toReturn.putFloat(P5Y);
+		toReturn.putFloat(P5Z);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Line.h
===================================================================
--- /trunk/Utilities/frog/Prim_Line.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Line.h	(revision 583)
@@ -0,0 +1,39 @@
+#ifndef _FROG_Prim_LINE_H__
+#define _FROG_Prim_LINE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Line : public BaseColl_Id {
+public :	
+	float P1X;    float P1Y;  float P1Z;
+	float P2X;    float P2Y;  float P2Z;	
+	
+	virtual unsigned int chunkId(){ return 43020;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Line(){}
+	Prim_Line(
+	unsigned int detId,			  
+	float p1X,    float p1Y,    float p1Z,
+	float p2X,	  float p2Y,    float p2Z):
+	BaseColl_Id(detId),
+	P1X(p1X),			P1Y(p1Y),			P1Z(p1Z),
+	P2X(p2X),			P2Y(p2Y),			P2Z(p2Z){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(28);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(P1X);
+		toReturn.putFloat(P1Y);
+		toReturn.putFloat(P1Z);
+		toReturn.putFloat(P2X);
+		toReturn.putFloat(P2Y);
+		toReturn.putFloat(P2Z);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_PartialSphere.h
===================================================================
--- /trunk/Utilities/frog/Prim_PartialSphere.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_PartialSphere.h	(revision 583)
@@ -0,0 +1,52 @@
+#ifndef _FROG_Prim_PARTIALSPHERE_H__
+#define _FROG_Prim_PARTIALSPHERE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_PartialSphere : public BaseColl_Id {
+public :
+	float Radius;
+	float PosX;			 float PosY;    float PosZ;	
+	float Phi1;			 float Phi2;	
+	float Theta1;		 float Theta2;	
+	unsigned short NPhi; unsigned short NTheta;	float ROT;
+	
+	virtual unsigned int chunkId(){ return 41031;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_PartialSphere(){}
+	Prim_PartialSphere(
+	unsigned int detId,		float radius,
+	float posX,				float posY,    float posZ,
+	float phi1,				float phi2,
+	float theta1,			float theta2,
+	unsigned short nPhi=10, unsigned short nTheta=5, float rot=0) :
+	BaseColl_Id(detId),
+	Radius(radius),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	Phi1(phi1),			Phi2(phi2),
+	Theta1(theta1),		Theta2(theta2),
+	NPhi(nPhi),			NTheta(nTheta), ROT(rot){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(44);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Radius);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(Phi1);
+		toReturn.putFloat(Phi2);
+		toReturn.putFloat(Theta1);
+		toReturn.putFloat(Theta2);
+		toReturn.putUShort(NPhi);
+		toReturn.putUShort(NTheta);
+		toReturn.putFloat(ROT);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Rectangle.h
===================================================================
--- /trunk/Utilities/frog/Prim_Rectangle.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Rectangle.h	(revision 583)
@@ -0,0 +1,45 @@
+#ifndef _FROG_Prim_RECTANGLE_H__
+#define _FROG_Prim_RECTANGLE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Rectangle : public BaseColl_Id {
+public :	
+	float PosX;    float PosY;    float PosZ;					
+	float WidthX;  float WidthY;  float WidthZ;
+	float LengthX; float LengthY; float LengthZ;	
+
+	virtual unsigned int chunkId(){ return 42020;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Rectangle(){}
+	Prim_Rectangle(
+	unsigned int detId,
+	float posX,    float posY,    float posZ,
+	float widthX,  float widthY,  float widthZ,
+	float lengthX, float lengthY, float lengthZ) :
+	BaseColl_Id(detId),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	WidthX(widthX),		WidthY(widthY),		WidthZ(widthZ),
+	LengthX(lengthX),	LengthY(lengthY),	LengthZ(lengthZ){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(40);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(WidthX);
+		toReturn.putFloat(WidthY);
+		toReturn.putFloat(WidthZ);
+		toReturn.putFloat(LengthX);
+		toReturn.putFloat(LengthY);
+		toReturn.putFloat(LengthZ);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Sphere.h
===================================================================
--- /trunk/Utilities/frog/Prim_Sphere.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Sphere.h	(revision 583)
@@ -0,0 +1,41 @@
+#ifndef _FROG_Prim_SPHERE_H__
+#define _FROG_Prim_SPHERE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Sphere : public BaseColl_Id {
+public :
+	float Radius;
+	float PosX;			 float PosY;    float PosZ;	
+	unsigned short NPhi; unsigned short NTheta;	
+	
+	virtual unsigned int chunkId(){ return 41030;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Sphere(){}
+	Prim_Sphere(
+	unsigned int detId,		float radius,
+	float posX,				float posY,    float posZ,
+	unsigned short nPhi=10, unsigned short nTheta=5) :
+	BaseColl_Id(detId),
+	Radius(radius),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	NPhi(nPhi),			NTheta(nTheta){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(24);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(Radius);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putUShort(NPhi);
+		toReturn.putUShort(NTheta);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Prim_Tube.h
===================================================================
--- /trunk/Utilities/frog/Prim_Tube.h	(revision 583)
+++ /trunk/Utilities/frog/Prim_Tube.h	(revision 583)
@@ -0,0 +1,50 @@
+#ifndef _FROG_Prim_TUBE_H__
+#define _FROG_Prim_TUBE_H__
+
+#include "Base.h"
+
+namespace FROG{
+
+class Prim_Tube : public BaseColl_Id {
+public :
+	float RadiusIn;		float RadiusOut;		 
+	float PosX;			float PosY;    float PosZ;	
+	float LengthX;		float LengthY; float LengthZ;
+	unsigned short NPhi; unsigned char Endcap;
+	float Phi0;
+	
+	virtual unsigned int chunkId(){ return 41041;}
+	virtual bool isCompactible(){ return true; }
+
+	Prim_Tube(){}
+	Prim_Tube(
+	unsigned int detId,	float radiusIn,float radiusOut,
+	float posX,			float posY,    float posZ,
+	float lengthX,		float lengthY, float lengthZ,
+	unsigned short nPhi=10, unsigned char endcap=0, float phi0=0) :
+	BaseColl_Id(detId),	
+	RadiusIn(radiusIn),	RadiusOut(radiusOut),
+	PosX(posX),			PosY(posY),			PosZ(posZ),
+	LengthX(lengthX),	LengthY(lengthY),	LengthZ(lengthZ),
+	NPhi(nPhi), Endcap(endcap), Phi0(phi0){}
+
+	virtual ByteBuffer writeData(){	
+		ByteBuffer toReturn(44);
+		toReturn.putUInt(detId_);
+		toReturn.putFloat(RadiusIn);
+		toReturn.putFloat(RadiusOut);
+		toReturn.putFloat(PosX);
+		toReturn.putFloat(PosY);
+		toReturn.putFloat(PosZ);
+		toReturn.putFloat(LengthX);
+		toReturn.putFloat(LengthY);
+		toReturn.putFloat(LengthZ);
+		toReturn.putUShort(NPhi);
+		toReturn.putUShort(Endcap);
+		toReturn.putFloat(Phi0);
+		return toReturn;	
+	}
+};
+
+}//FROG Namespace
+#endif
Index: /trunk/Utilities/frog/Utils.h
===================================================================
--- /trunk/Utilities/frog/Utils.h	(revision 583)
+++ /trunk/Utilities/frog/Utils.h	(revision 583)
@@ -0,0 +1,83 @@
+// FROG_Element_Base.h: Contains everything related to an element to be written in a file :
+//                     type, size, data
+//                     And a vector of daughters
+//////////////////////////////////////////////////////////////////////
+
+#ifndef _FROG_UTILS_H__
+#define _FROG_UTILS_H__
+
+#define _CRT_SECURE_NO_WARNINGS 1
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <vector>
+#include <map>
+#include <algorithm>
+#include <iostream>
+#include <math.h>
+
+
+
+struct ByteBuffer{
+	unsigned char* buffer;
+	unsigned int capacity_;
+	unsigned int position_;
+
+	ByteBuffer(){
+		buffer = NULL;
+		capacity_ = 0;
+		position_ = 0;
+	}
+
+	ByteBuffer(int size){
+		buffer = new unsigned char[size];
+		capacity_ = size;
+		position_ = 0;
+	}
+
+	~ByteBuffer(){
+		//printf("Destructor called\n");
+	}
+
+	void clear(){if(buffer!=NULL)delete [] buffer;}
+
+	unsigned int remaining(){return capacity_-position_;}
+	unsigned int capacity(){return capacity_;}
+	unsigned int position(){return position_;}
+	void position(unsigned int pos){position_ = pos;}
+	void flip(){position_ = 0;}
+
+	unsigned char get(unsigned int pos){return buffer[pos];}
+	unsigned char get(){unsigned char data=get(position_); position_++; return data;}
+
+	void put(unsigned int pos, unsigned char data){buffer[pos] = data;}
+	void put(unsigned char data){put(position_, data); position_++;}
+
+	void putByte(unsigned int pos, unsigned char data){put(pos, data);}
+	void putByte(unsigned char data){put(data);}
+
+	void putUShort(unsigned int pos, unsigned short data){memcpy(buffer+pos, (void*)&data, sizeof(data));}
+	void putUShort(unsigned short data){putUShort(position_, data); position_+=sizeof(data);}
+
+	void putInt(unsigned int pos, int data){memcpy(buffer+pos, (void*)&data, sizeof(data));}
+	void putInt(int data){putInt(position_, data); position_+=sizeof(data);}
+
+	void putUInt(unsigned int pos, unsigned int data){memcpy(buffer+pos, (void*)&data, sizeof(data));}
+	void putUInt(unsigned int data){putUInt(position_, data); position_+=sizeof(data);}
+
+	void putULong(unsigned int pos, unsigned long long data){memcpy(buffer+pos, (void*)&data, sizeof(data));}
+	void putULong(unsigned long long data){putULong(position_, data); position_+=sizeof(data);}
+
+	void putFloat(unsigned int pos, float data){memcpy(buffer+pos, (void*)&data, sizeof(data));}
+	void putFloat(float data){putFloat(position_, data); position_+=sizeof(data);}
+
+	void put(ByteBuffer& obj){
+		for(unsigned int i=obj.position();i<obj.capacity() && i-obj.position()+position_<capacity_;i++){
+			put(obj.get());		
+		}
+	}
+};
+
+#endif
+
