Marco van Leeuwen wrote: > > Hi all, > > Strangely enough, I didn't find an answer to this question in the Roottalk > digest, although it must have been mentioned... My question is the > following: is is possible to use a TNtuple containing x, y and dy values to > draw a graph (histogram) of points x,y with errorbars y-dy to y+dy ? > Hi Marco, See comments in TTree::draw at URL: http://root.cern.ch/root/html/src/TTree.cxx.html#TTree:Draw This includes the following section: // // How to obtain more info from TTree::Draw // ======================================== // // Once TTree::Draw has been called, it is possible to access useful // information still stored in the TTree object via the following functions: // -GetSelectedRows() // return the number of entries accepted by the // //selection expression. In case where no selection // //was specified, returns the number of entries processed. // -GetV1() //returns a pointer to the float array of V1 // -GetV2() //returns a pointer to the float array of V2 // -GetV3() //returns a pointer to the float array of V3 // -GetW() //returns a pointer to the double array of Weights // //where weight equal the result of the selection expression. // where V1,V2,V3 correspond to the expressions in // TTree::Draw("V1:V2:V3",selection); // // Example: // Root > ntuple->Draw("py:px","pz>4"); // Root > TGraph *gr = new TGraph(ntuple->GetSelectedRows(), // ntuple->GetV2(), ntuple->GetV1()); // Root > gr->Draw("ap"); //draw graph in current pad // creates a TGraph object with a number of points corresponding to the // number of entries selected by the expression "pz>4", the x points of the graph // being the px values of the Tree and the y points the py values. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET