Create ROOT executable to make a fit

Hello, I’ve this ROOT program,
but how to make it working?

It should produce an executable to make a fit. I also copied the bash that should compile the exectuable, but I don’t get it.

The code, the bash and the file to fit are here WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

Thanks

bash cpp.bash TH1fit.cpp
./TH1fit++

Hi @Wile_E_Coyote

-bash-4.2$ bash cpp.bash TH1fit.cpp
cpp.bash: line 2: $'\r': command not found
cpp.bash: line 4: $'\r': command not found
cpp.bash: line 25: syntax error: unexpected end of file
-bash-4.2$

I don’t see this r' command in the bash file…

You need to fix your “cpp.bash” file → Uncle Google → convert dos file to unix

Hi @Wile_E_Coyote …I’m not compiling on windows!

I’m compiling on a linux machine (vpn connection)! And the bash file has not been written on a windows machine, but by a mac

Uncle Google → convert mac file to unix

BTW. “\r\n” in your “cpp.bash” file suggests that it is a DOS-encoded file.

Hi @Wile_E_Coyote
maybe, when I opened the cpp.bash, my computer automatically modified the file to dos-econded.

I modified the file to unix-econded and I could compile

but I get

-bash-4.2$ ./TH1fit++
Warning in <UnknownClass::SetDisplay>: DISPLAY not set, setting it to linux106:0.0

Error: missing arguments: ROOT_FileIn  TH1D_HistName  Emin  Emax

-bash-4.2$
  1. Regarding the the display not set, maybe should I ask to the technician to set it?
  2. Regarding the ROOT_FileIn TH1D_HistName Emin Emax, how can I pass them?

Maybe you should contact the author of this utility.

Truely, I found the file in the laboratory machine. I’ve to ask to the group if they know the author!

Maybe your colleagues and/or your supervisor know this utility, too.

Ok, I runned the utility. Using the file here WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free it can be runned in this way:

./TH1fit++ reaz_ebeam380.0kev.hist GePD 1350 1967

but you have to set the working directory in the file before compiling then, for example:

string WorkDir= "/home/my_working_directory";

At the end, the utility produce a .fit file that you can open by ROOT

root [0] TFile *fin = TFile::Open("reaz_ebeam380.0kev.fit");
root [1] fin->ls();
TFile**         reaz_ebeam380.0kev.fit
 TFile*         reaz_ebeam380.0kev.fit
  KEY: TH1D     GePD;2  GePD [current cycle]
  KEY: TH1D     GePD;1  GePD [backup cycle]
root [2] GePD->Draw();
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1

The utility should automatically get the 3 peaks and fit them . In the Th1f I see that ti finds the peaks but doesn’t correctly fit them.

maybe, you or @moneta know how to solve?

The author of this utility should know how to “debug” it.

I see the utility uses also TSpectrum which is some legacy software for us. I guess the fit does not work because the initial fit parameters are not good enough.
Sorry we cannot be of much more help here

Best,

Lorenzo

When they said me how to run it, they said to have the same problem (i.e. the fit isn’t good)

What do you mean that Tspectrum is a legacy software?

Regarding the initial parameter, the utility calculates them…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.