Below is the code I’m trying to change from 2D histogram to 1D histogram.
What do I need to know to make the code works
Thanks
{
TH2D *Electron = new TH2D("Electron","",1500,0.,2.0,1500,30,60);
for(int i=0; i<10; i++){
double d =10;
double Me=0.000511;
double p =gRandom->Uniform(0., 2.0);
double Nrandom= gRandom->Gaus(1,0.01);
double p_z = p*Nrandom;
double x = TMath::Power((p/Me),2);
double v1 = sqrt(x/(1+x));
double v = sqrt(x/(1+x))*(3*1e8);
double t = (d/v)/ 0.000000001;
double Nrandomt= gRandom->Gaus(0,2);
double tof= t+Nrandomt;
Electron->Fill(p_z,tof);
}
TH1D *h1Electron = Electron->ProjectionX();
h1Electron->Draw();
}