Create a magnetic field interpolated with TGraph3

Hello everyone,

I would like to create a volume (for example a parallelepiped) in which I could set at every point/node (x,y,z) a magnetic vector (Bx,By,Bz) knowing that I take the datas from a .txt file.
After, the goal is to interpolate the vector field in the volume, and the useful information for the next will be the boundary of the volume and the values of the vector field at every point inside the magnetic volume.

One of my idea is to create a TGraph3 containing the geometry (the parallelepiped here).
SoI did it and I have my geometry. But now, I would like to add values of the magnetic field. For example, I could have 3 different TGraph3 for each component of my magnetic field and each component could be kind of weight to add at each node and that can be interpolated inside the volume.

I don’t know if I am clear. I did not find a way of setting the magnetic field. Would you have any idea ?

Thank you in advance,

Kali

TGraph3 is not a ROOT class. Can you post what you already did ?

TCanvas *c = new TCanvas("c","Volume of the b Field",0,0,700,600);
TGraph2D *g=new TGraph2D("/tmp/temp_bField.txt"); // File with three columns (x,y,z)
gStyle->SetPalette(1);
g->Draw("P"); 

I’m sorry actually, it is TGraph2D to have a 3D volume.

You said:

But the few lines you posted will not create parallelepiped. Il will draw a cloud of points.

Yes. I was not clear. I wanted to create a cloud of points and I would like to set at each point the value of the magnetic field.
I said a parallelepiped because this cloud of points here in this case have a parallelepiped shape.

May be a TH3D (or TH3F) is more appropriate in that case.

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