{ gROOT->SetStyle("Plain"); Double_t E0 = 1400; //keV Double_t c = 3e8; Double_t beta = 0.065; Double_t v = c*beta; Double_t d=10; //cm Double_t DE; Double_t Dv = 0; TCanvas *c1 = new TCanvas("c1","",600,500); leg=new TLegend(0.6,0.1,0.9,0.5); TGraph *dopp[9]; char doppname[20]; Double_t x; for(Int_t i=0;i<7;i++){ sprintf(doppname,"dopp%d",(i+1)); dopp[i+1] = new TGraph(180); dopp[i+1]->SetName(doppname); dopp[i+1]->SetTitle(); if(i==0)x=0.2; else x=i; Double_t Dthetarad = TMath::ATan((x/2)/d); //half opening angle Double_t Dthetadeg = TMath::RadToDeg()*Dthetarad; Int_t thetadeg; for(thetadeg=0;thetadeg<360;thetadeg++){ Double_t thetarad=TMath::DegToRad()*thetadeg; DE = E0 * TMath::Cos(thetarad) * (Dv/c) - E0 * (v/c) * TMath::Sin(thetarad) * Dthetarad; dopp[i+1]->SetPoint((thetadeg+1),thetadeg,DE); } if (i==0)dopp[i+1]->Draw("al"); else dopp[i+1]->Draw("l"); dopp[i+1]->GetXaxis()->Set(360,0,360); dopp[i+1]->GetXaxis()->SetTitle("#theta (degrees)"); dopp[i+1]->GetYaxis()->SetTitle("Doppler Broadening (keV)"); dopp[i+1]->SetMaximum(30); dopp[i+1]->SetMinimum(-30); dopp[i+1]->SetLineStyle(i+1); dopp[i+1]->SetLineWidth(2); if ((i+1)==5) dopp[i+1]->SetLineColor(9); else dopp[i+1]->SetLineColor(i+1); char legent[50]; sprintf(legent,"#Delta#theta = %4.2f#circ, x = %3.1fcm",Dthetadeg,x); leg->AddEntry(dopp[i+1],legent,"L"); } leg->SetFillColor(kWhite); leg->Draw(); c1->Print("dopp_test.eps"); }