Hello,
I have a huge root file having so many distributions. I would like to extract one distribution of them? I need your suggestion how to do that?
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Hello,
I have a huge root file having so many distributions. I would like to extract one distribution of them? I need your suggestion how to do that?
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
rootls --help
rootcp --help
Sorry to explain you I need to write a macro?
These are standalone executables delivered with ROOT 6.
Thanks yes that’s true but I want to do it in a macro. I wrote macro in this way. Tell me further what i should do to write my specific distribution in a current directory
TFile* myfile = TFile::Open(“filename.root”,“READ”);
TH1F* myhist = (TH1F*) myfile->Get(“name_of_the_histogram_in_the_Tree”);
TFile* myfile = TFile::Open(“filename.root”,“READ”);
TH1F* myhist = (TH1F*) myfile->Get(“name_of_the_histogram_in_the_Tree”);
myhist->Write();
Sorry to continue with my method please tell what is wrong with this that i can write the histogram?
This is my macro Please suggest me what is wrong with this:
#include<iostream>
using namespace std;
void sf()
{
TFile *myfile=TFile::Open("/storage/local/home/atlas/msohail/trigger_analysis/hist-tot22.root","RECREATE");
TH1F *myhist = (TH1F*)myfile->Get("PREtrigger_1Ele_And_1Ele3Jet_bjets_gt_2");
myhist->Write();
}
The TFile
command is launched with the option RECREATE
so a new empty file will be created, therefore the next command doing the “Get” on this newly created file cannot work as you are trying to get something from an empty file.
If I replace RECREATE by READ?
For instance … and check the file is not empty.
myfile->ls();
I checked It is not empty.
May be the simplest will be to use the rootcp
command:
$ rootcp --recreate /storage/local/home/atlas/msohail/trigger_analysis/hist-tot22.root:PREtrigger_1Ele_And_1Ele3Jet_bjets_gt_2 newfile.root
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.