hello all,
I encountered a problem in the reading of my datas, that I would like to plot. Indeed, a data at 10^-10 is plotted at 6*10^-8 for a mass of barely 789 GeV.
Here is my code : [code] #include “iostream.h”
#include “stdio.h”
#include “TH1F.h”
#include “iostream.h”
#include “TH2F.h”
#include “TAxis.h”
#include “fstream.h”
#include “TGraph.h”
#include “stdio.h”
#include “TGraphErrors.h”
#include “TMultiGraph.h”
#include “TLegend.h”
#include “TF1.h”
#include “TGraph.h”
#include “TMath.h”
#include “TCanvas.h”
#include “TVirtualFitter.h”
#include “THStack.h”
void CSBRs_processus() {
// Declaration de la structure even avec ses variables internes
struct event_t {
Double_t mass_DM_particle;
/Double_t Mh1;
Double_t Mh2;
Double_t Mh3;/
/first file/
Double_t first_CSBR;
Double_t second_CSBR;
Double_t third_CSBR;
Double_t fourth_CSBR;
Double_t fifth_CSBR;
Double_t sixth_CSBR;
Double_t seventh_CSBR;
Double_t eighth_CSBR;
/* Double_t nineth_CSBR;
Double_t tenth_CSBR;
Double_t eleventh_CSBR;
Double_t twelveth_CSBR;
Double_t thirteenth_CSBR;
Double_t fourteenth_CSBR;
Double_t fifteenth_CSBR;
Double_t sixteenth_CSBR;*/
};
// Declaration de variables additionnelles qui seront “plottées”.
event_t event;
Double_t RATIOh1;
Double_t RATIOh2;
Double_t chi2h1G=0;
Double_t chi2h2G=0;
//Déclaration de la variable de lecture de ligne de fichier
Int_t i=0.;
//OUverture du fichier de données
//FILE *fp_1=fopen("BRstimesCS_x2X2.txt","r");
//FILE *fp_2=fopen("BRstimesCS_x1H.txt","r");
//FILE *fp_4=fopen("BRstimesCS_x2X1.txt","r");
//FILE *fp_5=fopen("BRstimesCS_X2x1.txt","r");
FILE *fp_6=fopen("BRstimesCS_X1h.txt","r");
/*FILE *fp_7=fopen("BRstimesCS_X2h.txt","r");
FILE *fp_8=fopen("BRstimesCS_Hh.txt","r");
FILE *fp_3=fopen("BRstimesCS_x2H.txt","r");*/
char line[200];
// Declaration des histogrammes pour le scatterplot la structure est TH2F("string_name","",Nb_points_x,x_min,x_mx,Nb_points_y,y_min,y_max)
TH2F * CSBR_1 = new TH2F("CSBR_1","",8000,50,2100,8000,1e-10,1e-01);
TH2F * CSBR_2 = new TH2F("CSBR_2","",8000,400,1600,8000,1e-10,1e-03);
TH2F * CSBR_3 = new TH2F("CSBR_3","",8000,550,1100,8000,1e-10,1e-03);
TH2F * CSBR_4 = new TH2F("CSBR_4","",8000,550,1100,8000,1e-10,1e-01);
TH2F * CSBR_5 = new TH2F("CSBR_5","",8000,500,1100,8000,1e-10,1e-03);
TH2F * CSBR_6 = new TH2F("CSBR_6","",8000,520,1100,8000,1e-10,1e-04);
TH2F * CSBR_7 = new TH2F("CSBR_7","",8000,750,1100,8000,1e-10,1e-05);
TH2F * CSBR_8 = new TH2F("CSBR_8","",8000,500,1100,8000,1e-11,1e-03);
//TH2F * CSBR_8 = new TH2F("CSBR_8","",8000,120,130,8000,1e-10,1e-05);
// Declaration des lignes horizontales du plot
TLine * l = new TLine(0.,0.,1.,0.);
TLine * l10 = new TLine(0.,10.,1.,10.);
TLine * l10m = new TLine(0.,-10.,1.,-10.);
TLine * l20m = new TLine(0.,-20.,1.,-20.);
TLine * l20 = new TLine(0.,20.,1.,20.);
TLine * l30m = new TLine(0.,-30.,1.,-30.);
TLine * l30 = new TLine(0.,30.,1.,30.);
TLine * l40m = new TLine(0.,-40.,1.,-40.);
TLine * l40 = new TLine(0.,40.,1.,40.);
while ((i<=100) &&((fscanf(fp_6,"%lf %le %le %le %le %le %le %le %lf",&event.mass_DM_particle, &event.first_CSBR, &event.second_CSBR, &event.third_CSBR, &event.fourth_CSBR, &event.fifth_CSBR, &event.sixth_CSBR, &event.seventh_CSBR, &event.eighth_CSBR)>0)))
{
//Remplissage des histos
//{
CSBR_1->Fill(event.mass_DM_particle,event.first_CSBR);
CSBR_2->Fill(event.mass_DM_particle,event.second_CSBR);
CSBR_3->Fill(event.mass_DM_particle,event.third_CSBR);
CSBR_4->Fill(event.mass_DM_particle,event.fourth_CSBR);
CSBR_5->Fill(event.mass_DM_particle,event.fifth_CSBR);
CSBR_6->Fill(event.mass_DM_particle,event.sixth_CSBR);
CSBR_7->Fill(event.mass_DM_particle,event.seventh_CSBR);
CSBR_8->Fill(event.mass_DM_particle,event.eighth_CSBR);
//}
/*CSBR_1.Fill(event.mass_DM_particle,event.first_CSBR);
CSBR_2.Fill(event.mass_DM_particle,event.second_CSBR);
CSBR_3.Fill(event.mass_DM_particle,event.third_CSBR);
CSBR_4.Fill(event.mass_DM_particle,event.fourth_CSBR);
CSBR_5.Fill(event.mass_DM_particle,event.fifth_CSBR);
CSBR_6.Fill(event.mass_DM_particle,event.sixth_CSBR);
CSBR_7.Fill(event.mass_DM_particle,event.seventh_CSBR);
CSBR_8.Fill(event.mass_DM_particle,event.eighth_CSBR);*/
//printf("%le",event.fourth_CSBR);
}
//std::cout << " chi2h1G fin = " << chi2h1G << std::endl;
//std::cout << " chi2h2G fin = " << chi2h2G << std::endl;
//Options d'affichage root
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0000000);
gStyle->SetOptFit(0000);
gStyle->SetPalette(1);
//Fermeture fichier
//fclose(fp_1);
//fclose(fp_2);
//fclose(fp_3);
//fclose(fp_4);
//fclose(fp_5);
fclose(fp_6);
//fclose(fp_7);
//fclose(fp_8);
//Création du canvas ou le scatterplot va être affiché
//TCanvas c1("c1","c1",1100,1320);
TCanvas * c1 = new TCanvas("c1","c1",1100,1320);
c1->ToggleToolBar();
c1->ToggleEditor();
c1->SetLogy(kTRUE);
c1->SetGridx(kTRUE);
c1->SetGridy(kTRUE);
/*c1.ToggleToolBar();
c1.ToggleEditor();*/
//Options d'affichage
/*CSBR_1->SetMarkerStyle(26);
CSBR_1->SetMarkerColor(kRed);
CSBR_1->Draw();
CSBR_1->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_1->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_1->GetYaxis()->CenterTitle(true);
CSBR_1->GetXaxis()->CenterTitle(true);
CSBR_2->SetMarkerStyle(20);
CSBR_2->SetMarkerColor(kBlue);
CSBR_2->Draw("same");
CSBR_3->SetMarkerStyle(21);
CSBR_3->SetMarkerColor(kGreen+2);
CSBR_3->Draw("same");
CSBR_4->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_4->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_4->SetMarkerStyle(22);
CSBR_4->SetMarkerColor(kBlack);
CSBR_4->Draw("same");*/
/*CSBR_5->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_5->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_5->SetMarkerStyle(23);
CSBR_5->SetMarkerColor(kViolet);
CSBR_5->Draw("same");
CSBR_6->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_6->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_6->SetMarkerStyle(24);
CSBR_6->SetMarkerColor(kPink+2);
CSBR_6->Draw("same");
CSBR_7->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_7->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_7->SetMarkerStyle(25);
CSBR_7->SetMarkerColor(kAzure+2);
CSBR_7->Draw("same");*/
CSBR_8->GetYaxis()->SetTitle("Cross section times Branching ratios for X1Hplus");
CSBR_8->GetXaxis()->SetTitle("Mass of ~H+(in GeV)");
CSBR_8->SetMarkerStyle(26);
CSBR_8->SetMarkerColor(kAzure);
CSBR_8->Draw("same");
l->SetLineStyle(3);
l10->SetLineStyle(3);
l10m->SetLineStyle(3);
l20->SetLineStyle(3);
l20m->SetLineStyle(3);
l30->SetLineStyle(3);
l30m->SetLineStyle(3);
l40->SetLineStyle(3);
l40m->SetLineStyle(3);
l->Draw("same");
l10->Draw("same");
l10m->Draw("same");
l20->Draw("same");
l20m->Draw("same");
l30->Draw("same");
l30m->Draw("same");
l40->Draw("same");
l40m->Draw("same");
//Déclaration et affichage de la légende
//TLegend legend(0.9,0.9,1.0,1.0);
TLegend * legend = new TLegend(0.9,0.9,1.0,1.0);
/*legend->AddEntry(CSBR_1,"CSx2X2 BRZ0x1","p");
legend->AddEntry(CSBR_2,"CSx2X2 BRX1X1 ","p");
legend->AddEntry(CSBR_3,"CSx2X2 BRhx1","p");
legend->AddEntry(CSBR_4,"CSx2X2 BRW-H+ ","p");
legend->AddEntry(CSBR_5,"CSx2X2 BRZ0X1 ","p");
legend->AddEntry(CSBR_6,"CSx2X2 BRx1x1","p");
legend->AddEntry(CSBR_7,"CSx2X2 BRhX1","p");
legend->AddEntry(CSBR_8,"CSx2X2 BRW+H-","p");*/
legend->Draw();
/libération de la mémoire/
delete(CSBR_1);
delete(CSBR_2);
delete(CSBR_3);
delete(CSBR_4);
delete(CSBR_5);
delete(CSBR_6);
delete(CSBR_7);
delete(CSBR_8);
/delete(CSBR_9);
delete(CSBR_10);
delete(CSBR_11);
delete(CSBR_12);
delete(CSBR_13);
delete(CSBR_14);
delete(CSBR_15);
delete(CSBR_16);
delete(CSBR_17);/
delete(legend);
delete(c1);
delete(l);
delete(l10);
delete(l10m);
delete(l20);
delete(l20m);
delete(l30);
delete(l30m);
delete(l40);
delete(l40m);
killPlots();
}
[/code]
Thanks in advance, regards
Jean-PhilippeCSBRX1HplusqQx2.eps (8.7 KB)BRstimesCS_X1Hplus_sorted.txt (3.43 KB)