File indexing completed on 2024-04-06 12:26:31
0001 #include "TH1F.h"
0002 #include "TCanvas.h"
0003 #include "TObject.h"
0004 #include "TFile.h"
0005 #include "TPaveStats.h"
0006 #include "TGraphErrors.h"
0007 #include "TGaxis.h"
0008 #include "TROOT.h"
0009 #include "TF1.h"
0010 #include "TLegend.h"
0011 #include "TKey.h"
0012 #include "TClass.h"
0013
0014 #include "iostream"
0015 #include "vector"
0016 #include "math.h"
0017 #include "map"
0018
0019 void displayBaselineMacro(TString file, int limit) {
0020 TFile* f;
0021 TString BaseDir;
0022 TString dir[4];
0023 TString fullPath, title, subDet, genSubDet;
0024 TCanvas* C;
0025 C = new TCanvas();
0026 f = new TFile(file);
0027
0028
0029 dir[0] = "baselineAna/ProcessedRawDigis";
0030 dir[1] = "baselineAna/Baseline";
0031 dir[2] = "baselineAna/Clusters";
0032 dir[3] = "baselineAna/RawDigis";
0033 f->cd();
0034
0035
0036 f->cd(dir[0]);
0037
0038 TIter nextkey(gDirectory->GetListOfKeys());
0039 TKey* key;
0040 int objcounter = 1;
0041 int histolimit = 0;
0042 while ((key = (TKey*)nextkey())) {
0043 if (histolimit < limit) {
0044 histolimit++;
0045 TObject* obj = key->ReadObj();
0046
0047 if (obj->IsA()->InheritsFrom("TH1")) {
0048 std::cout << "Found object n: " << objcounter << " Name: " << obj->GetName() << " Title: " << obj->GetTitle()
0049 << std::endl;
0050 ++objcounter;
0051
0052
0053
0054 C->Clear();
0055 TH1F* h = (TH1F*)key->ReadObj();
0056
0057
0058
0059
0060 h->SetLineWidth(2);
0061 h->SetXTitle("StripNumber");
0062 h->SetYTitle("Charge (ADC counts)");
0063 h->Draw("hist p l");
0064 f->cd();
0065
0066 TH1F* hb = (TH1F*)f->Get(dir[1] + "/" + obj->GetName());
0067
0068 if (hb != 0) {
0069 hb->SetLineWidth(2);
0070 hb->SetLineStyle(2);
0071 hb->SetLineColor(2);
0072
0073 hb->Draw("hist p l same");
0074 }
0075
0076 f->cd();
0077
0078 TH1F* hc = (TH1F*)f->Get(dir[2] + "/" + obj->GetName());
0079
0080 if (hc != 0) {
0081 hc->SetLineWidth(2);
0082 hc->SetLineStyle(2);
0083 hc->SetLineColor(3);
0084
0085 hc->Draw("hist p l same");
0086 }
0087 TH1F* hd = (TH1F*)f->Get(dir[3] + "/" + obj->GetName());
0088
0089 if (hd != 0) {
0090 hd->SetLineWidth(2);
0091 hd->SetLineStyle(2);
0092 hd->SetLineColor(6);
0093
0094 hd->Draw("hist p l same");
0095 }
0096
0097 else
0098 std::cout << "not found " << obj->GetName() << std::endl;
0099
0100
0101 C->Update();
0102
0103
0104
0105 C->SaveAs(TString("img/") + obj->GetName() + TString(".png"));
0106 }
0107 }
0108 }
0109 }