|
8166 | 8166 | buf.CheckBytecount(ver, 'branch_vector_read'); |
8167 | 8167 | } |
8168 | 8168 | } else { |
8169 | | - arrays.push(baskets[n].raw.ReadFastArray(baskets[n].fNevBuf, item._datakind)); |
| 8169 | + arrays.push(baskets[n].raw.ReadFastArray(baskets[n].fNevBuf * item._arrsize, item._datakind)); |
8170 | 8170 | } |
8171 | 8171 |
|
8172 | 8172 | // console.log('array', arr.length); |
|
8181 | 8181 | if ((n===0) || (lmax > xmax)) xmax = lmax; |
8182 | 8182 | } |
8183 | 8183 |
|
8184 | | - if (xmin>=xmax) |
8185 | | - xmax = (xmin<1e6) ? (xmin+1) : (xmin*1.01); |
| 8184 | + var nbins = 200; |
8186 | 8185 |
|
8187 | | - histo = JSROOT.CreateTH1(100); |
| 8186 | + if (xmin>=xmax) { |
| 8187 | + xmax = xmin; |
| 8188 | + if (Math.abs(xmin<100)) { xmin-=1; xmax+=1; } else |
| 8189 | + if (xmin>0) { xmin*=0.9; xmax*=1.1; } else |
| 8190 | + { xmin*=1.1; xmax*=0.9; } |
| 8191 | + } else |
| 8192 | + if (JSROOT.IO.IsInteger(item._datakind) && (xmax-xmin >=1) && (xmax-xmin<5000)) { |
| 8193 | + xmin = Math.floor(xmin) - 1; |
| 8194 | + xmax = Math.floor(xmax) + ((xmax === Math.round(xmax)) ? 1 : 2); |
| 8195 | + nbins = xmax - xmin + 1; |
| 8196 | + } else { |
| 8197 | + xmax += (xmax-xmin)/nbins; |
| 8198 | + } |
| 8199 | + |
| 8200 | + histo = JSROOT.CreateTH1(nbins); |
8188 | 8201 | histo.fXaxis.fXmin = xmin; |
8189 | | - histo.fXaxis.fXmax = xmin + (xmax-xmin)*1.001; |
| 8202 | + histo.fXaxis.fXmax = xmax; |
8190 | 8203 | histo.fName = "draw_" + item._name; |
8191 | 8204 | histo.fTitle = "drawing '" + item._name + "' from " + item._parent._name; |
8192 | 8205 | histo.fCustomStat = 111110; |
|
8207 | 8220 | ReadNextBaskets(0); |
8208 | 8221 | } |
8209 | 8222 |
|
| 8223 | +/* |
8210 | 8224 | JSROOT.Painter.CreateBranchLeaves = function(s_i, hitem) { |
8211 | 8225 | // not yet used, in the feauture one can streamer objects from branch and access its fields |
8212 | 8226 |
|
|
8263 | 8277 |
|
8264 | 8278 | return cnt; |
8265 | 8279 | } |
| 8280 | +*/ |
8266 | 8281 |
|
8267 | 8282 | JSROOT.Painter.CreateBranchItem = function(node, branch) { |
8268 | 8283 | if (!node || !branch) return false; |
8269 | 8284 |
|
8270 | 8285 | var nb_branches = branch.fBranches ? branch.fBranches.arr.length : 0, |
8271 | 8286 | nb_leaves = branch.fLeaves ? branch.fLeaves.arr.length : 0, |
8272 | 8287 | leaf = (nb_leaves>0) ? branch.fLeaves.arr[0] : null, |
8273 | | - datakind = 0, isvector = false, |
| 8288 | + datakind = 0, arrsize = 1, |
| 8289 | + isvector = false, |
8274 | 8290 | fprnt = node._parent; |
8275 | 8291 |
|
8276 | 8292 | // check that we have file |
8277 | 8293 | while (fprnt && !fprnt._file) fprnt = fprnt._parent; |
8278 | 8294 |
|
8279 | | - // display branch with only leaf as leaf |
8280 | | - if ((nb_leaves === 1) && (leaf.fName === branch.fName) && fprnt) { |
| 8295 | + // display branch with the only leaf |
| 8296 | + if ((nb_leaves === 1) && fprnt && ((leaf.fName === branch.fName) || (branch.fName.indexOf(leaf.fName)===0)) ) { |
8281 | 8297 | switch (leaf._typename) { |
8282 | 8298 | case 'TLeafF' : datakind = JSROOT.IO.kFloat; break; |
8283 | 8299 | case 'TLeafD' : datakind = JSROOT.IO.kDouble; break; |
|
8295 | 8311 | case "vector<bool>": isvector = true; datakind = JSROOT.IO.kBool; break; |
8296 | 8312 | } |
8297 | 8313 | } else |
8298 | | - if ((leaf.fType > 0) && (leaf.fType < 19) && |
8299 | | - (leaf.fType!==JSROOT.IO.kCharStar) && (leaf.fType!==JSROOT.IO.kBits)) |
8300 | | - datakind = leaf.fType; |
| 8314 | + if (JSROOT.IO.IsNumeric(leaf.fType)) { |
| 8315 | + datakind = leaf.fType; |
| 8316 | + } else |
| 8317 | + if (JSROOT.IO.IsNumeric(leaf.fType-JSROOT.IO.kOffsetL)) { |
| 8318 | + datakind = leaf.fType - JSROOT.IO.kOffsetL; |
| 8319 | + arrsize = leaf.fLen; // fixed-size array |
| 8320 | + } |
| 8321 | + |
8301 | 8322 | break; |
8302 | 8323 | } |
8303 | 8324 | } |
|
8311 | 8332 | _name : ClearName(branch.fName), |
8312 | 8333 | _kind : "ROOT." + branch._typename, |
8313 | 8334 | _title : branch.fTitle |
8314 | | - // _obj: branch // only for debug purposes |
| 8335 | + // _obj: branch // only for debug purposes |
8315 | 8336 | }; |
8316 | 8337 |
|
8317 | 8338 | if (!node._childs) node._childs = []; |
|
8326 | 8347 | subitem._can_draw = true; |
8327 | 8348 | subitem._branch = branch; |
8328 | 8349 | subitem._datakind = datakind; |
| 8350 | + subitem._arrsize = arrsize; |
8329 | 8351 | subitem._isvector = isvector; |
8330 | 8352 | subitem._get = JSROOT.Painter.TreeDrawGet; |
8331 | 8353 |
|
|
8335 | 8357 | if (branch._typename==='TBranchElement') |
8336 | 8358 | subitem._title += " " + branch.fClassName + ";" + branch.fClassVersion; |
8337 | 8359 |
|
8338 | | - //subitem._obj = branch; |
| 8360 | + subitem._obj = branch; |
8339 | 8361 |
|
8340 | 8362 | if (nb_branches > 0) { |
8341 | 8363 | subitem._more = true; |
|
10517 | 10539 | JSROOT.addDrawFunc({ name: "TTask", icon: "img_task", expand: JSROOT.Painter.TaskHierarchy, for_derived: true }); |
10518 | 10540 | JSROOT.addDrawFunc({ name: "TTree", icon: "img_tree", noinspect:true, expand: JSROOT.Painter.TreeHierarchy }); |
10519 | 10541 | JSROOT.addDrawFunc({ name: "TNtuple", icon: "img_tree", noinspect:true, expand: JSROOT.Painter.TreeHierarchy }); |
10520 | | - JSROOT.addDrawFunc({ name: /^TBranch/, icon: "img_branch", noinspect:true }); |
10521 | | - JSROOT.addDrawFunc({ name: /^TLeaf/, icon: "img_leaf", noinspect:true }); |
| 10542 | + JSROOT.addDrawFunc({ name: /^TBranch/, icon: "img_branch", noinspect:false }); |
| 10543 | + JSROOT.addDrawFunc({ name: /^TLeaf/, icon: "img_leaf", noinspect:false }); |
10522 | 10544 | JSROOT.addDrawFunc({ name: "TList", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy }); |
10523 | 10545 | JSROOT.addDrawFunc({ name: "TObjArray", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy }); |
10524 | 10546 | JSROOT.addDrawFunc({ name: "TClonesArray", icon: "img_list", noinspect:true, expand: JSROOT.Painter.ListHierarchy }); |
|
0 commit comments