[ROOT] printing a variable on canvas
From: Manoj Jha (Manoj.Jha@cern.ch)
Date: Mon Oct 11 2004 - 10:05:41 MEST
Dear root developers,
I have generated a plot (file attacheda as crystal.ps ) using root .
I am trying to print the dimensions of each boxes along its sides. The
dimensions of each boxes are different from each other. Is it possible
to print the dimensions along the sides of boxes in the root ? I am
attaching the file that I had used for generating the plot.
Thanks in advance,
Manoj Jha
{
// library that handles input-output
#include <iomanip>
Int_t n = 100;
Float_t x[n] = { 98.4624, 98.4931, 101.322, 101.289, 98.4921, 98.5244, 101.357, 101.321, 98.5219, 98.5558, 101.391, 101.354, 98.5517, 98.5873, 101.426, 101.387, 98.5815, 98.6188, 101.461, 101.42, 101.336, 101.37, 104.213, 104.176, 101.369, 101.405, 104.251, 104.212, 101.402, 101.439, 104.288, 104.248, 101.435, 101.474, 104.326, 104.284, 101.468, 101.509, 104.364, 104.32, 104.222, 104.259, 107.115, 107.075, 104.258, 104.297, 107.156, 107.114, 104.294, 104.335, 107.197, 107.153, 104.33, 104.373, 107.238, 107.192, 104.367, 104.411, 107.28, 107.232, 107.119, 107.16, 110.03, 109.986, 107.159, 107.201, 110.074, 110.028, 107.198, 107.242, 110.118, 110.071, 107.237, 107.283, 110.163, 110.113, 107.277, 107.324, 110.207, 110.156, 110.028, 110.072, 112.956, 112.909, 110.071, 110.116, 113.003, 112.955, 110.113, 110.16, 113.051, 113, 110.156, 110.205, 113.099, 113.046, 110.199, 110.25, 113.147, 113.092 };
Float_t y[n] = { 55.736, 58.47, 58.5877, 55.8481, 58.5167, 61.2577, 61.3813, 58.6346, 61.3034, 64.0516, 64.1809, 61.427, 64.0959, 66.8515, 66.9867, 64.2253, 66.8944, 69.6576, 69.7986, 67.0295, 55.8492, 58.5887, 58.7081, 55.9627, 58.6356, 61.3822, 61.5075, 58.7551, 61.4279, 64.1818, 64.313, 61.5533, 64.2262, 66.9875, 67.1247, 64.3575, 67.0304, 69.7993, 69.9426, 67.1677, 55.9628, 58.708, 58.8289, 56.0778, 58.7549, 61.5071, 61.6342, 58.876, 61.553, 64.3125, 64.4457, 61.6801, 64.357, 67.124, 67.2633, 64.4902, 67.1669, 69.9416, 70.0872, 67.3064, 56.0769, 58.8277, 58.9502, 56.1933, 58.8747, 61.6326, 61.7615, 58.9974, 61.6785, 64.4437, 64.5789, 61.8075, 64.4883, 67.261, 67.4025, 64.6235, 67.304, 70.0845, 70.2323, 67.4456, 56.1915, 58.9479, 59.0721, 56.3093, 58.995, 61.7586, 61.8892, 59.1193, 61.8046, 64.5755, 64.7126, 61.9354, 64.6202, 67.3986, 67.5423, 64.7574, 67.4417, 70.2279, 70.3781, 67.5855 };
// Creation of Pad
// Cordinate for canvas
Float_t x_canvas_min = 94. ;
Float_t y_canvas_min = 54. ;
Float_t x_canvas_max = 116. ;
Float_t y_canvas_max = 76. ;
// Cordinate for Axis
Double_t xmin = 95. ;
Double_t ymin = 55. ;
Double_t xmax = 115. ;
Double_t ymax = 75. ;
c1 = new TCanvas ("c1", " Plot of Extraploted Crystals Coordinate for Plane 1 ");
c1->Range(x_canvas_min,y_canvas_min,x_canvas_max,y_canvas_max) ;
axis = new TGaxis (xmin,ymin,xmax,ymax,xmin,ymax,20);
//axis->Draw();
for (Int_t j = 0; j < 100; j = j + 4 )
{
l = new TLine( x[j],y[j],x[j+1],y[j+1] );
l->Draw();
l = new TLine( x[j+1],y[j+1],x[j+2],y[j+2] );
l->Draw();
l = new TLine( x[j+2],y[j+2],x[j+3],y[j+3] );
l->Draw();
l = new TLine( x[j+3],y[j+3],x[j],y[j] );
l->Draw();
}
// Plot of Circle for Plane 1
e = new TEllipse( 0., 0., 120., 120.);
e->Draw();
}
This archive was generated by hypermail 2b29
: Sun Jan 02 2005 - 05:50:09 MET