I want to open up 6 root files which contain histograms all with the same naming scheme for each, each file will contain 26199 as a histogram name. I want to divide 26199 from each file by 26199 from all the other 5 files, so there will be 30 divided histograms in total (I think). I’m not sure how best to approach this in a loop. So far I know how to do it for two files (see below). I’m not necessarily looking for a solution but more the logic as I’m not sure how to do all the combinations. This is a very small watered down snippet of what I am trying to do
std::vector<std::string> Ratio_Plot_Names={26199};
TFile *FileN0A0 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N0A0.root");
TFile *FileN0A2 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N0A2.root");
TFile *FileN0A4 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N0A0.root");
TFile *FileN2A0 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N2A0.root");
TFile *FileN2A4 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N2A4.root");
TFile *FileN4A0 = TFile::Open("/home/atlas/amytee/PhD_Work_Analysis_III/MC_V5/Version_2/Ratios_and_Overlays/N4A0.root");
for (int Ratio_Bins = 0; Ratio_Bins < 1; Ratio_Bins++){
//Dividing the same bin from each file (e.g dividing 20199 from N0A0 by 20199 from N0A2)
TH1D *h1;
FileN0A0->GetObject(Ratio_Plot_Names[Ratio_Bins].c_str(), h1 );
TH1D *h2;
FileN0A2->GetObject(Ratio_Plot_Names[Ratio_Bins].c_str(), h2 );
TCanvas *c1 = new TCanvas ("c1", "c1", 700, 500);
TH1D *h12 = new TH1D(*h2); //Create a clone of h2 for the correct binning
h12->Divide(h2 , h1, 1., 1.); //Empties the h12 canvas, and then does the division of h2 over h1
h12->Draw();
}//Closing loop over the variable names and bins (Ratio_Bins)
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided