Hello,
I would like to plot a TH2D with in x the load for a certain “om” and in y the load with another “om”.
The problem is that I don’t know how to fill only the x part of TH2 and the y part independently.
void OMcompare()
{
//gStyle->SetOptStat(0);
//gStyle->SetOptFit(1111);
TCanvas *c1 = new TCanvas();
TFile *input = new TFile("/home/dupuy/Documents/code_dupuy/Exercices/fichier root/histo_Li_system_568.root","READ");
TTree *tree = (TTree*)input->Get("Result_tree;3");
int om_number;
double amplitude_tree,charge_tree, time;
tree->SetBranchAddress("amplitude_tree", &litude_tree);
tree->SetBranchAddress("charge_tree", &charge_tree);
tree->SetBranchAddress("om_number", &om_number);
tree->SetBranchAddress("time", &time);
int entries = tree->GetEntries();
cout << entries << endl;
double constante;
constante = 100;
TH2D *hist1 = new TH2D("hist", "amplitude1 en fonction du temps",1000, 0, 300, 1000, 0, 300);
for(int i=0; i < entries; i++) // rentre les valeurs de la branche dans notre variable
{
tree->GetEntry(i);
if (om_number == 301)
{
hist1->Fill(amplitude_tree);
}
if (om_number == 302)
{
hist1->Fill(amplitude_tree);
}
}
hist1->Draw("");
hist1->GetXaxis()->SetTitle("amplitude 301");
hist1->GetYaxis()->SetTitle("amplitude 302");
hist1->GetXaxis()->SetTitleSize(0.05);
hist1->GetYaxis()->SetTitleSize(0.05);
hist1->GetXaxis()->SetLabelSize(0.05);
hist1->GetYaxis()->SetLabelSize(0.05);
}