// sample to plot ND data // 04/26/2007 // // // C/C++ headers // #include "TrAng.h" #include "QtoInc.h" #include "option.h" #include #include #include // // ROOT headers // #include #include #include #include #include #include #include #include #include //#include #include "TStyle.h" //#include #include #include #include #include using namespace std; TH2F* NormalizeTH2F(TH2F* h1,Int_t Nev){ TH2F* h2 = new TH2F("h2","Zenit, deg; Azimut, deg",36,0,360,20,140,180); //h2-SetName("h2"); //h2.SetBins(36,0,360,20,140,180); for(Int_t i=0;i<=36;i++) for(Int_t j=0;j<=20;j++)h2->Fill(i*10-5,j*2+139,h1->GetBinContent(i,j)/Nev); return h2; } void DivideHystTH2F(TString file1, TString file2, TString hyst1, TString hyst2, Int_t Nev1, Int_t Nev2, string outdir,Bool_t Err){ gStyle->SetPalette(1); TFile* f1 = new TFile(file1); TFile* f2 = new TFile(file2); TH2F* h1 = (TH2F*)f1->Get(hyst1); TH2F* h2 = (TH2F*)f2->Get(hyst2); TH2F* h1n = NormalizeTH2F(h1,1); TH2F* h2n = NormalizeTH2F(h2,1); /*TH2F* h1n = new TH2F("h1n","Zenit, deg; Azimut, deg",36,0,360,20,140,180); TH2F* h2n = new TH2F("h2n","Zenit, deg; Azimut, deg",36,0,360,20,140,180); for(Int_t i=0;i<=36;i++) for(Int_t j=0;j<=20;j++){ h1n->Fill(i*10-5,j*2+140,h1->GetBinContent(i,j)/h1->GetEntries()); h2n->Fill(i*10-5,j*2+140,h2->GetBinContent(i,j)/h2->GetEntries()); }*/ //vector GrafErr(8); TH2F* h3 = new TH2F("h3","Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); h3->Divide(h1n,h2n); TH2F* h3ErrPer; if(Err){ TH2F* h3Err = new TH2F("h3Err","Errot of Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); h3ErrPer = new TH2F("h3Err","Errot of Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); //ofstream fe((TString)outdir+"Divide_errors"+hyst1+"_"+hyst2+".txt"); ofstream fe2((TString)outdir+"Protons_Divide_errors"+hyst1+"_"+hyst2+".txt"); //Int_t Nev1 = 0; //Int_t Nev2 = 0; //for(Int_t i=1;i<=36;i++) for(Int_t j=0;j<=20;j++){Nev1=Nev1+h1->GetBinContent(i,j);Nev2=Nev2+h2->GetBinContent(i,j);} //cout<<"Nev1 = "<GetBinContent(i,j)<<"/"<GetBinContent(i,j)<<" = "; if(h2->GetBinContent(i,j)!=0){ Float_t Val = (h1->GetBinContent(i,j))/(h2->GetBinContent(i,j)); Float_t Err = 0; if(h1->GetBinContent(i,j)==0)Err=0;else Err = Val*(sqrt(1./h1->GetBinContent(i,j)+1./h2->GetBinContent(i,j))); //Float_t Err = (h2->GetBinContent(i,j)*sqrt(h1->GetBinContent(i,j))-h1->GetBinContent(i,j)*sqrt(h2->GetBinContent(i,j)))/pow(h2->GetBinContent(i,j),2); //Float_t Err = (h1->GetBinContent(i,j)/pow(h2->GetBinContent(i,j),2))+pow(h1->GetBinContent(i,j),2)*h2->GetBinContent(i,j)/pow(h2->GetBinContent(i,j),4); Float_t ErrPer = Err*100/(fabs(Val-1)); fe2<<(-j+20)*2+1<<"\t"<GetBinContent(i,j)<<"\t"<GetBinContent(i,j)<100)ErrPer=100; h3ErrPer->Fill(i*10-5,j*2+139,ErrPer); h3Err->Fill(i*10-5,j*2+139,Err); } } //fe<<"\n"; } //h1ErrCanv->Divide(1,8); for(Int_t i=0;i<8;i++){ Float_t x[36]; Float_t y[36]; Float_t y1[36]; Float_t Ex[36]; Float_t Ey[36]; TH1F* Profil1D = new TH1F("Profil1D","Profil1D",36,0,36); Profil1D->SetFillColor(2); for(Int_t j=0;j<36;j++){ y[j] = h3->GetBinContent(j,19-i); Ey[j] = h3Err->GetBinContent(j,19-i); x[j] = j; Ex[j] = 0; y1[j] = 1; Profil1D->Fill(j,h2->GetBinContent(j,19-i)); } TCanvas* h1ErrCanv = new TCanvas("h1ErrCanv","",1200,800); h1ErrCanv->Divide(1,2); TGraphErrors* Gep = new TGraphErrors(36,x,y,Ex,Ey); TGraph* _1 = new TGraph(36,x,y1); Gep->SetLineColor(4); Gep->SetFillColor(2); h1ErrCanv->cd(1); Gep->Draw("AB"); _1->Draw(""); h1ErrCanv->cd(2); Profil1D->Draw(""); /*string s; stringstream out; out<SaveAs((TString)outdir+"Divide_"+hyst1+"_"+hyst2+"_1Ds"+s+".png");*/ Gep->Delete(); delete h1ErrCanv; } /*fe2.close(); TFile f3((TString)outdir+"DivideHyst"+hyst1+"_"+hyst2+".root","recreate"); h3->Write(); f3.Close();*/ } /*TCanvas* c1 = new TCanvas("c1",hyst1+"/"+hyst2,1200,1200); if(Err) c1->Divide(1,2); c1->cd(1); h3->Draw("colz"); if(Err){ c1->cd(2); h3ErrPer->Draw("colz"); } c1->SaveAs((TString)outdir+"Divide_"+hyst1+"_"+hyst2+".png"); delete c1;*/ h2->Delete(); h1->Delete(); h3->Delete(); f1->Delete(); f2->Delete(); } void DiferenceHystTH2F(TString file1, TString file2, TString hyst1, TString hyst2, Int_t Nev1, Int_t Nev2, string outdir){ gStyle->SetPalette(1); TFile* f1 = new TFile(file1); TFile* f2 = new TFile(file2); TH2F* h1 = (TH2F*)f1->Get(hyst1); TH2F* h2 = (TH2F*)f2->Get(hyst2); TH2F* h1n = NormalizeTH2F(h1,Nev1); TH2F* h2n = NormalizeTH2F(h2,Nev2); TH2F* h3 = new TH2F("h3","Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); TH2F* h3Err = new TH2F("h3Err","Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); TH2F* h3ErrPer = new TH2F("h3Err","Errot of Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); ofstream fe((TString)outdir+"Diference_errors2.txt"); for(Int_t i=1;i<=36;i++){ for(Int_t j=1;j<=20;j++){ Float_t Val = h1->GetBinContent(i,j)/Nev1-h2->GetBinContent(i,j)/Nev2; Float_t Err = sqrt(pow(h1->GetBinContent(i,j)/Nev1,2)*(1./h1->GetBinContent(i,j)+1./Nev1)+pow(h2->GetBinContent(i,j)/Nev2,2)*(1./h2->GetBinContent(i,j)+1./Nev2)); Float_t ErrPer = Err*100/(fabs(Val)); h3->Fill(i*10-5,j*2+139,h1->GetBinContent(i,j)/Nev1-h2->GetBinContent(i,j)/Nev2); fe<GetBinContent(i,j)/Nev1<<" - "<GetBinContent(i,j)/Nev2<<" = "<GetBinContent(i,j)!=0 && h2->GetBinContent(i,j)!=0){ fe<<" +/- "<100)ErrPer=100; h3Err->Fill(i*10-5,j*2+139,Err); h3ErrPer->Fill(i*10-5,j*2+139,ErrPer); }else fe<<"\n"; } fe<<"\n"; } for(Int_t i=0;i<8;i++){ Float_t x[36]; Float_t y[36]; Float_t Ex[36]; Float_t Ey[36]; TH1F* Profil1D = new TH1F("Profil1D","Profil1D",36,0,36); Profil1D->SetFillColor(2); for(Int_t j=0;j<36;j++){ if(h1n->GetBinContent(j,19-i)!=0)y[j] = h3->GetBinContent(j,19-i)*100/h1n->GetBinContent(j,19-i); else y[j]=0; if(h1n->GetBinContent(j,19-i)!=0) Ey[j] = h3Err->GetBinContent(j,19-i)*100/h1n->GetBinContent(j,19-i); else Ey[j]=0; Profil1D->Fill(j,h2->GetBinContent(j,19-i)); //cout<<"h3 = "<GetBinContent(j,19-i)<<" h1n = "<GetBinContent(j,19-i)<<" yn = "<GetBinContent(j,19-i); //cout<Divide(1,2); TGraphErrors* Gep = new TGraphErrors(36,x,y,Ex,Ey); Gep->SetLineColor(4); Gep->SetFillColor(2); h1ErrCanv->cd(1); Gep->Draw("AB"); h1ErrCanv->cd(2); Profil1D->Draw(""); string s; stringstream out; out<SaveAs((TString)outdir+"Diference_"+hyst1+"_"+hyst2+"_1Ds"+s+".png"); Gep->Delete(); Profil1D->Delete(); delete h1ErrCanv; } fe.close(); TFile f3((TString)outdir+"resultDifferenceHyst.root","recreate"); h3->Write(); f3.Close(); TCanvas* c1 = new TCanvas("c1",hyst1+" - "+hyst2,1200,1200); c1->Divide(1,2); c1->cd(1); h3->Draw("colz"); c1->cd(2); h3ErrPer->Draw("colz"); c1->SaveAs((TString)outdir+"Difference_"+hyst1+"_"+hyst2+".png"); delete c1; h2->Delete(); h1->Delete(); h3->Delete(); f1->Delete(); f2->Delete(); } void MergeHystTH2F(TString file1, TString file2, TString hyst1, TString hyst2, string outdir){ gStyle->SetPalette(1); TFile* f1 = new TFile(file1); TFile* f2 = new TFile(file2); TH2F* h1 = (TH2F*)f1->Get(hyst1); TH2F* h2 = (TH2F*)f2->Get(hyst2); TH2F* h3 = new TH2F("h3","Zenit angle, deg; Azimut angle, deg",36,0,360,20,140,180); for(Int_t i=0;i<=36;i++) for(Int_t j=0;j<=20;j++) h3->Fill(i*10-5,j*2+140,h1->GetBinContent(i,j)+h2->GetBinContent(i,j)); TFile f3((TString)outdir+hyst1+"_"+hyst2+"_resultMergeHyst.root","recreate"); h3->Write(); f3.Close(); TCanvas* c1 = new TCanvas("c1",hyst1+" + "+hyst2,1200,800); c1->cd(); h3->Draw("colz"); c1->SaveAs((TString)outdir+"Merge_"+hyst1+"_"+hyst2+".png"); delete c1; h2->Delete(); h1->Delete(); h3->Delete(); f1->Delete(); f2->Delete(); } void Convert2Dto1Dhyst(TString file, TString hyst, string outdir){ TFile* f1 = new TFile(file); TH2F* h1 = (TH2F*)f1->Get(hyst); //TH1F* h2 = new TH1F("h2","Zenit Efficiency",20,140,180); //TH1F* h3 = new TH1F("h3","Azimuth Efficiency",36,0,360); //for(Int_t i=0;i<36;i++) for(Int_t j=0;j<20;j++) h3->Fill(i*10-5,h1->GetBinContent(i,j)); //for(Int_t i=0;i<20;i++) for(Int_t j=0;j<36;j++) h2->Fill(j*2+140,h1->GetBinContent(j,i)); TH1D* h2 = (TH1D*)h1->ProjectionY(" ",1,20,""); TCanvas* c1 = new TCanvas("c1","Zenit Efficiency",1200,800); c1->cd(); h2->Draw(); c1->SaveAs((TString)outdir+hyst+"Zenit.png"); delete c1; TFile f2((TString)outdir+hyst+"Zenit.root","recreate"); h2->Write(); f2.Close(); TH1D* h3 = (TH1D*)h1->ProjectionX(" ",1,36,""); TCanvas* c2 = new TCanvas("c2","Azimuth Efficiency",1200,800); c2->cd(); h3->Draw(); c2->SaveAs((TString)outdir+hyst+"Azimuth.png"); delete c2; TFile f3((TString)outdir+hyst+"Azimuth.root","recreate"); h3->Write(); f3.Close(); h3->Delete(); h1->Delete(); h2->Delete(); f1->Delete(); } void ReBinTH2F(TString file, TString hyst, string outdir){ gStyle->SetPalette(1); TFile* f1 = new TFile(file); TH2F* h1 = (TH2F*)f1->Get(hyst); TH2F* h2 = new TH2F("h2","Zenith, deg; Azimuth, deg",18,0,360,20,140,180); for(Int_t i=0;i<=20;i++) for(Int_t j=0;j<=36;j++){h2->Fill(j*10-5,i*2+140,h1->GetBinContent(j,i)+h1->GetBinContent(j+1,i));j++;} TFile f2((TString)outdir+hyst+"Re-Bin.root","recreate"); h2->Write(); f2.Close(); TCanvas* c1 = new TCanvas("c1",hyst,800,600); c1->cd(); h2->Draw("colz"); c1->SaveAs((TString)outdir+hyst+"Re-Bin.png"); delete c1; h2->Delete(); h1->Delete(); f1->Delete(); } void Modeling(Double_t R, Int_t Nevents, Float_t zmax, string outdir){ cout<<"Modelling..."<SetPalette(1); TH2F* h1 = new TH2F("h1","Azimut,deg;Zenit,deg",36,0,360,20,140,180); TH2F* h2 = new TH2F("h2","Azimut,deg;Zenit,deg",36,0,360,20,140,180); TH2F* h3 = new TH2F("h3","Azimut,deg;Zenit,deg",36,0,360,20,140,180); TH2F* h4 = new TH2F("h4","Azimut,deg;Zenit,deg",36,0,360,20,140,180); Float_t A; Float_t Zenit; Float_t Azimuth; for(Int_t i=0;iFill(Azimuth,180-Zenit); /*for(Int_t nx=0;nx<24;nx++){ for(Int_t ny=0;ny<24;ny++){ h2->Fill(Azimuth,180-Zenit); Float_t x = (nx+0.5)*6.75; Float_t y = (ny+0.5)*5.5; Float_t k = sin(TMath::DegToRad()*Zenit)*cos(TMath::DegToRad()*Azimuth); Float_t l = sin(TMath::DegToRad()*Zenit)*sin(TMath::DegToRad()*Azimuth); Float_t m = cos(TMath::DegToRad()*Zenit); Float_t xl = x+k*zmax/m; Float_t yl = y+l*zmax/m; Float_t hl = sqrt(pow(x-xl,2)+zmax); Float_t za=0; Float_t xa=0; Float_t Rk=1000*0.3*R/0.4; //cout<<"Zenith = "<Draw("colz"); c1->SaveAs((TString)outdir+".png"); TFile f2((TString)outdir+".root","recreate"); h1->Write(); f2.Close(); */ TCanvas* c3 = new TCanvas("c3","Model Isotropic distribution",1200,800); h4->Draw("colz"); c3->SaveAs((TString)outdir+"_isotrop.png"); TFile f4((TString)outdir+"_isotrop.root","recreate"); h4->Write(); f4.Close(); /* TFile f3((TString)outdir+"Abs.root","recreate"); h2->Write(); f3.Close(); h3->Divide(h2,h1); TCanvas* c2 = new TCanvas("c2","Model distribution",1200,800); h3->Draw("colz"); c2->SaveAs((TString)outdir+"Rate.png"); delete c1; delete c2;*/ delete c3; h1->Delete(); h2->Delete(); h3->Delete(); h4->Delete(); } int main(int argc, char* argv[]){ OptionParam opt1; string outdir = "/home/pamelaprod/malakhov/QtoInc/Picture/"; Bool_t AnglHist = false; Bool_t DiffHist = false; Bool_t PamEff = false; Bool_t DoTr = false; Bool_t PamAngTime = false; Bool_t PamExp = false; /*vector Hyst(1); Hyst[0].SetName("ElectronLowEnergy"); Hyst[0].SetBins(36,0,360); Hyst[0].FillRandom("gaus",5000); TFile f1("/home/pamelaprod/malakhov/QtoInc/TEST/TEST.root","recreate"); Hyst[0].Write(); f1.Close(); //TFile* f1 = new TFile("/home/pamelaprod/malakhov/QtoInc/TEST/TEST.root"); //TH1F* h1 = (TH1F*)f1->Get(""); //cout<GetEntries()<Hyst2DF(1); //Hyst2DF[0].SetName("Test1"); //Hyst2DF[0].SetBins(36,0,360,36,0,360); //Hyst2DF.resize(Hyst2DF.size()+1); //Hyst2DF[1].SetName("Test2"); //Hyst2DF[1].SetBins(36,0,360,36,0,360); //cout<= argc){ cout<<"--Normalize needs argument\n See --help\n"; exit(1); } NormalizeTH2F((TString)argv[2],(TString)argv[3],argv[4]); exit(0); }*/ if(!strcmp(argv[1],"--Model")){ if(5 >= argc){ cout<<"--Model needs argument\n See --help\n"; exit(1); } Modeling(atof(argv[2]),atoi(argv[3]),atof(argv[4]),argv[5]); exit(0); } if(!strcmp(argv[1],"--Diference")){ if(6 >= argc){ cout<<"--Diference needs argument\n See --help\n"; exit(1); } DiferenceHystTH2F((TString)argv[2],(TString)argv[3],(TString)argv[4],(TString)argv[5],atoi(argv[6]),atoi(argv[7]),argv[8]); exit(0); } if(!strcmp(argv[1],"--Compare")){ //gStyle->SetPalette(1); //TMultiGraph* mg; //vector Gep; Float_t Val[20][36]; Float_t Err[20][36]; string tmp; char g; TString out = ""; for(Int_t ii=2;ii0;i--){ for(Int_t j=1;j<=36;j++){ in>>tmp;in>>tmp;in>>g; if(g=='0'){ Val[i-1][j-1]=0; Err[i-1][j-1]=0; Bool_t xx=false; Bool_t yy=false; while(g!='='){ in>>g; if(g=='/'){yy=true;continue;} if(yy && g=='0') xx=true; else yy=false; } if(!xx){ in>>tmp; in>>tmp; in>>tmp; } }else{ while(g!='/') in>>g; in>>g; if(g=='0'){ in>>tmp; Val[i-1][j-1]=0; Err[i-1][j-1]=0; }else{ while(g!='=') in>>g; in>>Val[i-1][j-1]; in>>tmp; in>>Err[i-1][j-1]; } } }} ii++; //Val.resize(Val.size()+1); //Val[Val.size()-1][1][1]=0; } } ofstream fv(out+"Val.txt"); ofstream fe(out+"Err.txt"); for(Int_t i=20;i>0;i--){ for(Int_t j=1;j<=36;j++){fv<= argc){ cout<<"--Merge needs argument\n See --help\n"; exit(1); } gStyle->SetPalette(1); //vector Hysts; //vector Files; vector h1; vector h2; TH2F h2sum; TH1F h1sum; Bool_t H2 = false; TString out = ""; if(!strcmp(argv[2],"2D")) H2=true; for(Int_t i=3;ils(); h2[h2.size()-1] = (TH2F*)f2->Get(argv[i+1]); //cout<GetNbinsX()<Get(argv[i+1]); i++; } } } cout<<"outputh is "<cd(); h2sum.Draw("colz"); c1->SaveAs(out+".png"); delete c1; }else{ TFile fsum(out+".root","recreate"); h1sum.Write(); fsum.Close(); TCanvas* c1 = new TCanvas("c1","resultMerge",1200,800); c1->cd(); h1sum.Draw(); c1->SaveAs(out+".png"); delete c1; } //MergeHystTH2F((TString)argv[2],(TString)argv[3],(TString)argv[4],(TString)argv[5],argv[6]); exit(0); } if(!strcmp(argv[1],"--PlotEfficiency")){ vector ge; TString out = ""; Int_t t = 1; //TGraphErrors tmp; for(Int_t i=2;i>Val[j][k];inErr>>Err[j][k];} if(!strcmp(argv[i+2],"-yline")){ Int_t n = atoi(argv[i+3]); Float_t x[36]; Float_t y[36]; Float_t xe[36]; Float_t ye[36]; ge.resize(ge.size()+1); //ge[ge.size()-1]->Set(36); for(Int_t j=0;j<36;j++){ x[j]=j*10+5; xe[j]=5; y[j]=Val[n][j]; ye[j]=Err[n][j]; ge[ge.size()-1].SetPoint(j,x[j],y[j]); ge[ge.size()-1].SetPointError(j,xe[j],ye[j]); //tmp.SetPoint(j,x[j],y[j]); } ge[ge.size()-1].SetLineColor(t); ge[ge.size()-1].SetTitle((TString)argv[i+1]+" Pitch "+(TString)argv[i+3]); t++; //TGraphErrors *tmp = new TGraphErrors(36,x,y,xe,ye); //TGraphErrors df; //df = *tmp; //cout<<"check"<Delete(); i+=3; } if(!strcmp(argv[i+2],"-xline")){ Int_t p = 0; Int_t n=0; if(!strcmp(argv[i+3],"All")) p=36;else n = atoi(argv[i+3]); Float_t x[20]; Float_t y[20]; Float_t xe[20]; Float_t ye[20]; for(Int_t j=0;j<20;j++){y[j]=0;ye[j]=0;} ge.resize(ge.size()+1); for(Int_t j=0;j<20;j++){ x[j]=j*2+1; xe[j]=1; for(Int_t yi=0;yiDelete(); i+=3; } } } TMultiGraph* mg = new TMultiGraph(); cout<<"check"<SetLineColor(i+1); //cout<Add(&ge[i]); } TCanvas* c1 = new TCanvas("c1","eryt",1200,800); c1->cd(); mg->Draw("AP"); cout<<"check"<Delete(); exit(1); } if(!strcmp(argv[1],"--Divide")){ if(argc<7){ cout<<"--Divide needs argument\n See --help\n"; exit(1); }/* Bool_t H2 = false; TString out = ""; if(!strcmp(argv[2],"2D")) H2=true; out = (TString)argv[7]; gStyle->SetPalette(1); TFile* f1 = new TFile((TString)argv[3]); TFile* f2 = new TFile((TString)argv[5]); TH1F* h11D; TH1F* h21D; TH2F* h12D; TH2F* h22D; TH1F h1n1D; TH1F h2n1D; TH2F h1n2D; TH2F h2n2D; TH1F h1div; TH2F h2div; cout<<"out is "<Get(argv[4]); h22D = (TH2F*)f2->Get(argv[6]); h1n2D.SetBins(h12D->GetNbinsX(),h12D->GetXaxis()->GetXmin(),h12D->GetXaxis()->GetXmax(),h12D->GetNbinsY(),h12D->GetYaxis()->GetXmin(),h12D->GetYaxis()->GetXmax()); h2n2D.SetBins(h12D->GetNbinsX(),h12D->GetXaxis()->GetXmin(),h12D->GetXaxis()->GetXmax(),h12D->GetNbinsY(),h12D->GetYaxis()->GetXmin(),h12D->GetYaxis()->GetXmax()); h2div.SetBins(h12D->GetNbinsX(),h12D->GetXaxis()->GetXmin(),h12D->GetXaxis()->GetXmax(),h12D->GetNbinsY(),h12D->GetYaxis()->GetXmin(),h12D->GetYaxis()->GetXmax()); for(Int_t i = 0; i < h12D->GetNbinsX(); i++){ for(Int_t j = 0; j < h12D->GetNbinsY(); j++){ h1n2D.SetBinContent(i,j,h12D->GetBinContent(i,j)/h12D->GetEntries()); h2n2D.SetBinContent(i,j,h22D->GetBinContent(i,j)/h22D->GetEntries()); } } h2div.Divide(&h1n2D,&h2n2D); }else{ h11D = (TH1F*)f1->Get((TString)argv[4]); h21D = (TH1F*)f2->Get((TString)argv[6]); h1n1D.SetBins(h11D->GetNbinsX(),h11D->GetXaxis()->GetXmin(),h11D->GetXaxis()->GetXmax()); h2n1D.SetBins(h21D->GetNbinsX(),h21D->GetXaxis()->GetXmin(),h21D->GetXaxis()->GetXmax()); h1div.SetBins(h21D->GetNbinsX(),h21D->GetXaxis()->GetXmin(),h21D->GetXaxis()->GetXmax()); for(Int_t i = 0; iGetNbinsX();i++){ h1n1D.SetBinContent(i,h11D->GetBinContent(i)/h11D->GetEntries()); h2n1D.SetBinContent(i,h21D->GetBinContent(i)/h21D->GetEntries()); } h1div.Divide(&h1n1D,&h2n1D); } h2div.SetName("Proton"); h1div.SetName("Proton"); if(H2){ TFile fdiv(out+".root","recreate"); h2div.Write(); fdiv.Close(); TCanvas* c1 = new TCanvas("c1","resultDivide",1200,800); c1->cd(); h2div.Draw("colz"); c1->SaveAs(out+".png"); delete c1; }else{ TFile fdiv(out+".root","recreate"); h1div.Write(); fdiv.Close(); TCanvas* c1 = new TCanvas("c1","resultDivide",1200,800); c1->cd(); h1div.Draw(); c1->SaveAs(out+".png"); delete c1; }*/ Bool_t Err = false; if((argc==10) && !strcmp(argv[9],"-Err")) Err = true; DivideHystTH2F((TString)argv[2],(TString)argv[3],(TString)argv[4],(TString)argv[5],atoi(argv[6]),atoi(argv[7]),argv[8],Err); exit(0); } if(!strcmp(argv[1],"--ReBin")){ if(4 >= argc){ cout<<"--ReBin needs argument\n See --help\n"; exit(1); } ReBinTH2F((TString)argv[2],(TString)argv[3],argv[4]); exit(0); } if(!strcmp(argv[1],"--2Dto1D")){ if(4 >= argc){ cout<<"--2Dto1D needs argument\n See --help\n"; exit(1); } Convert2Dto1Dhyst((TString)argv[2],(TString)argv[3],argv[4]); exit(0); } if(!strcmp(argv[3],"--OutPuth")){ if (4 >= argc){ cout<<"--OutPath needs argument\n See --help\n"; }else{ outdir = argv[4]; opt1.outdir = argv[4]; } }else{ cout<<"\n ERROR:\tYou need --OutPuth as second argument for run programm\n See --help for more information\n"<= argc){ cout<<"--WorkDir needs argument\n See --help\n"; exit(1); } }else{ cout<<"\n ERROR:\tYou need --WorkDir as first argument for run programm\n See --help for more information\n"<=argc){ //opt1.AnglHystDefault(); if(opt1.debug) cout<<"Setting default value for AnglHyst option.\n\n"; }else{ Int_t i0 = i+1; Bool_t inside = false; //Check that we go inside loop Int_t NPth = 0; Int_t NMA = 0; Int_t NPNO = 0; opt1.AnglHystFunc(argc,argv); } //if((i+1)>=argc) {...}; else } //AnglHyst if(!strcmp(argv[i],"--DiffHyst")){ //opt1.opt.DH.DiffHystOn = true; //opt1.DiffHystFunc(argc,argv); }*/ if(!strcmp(argv[i],"--PamEff")){ //opt1.opt.PE.PamEffOn = true; opt1.PamEffFunc(argc,argv); /*if(opt1.debug){ for(Int_t i = 0; i=argc || !atoi(argv[i+1])){ cout<<"\n ERROR! \t -verbose needs arguments \n See --help \n"; if(opt1.debug) cout<<"Argument number\t"<3){ cout<<"\n ERROR! \t -verbose needs 0, 1, 2 or 3 only \n See --help \n"; if(opt1.debug) cout<<"Argument\t"<=argc || (strcmp(argv[i7],"jpg") && strcmp(argv[i7],"png") && strcmp(argv[i7],"bmp") && strcmp(argv[i7],"root") && strcmp(argv[i7],"txt") && strcmp(argv[i7],"all"))){ cout<<"\n ERROR! \t -outform needs argument \n See --help \n"; if(opt1.debug) cout<<"Argument number - "<=argc || !atoi(argv[i+1])){ cout<<"\n ERROR! \t -nevents needs ULong integer \n See --help \n"; exit(1); } if(atoi(argv[i+1])<0){ cout<<"\n ERROR! \t -nevents needs ULong integer \n See --help \n"; exit(1); } opt1.opt.Neve = atoi(argv[i+1]); } if(!strcmp(argv[i],"-nv") || (!strcmp(argv[i],"-Nverbose"))){ if(i+1>=argc || !atoi(argv[i+1])){ cout<<"\n ERROR! \t -nevents needs ULong integer \n See --help \n"; exit(1); } if(atoi(argv[i+1])<0){ cout<<"\n ERROR! \t -nevents needs ULong integer \n See --help \n"; exit(1); } opt1.opt.Nverb = atoi(argv[i+1]); } if(!strcmp(argv[i],"-ns") || (!strcmp(argv[i],"-Nstart"))){ if(i+1>=argc || !atoi(argv[i+1])){ cout<<"\n ERROR! \t -Nstart needs ULong integer \n See --help \n"; exit(1); } if(atoi(argv[i+1])<0){ cout<<"\n ERROR! \t -nstart needs ULong integer \n See --help \n"; exit(1); } opt1.opt.Nstart = atoi(argv[i+1]); } if(!strcmp(argv[i],"--Show")){ Int_t a=0; if(opt1.debug) a=1; if(i>5+a){ cout<<"\n Error!: \t --Show must be used as single option without any other \n See --help \n"; if(opt1.debug) cout<<"Argument number - "<=argc){ cout<<"\n ERROR! \t -FullInformation needs argument \n See --help \n"; exit(1); } while(j6=argc || !atoi(argv[j6+1])){ cout<<"\n ERROR! \t -nevents needs argument \n See --help \n"; exit(1); } opt1.opt.SP.FI.NEvent = atoi(argv[j6+1]); if(opt1.debug) cout<<"Event number\t"<=argc || !atoi(argv[j6+1])){ cout<<"\n ERROR! \t -absTime needs argument \n See --help \n"; exit(1); } opt1.opt.SP.FI.AbsTime = atoi(argv[j6+1]); if(opt1.debug) cout<<"Absolute time of Event\t"<=argc){ cout<<"\n ERROR! \t -UTS needs argument \n See --help \n"; exit(1); } opt1.opt.SP.FI.UTS = argv[j6+1]; if(opt1.debug) cout<<"UTS of Event\t"<=argc || !atoi(argv[i+2])){ cout<<"\n ERROR! \t -event needs integer argument \n See --help \n"; exit(1); } opt1.opt.SP.AbsTime = atoi(argv[i+2]); if(opt1.debug) cout<<"AbsTime for convert is "<=argc){ cout<<"\n ERROR! \t -UTS needs argument \n See --help \n"; exit(1); } opt1.opt.SP.UTS = argv[i+2]; if(opt1.debug) cout<<"UTS for convert is "<=2) cout<<"\nGeneral variables initialisation...\n\n"; TSystemDirectory* workdir = new TSystemDirectory("workdir",dirname); //TSystemDirectory* workdir2 = new TSystemDirectory("workdir2","/data01/_3/607_3/"); TList* flist = workdir->GetListOfFiles(); PamLevel2* pam_events = new PamLevel2(); PamelaOrientation* PO = new PamelaOrientation(); TTree *T = pam_events->GetPamTree(flist,"treename"); ULong_t nevents = T->GetEntries(); if(opt.opt.verbose>=1) cout<<"\n Nevents = "<GetTrkLevel2()->LoadField("/data01/pam7/installed/pamela_software/calib/trk-param/field_param-0/"); /********************************************************************************/ Int_t nz = 6; Float_t zin[6]; for (Int_t ip=0;ipGetToFLevel2()->GetZTOF(pam_events->GetToFLevel2()->GetToFPlaneID(ip));cout<=2) cout<<"\n Other Variables initialisation...\n\n"; PamTrack *track; Int_t ntr; Float_t Argv = 0; Double_t PamAzim = 0; Double_t PamZenit = 0; Double_t MyAzim = 0; Double_t MyZenit = 0; Double_t Px = 0; Double_t Py = 0; Double_t Pz = 0; //Peremennye dlya opredeleniya pervogo vhoda v cycly v PamExp ULong_t PHE1 = 0; ULong_t PLE1 = 0; ULong_t PAE1 = 0; ULong_t EHE1 = 0; ULong_t ELE1 = 0; ULong_t EAE1 = 0; ULong_t pHE1 = 0; ULong_t pLE1 = 0; ULong_t pAE1 = 0; ULong_t AHE1 = 0; ULong_t ALE1 = 0; ULong_t AAE1 = 0; /*********************************************************************************/ //Histogramms for Count and exposition of Angles (Pitch, Pamela's Main axis, etc ) /*********************************************************************************/ if(opt.opt.verbose>=2) cout<<"\n--AnglHyst Hystogramm block...\n\n"; /***************************************************************************************/ //Histogramms for differences in results between calculating using DoTrack2 //and using axv[0], ayv[0] /**************************************************************************************/ if(opt.opt.verbose>=2) cout<<"\n--DiffHyst Hystogramm block...\n\n"; /***************************************************************************************/ //Initialization histogramms for count of protons depends from Energy. Volodia. /***************************************************************************************/ // TH1F* proton10log= new TH1F("Protons Flux","",80,-1.,3.); // proton10log->GetXaxis()->SetTitle("log10(Energy) , GeV"); // TH1F* proton1log= new TH1F("Protons Flux","",80,-1.,3.); //TH1F* binw= new TH1F("w","",80,-1.,3.); TH1F binw; binw.SetBins(80,-1.,3.); // proton1log->GetXaxis()->SetTitle("log10(Energy) , GeV"); // proton1log->SetLineColor(kRed); // TCanvas *plogCanvas = new TCanvas("proton flux","protonflux", 800, 800); // this is bins wide to calculate Flux //Float_t x; //Float_t xmin, xmax; //Float_t binwide[80]; for (Int_t l=0 ; l<80; l++) { binw.Fill(-1.+0.05*l,pow(10.,0.05*(Float_t)(l+1)-1.)- pow(10.,0.05*(Float_t)(l)-1.)); //binwide[l]=-1.+0.05*l,pow(10.,0.05*(Float_t)(l+1)-1.)- pow(10.,0.05*(Float_t)(l)-1.) } //for (Int_t l=0 ; l<80; l++) { //binwide[l]=binw->GetBinContent(l+1); // } /****************************************************************************/ //Geometrical Factor. Volodia /****************************************************************************/ /* TH1F* Geomfactor = new TH1F("G","G",1000,0.1,500.1); TH1F* Geomfactorlog= new TH1F("Glog","Glog",80,-1.,3.); TH1F* Geomfactorlogelectron= new TH1F("Gloge","Gloge",80,-1.,3.); for (Int_t l=0 ; l <80 ;l++) { x=pow(10.,(Float_t) 0.05*l-1.); Geomfactorlogelectron->SetBinContent(l+1,pow(1/pow(66.7051+50.05404*log10(x),3.5083)+1./pow(21.6238,3.5083),(-1./3.5083))); x=ConvertT2R(x,0.938,1., 1.); Geomfactorlog->SetBinContent(l+1,pow(1/pow(66.7051+50.05404*log10(x),3.5083)+1./pow(21.6238,3.5083),(-1./3.5083))); }//geomfactor for linear scale for (Int_t l=0 ; l <1000 ;l++) { x=(Float_t) 0.5*l+0.1; Geomfactor->SetBinContent(l+1,pow(1/pow(66.7051+50.05404*log10(x),3.5083)+1./pow(21.6238,3.5083),(-1./3.5083))); } */ /****************************************************************************/ //General loop /****************************************************************************/ if(opt.opt.Neve == 0) opt.opt.Neve = nevents; cout<GetEntry(i); Bool_t OneTrack = false; if(pam_events->GetTrkLevel2()->GetNTracks()==1) OneTrack = true; Int_t M0DE = pam_events->GetOrbitalInfo()->mode; //0 is zero here Float_t Bx = -pam_events->GetOrbitalInfo()->Bdown; //don't need for PamExp ExpOnly for all geography areas Float_t By = pam_events->GetOrbitalInfo()->Beast; //don't need for PamExp ExpOnly for all geography areas Float_t Bz = pam_events->GetOrbitalInfo()->Bnorth; //don't need for PamExp ExpOnly for all geography areas Float_t Babs = pam_events->GetOrbitalInfo()->Babs; //don't need for PamExp ExpOnly for all geography areas Float_t L = pam_events->GetOrbitalInfo()->L; //don't need for PamExp ExpOnly for all geography areas Float_t Alt = pam_events->GetOrbitalInfo()->alt; Float_t Lat = pam_events->GetOrbitalInfo()->lat; Float_t Lon = pam_events->GetOrbitalInfo()->lon; Float_t LieveTime = 0.16*pam_events->GetTrigLevel2()->dltime[0]; Float_t DeathTime = 0.01*pam_events->GetTrigLevel2()->dltime[1]; Float_t rigev = 0; Float_t detr = 0; Int_t hm0; Int_t hm1; Int_t hs0; Int_t hs1; ntr = 0; Double_t A1; Double_t A2; Double_t A3; Double_t SB = 1000; Double_t SA; Double_t SC; Double_t ZC; if(OneTrack){ track = pam_events->GetTrack(0); //don't need for PamExp option rigev = 1/track->GetTrkTrack()->GetDeflection(); //dont need for AnglHyst, DiffHyst and PamExp options; detr = track->GetTrkTrack()->GetDEDX(); hm0 = pam_events->GetAcLevel2()->hitmap[0]; hm1 = pam_events->GetAcLevel2()->hitmap[1]; hs0 = pam_events->GetAcLevel2()->hitstatus[0]; hs1 = pam_events->GetAcLevel2()->hitstatus[1]; if(!OneTrack) ntr = -1; else{ //cout<<"OneTrack"<GetTrkTrack()->GetDeflection())*1.85+3.0; if ((track->GetTrkTrack()->chi2<=0) || (track->GetTrkTrack()->chi2>=pow(ichi2lim,4.))) ntr=-1; /*for(Int_t ii=1;ii<=12;ii++){ if ((track->GetToFTrack()->beta[ii]<0) || (track->GetToFTrack()->beta[ii]>99)) ntr=-1; }*/ if ((track->GetToFTrack()->beta[12]<0) || (track->GetToFTrack()->beta[12]>99)) ntr=-1; if((track->GetTrkTrack()->GetNX()<=4)&&(track->GetTrkTrack()->GetNY()<4)) ntr=-1; if(!track->GetTrkTrack()->IsInsideCavity()) ntr=-1; if(sqrt(pow(Bx,2)+pow(By,2)+pow(Bz,2))<0.001) ntr=-1; if((M0DE!=0)&&(M0DE!=1)&&(M0DE!=6)&&(M0DE!=2)&&(M0DE!=3)&&(M0DE!=8)&&(M0DE!=4)) ntr=-1; } if(ntr!=-1){ if(!opt.opt.DoTr){ Double_t Aaxv = TMath::Abs(track->GetTrkTrack()->axv[0])*TMath::DegToRad(); Double_t Aayv = TMath::Abs(track->GetTrkTrack()->ayv[0])*TMath::DegToRad(); PamZenit = TMath::RadToDeg()*asin(sqrt(pow(sin(Aayv), 2) + pow(sin(Aaxv), 2))); Double_t axv = -track->GetTrkTrack()->axv[0] * TMath::DegToRad(); Double_t ayv = -track->GetTrkTrack()->ayv[0] * TMath::DegToRad(); Double_t angle = atan(sin(TMath::Abs(ayv))/sin(TMath::Abs(axv))) * TMath::RadToDeg(); PamAzim = 360. - angle; if(axv>=0 && ayv >=0) PamAzim = angle; if(axv<0 && ayv >0) PamAzim = 180. - angle; if(axv<0 && ayv <0) PamAzim = 180. + angle; PamAzim = PamAzim * TMath::DegToRad(); PamZenit = (180 - PamZenit) * TMath::DegToRad(); Px = sin(axv); Py = sin(ayv); Pz = cos(PamZenit); //cout<<"PamAzimuth = "<opt.US[jy].USP[jx].Bmore && Lopt.US[jy].USP[jx].Lmore && Altopt.US[jy].USP[jx].altmore && SBopt.PS[jz].PitchMin){ for(Int_t hg = 0; hgGetTrigLevel2()->dltime[0]; opt.Hyst1D[thg].HI.DeathTime+= 0.01*pam_events->GetTrigLevel2()->dltime[1]; //cout<<"Pitch = "<GetTrigLevel2()->dltime[0]; opt.Hyst2D[thg].HI.DeathTime+= 0.01*pam_events->GetTrigLevel2()->dltime[1]; } } } for(Int_t hg = 0; hgGetTrigLevel2()->dltime[0]; opt.Hyst3D[thg].HI.DeathTime+= 0.01*pam_events->GetTrigLevel2()->dltime[1]; } } } jx = opt.US[jy].USP.size(); } } } } } //cout<=opt.opt.Nverb) verb = true; //if(opt.opt.Nverb==-1) verb = false; if(verb) cout<<"\n\ni = "<GetCaloTrack()->qpre; Int_t calonpre=track->GetCaloTrack()->npre; Float_t caloqtrack=track->GetCaloTrack()->qtrack; Float_t caloqmax=pam_events->GetCaloLevel2()->qmax; Int_t dncore=track->GetCaloTrack()->ncore; Int_t lepton = 0; Bool_t ACSelection = false; if((hm0 & hs0)==0 && (hm1 & hs1)==0) ACSelection = true; //cout<<"hm0 = "<1.7 && rigev<= 1.8 && L>6 && Lat>60 && Lat<-60){ cout<<"rigev = "<>rigev; cout<<"Write detr, please:"<>detr; cout<<"Write lepton, please:"<>lepton; cout<<"Write Anticounter, please:"<>ACSelection; cout<<"Write Babs, please:"<>Babs; cout<<"Write L, please:"<>L; cout<<"Write Altitude, please:"<>Alt;*/ Double_t Rmin = 0; Double_t Rmax = 0; Double_t Detrmin = 0; Double_t Detrmax = 0; for(Int_t k=0;k>we; } jx = opt.US[nus].USP.size(); } } } for(Int_t cu=0;cuBmore && BabsLmore && Laltmore && AltRmore && rigevPmore && SB1.7 && rigev<= 1.8){ cout<<"nus = "<>we; } jx = opt.US[nus].USP.size(); } } } for(Int_t d=0;dRmin && rigev<=Rmax && detr>Detrmin && detr<=Detrmax){ Int_t ExpType = opt.Hyst1D[N1D[d]].HI.ExpType; Double_t LTI = 0; Double_t DTI = 0; if(ExpType == 1 || ExpType == 3) LTI = 0.16*pam_events->GetTrigLevel2()->dltime[0]; if(ExpType == 2 || ExpType == 3) DTI = 0.01*pam_events->GetTrigLevel2()->dltime[1]; switch ( ExpType ){ case 1:{Argv = LTI;break;} case 2:{Argv = DTI;break;} case 3:{Argv = LTI+DTI;break;} case 4:{ Argv = opt.Hyst1D[N1D[d]].HI.LieveTime; opt.Hyst1D[N1D[d]].HI.LieveTime = 0; break; } case 5:{ Argv = opt.Hyst1D[N1D[d]].HI.DeathTime; opt.Hyst1D[N1D[d]].HI.DeathTime = 0; break; } case 6:{ Argv = opt.Hyst1D[N1D[d]].HI.LieveTime+opt.Hyst1D[N1D[d]].HI.DeathTime; opt.Hyst1D[N1D[d]].HI.LieveTime = 0; opt.Hyst1D[N1D[d]].HI.DeathTime = 0; break; } }; Double_t Xfill = 0; //cout<<"XType = "<=2) cout<<"\n\nSave block...\n\n"; gStyle->SetPalette(1); for(Int_t i = 0; iGetXmin(),opt.Hyst1D[i].Hyst1DF.GetXaxis()->GetXmax()); h2n1D.SetBins(opt.Hyst1D[i].Hyst1DF.GetNbinsX(),opt.Hyst1D[i].Hyst1DF.GetXaxis()->GetXmin(),opt.Hyst1D[i].Hyst1DF.GetXaxis()->GetXmax()); //h2div.SetBins(h12D->GetNbinsX(),h12D->GetXaxis()->GetXmin(),h12D->GetXaxis()->GetXmax(),h12D->GetNbinsY(),h12D->GetYaxis()->GetXmin(),h12D->GetYaxis()->GetXmax()); for(Int_t ii = 0; ii < opt.Hyst1D[i].Hyst1DF.GetNbinsX(); ii++){ h1n1D.SetBinContent(ii,opt.Hyst1D[i].Hyst1DF.GetBinContent(ii)/opt.Hyst1D[i].Hyst1DF.GetEntries()); h2n1D.SetBinContent(ii,opt.Hyst1D[i].Hyst1DFExp.GetBinContent(ii)/opt.Hyst1D[i].Hyst1DFExp.GetEntries()); } hdiv.SetName(opt.Hyst1D[i].Hyst1DF.GetName()); hdiv.SetBins(opt.Hyst1D[i].Hyst1DF.GetNbinsX(),opt.Hyst1D[i].Hyst1DF.GetXaxis()->GetXmin(),opt.Hyst1D[i].Hyst1DF.GetXaxis()->GetXmax()); hdiv.Divide(&h1n1D,&h2n1D); cout<<"i = "< 0){ Canv = new TCanvas("Canv",opt.Hyst1D[i].Hyst1DF.GetName(),1200,800); Canv->cd(); opt.Hyst1D[i].Hyst1DF.Draw(); Canv->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+".png"); if(opt.Hyst1D[i].HI.ExpType!=0){ CanvExp = new TCanvas("CanvExp",opt.Hyst1D[i].Hyst1DFExp.GetName(),1200,800); CanvExp->cd(); opt.Hyst1D[i].Hyst1DFExp.Draw(); CanvExp->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"_Exp.png"); Canvdiv = new TCanvas("Canvdiv",hdiv.GetName(),1200,800); Canvdiv->cd(); hdiv.Draw(); Canvdiv->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"DivExp.png"); } if(opt.Hyst1D[i].XType==17){ CanvLog = new TCanvas("CanvLog",opt.Hyst1D[i].Hyst1DF.GetName(),1200,800); CanvLog->cd(); hlog.Draw(); CanvLog->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"_DivBinWide.png"); } } if(opt.Hyst1D[i].HI.TypeExt == 0 || opt.Hyst1D[i].HI.TypeExt == 2){ TFile fg((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+".root","recreate"); opt.Hyst1D[i].Hyst1DF.Write(); fg.Close(); TFile fe((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"_DivWide.root","recreate"); hlog.Write(); fe.Close(); if(opt.Hyst1D[i].HI.ExpType!=0){ TFile fgExp((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"_Exp.root","recreate"); opt.Hyst1D[i].Hyst1DFExp.Write(); fg.Close(); TFile fgdiv((TString)outdir+"ParDirCalc_"+opt.Hyst1D[i].HI.filename+"_DivExp.root","recreate"); hdiv.Write(); fgdiv.Close(); } } } for(Int_t i = 0; iGetXmin(),opt.Hyst2D[i].Hyst2DF.GetXaxis()->GetXmax(),opt.Hyst2D[i].Hyst2DF.GetNbinsY(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmin(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmax()); h2n2D.SetBins(opt.Hyst2D[i].Hyst2DF.GetNbinsX(),opt.Hyst2D[i].Hyst2DF.GetXaxis()->GetXmin(),opt.Hyst2D[i].Hyst2DF.GetXaxis()->GetXmax(),opt.Hyst2D[i].Hyst2DF.GetNbinsY(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmin(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmax()); //h2div.SetBins(h12D->GetNbinsX(),h12D->GetXaxis()->GetXmin(),h12D->GetXaxis()->GetXmax(),h12D->GetNbinsY(),h12D->GetYaxis()->GetXmin(),h12D->GetYaxis()->GetXmax()); for(Int_t ii = 0; ii < opt.Hyst2D[i].Hyst2DF.GetNbinsX(); ii++){ for(Int_t j = 0; j < opt.Hyst2D[i].Hyst2DF.GetNbinsY(); j++){ h1n2D.SetBinContent(ii,j,opt.Hyst2D[i].Hyst2DF.GetBinContent(ii,j)/opt.Hyst2D[i].Hyst2DF.GetEntries()); h2n2D.SetBinContent(ii,j,opt.Hyst2D[i].Hyst2DFExp.GetBinContent(ii,j)/opt.Hyst2D[i].Hyst2DFExp.GetEntries()); } } hdiv.SetName(opt.Hyst2D[i].Hyst2DF.GetName()); hdiv.SetBins(opt.Hyst2D[i].Hyst2DF.GetNbinsX(),opt.Hyst2D[i].Hyst2DF.GetXaxis()->GetXmin(),opt.Hyst2D[i].Hyst2DF.GetXaxis()->GetXmax(),opt.Hyst2D[i].Hyst2DF.GetNbinsY(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmin(),opt.Hyst2D[i].Hyst2DF.GetYaxis()->GetXmax()); //cout<<"I try to divide it!!!"<cd(); //cout<<"Canvas..."<SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst2D[i].HI.filename+".png"); cout<<"Save canvas..."<cd(); opt.Hyst2D[i].Hyst2DFExp.Draw("colz"); CanvExp->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst2D[i].HI.filename+"_Exp.png"); Canvdiv = new TCanvas("Canvdiv",hdiv.GetName(),1200,800); Canvdiv->cd(); hdiv.Draw("colz"); Canvdiv->SaveAs((TString)outdir+"ParDirCalc_"+opt.Hyst2D[i].HI.filename+"DivExp.png"); } } if(opt.Hyst2D[i].HI.TypeExt == 0 || opt.Hyst2D[i].HI.TypeExt == 2){ TFile fg((TString)outdir+"ParDirCalc_"+opt.Hyst2D[i].HI.filename+".root","recreate"); opt.Hyst2D[i].Hyst2DF.Write(); fg.Close(); if(opt.Hyst2D[i].HI.ExpType!=0){ TFile fgExp((TString)outdir+"ParDirCalc_"+opt.Hyst2D[i].HI.filename+"_Exp.root","recreate"); opt.Hyst2D[i].Hyst2DFExp.Write(); fg.Close(); cout<<"I'm here!"<cd(); //plogCanvas->SetLogx(); plogCanvas->SetLogy(); plogCanvas->SetGrid(); //BinLogX(proton1); Float_t Energybin[80],Fluxbin[80],dE[80],dFlux[80]; for (Int_t i=0;i<80;i++){ dFlux[i]=proton1log->GetBinContent(i+1); dFlux[i]=1./sqrt(dFlux[i]); // bintime3eq[i]=time3eq->GetBinContent(i+1); } proton1log->Divide(proton1log,binw); proton1log->Divide(proton1log,Geomfactorlog); proton1log->Scale(0.001); //MeV ->GeV proton1log->Scale(10000.); //cm2 -> m2 //proton1log->Scale(1./exposure[0]); for (Int_t i=0;i<80;i++){ Fluxbin[i]=proton1log->GetBinContent(i+1); dFlux[i]=Fluxbin[i]*dFlux[i]; Energybin[i]=pow(10.,(Float_t)i*0.05+0.025-1); Energybin[i+1]=pow(10.,(Float_t)(i+1)*0.05+0.025-1.); dE[i]=(Energybin[i+1]-Energybin[i])/2.; // bintime3eq[i]=time3eq->GetBinContent(i+1); //cout<Draw(""); */ }