#include "TFile.h"
#include "TH1D.h"
#include "TCanvas.h"
#include "TStopwatch.h"
#include "TROOT.h"
#include "TSystem.h"
#include "TTree.h"
#include "TString.h"
Go to the source code of this file.
int combine_ana |
( |
TString |
infilename, |
|
|
TString |
outfilename = "combined_psi3770.root" |
|
) |
| |
Definition at line 19 of file combine_ana.C.
References SaveAndUpdateHisto(), and TString.
27 TFile inputfile(infilename,
"READ");
28 TList* mylist = inputfile.GetListOfKeys();
29 TListIter myiter(mylist);
30 TFile outputstorage(outfilename,
"UPDATE");
36 TString histoClassName =
"TH1D";
38 if (mylist->GetEntries() != nHistos) {
39 cout <<
"Fatal Entry Mismatch: " << mylist->GetEntries() << endl;
45 while (mykey = (TKey*)myiter()) {
46 if (histoClassName ==
TString(mykey->GetClassName())) {
47 TH1D* myhisto = (TH1D*)mykey->ReadObj();
50 cout <<
"Ignored, not a histogram: " << mykey->GetName() <<
", " << mykey->GetClassName() << endl;
void SaveAndUpdateHisto(TH1D *currenthisto, TFile &storagefile)
void SaveAndUpdateHisto |
( |
TH1D * |
currenthisto, |
|
|
TFile & |
storagefile |
|
) |
| |
Definition at line 10 of file combine_ana.C.
Referenced by combine_ana().
12 if (storagefile.Get(currenthisto->GetName()) != 0) {
13 currenthisto->Add((TH1D*)storagefile.Get(currenthisto->GetName()));
16 currenthisto->Write();