Hi,
I want to get the GetSumOfWeights
of the histograms in: run_01.root (842.2 KB)
I use the following code:
void read_root(TString path, TString keyNominal){
TFile* file = new TFile(path, "READ");
// Keys
std::vector<TString> keys = {};
// Cross sections
std::map<string, Double_t>xs = {};
// https://gist.github.com/alejolp/c385fde5717120a3ad614ce18c9a2abd
TIter next(file->GetListOfKeys());
TKey *key;
while ((key = (TKey*)next())) {
cout << key->GetName() << endl;
keys.push_back(key->GetName());
xs[key->GetName()] = file->Get(key->GetName())->GetSumOfWeights();
}
}
But I get:
/mnt/d/Sync1/Estudios/IFICCSIC/JAEICUIFIC2122/MadGraph/Project2/pp2ttbarllbar_SMEFTsim_analysis/xs_param.c:63:51: error: no member named 'GetSumOfWeights' in 'TObject'
xs[key->GetName()] = file->Get(key->GetName())->GetSumOfWeights();
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
But that things are TH1F, not TObject.
ROOT Version:ROOT 6.24/06
Platform: Debian, Windows Subsystem for Linux
Compiler: Not Provided