how to remain a TObject after the corresponding TFile is closed
来源:互联网 发布:客户满意率的数据来源 编辑:程序博客网 时间:2024/05/21 17:15
当一个TFile 被关闭时,在这个文件打开至结束之间产生的任何类,默认都是delete的。其用意相当于,TFile相当于一个目录,当打开这个目录的时候,里面的任何东西都是可以看得到的,但当关闭了这个目录,其中的任何东西都在内存中被清除。这是一个保持文件使用过程中保持内存清洁的做法。
但是有的时候,我们可能会连续打开多个文件,并在每一个文件中提取一个TObject。而在这些文件都被关闭后,再使用它们。这就要求,我们提取的TObject不能仍然保持在TFile关闭时delete的列表里。于是TObject包含了一个改变目录的方式,
TH2D * GetTH2DFromFile(const char * fn, const char * classname){ TFile * f = new TFile(fn, "read"); TH2D * h2d = (TH2D *) f->Get(classname)->Clone(); h2d->SetDirectory(0);// 这个就是 return h2d;}
这样就完成了how to remain a TObject after the corresponding TFile is closed。
ref
https://root.cern.ch/phpBB3/viewtopic.php?t=3170
0 0
- how to remain a TObject after the corresponding TFile is closed
- extract-text-webpack-plugin" loader is used without the corresponding plugin How to deal
- The ones to remain
- When An SO is closed ,how to cancel it
- how to find the corresponding libraries are linked to when some APIs are used(2.0)
- how to find the corresponding libraries are linked to when some APIs are used(3.0)
- How to know the corresponding relation between T-code and Program
- How to hot Restart HA after rsf config is modified
- The requested operation is invalid on a closed state
- How to do the trade after new updates?
- How to recover after rebooting the LFS procession
- [HttpClient]: How to find the final URI after redirects
- How To MakeUp With Your Girlfriend After A Fight
- QT12 How to open a new window after successful Login
- Android报错 Attempted to access a cursor after it has been closed.的解决方法
- android.database.StaleDataException: Attempted to access a cursor after it has been closed
- Android选择图片报错Attempted to access a cursor after it has been closed.
- android开发问题:Attempted to access a cursor after it has been closed.
- 1433. 数码问题
- HDU2088 Box of Bricks
- html5学记笔记(三)新的布局
- LeetCode-Binary Tree Level Order Traversal
- Android 侧栏A-Z的快速滑动搜索(一)
- how to remain a TObject after the corresponding TFile is closed
- 工业无线通信网络步入LTE 时代
- ActiveX控件(ATL篇)
- ubuntu 下pip的卸载,安装,更新与使用
- Android ImageView
- 解析 STM32 的启动过程
- Java基础 - 哈夫曼编码
- linux动态链接库的创建和使用
- C#实现二叉查找树