ROOT logo
drawCaloHistograms(const char* filename="HLT-OFFLINE-PHOS-comparison.root") {
  

  gStyle->SetPalette(1, 0);
  //gStyle->SetOptFit(1111);

  TFile * file = TFile::Open(filename);
  if(!file || file->IsZombie()){
     printf("file %s does not exist or there is an error opening it\n", filename);
     return;
  }
  
  TList * list = dynamic_cast<TList*>(file->Get("phos_histograms"));
  if(!list){
     printf("No list %s contained in your input file\n", list->GetName()); 
     return; 
  }
  
  TH1* hist = list->FindObject("fHistOfflResiduals");
  hist->SetLineColor(kRed);
  hist->DrawNormalized();
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOnlResiduals"));
  hist->SetLineColor(kBlue);
  hist->DrawNormalized("same");


  TCanvas * c2 = new TCanvas("c2", "Matching_histos", 1000, 900);
  c2->Divide(3,2);

  int icd = 1;

  c2->cd(icd++);
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOnlDzNeg"));
  hist->SetFillColor(25);
  hist->SetTitle("Dz of negative tracks");
  hist->DrawNormalized("");
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOfflDzNeg"));
  hist->SetLineColor(kRed);
  hist->DrawNormalized("same");

  c2->cd(icd + 2);
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOnlDzPos"));
  hist->SetFillColor(25);
  hist->SetTitle("dZ of positive tracks");
  hist->DrawNormalized("");
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOfflDzPos"));
  hist->SetLineColor(kRed);
  hist->DrawNormalized("same");
  
  c2->cd(icd++);
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOnlDxyNeg"));
  hist->SetTitle("dXY of negative tracks");
  hist->SetFillColor(25);
  hist->DrawNormalized("");
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOfflDxyNeg"));
  hist->SetLineColor(kRed);
  hist->DrawNormalized("same");

  c2->cd(icd +2);
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOnlDxyPos"));
  hist->SetTitle("dXY of positive tracks");
  hist->SetFillColor(25);
  hist->DrawNormalized("");
  hist = dynamic_cast<TH1*>(list->FindObject("fHistOfflDxyPos"));
  hist->SetLineColor(kRed);
  hist->DrawNormalized("same");

  c2->cd(icd++);
  TH2F * hist2d = dynamic_cast<TH2F*>(list->FindObject("_OFF_fHistdXYdZ"));
  hist2d->SetTitle("dXYdZ offline");
  hist2d->Draw("colz");
  c2->cd(icd +2);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("_ON_fHistdXYdZ"));
  hist2d->SetTitle("dXYdZ hlt");
  hist2d->Draw("colz");

 

  TCanvas * c3 = new TCanvas("c3", "Energy_histos", 1000, 900);
  icd = 1;
  c3->Divide(3,2);

  c3->cd(icd++);
  hist = dynamic_cast<TH1*>(list->FindObject("_ON fHistClusterEnergy"));
  hist->SetTitle("Cluster energy");
  hist->SetAxisRange(0, 1, "X");
  hist->SetFillColor(25);
  hist->DrawNormalized();
  hist = dynamic_cast<TH1*>(list->FindObject("_OFF fHistClusterEnergy"));
  hist->DrawNormalized("same");

  c3->cd(icd+2);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("fHistTotEVsTotE"));
  hist2d->SetTitle("Sum cluster Energies HLT vs offline");
  hist2d->SetAxisRange(0, 10, "X");
  hist2d->SetAxisRange(0, 10, "Y");
  hist2d->Draw("colz");

  c3->cd(icd++);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("_ON fHistClusterEnergyVsNCells"));
  hist2d->SetTitle("Cluster energy vs nCells, HLT"); 
  hist2d->SetAxisRange(0, 5, "X");
  hist2d->SetAxisRange(0, 30, "Y");
  hist2d->Draw("colz");
  c3->cd(icd + 2);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("_OFF fHistClusterEnergyVsNCells"));
  hist2d->SetTitle("Cluster energy vs nCells, Offline"); 
  hist2d->SetAxisRange(0, 5, "X");
  hist2d->SetAxisRange(0, 30, "Y");
  hist2d->Draw("colz");

  c3->cd(icd++);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("_ON fHistClusterEnergyDepositedEtaPhi"));
  hist2d->SetTitle("Energy deposited eta vs phi HLT");
  hist2d->SetAxisRange(-0.2, 0.2, "Y");
  hist2d->SetAxisRange(4, 6, "X");
  hist2d->Draw("colz");
  c3->cd(icd+2);
  hist2d = dynamic_cast<TH2F*>(list->FindObject("_OFF fHistClusterEnergyDepositedEtaPhi"));
  hist2d->SetTitle("Energy deposited eta vs phi Offline");
  hist2d->SetAxisRange(-0.2, 0.2, "Y");
  hist2d->SetAxisRange(4, 6, "X");
  hist2d->Draw("colz");


  // TCanvas * c4 = new TCanvas("c4", "Energy_histos", 1100, 900);
  // icd = 1;
  // c4->Divide(3,2);
  // for( int i = 0; i < 6; i++) {
  //   hist = dynamic_cast<TH1*>(list->FindObject(Form("fHistDArr_%d", i)));
  //   c4->cd(icd++);
  //   hist->Draw();
  //   TFitResultPtr fr = hist->Fit("gaus");
  //   fr->Dump();
  //   //cout << fr->GetParams() << endl;
  // }
	


}
 drawCaloHistograms.C:1
 drawCaloHistograms.C:2
 drawCaloHistograms.C:3
 drawCaloHistograms.C:4
 drawCaloHistograms.C:5
 drawCaloHistograms.C:6
 drawCaloHistograms.C:7
 drawCaloHistograms.C:8
 drawCaloHistograms.C:9
 drawCaloHistograms.C:10
 drawCaloHistograms.C:11
 drawCaloHistograms.C:12
 drawCaloHistograms.C:13
 drawCaloHistograms.C:14
 drawCaloHistograms.C:15
 drawCaloHistograms.C:16
 drawCaloHistograms.C:17
 drawCaloHistograms.C:18
 drawCaloHistograms.C:19
 drawCaloHistograms.C:20
 drawCaloHistograms.C:21
 drawCaloHistograms.C:22
 drawCaloHistograms.C:23
 drawCaloHistograms.C:24
 drawCaloHistograms.C:25
 drawCaloHistograms.C:26
 drawCaloHistograms.C:27
 drawCaloHistograms.C:28
 drawCaloHistograms.C:29
 drawCaloHistograms.C:30
 drawCaloHistograms.C:31
 drawCaloHistograms.C:32
 drawCaloHistograms.C:33
 drawCaloHistograms.C:34
 drawCaloHistograms.C:35
 drawCaloHistograms.C:36
 drawCaloHistograms.C:37
 drawCaloHistograms.C:38
 drawCaloHistograms.C:39
 drawCaloHistograms.C:40
 drawCaloHistograms.C:41
 drawCaloHistograms.C:42
 drawCaloHistograms.C:43
 drawCaloHistograms.C:44
 drawCaloHistograms.C:45
 drawCaloHistograms.C:46
 drawCaloHistograms.C:47
 drawCaloHistograms.C:48
 drawCaloHistograms.C:49
 drawCaloHistograms.C:50
 drawCaloHistograms.C:51
 drawCaloHistograms.C:52
 drawCaloHistograms.C:53
 drawCaloHistograms.C:54
 drawCaloHistograms.C:55
 drawCaloHistograms.C:56
 drawCaloHistograms.C:57
 drawCaloHistograms.C:58
 drawCaloHistograms.C:59
 drawCaloHistograms.C:60
 drawCaloHistograms.C:61
 drawCaloHistograms.C:62
 drawCaloHistograms.C:63
 drawCaloHistograms.C:64
 drawCaloHistograms.C:65
 drawCaloHistograms.C:66
 drawCaloHistograms.C:67
 drawCaloHistograms.C:68
 drawCaloHistograms.C:69
 drawCaloHistograms.C:70
 drawCaloHistograms.C:71
 drawCaloHistograms.C:72
 drawCaloHistograms.C:73
 drawCaloHistograms.C:74
 drawCaloHistograms.C:75
 drawCaloHistograms.C:76
 drawCaloHistograms.C:77
 drawCaloHistograms.C:78
 drawCaloHistograms.C:79
 drawCaloHistograms.C:80
 drawCaloHistograms.C:81
 drawCaloHistograms.C:82
 drawCaloHistograms.C:83
 drawCaloHistograms.C:84
 drawCaloHistograms.C:85
 drawCaloHistograms.C:86
 drawCaloHistograms.C:87
 drawCaloHistograms.C:88
 drawCaloHistograms.C:89
 drawCaloHistograms.C:90
 drawCaloHistograms.C:91
 drawCaloHistograms.C:92
 drawCaloHistograms.C:93
 drawCaloHistograms.C:94
 drawCaloHistograms.C:95
 drawCaloHistograms.C:96
 drawCaloHistograms.C:97
 drawCaloHistograms.C:98
 drawCaloHistograms.C:99
 drawCaloHistograms.C:100
 drawCaloHistograms.C:101
 drawCaloHistograms.C:102
 drawCaloHistograms.C:103
 drawCaloHistograms.C:104
 drawCaloHistograms.C:105
 drawCaloHistograms.C:106
 drawCaloHistograms.C:107
 drawCaloHistograms.C:108
 drawCaloHistograms.C:109
 drawCaloHistograms.C:110
 drawCaloHistograms.C:111
 drawCaloHistograms.C:112
 drawCaloHistograms.C:113
 drawCaloHistograms.C:114
 drawCaloHistograms.C:115
 drawCaloHistograms.C:116
 drawCaloHistograms.C:117
 drawCaloHistograms.C:118
 drawCaloHistograms.C:119
 drawCaloHistograms.C:120
 drawCaloHistograms.C:121
 drawCaloHistograms.C:122
 drawCaloHistograms.C:123
 drawCaloHistograms.C:124
 drawCaloHistograms.C:125
 drawCaloHistograms.C:126
 drawCaloHistograms.C:127
 drawCaloHistograms.C:128
 drawCaloHistograms.C:129
 drawCaloHistograms.C:130
 drawCaloHistograms.C:131
 drawCaloHistograms.C:132
 drawCaloHistograms.C:133
 drawCaloHistograms.C:134
 drawCaloHistograms.C:135
 drawCaloHistograms.C:136
 drawCaloHistograms.C:137
 drawCaloHistograms.C:138
 drawCaloHistograms.C:139
 drawCaloHistograms.C:140
 drawCaloHistograms.C:141