I think there is actually a slight difference, because when it is drawn just with the “L” option and afterwards changed to SetLineStyle(3), just the “L” line (straight connections between datapoints) is dotted. In my case I wanted to have a “smooth curve” between the data points, because otherwise my plot looks not very nice.
The complete code is (c++):
[code]#include
#include
#include
#include
#include
#include <TROOT.h>
#include <TSystem.h>
#include <TF1.h>
#include <TCanvas.h>
#include <TApplication.h>
using namespace std;
double func_power_sum(double x[], double par[]){
double P0 = par[0];
double tau0 = par[1];
double t0 = par[2];
double n_pulses = par[3];
double t =x[0];
double result = 0.;
for (int i=0;i<n_pulses;i++){
result += P0*exp(-(t-i*t0)*(t-i*t0)/(2.*tau0*tau0));
}
return result;
}
int main(int argc, char *argv[]) {
TApplication theApp(“App”, &argc, argv);
TCanvas *a = new TCanvas(“a”,“a”,1200,700);
a->cd();
TF1 *f_broadening_2ns[4];
char temp_f_name[256];
for (int i=0;i<4;i++){
sprintf(temp_f_name,“f_broadening_2ns_%d”,i);
f_broadening_2ns[i] = new TF1(temp_f_name,func_power_sum,0,22,4);
f_broadening_2ns[i]->SetParameters(1,0.5+i/10.,2,10);
if (i==0){
f_broadening_2ns[i]->Draw(“C”);
}else{
f_broadening_2ns[i]->SetLineColor(i+1);
f_broadening_2ns[i]->Draw(“C.same”);
f_broadening_2ns[i]->SetLineStyle(2);
}
}
theApp.Run();
}[/code]
The black function is drawn with “C” option and produce a smooth curve, the three other owns are jagged.
Is there way to increase the number of data points used for the function? That would be perhaps even better.
thanks for so much effort!
[/code]