|
Porting to ROOT 6
|
|
| |
| Working groups |
| Blessed plots and figures |
| Approving new results and publications |
| Approval web pages - new results |
| Approval web pages - new publications |
| Mu2e Acronyn Dictionary |
| Fermilab Meeting Rooms |
| Fermilab Service Desk |
| ReadyTalk : Home |
| ReadyTalk : Help |
| ReadyTalk : Toll Free Numbers |
Until the end of the ROOT v5 series of releases, ROOT interactive command lines and ROOT macros were parsed and executed by a custom written interpreter named CINT. CINT was advertised as an interpreter for code written in C and C++. A more accurate description is that the CINT language shares many features with C and C++ but it misses many important features and adds other features that are not part of either language. Indeed there is code that is both legal CINT and legal C++ but they do different things.
Starting with ROOT v6, CINT has been replaced by a new interpretter named cling. Quoting from the Cling web site:
Cling is an interactive C++ interpreter, built on the top of LLVM and Clang libraries. Its advantages over the standard interpreters are that it has command line prompt and uses just-in-time (JIT) compiler for compilation.
In addition, Cling can also parse and execute some Cling-specific extensions to C++. These extensions are much less extensive than the extensions supported by CINT.
gROOT->LoadMacro("file.C+");
In ROOT 6 this has been replaced with the syntax.
#include "file.C+"I have not learned the rules for resolving user supplied header files that are included in file.C; they are not what I expected.
ROOT 6 does not do this. If you create a TObject inside a class or function called from the command line and if you want a pointer to it to be available at the command line, then it is your responsibity to provide a mechanism to communicate the pointer to the command line.
The two ROOT scripts that are used to make one of the standard sets of tracking efficiency and resolution plots are:
TrkDiag/test/KalFit.C TrkDiag/test/ce.CKalFit.C does all of the physics work; ce.C manages I/O and calls KalFit.C.
These scripts operate on a ROOT TTree created by TrkDiag/src/ReadKalFits_module.cc; for an example you can use Analyses/test/genReco.fcl; running it for 2000 events will take about 15 minutes and will produce enough reconstructed tracks to explore.
To run these scripts, setup the Mu2e run-time environment and:
root -l TrkDiag/test/ce.CThis will pop up two TCanvas windows and return control to the ROOT prompt.
These files are available in Mu2e Offline and copies are available here:
23a25,26
> TCanvas* rcan;
> TCanvas* acan;
695c699
< TCanvas* acan = new TCanvas("acan","Acceptance",1200,800);
---
> acan = new TCanvas("acan","Acceptance",1200,800);
753c757
< TCanvas* rcan = new TCanvas("rcan","Momentum Resolution",1200,800);
---
> rcan = new TCanvas("rcan","Momentum Resolution",1200,800);
In the ROOT 5 version, variables acan and rcan were
function-local; in the ROOT 6 version they are public member data.
The following text is the output of: diff -wbB v5/ce.C v6/ce.C
2c2
< // Version for use with root v5.
---
> // Version for use with root v6.
30,31d29
<
< gROOT->Reset();
38c36
< gROOT->LoadMacro("TrkDiag/test/KalFit.C+");
---
> #include "TrkDiag/test/KalFit.C+"
45,46c43,45
< acan->Print("acan_ce.pdf");
< rcan->Print("rcan_ce.pdf");
---
>
> fit.acan->Print("acan_ce.pdf");
> fit.rcan->Print("rcan_ce.pdf");
In the ROOT 6 code, the LoadMacro call is replaced
as described in item 2 from General Comments section.
In the ROOT 6 code, the TCanvas* pointers acan and rcan
are accessed as public member data of the class KalFit.C;
in the ROOT 5 code they were automagicaly provided by CINT.
I am not sure if it was necessary to remove the gROOT->Reset() or if it is an artifact of debugging.
|
|
|
| Security, Privacy, Legal |
|