of course... here is the complete program (its a root program but I hope its not connected to root itself)
Code:
#include <math.h>
void pos_plot_2color(){
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
gStyle->SetOptFit(1111);
const int num = 1000000;
double x[num], y[num], z[num], type[num], dummy;
double vx[num], vy[num], vz[num];
double xmax, ymax, zmax, mass[num];
int j, n;
xmax = 0;
ymax = 0;
zmax = 0;
n = 0;
ifstream widthfile("data-files/output_file3.txt");
while((widthfile >> x[n] >> y[n] >> z[n] >> vx[n] >> vy[n] >> vz[n] >> mass[n] >> type[n])){
if(xmax < x[n]) xmax = x[n];
if(ymax < y[n]) ymax = y[n];
if(zmax < z[n]) zmax = z[n];
n++;
}
widthfile.close();
cout<<"xmax: "<<xmax<< endl;
cout<<"ymax: "<<ymax<< endl;
cout<<"zmax: "<<zmax<< endl;
TH3F *frame3d = new TH3F("frame3d","frame3d",10,-xmax,xmax,10,-ymax,ymax,10,-zmax,zmax);
frame3d->Draw();
TPolyMarker3D *pm3d1 = new TPolyMarker3D(3);
j = 0;
for(int i = 0; i <= n; i++){
if(type[i] == 2){
pm3d1->SetPoint(j,x[i],y[i],z[i]);
cout<<"x: "<<x[i]<<" y: "<<y[i]<<" z: "<<z[i]<<" vx: "<<vx[i]<<" vy: "<<vy[i]<<" vz: "<<vz[i]<< endl;
j++;
}
}
cout<<"type1: "<<j<< endl;
pm3d1->SetMarkerSize(1);
pm3d1->SetMarkerColor(kRed);
pm3d1->SetMarkerStyle(20);
frame3d->SetTitle("");
pm3d1->Draw();
TPolyMarker3D *pm3d2 = new TPolyMarker3D(3);
j = 0;
for(int i = 0; i <= n; i++){
if(type[i] == 1){
pm3d2->SetPoint(j,x[i],y[i],z[i]);
if(x[i] == 10000. && y[i] == 0. && z[i] == 0.) cout<<"i = "<<i<< endl;
j++;
}
}
cout<<"type2: "<<j<< endl;
pm3d2->SetMarkerSize(0.1);
pm3d2->SetMarkerColor(1);
pm3d2->SetMarkerStyle(20);
pm3d2->Draw();
}
thanks fpr the help
florian