#include #include #include #include "TCanvas.h" #include "TArrayD.h" #include "TROOT.h" #include "TColor.h" #include "TH2.h" #include "TH1.h" #include "TMath.h" #include "TGraph.h" #include #include "TString.h" #include #include "TMarker.h" #include "TAttMarker.h" #include "TLatex.h" #include #include "TTimeStamp.h" void twocams() { gROOT->SetStyle("Plain"); TVectorT cX1; TVectorT cY1; TVectorT cX2; TVectorT cY2; TVectorT cDate; TVectorT cSeconds; TVectorT cTime; TVectorT cRadius; TVectorT cIntegral; TVectorT cIntensity2; TVectorT cIntensity1; Int_t n=0; Bool_t openC=true; Int_t cElem=0; TVectorT aX1; TVectorT aY1; TVectorT aX2; TVectorT aY2; TVectorT aDate; TVectorT aSeconds; TVectorT aTime; TVectorT aRadius; TVectorT aIntegral; TVectorT aIntensity2; TVectorT aIntensity1; Int_t nII=0; Bool_t openA=true; Int_t aElem=0; double a, b, c, d, e, f, g; TLatex *mytext = new TLatex(); //*******************SetLabel for X axis*************// TString theLabel="24 and 25 Nov 08"; Bool_t quick=false; //*************************************************** Bool_t box4=false; //to be set to true only for camera 4 of RICH1 ifstream Cfile ("/scratch/fsoomro/LAMS/RICH2/Data/r2Cam05-data.txt"); TString mystring="cam05"; //**************************************************** ifstream Afile ("/scratch/fsoomro/LAMS/RICH2/Data/r2Cam07-data.txt"); TString mystringII="cam07"; if (Cfile.is_open() ) { while ( (!Cfile.eof()) ) { cDate.ResizeTo(n+1); cTime.ResizeTo(n+1); cX1.ResizeTo(n+1); cY1.ResizeTo(n+1); cX2.ResizeTo(n+1); cY2.ResizeTo(n+1); cIntegral.ResizeTo(n+1); cIntensity2.ResizeTo(n+1); cIntensity1.ResizeTo(n+1); Cfile>>cDate[n]>>cTime[n]; if(box4) { Cfile>> a >>cIntegral[n] >> cIntensity1[n] >> b >>cIntensity2[n] >> c; Cfile>> d >> e >> cX2[n]>>cY2[n]>> f >> g >> cX1[n] >>cY1[n]; } else { Cfile>> a >>cIntegral[n] >> cIntensity2[n] >> b >>cIntensity1[n] >> c; Cfile>> d >> e >> cX1[n]>>cY1[n]>> f >> g >> cX2[n] >>cY2[n]; } n++; } Cfile.close(); } else { cout << "Unable to open C-file"< "<>aDate[nII]>>aTime[nII]; Afile>> a >> aIntegral[nII]>> aIntensity2[nII]>> b >> aIntensity1[nII] >> c; Afile>> d >> e >> aX1[nII] >> aY1[nII]>> f >> g >>aX2[nII]>>aY2[nII]; nII++; } Afile.close(); } else { cout << "Unable to open A-file"< "<GetSec(); delete t; } for(Int_t i=1; itime display // if(cIntensity2[i]<35000 && (cDate[i]-20080000)>=1205 && (cDate[i]-20080000)<=1210 ) // cout<<"--------- "<Divide(2,3); mystring.Append(" x y Intensity"); c1->cd(2); mytext->DrawText(0.1,0.8,mystring);gPad->Update(); TLatex *textII = new TLatex(0.1, 0.7,"Reference Spot"); textII->SetTextColor(kRed); textII->Draw("SAME"); gPad->Update(); TText *t1 = new TLatex(0.30,0.7,Form("%3.2f",cX1[0])); t1->SetTextColor(kRed); t1->Draw("SAME"); TText *t2 = new TLatex(0.40,0.7,Form("%3.2f",cY1[0])); t2->SetTextColor(kRed); t2->Draw("SAME"); TText *t3 = new TLatex(0.50,0.7,Form("%3.0f",cIntensity1[0])); t3->SetTextColor(kRed); t3->Draw("SAME"); TLatex *textIII= new TLatex(0.1, 0.6, "Reflected Spot"); textIII->SetTextColor(kGreen); textIII->Draw("SAME"); gPad->Update(); TText *t4 = new TLatex(0.30,0.6,Form("%3.2f",cX2[0])); t4->SetTextColor(kGreen); t4->Draw("SAME"); TText *t5 = new TLatex(0.40,0.6,Form("%3.2f",cY2[0])); t5->SetTextColor(kGreen); t5->Draw("SAME"); TText *t6 = new TLatex(0.50,0.6,Form("%3.0f",cIntensity2[0])); t6->SetTextColor(kGreen); t6->Draw("SAME"); TString str1=Form("%3.2f", cRadius[0]); TString str2=Form("%3.2f", cIntegral[0]); TString str3="Radial separation: "; str3.Append(str1); TString str4="Overall intensity: "; str4.Append(str2); str4.Append("x10^7"); TLatex *text4= new TLatex(0.1, 0.5, str3); text4->Draw("SAME"); gPad->Update(); TLatex *text5= new TLatex(0.1, 0.4, str4); text5->Draw("SAME"); gPad->Update(); TLatex *text6= new TLatex(0.1, 0.2, theLabel); text6->Draw("SAME"); cX1[0]=0; cY1[0]=0; cX2[0]=0; cY2[0]=0; cIntensity2[0]=0; cIntensity1[0]=0; cIntegral[0]=0; cRadius[0]=0; // cSeconds[0]=0; //------------------------------>time display TGraph *graphs[8]; graphs[0]= new TGraph(cSeconds, cX1); graphs[0]->GetYaxis()->SetTitle("Shift in \"x\" coordinate"); if(quick) graphs[0]->GetYaxis()->SetRangeUser(-5,5); else graphs[0]->GetYaxis()->SetRangeUser(-60, 60); graphs[0]->SetLineColor(kRed); c1->cd(1); graphs[0]->Draw("AL"); graphs[1]= new TGraph(cSeconds, cX2); graphs[1]->SetLineColor(kGreen); graphs[1]->Draw("same"); graphs[2]= new TGraph(cSeconds, cY1); graphs[2]->GetYaxis()->SetTitle("Shift in \"y\" coordinate"); if(quick) graphs[2]->GetYaxis()->SetRangeUser(-5,5); else graphs[2]->GetYaxis()->SetRangeUser(-5, 30); graphs[2]->SetLineColor(kRed); c1->cd(3); graphs[2]->Draw("AL"); graphs[3]= new TGraph(cSeconds, cY2); graphs[3]->SetLineColor(kGreen); graphs[3]->Draw("same"); graphs[4]= new TGraph(cSeconds, cIntensity1); graphs[4]->GetYaxis()->SetTitle("Shift in \"Intensity\""); if(quick) graphs[4]->GetYaxis()->SetRangeUser(-10000,10000); else graphs[4]->GetYaxis()->SetRangeUser(-60000, 30000); graphs[4]->SetLineColor(kRed); c1->cd(5); graphs[4]->Draw("AL"); graphs[5]= new TGraph(cSeconds, cIntensity2); graphs[5]->SetLineColor(kGreen); graphs[5]->Draw("same"); graphs[6]= new TGraph(cSeconds, cRadius); graphs[6]->GetYaxis()->SetTitle("Shift in radial separation"); if(quick) graphs[6]->GetYaxis()->SetRangeUser(-5,5); else graphs[6]->GetYaxis()->SetRangeUser(-5, 65); c1->cd(4); graphs[6]->Draw("AL"); graphs[7]= new TGraph(cSeconds, cIntegral); graphs[7]->GetYaxis()->SetTitle("Shift in overall intensity x10^7"); if (quick) graphs[7]->GetYaxis()->SetRangeUser(-0.08,0.08); else graphs[7]->GetYaxis()->SetRangeUser(-0.08, 0.3); c1->cd(6); graphs[7]->Draw("AL"); for(int i=0; i<8; i++) { graphs[i]->GetYaxis()->SetTitleSize(0.06); graphs[i]->GetYaxis()->SetTitleOffset(0.7); graphs[i]->GetXaxis()->SetTitleSize(0.06); graphs[i]->GetXaxis()->SetTitleOffset(0.7); graphs[i]->GetXaxis()->SetTimeDisplay(1); graphs[i]->GetXaxis()->SetNdivisions(-504); graphs[i]->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M"); graphs[i]->GetXaxis()->SetLimits(cSeconds[0], cSeconds[cElem-1]); graphs[i]->GetXaxis()->SetTimeOffset(0,"gmt");//local") graphs[i]->GetXaxis()->SetLabelOffset(0.02); } } //if openC if(openA) //************draw graphs for A-side file { for(Int_t i=0; iGetSec(); delete t; } for(Int_t i=1; itime display } TCanvas *c2 = new TCanvas("c2", "c2", 1600,1000 ); c2->Divide(2,3); mystringII.Append(" x y Intensity"); c2->cd(2); mytext->DrawText(0.1, 0.8,mystringII); gPad->Update(); TLatex *textII = new TLatex(0.1, 0.7,"Reference Spot"); textII->SetTextColor(kRed); textII->Draw("SAME"); gPad->Update(); TText *t1 = new TLatex(0.30,0.7,Form("%3.2f",aX1[0])); t1->SetTextColor(kRed); t1->Draw("SAME"); TText *t2 = new TLatex(0.40,0.7,Form("%3.2f",aY1[0])); t2->SetTextColor(kRed); t2->Draw("SAME"); TText *t3 = new TLatex(0.50,0.7,Form("%3.0f",aIntensity1[0])); t3->SetTextColor(kRed); t3->Draw("SAME"); TLatex *textIII= new TLatex(0.1, 0.6, "Reflected Spot"); textIII->SetTextColor(kGreen); textIII->Draw("SAME"); gPad->Update(); TText *t4 = new TLatex(0.30,0.6,Form("%3.2f",aX2[0])); t4->SetTextColor(kGreen); t4->Draw("SAME"); TText *t5 = new TLatex(0.40,0.6,Form("%3.2f",aY2[0])); t5->SetTextColor(kGreen); t5->Draw("SAME"); TText *t6 = new TLatex(0.50,0.6,Form("%3.0f",aIntensity2[0])); t6->SetTextColor(kGreen); t6->Draw("SAME"); TString str1=Form("%3.2f", aRadius[0]); TString str2=Form("%3.2f", aIntegral[0]); TString str3="Radial separation: "; str3.Append(str1); TString str4="Overall intensity: "; str4.Append(str2); str4.Append("x10^7"); mytext->DrawText(0.1, 0.5,str3); gPad->Update(); mytext->DrawText(0.1, 0.4,str4); gPad->Update(); mytext->DrawText(0.1, 0.2,theLabel); aX1[0]=0; aY1[0]=0; aX2[0]=0; aY2[0]=0; aIntensity2[0]=0; aIntensity1[0]=0; aIntegral[0]=0; aRadius[0]=0; // aSeconds[0]=0; //------------------------------>time display TGraph *graphsII[8]; graphsII[0]= new TGraph(aSeconds, aX1); graphsII[0]->GetYaxis()->SetTitle("Shift in \"x\" coordinate"); if(quick) graphsII[0]->GetYaxis()->SetRangeUser(-5,5); else graphsII[0]->GetYaxis()->SetRangeUser(-60, 60); graphsII[0]->SetLineColor(kRed); c2->cd(1); graphsII[0]->Draw("AL"); graphsII[1]= new TGraph(aSeconds, aX2); graphsII[1]->SetLineColor(kGreen); graphsII[1]->Draw("same"); graphsII[2]= new TGraph(aSeconds, aY1); graphsII[2]->GetYaxis()->SetTitle("Shift in \"y\" coordinate"); if(quick) graphsII[2]->GetYaxis()->SetRangeUser(-5,5); else graphsII[2]->GetYaxis()->SetRangeUser(-5, 30); graphsII[2]->SetLineColor(kRed); c2->cd(3); graphsII[2]->Draw("AL"); graphsII[3]= new TGraph(aSeconds, aY2); graphsII[3]->SetLineColor(kGreen); graphsII[3]->Draw("same"); graphsII[4]= new TGraph(aSeconds, aIntensity1); graphsII[4]->GetYaxis()->SetTitle("Shift in \"Intensity\""); if(quick) graphsII[4]->GetYaxis()->SetRangeUser(-10000,10000); else graphsII[4]->GetYaxis()->SetRangeUser(-60000, 30000); graphsII[4]->SetLineColor(kRed); c2->cd(5); graphsII[4]->Draw("AL"); graphsII[5]= new TGraph(aSeconds, aIntensity2); graphsII[5]->SetLineColor(kGreen); graphsII[5]->Draw("same"); graphsII[6]= new TGraph(aSeconds, aRadius); graphsII[6]->GetYaxis()->SetTitle("Shift in radial separation"); if(quick) graphsII[6]->GetYaxis()->SetRangeUser(-5,5); else graphsII[6]->GetYaxis()->SetRangeUser(-5, 65); c2->cd(4); graphsII[6]->Draw("AL"); graphsII[7]= new TGraph(aSeconds, aIntegral); graphsII[7]->GetYaxis()->SetTitle("Shift in overall intensity x10^7"); if (quick) graphsII[7]->GetYaxis()->SetRangeUser(-0.08,0.08); else graphsII[7]->GetYaxis()->SetRangeUser(-0.08, 0.3); c2->cd(6); graphsII[7]->Draw("AL"); for(int i=0; i<8; i++) { graphsII[i]->GetYaxis()->SetTitleSize(0.06); graphsII[i]->GetYaxis()->SetTitleOffset(0.7); graphsII[i]->GetXaxis()->SetTitleSize(0.06); graphsII[i]->GetXaxis()->SetTitleOffset(0.7); graphsII[i]->GetXaxis()->SetTimeDisplay(1); graphsII[i]->GetXaxis()->SetNdivisions(-504); graphsII[i]->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M"); graphsII[i]->GetXaxis()->SetTimeOffset(0,"gmt");//local"); graphsII[i]->GetXaxis()->SetLimits(aSeconds[0], aSeconds[aElem-1]); graphsII[i]->GetXaxis()->SetLabelOffset(0.02); } } //if openA }