{ TCanvas *c1 = new TCanvas("c1"," ",1000,700); ifstream data; Double_t weight; int counter=0; char title[50]; Float_t rightmax; Float_t scale; data.open("yCAL07det93_35deg.doc"); if(!data){cout << " data file not opened" << endl;exit(1);} sprintf(title, "histo%d",6); TH1D *histo=new TH1D(title, " ", 41, 0, 2000); while (data){ data >> weight; histo->SetBinContent(counter,weight); counter++; } histo->Sumw2(); histo->Scale(1./78.55/91.); histo->GetXaxis()->SetNdivisions(505); histo->GetXaxis()->SetTitle("Amplitude [mV]"); histo->GetXaxis()->CenterTitle(); histo->GetYaxis()->SetTitle("Neutron counts/50mV/h/g"); histo->GetYaxis()->SetTitleOffset(1.2); histo->GetYaxis()->CenterTitle(); histo->DrawCopy(); TGaxis::SetMaxDigits(2); histo->SetFillColor(kGray); histo->DrawCopy("same histo"); c1->Update(); counter=0; data.close(); delete histo; data.open("yBDF35DET93.doc"); if(!data){ cout << " data file not opened" << endl;exit(1);} sprintf(title, "histo%d",7); TH1D *histo=new TH1D(title, " ", 41, 0, 2000); while (data){ data >> weight; histo->SetBinContent(counter,weight); counter++; } counter=0; data.close(); //scale hint1 to the pad coordinates histo->Sumw2(); histo->Scale(1./519./91.); rightmax = 1.05*histo->GetMaximum(); scale = gPad->GetUymax()/rightmax; histo->SetFillColor(0); histo->SetLineWidth(2); histo->Scale(scale); histo->DrawCopy("same"); histo->DrawCopy("same histo"); //draw an axis on the right side TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L"); axis->Draw(); axis->SetTitle("Alpha counts/50mV/h/g"); axis->SetTitleOffset(1.2); axis->CenterTitle(); axis->SetMaxDigits(2); delete histo; }