File indexing completed on 2024-04-06 12:19:14
0001 #include <iostream>
0002 #include <TFile.h>
0003 #include <TH1F.h>
0004 #include <TList.h>
0005 #include <TCanvas.h>
0006 #include <TROOT.h>
0007
0008 void histo_check (Int_t min_height=4) {
0009 gROOT->SetStyle("Plain");
0010
0011 TString dir="tmp";
0012 TString tag="example";
0013 TFile f("/"+dir+"/"+tag+"/"+tag+".root");
0014 f.cd("adc");
0015 TList *list=gDirectory->GetListOfKeys();
0016 Int_t stop=list->LastIndex();
0017
0018 TCanvas c1("c1");
0019
0020 Int_t num=0;
0021 Int_t num_limit=1000;
0022 Int_t i_print=5000;
0023
0024 TString ps_file="/"+dir+"/"+tag+"/histos.ps";
0025
0026 c1.Print(ps_file+"[");
0027 for (Int_t i=0;i<=stop;i++) {
0028
0029
0030 TString str=list->At(i)->GetName();
0031 TH1F *h=(TH1F*)f.Get("adc/"+str)->Clone();
0032
0033 Float_t height=h->GetBinContent(h->GetMaximumBin());
0034 if (height>min_height) {
0035 h->Draw();
0036 cout << h->GetName() << endl;
0037 c1.Print(ps_file);
0038 num++;
0039 }
0040
0041
0042
0043 delete h;
0044 if (num>num_limit) break;
0045 }
0046 c1.Print(ps_file+"]");
0047 }