Page MenuHomeHEPForge

FROG_Element_Event_Sim_Hit.h
No OneTemporary

FROG_Element_Event_Sim_Hit.h

#ifndef _FROG_ELEMENT_EVENT_SIM_HIT_H__
#define _FROG_ELEMENT_EVENT_SIM_HIT_H__
#include "FROG_Element_Base.h"
#include "FROG_Objects_Extended.h"
class FROG_Element_Event_Sim_Hit : public FROG_Element_Base {
public :
float x; float y; float z; float Charge; unsigned char ProcessType;
FROG_Objects_Extended* frogObjects_;
unsigned int nameId_;
virtual bool isCompactible(){ return true; }
static unsigned int sizeOf(){ return FROG_Element_Base::sizeOf() + 4*sizeof(float) + 1*sizeof(unsigned char); }
FROG_Element_Event_Sim_Hit():FROG_Element_Base(C_SIM_HIT){}
FROG_Element_Event_Sim_Hit(float x_, float y_, float z_, float Charge_, unsigned char ProcessType_):
FROG_Element_Base(C_SIM_HIT),
x(x_),y(y_),z(z_),Charge(Charge_), ProcessType(ProcessType_)
{
size_ = sizeOf();
}
unsigned int read(FILE* pFile, unsigned int toRead=0){
unsigned int read = 0;
read += fread(&x ,1,sizeof(x) ,pFile);
read += fread(&y ,1,sizeof(y) ,pFile);
read += fread(&z ,1,sizeof(z) ,pFile);
read += fread(&Charge ,1,sizeof(Charge) ,pFile);
read += fread(&ProcessType ,1,sizeof(ProcessType) ,pFile);
return read;
}
virtual void write () {
size_ = sizeOf();
data_ = new unsigned char[size_-6];
data_ = FillBuffer( data_, &x, sizeof(x));
data_ = FillBuffer( data_, &y, sizeof(y));
data_ = FillBuffer( data_, &z, sizeof(z));
data_ = FillBuffer( data_, &Charge, sizeof(Charge));
data_ = FillBuffer( data_, &ProcessType, sizeof(ProcessType));
data_ = (unsigned char*)((unsigned long)data_ - (size_-6) );
}
virtual void printInfos(char* buffer){
sprintf(buffer,"SimHit : x=%7.2f y=%7.2f z=%7.2f Charge=%E ProcessType=%i",x,y,z,Charge,ProcessType);
}
#ifdef FROG_OPENGL
virtual void display(bool UseDisplayList=true, float* color=NULL){
// first Init Colors & Style!
if(style_==NULL) init(NULL);
glColor4fv (style_->color_);
if(Start_Display(UseDisplayList)){
FROG_Light::SwitchLight_NoNormal();
glLoadName( nameId_ );
if(style_->marker_>0){
glBindTexture(GL_TEXTURE_2D,frogObjects_->getMarker(style_->marker_));
glEnable(GL_TEXTURE_2D);
glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
glEnable( GL_POINT_SPRITE_ARB );
}
glPointSize (style_->markerSize_);
glBegin (GL_POINTS);
glVertex3f(x, y, z);
glEnd();
if(style_->marker_>0){
glDisable( GL_POINT_SPRITE_ARB );
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,0);
}
FROG_Light::SwitchLight_Normal();
End_Display(UseDisplayList);
}
}
#endif
virtual void init(void* frogObjects){
if(frogObjects!=NULL){
frogObjects_ = (FROG_Objects_Extended*) frogObjects;
nameId_ = frogObjects_->frogEvent_->name_map.size();
frogObjects_->frogEvent_->name_map.push_back(this);
//for(unsigned int i=0;i<daughters_.size();i++) daughters_[i]->init(frogObjects);
}else if(frogObjects==NULL && frogObjects_ != NULL){
if(mother_ != NULL && mother_->style_ !=NULL){ style_ = mother_->style_;
}else{ style_ = new FROG_Objects_Style(); }
}
}
};
#endif

File Metadata

Mime Type
text/x-c++
Expires
Wed, May 14, 10:56 AM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5111307
Default Alt Text
FROG_Element_Event_Sim_Hit.h (3 KB)

Event Timeline