#ifndef __CINT__ #include #include #include #include #include "TROOT.h" #include "TNtuple.h" #include "TStyle.h" #include "TFile.h" #include "TString.h" //#include "TH1F.h" #include "TH1.h" #include "TCanvas.h" #include "TTree.h" #include "TFormula.h" #include "TGraph.h" #include "TStyle.h" #include "TApplication.h" #include "TPaveClass.h" #include "TLegend.h" #include "TFrame.h" //using namespace std; //TROOT root ("Stability","Stability"); int main(int argc, char **argv) #endif { #ifndef __CINT__ #define USAGE "USAGE: program " if(argc != 3){ std::cout<Get("Archive"); #else int tankid=637, status=1; #endif gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); Float_t fTime,fLsId; char tankidchar[20],pngaddress[40]; Archive->SetBranchAddress("fTime",&fTime); Archive->SetBranchAddress("fTime",&fTime); Archive->SetBranchAddress("fLsId",&fLsId); TDatime T0(1995,01,01,00,00,00); int X0 = T0.Convert(); gStyle->SetTimeOffset(X0); char titlechar[20]; #ifndef __CINT__ //this will loop the rest of the program until it finishes the list of ids. int tankid; ifstream InFile; InFile.open(file_in); while(!InFile.eof()){ InFile>>tankid; if(InFile.eof()){ break; } std::cout<<"making plots for Tankid: "<Divide(2,2); c1->cd(1); Archive->SetMarkerSize(0.4); Archive->Draw("fDynodeAnode0:(fTime-788929200)",tankidchar,""); TH1F *h1 = (TH1F*)Archive->GetHistogram(); h1->GetXaxis()->SetTimeDisplay(1); h1->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"D/A1 for TankId=%d",tankid); h1->SetTitle(titlechar); // TPad *pad1 = (TPad*)c1->GetPad(1); // TFrame *frame1 = (TFrame*)c1->GetFrame(); // frame1->SetLineWidth(5); // frame1->SetLineColor(kBlack); c1->cd(2); Archive->Draw("fDynodeAnode1:(fTime-788929200)",tankidchar,""); TH1F *h2 = (TH1F*)Archive->GetHistogram(); h2->GetXaxis()->SetTimeDisplay(1); h2->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"D/A2 for TankId=%d",tankid); h2->SetTitle(titlechar); c1->cd(3); Archive->Draw("fDynodeAnode2:(fTime-788929200)",tankidchar,""); TH1F *h3 = (TH1F*)Archive->GetHistogram(); h3->GetXaxis()->SetTimeDisplay(1); h3->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"D/A3 for TankId=%d",tankid); h3->SetTitle(titlechar); c1->cd(4); Archive->SetMarkerColor(kGreen); Archive->Draw("fPMT1:(fTime-788929200)",tankidchar,""); TH1F *h7 = (TH1F*)Archive->GetHistogram(); h7->GetXaxis()->SetTimeDisplay(1); h7->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"T1, T2, T3 for TankId=%d",tankid); h7->SetTitle(titlechar); Archive->SetMarkerColor(kRed); Archive->Draw("fPMT0:(fTime-788929200)",tankidchar,"same"); TH1F *h20 = (TH1F*)Archive->GetHistogram(); Archive->SetMarkerColor(kBlue); Archive->Draw("fPMT2:(fTime-788929200)",tankidchar,"same"); TH1F *h21 = (TH1F*)Archive->GetHistogram(); Archive->SetMarkerColor(kBlack); TLegend *leg = new TLegend(0.85,0.8,.97,.97); leg->SetFillColor(kWhite); leg->AddEntry(h20,"Temp PMT1","p"); leg->AddEntry(h7,"Temp PMT2","p"); leg->AddEntry(h21,"Temp PMT3","p"); leg->Draw(); #ifndef __CINT__ // sprintf(pngaddress,"./plots/%d_DA_%s.png",tankid,rootfile); sprintf(pngaddress,"%d_DA_%s.png",tankid,rootfile); c1->Print(pngaddress,"png"); c1->Close(); c1->Clear(); #else break; } case 2: { //Makes V1, V2, V3 plot for the three PMTs #endif TCanvas *c2 = new TCanvas("c2","c2",1200,1000); c2->Divide(2,2); c2->cd(1); Archive->SetMarkerSize(0.4); Archive->Draw("fPMV0:(fTime-788929200)",tankidchar,""); TH1F *h4 = (TH1F*)Archive->GetHistogram(); h4->GetXaxis()->SetTimeDisplay(1); h4->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"PMV1 for TankId=%d",tankid); h4->SetTitle(titlechar); c2->cd(2); Archive->Draw("fPMV1:(fTime-788929200)",tankidchar,""); TH1F *h5 = (TH1F*)Archive->GetHistogram(); h5->GetXaxis()->SetTimeDisplay(1); h5->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"PMV2 for TankId=%d",tankid); h5->SetTitle(titlechar); c2->cd(3); Archive->Draw("fPMV2:(fTime-788929200)",tankidchar,""); TH1F *h6 = (TH1F*)Archive->GetHistogram(); h6->GetXaxis()->SetTimeDisplay(1); h6->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"PMV3 for TankId=%d",tankid); h6->SetTitle(titlechar); c2->cd(4); //first plot for PMT2 because most of the times has the bigger variation, so adjusts better the plot. Archive->SetMarkerColor(kGreen); Archive->Draw("fPMT1:(fTime-788929200)",tankidchar,""); TH1F *h8 = (TH1F*)Archive->GetHistogram(); h8->GetXaxis()->SetTimeDisplay(1); h8->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"T1, T2, T3 for TankId=%d",tankid); h8->SetTitle(titlechar); Archive->SetMarkerColor(kRed); Archive->Draw("fPMT0:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlue); Archive->Draw("fPMT2:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlack); #ifndef __CINT__ sprintf(pngaddress,"./plots/%d_V_%s.png",tankid,rootfile); c2->Print(pngaddress,"png"); c2->Close(); c2->Clear(); #else break; } case 3: { //makes the Peak0,1,2 plot. #endif TCanvas *c3 = new TCanvas("c3","c3",1200,1000); c3->Divide(2,2); c3->cd(1); Archive->SetMarkerSize(0.4); Archive->Draw("fPeak0:(fTime-788929200)",tankidchar,""); TH1F *h10 = (TH1F*)Archive->GetHistogram(); h10->GetXaxis()->SetTimeDisplay(1); h10->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Peak1 for TankId=%d",tankid); h10->SetTitle(titlechar); c3->cd(2); Archive->Draw("fPeak1:(fTime-788929200)",tankidchar,""); TH1F *h11 = (TH1F*)Archive->GetHistogram(); h11->GetXaxis()->SetTimeDisplay(1); h11->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Peak2 for TankId=%d",tankid); h11->SetTitle(titlechar); c3->cd(3); Archive->Draw("fPeak2:(fTime-788929200)",tankidchar,""); TH1F *h12 = (TH1F*)Archive->GetHistogram(); h12->GetXaxis()->SetTimeDisplay(1); h12->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Peak3 for TankId=%d",tankid); h12->SetTitle(titlechar); c3->cd(4); Archive->SetMarkerColor(kGreen); Archive->Draw("fPMT1:(fTime-788929200)",tankidchar,""); TH1F *h13 = (TH1F*)Archive->GetHistogram(); h13->GetXaxis()->SetTimeDisplay(1); h13->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"T1, T2, T3 for TankId=%d",tankid); h13->SetTitle(titlechar); Archive->SetMarkerColor(kRed); Archive->Draw("fPMT0:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlue); Archive->Draw("fPMT2:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlack); #ifndef __CINT__ sprintf(pngaddress,"./plots/%d_Peak_%s.png",tankid,rootfile); c3->Print(pngaddress,"png"); c3->Close(); c3->Clear(); #else break; } case 4: { //makes the Area0,1,2 plot. #endif TCanvas *c4 = new TCanvas("c4","c4",1200,1000); c4->Divide(2,2); c4->cd(1); Archive->SetMarkerSize(0.4); Archive->Draw("fArea0:(fTime-788929200)",tankidchar,""); TH1F *h14 = (TH1F*)Archive->GetHistogram(); h14->GetXaxis()->SetTimeDisplay(1); h14->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Area1 for TankId=%d",tankid); h14->SetTitle(titlechar); c4->cd(2); Archive->Draw("fArea1:(fTime-788929200)",tankidchar,""); TH1F *h15 = (TH1F*)Archive->GetHistogram(); h15->GetXaxis()->SetTimeDisplay(1); h15->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Area2 for TankId=%d",tankid); h15->SetTitle(titlechar); c4->cd(3); Archive->Draw("fArea2:(fTime-788929200)",tankidchar,""); TH1F *h16 = (TH1F*)Archive->GetHistogram(); h16->GetXaxis()->SetTimeDisplay(1); h16->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"Area3 for TankId=%d",tankid); h16->SetTitle(titlechar); c4->cd(4); Archive->SetMarkerColor(kGreen); Archive->Draw("fPMT1:(fTime-788929200)",tankidchar,""); TH1F *h17 = (TH1F*)Archive->GetHistogram(); h17->GetXaxis()->SetTimeDisplay(1); h17->GetXaxis()->SetTimeFormat("%d/%m"); sprintf(titlechar,"T1, T2, T3 for TankId=%d",tankid); h17->SetTitle(titlechar); Archive->SetMarkerColor(kRed); Archive->Draw("fPMT0:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlue); Archive->Draw("fPMT2:(fTime-788929200)",tankidchar,"same"); Archive->SetMarkerColor(kBlack); #ifndef __CINT__ sprintf(pngaddress,"./plots/%d_Area_%s.png",tankid,rootfile); c4->Print(pngaddress,"png"); c4->Close(); c4->Clear(); } // this bracket corresponds to the While loop for ids. #else break; } } #endif }