#include "TFile.h" #include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TRandom.h" #include "TLegend.h" #include "TPaveStats.h" #include "TGraph.h" #include "TSystem.h" #include "TTree.h" #include "TTreePlayer.h" #include "TF1.h" #include "TCut.h" #include "TPaletteAxis.h" void calomini() { char fobject[50]; sprintf(fobject, "lemma"); TFile *fin = TFile::Open("C:/si-calo-sep18/si-500596-trasl.root"); fin->ls(); //TGaxis::SetMaxDigits(5); if (fin == 0) { printf("Error: cannot open the file!\n"); } else { TTree *fChain=0; fin->GetObject(fobject,fChain); TCut cut912 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[12] - (3.32785)) < (3)*(1.47188) ").Data(); TCut cut913 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[13] - (4.43584)) < (3)*(0.685633) ").Data(); TCut cut914 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[14] - (3.42323)) < (3)*(0.646554) ").Data(); TCut cut915 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[15] - (1.71963)) < (3)*(1.78036) ").Data(); TCut cut90 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[0] - (-125.007)) < (3)*(2.67618) ").Data(); TCut cut91 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[1] - (-125.773)) < (3)*(3.01779) ").Data(); TCut cut92 = TString::Format("TMath::Abs(Calo_Time[9] - Calo_Time[2] - (-124.395)) < (3)*(2.83948) ").Data(); TCut cutx37 = TString::Format("TMath::Abs(x37[0] - (-20.7411)) < (1)*(1.16973) ").Data(); TCut xh99 = TString::Format("xh > -99 ").Data(); TCanvas *c0 = new TCanvas("c0","Energy",1280,1024); gStyle->SetOptFit(); fChain->SetLineColor(kBlue); TString hxb01string = TString::Format("Calo_EnDep[0]>> htemp(100, 0., 0.)"); fChain->Draw(hxb01string,cut90); fChain->GetHistogram()->SetTitle("Energy"); TH1F *hxb01= (TH1F*)gPad->GetPrimitive("htemp"); //t->SetScanField(0); hxb01->GetXaxis()->SetTitle("Energy (ADC)"); hxb01->GetYaxis()->SetTitle("#Counts"); hxb01->SetTitle("si-500596, #mu^{+}_{22 GeV}- Calo_EnDep[0], LG0"); hxb01->SetFillColorAlpha(kBlue, 0.35); hxb01->Draw(); hxb01->SetName("Energy "); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c0->Update(); TLegend* leg01 = new TLegend(0.15, 0.7, .25, .75); leg01->SetHeader("Legend"); leg01->SetNColumns(1); leg01->AddEntry(hxb01, "Data", "l"); leg01->Draw(); c0->Update(); gPad->Modified(); gPad->Update(); TPaveStats *stat01 = (TPaveStats*)hxb01->GetListOfFunctions()->FindObject("stats"); stat01->SetTextColor(kBlue); stat01->SetX1NDC(0.80); stat01->SetX2NDC(0.98); stat01->SetY1NDC(0.77); stat01->SetY2NDC(0.92); stat01->DrawClone(); gPad->Update(); c0->Print("C:/si-calo-sep18/Calo_EnDep[0]_LG0.pdf"); delete c0; TCanvas *c1 = new TCanvas("c1","Energy",1280,1024); gStyle->SetOptFit(); fChain->SetLineColor(kBlue); TString hxb02string = TString::Format("Calo_EnDep[0]>> htemp(100, 0., 0.)"); fChain->Draw(hxb02string,cut90 && cut912 && cut913 && cut914 && cut915); fChain->GetHistogram()->SetTitle("Energy"); TH1F *hxb02= (TH1F*)gPad->GetPrimitive("htemp"); //t->SetScanField(0); hxb02->GetXaxis()->SetTitle("Energy (ADC)"); hxb02->GetYaxis()->SetTitle("#Counts"); hxb02->SetTitle("si-500596, #mu^{+}_{22 GeV}- Calo_EnDep[0], LG0, HORSA"); hxb02->SetFillColorAlpha(kBlue, 0.35); hxb02->Draw(); hxb02->SetName("Energy "); gPad->Modified(); gPad->Update(); // make sure it's really (re)drawn c1->Update(); TLegend* leg02 = new TLegend(0.15, 0.7, .25, .75); leg02->SetHeader("Legend"); leg02->SetNColumns(1); leg02->AddEntry(hxb02, "Data", "l"); leg02->Draw(); c1->Update(); gPad->Modified(); gPad->Update(); TPaveStats *stat02 = (TPaveStats*)hxb02->GetListOfFunctions()->FindObject("stats"); stat02->SetTextColor(kBlue); stat02->SetX1NDC(0.80); stat02->SetX2NDC(0.98); stat02->SetY1NDC(0.77); stat02->SetY2NDC(0.92); stat02->DrawClone(); gPad->Update(); c1->Print("C:/si-calo-sep18/Calo_EnDep[0]_LG0_HORSA.pdf"); delete c1; } }