Hello, I have a file containing the values of px, py, pz and E for a particle. I organized them in histogram as you can see in the following code:
void read_file(){
TH1F* hE = new TH1F("hE"," energy",100,0,0);
TH1F* hth = new TH1F("hth"," theta",100,0,0);
TH2F* hpth = new TH2F("hpth"," p-theta",100,0,0,100,0,0);
TH2F* hpcth = new TH2F("hpcth"," p-costheta",100,0,0,100,0,0);
ifstream f(data.txt");
double p=0,px=0,py=0,pz=0,E=0,th=0,cth=0;
do{
f>>px>>py>>pz>>E;
p=sqrt(px*px+py*py+pz*pz);
th=TMath::ACos(pz/p);
cth=pz/p;
hE->Fill(p);
hth->Fill(th);
hpth->Fill(p,th);
hpcth->Fill(p,cth);
}while(f);
I have been instructed to creat a loop and use
h2->GetRandom2(x,y);
h2bis->Fill(x,y)
Then I should put the x y z px py pz in a text file because I’ll need them for another simulation.
However I do not understand exactly what I’m supposed to do or why and I also don’t know what GetRandom does. I’ve tried looking up some examples but found nothing.
Does anybody have an idea of what I’m supposed to do?
Thanks in advance