Read a file containing dose values "dose.dat"

Greetings;
in my application I have already found the results (.txt file attached below). now i want to plot these results (x axis: X, y axis : dose) and i don’t really know how i am going to plot them in a histogram (1 D or 3D).
I inform you that these results are found using voxelization of a cubic volume of 40 * 40 * 40 cm3 (40 * 40 * 40 bins). can someone help me please.dDep.txt (1.3 MB)

Try searching this forum, there are many examples, just search for: read text to histogram (or to graph), or other variants.

yes I know but here I have a voxelized volume. so for each value of x, y, z have a dose value (i.e : x=0,y=0,z=0 =>Dose=0;)

@couet @agheata would you have an idea how to visualize such a 3D graph? I see TTree::Draw on 4 expressions uses a series of TPolyMarker3D - but that’s cheating :wink:

Yes a ntuple would be the best way:

ntuple->Draw("dose:x:y:z");

you will get a 3D scatter plot with the fourth variable mapped on the current colour table

@couet @Axel
yes i did it. but it takes a long time to run (my code below)
///////////////////////////////////////////////////////
TFile *temp=new TFile(“analyse.root”, “RECREATE”);

TNtuple* ntuple = new TNtuple(“ntuple”,“NTUPLE”,“iX:iY:iZ:dose:dose2:entry”);

  ifstream fromfile1("dDep.txt");   

   double dose,dose2;
   int x,y,z,entry;
  

   //     for (Int_t i=0; i<=100000000; i++){ 
   while (!fromfile1.eof()) {
   fromfile1>>x>>y>>z>>dose>>dose2>>entry;
 
   ntuple->Fill(x,y,z,dose,dose2,entry); 
          }

TCanvas *c1_2 = new TCanvas(“c1_2”,“yuub”,200,200,500,500);
//ntuple->Draw(“p”);
ntuple->Draw(“dose:iX:iY:iZ”);
temp->Write();

from yesterday (pic below)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.