Hello,
I am trying to plot the lifetime plot of muons (which is an exponential function), however it is not working as I am intended, so I just want to move the whole graph so it start at 2 instead of 0 on the X axis, but without changing the initial hight at x = 0, so here is what I have done
#include "TH2S.h"
4 #include "string.h"
5 #include "TBranch.h"
6 #include "math.h"
7 #include "stdio.h"
8 #include "TF1.h"
9
10 //Double_t = x>2;
11
12 double f(double x,double c){
13 double y;
14 y = (10000/2.2*exp((-x+c)/2.2));
15 return y;
16 }
17
18 void pulsetime(){
33 TF1* Pos1 = new TF1("Pos1","f(x,[2])",0,10);
34 //TF1* Pos2 = new TF1("Pos2","f(x,[2])",0,10); This is not working as expected
38 Int_t csizex = 1000;
39 Int_t csizey = 700;
40 Int_t cposx = 10000;
41 Int_t cposy = 500;
42 TCanvas* can = new TCanvas("c","", cposx, cposy, csizex, csizey);
43 can->Divide(1, 1);
44
45 can->cd(1);
46 gPad->SetGridy();
47 gPad->SetGridx();
48
49 Pos1->SetLineColor(1);
50 Pos2->SetLineColor(2);
57 Pos1->Draw();
58 Pos2->Draw("same");
64 }