Oxygen Basic

Information => Open Forum => Topic started by: JRS on September 17, 2014, 03:05:13 PM

Title: CERN ROOT - Javascript
Post by: JRS on September 17, 2014, 03:05:13 PM
One interesting new feature of this release is the ROOT I/O package rewritten in Javascript. This allows the browsing and displaying of histograms in any ROOT file hosted on a web server, without any server side plugins. This is still work in progress (more histogram plotting options, etc.), but an exciting demo can already be seen here (http://root.cern.ch/js/). Look at the source of this demo page to see how to use ROOT-IO.js.

FYI: You can actually drag the 3D renderings for a different perspective view. Amazing! (for a JavaScript application)


Enabled support for asimage, astiff, builtin_afterimage, builtin_lzma, cintex, explicitlink, fftw3, fitsio, gviz, genvector, krb5, ldap, mathmore, memstat, mysql, odbc, opengl, python, reflex, shadowpw, shared, sqlite, ssl, tmva, vdt, x11, xft, xml.

To build ROOT type:

   make
   make  install

   ============================================================
   ===                ROOT BUILD SUCCESSFUL.                ===
   === Run 'make install' now.                              ===
   ============================================================
Installing binaries in /usr/bin
Installing libraries in /usr/lib/root
Installing headers in /usr/include/root
Installing /home/jrs/cern/root/main/src/rmain.cxx in /usr/include/root
Installing cint/cint/include cint/cint/lib and cint/cint/stl in /usr/lib/root/cint
Installing icons in /usr/share/root/icons
Installing fonts in /usr/share/root/fonts
Installing misc docs in /usr/share/doc/root
Installing tutorials in /usr/share/doc/root/tutorials
Installing tests in /usr/share/doc/root/test
Installing macros in /usr/share/root/macros
Installing man(1) pages in /usr/share/man/man1
Installing config files in /etc/root
Installing Autoconf macro in /usr/share/aclocal
Installing Emacs Lisp library in /usr/share/emacs/site-lisp
Installing GDML conversion scripts in /usr/lib/root


.
Title: Hello ROOT
Post by: JRS on September 17, 2014, 04:57:07 PM
Here is my first test of ROOT since the build. This was run interactively in the ROOT shell.


.L 3dhist.c
glh3c()


Code: [Select]
// Display a 3D histogram using GL (box option).
//Author: Timur Pocheptsov
void glh3c()
{
  gStyle->SetCanvasPreferGL(kTRUE);
 

  TGLTH3Composition * comp = new TGLTH3Composition;
  TH3F * h1 = new TH3F("h1", "h1", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h1->FillRandom("gaus");
  h1->SetFillColor(kRed);
  TH3F * h2 = new TH3F("h2", "h2", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h2->FillRandom("landau");
  h2->SetFillColor(kGreen);
  TH3F * h3 = new TH3F("h3", "h3", 10, -1., 1., 10, -1., 1., 10, -1., 1.);
  h3->FillRandom("gaus");
  h3->SetFillColor(kBlue);
 
  comp->AddTH3(h1);
  comp->AddTH3(h2, TGLTH3Composition::kSphere);
  comp->AddTH3(h3);

  comp->Draw();

  TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98,
                                     "TH3 composition.");
  title->SetFillColor(32);
  title->Draw();
}



.
Title: Re: CERN ROOT - Koding .com
Post by: JRS on September 17, 2014, 10:08:08 PM
Rob,

If there is any interest, I was able to build CERN ROOT on Koding.com.

Title: Re: CERN ROOT - OpenGL
Post by: JRS on September 17, 2014, 11:29:28 PM
A few more CERN ROOT examples.

Code: Text
  1. // Various surfaces rendered with GL.
  2. // This example draws 6 surfaces using OpenGL in pad (one is remake
  3. // of a classic surfaces.C, another contains 4 surfaces).
  4. //
  5. // The commands used are exactly the same as with a normal pad.
  6. // The only command to add is: gStyle->SetCanvasPreferGL(true);
  7. // Authors: Rene Brun, Timur Pocheptsov
  8.  
  9. void glsurfaces()
  10. {
  11.    gStyle->SetPalette(0);
  12.    
  13.    // after this command all legos surfaces (surf/srf1/surf2/surf4/tf3
  14.    // options) are automatically rendered with OpenGL.
  15.    gStyle->SetCanvasPreferGL(kTRUE);
  16.  
  17.    TCanvas *c1 = new TCanvas("glc1","Surfaces Drawing Options",200,10,700,900);
  18.    c1->SetFillColor(42);
  19.    gStyle->SetFrameFillColor(42);
  20.    title = new TPaveText(0.2, 0.96, 0.8, 0.995);
  21.    title->SetFillColor(33);
  22.    title->AddText("Examples of Surface options");
  23.    title->Draw();
  24.  
  25.    TPad *pad1 = new TPad("pad1","Gouraud shading", 0.03, 0.50, 0.98, 0.95, 21);
  26.    TPad *pad2 = new TPad("pad2","Color mesh", 0.03, 0.02, 0.98, 0.48, 21);
  27.    pad1->Draw();
  28.    pad2->Draw();
  29.    // We generate a 2-D function
  30.    TF2 *f2 = new TF2("f2","x**2 + y**2 - x**3 -8*x*y**4", -1., 1.2, -1.5, 1.5);
  31.    // Draw this function in pad1 with Gouraud shading option
  32.    pad1->cd();
  33.    pad1->SetLogz();
  34.    f2->SetFillColor(45);
  35.    f2->Draw("glsurf4");
  36.  
  37.    TF2 *f2clone = new TF2("f2clone","x**2 + y**2 - x**3 -8*x*y**4",
  38.                           -1., 1.2, -1.5, 1.5);
  39.    // Draw this function in pad2 with color mesh option
  40.    pad2->cd();
  41.    pad2->SetLogz();
  42.    f2clone->Draw("glsurf1");
  43.    
  44.    //add axis titles. The titles are set on the intermediate
  45.    //histogram used for visualisation. We must force this histogram
  46.    //to be created, then force the redrawing of the two pads
  47.    pad2->Update();
  48.    f2->GetHistogram()->GetXaxis()->SetTitle("x title");
  49.    f2->GetHistogram()->GetYaxis()->SetTitle("y title");
  50.    f2->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
  51.    f2->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
  52.    f2clone->GetHistogram()->GetXaxis()->SetTitle("x title");
  53.    f2clone->GetHistogram()->GetYaxis()->SetTitle("y title");
  54.    f2clone->GetHistogram()->GetXaxis()->SetTitleOffset(1.4);
  55.    f2clone->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
  56.    pad1->Modified();
  57.    pad2->Modified();
  58.  
  59.    TCanvas *c2 = new TCanvas("glc2","Surfaces Drawing Options with gl",
  60.                              700,10,700,700);
  61.    c2->SetFillColor(42);
  62.    gStyle->SetFrameFillColor(42);
  63.  
  64.    c2->Divide(2, 2);
  65.  
  66.    c2->cd(1);
  67.    TF2 *fun1 = new TF2("fun1","1000*((sin(x)/x)*(sin(y)/y))+200",
  68.                        -6., 6., -6., 6.);
  69.    fun1->SetNpx(30);
  70.    fun1->SetNpy(30);
  71.    fun1->SetFillColor(kGreen);
  72.    fun1->Draw("glsurf3");
  73.  
  74.    c2->cd(2);
  75.    TF2 *fun2 = new TF2("fun2","cos(y)*sin(x)+cos(x)*sin(y)",
  76.                        -6., 6., -6., 6.);
  77.    fun2->Draw("glsurf1cyl");
  78.  
  79.    c2->cd(3);
  80.    TF2 *fun3 = new TF2("fun3","sin(x) / x * cos(y) * y", -6., 6., -6., 6.);
  81.    fun3->Draw("glsurfpol");
  82.  
  83.    c2->cd(4);
  84.    TF3 *fun4 = new TF3("fun4","sin(x * x + y * y + z * z - 4)",
  85.                        -2.5, 2.5, -2.5, 2.5, -2.5, 2.5);
  86.    Int_t colInd = TColor::GetColor(1.f, 0.5f, 0.f);
  87.    fun4->SetFillColor(colInd);
  88.    fun4->Draw("gl");//tf3 option
  89. }
  90.  

http://files.allbasic.info/ROOT/root3D.swf
Title: CERN ROOT - Mandelbrot
Post by: JRS on September 18, 2014, 02:04:43 AM
This thread wouldn't be traditional without a Mandelbrot example.  8)

Code: Text
  1. #include <TStyle.h>
  2. #include <TROOT.h>
  3. #include <TH2.h>
  4. #include <TComplex.h>
  5. #include <TVirtualPad.h>
  6. #include <TCanvas.h>
  7.  
  8. //==================================================================
  9. //
  10. // Using TExec to handle keyboard events and TComplex to draw the Mandelbrot set.
  11. // Author : Luigi Bardelli [ bardelli@fi.infn.it ]
  12. //
  13. // Pressing the keys 'z' and 'u' will zoom and unzoom the picture
  14. // near the mouse location, 'r' will reset to the default view.
  15. //
  16. // Try it (in compiled mode!) with:   root mandelbrot.C+
  17. //
  18. // Details:
  19. //    when a mouse event occurs the myexec() function is called (by
  20. //    using AddExec). Depending on the pressed key, the mygenerate()
  21. //    function is called, with the proper arguments. Note the
  22. //    last_x and last_y variables that are used in myexec() to store
  23. //    the last pointer coordinates (px is not a pointer position in
  24. //    kKeyPress events).
  25. //==================================================================
  26.  
  27. TH2F *last_histo=NULL;
  28.  
  29. void mygenerate(double factor, double cen_x, double cen_y)
  30. {
  31.   printf("Regenerating...\n");
  32.   // resize histo:
  33.   if(factor>0)
  34.     {
  35.       double dx=last_histo->GetXaxis()->GetXmax()-last_histo->GetXaxis()->GetXmin();
  36.       double dy=last_histo->GetYaxis()->GetXmax()-last_histo->GetYaxis()->GetXmin();
  37.       last_histo->SetBins(
  38.                           last_histo->GetNbinsX(),
  39.                           cen_x-factor*dx/2,
  40.                           cen_x+factor*dx/2,
  41.                           last_histo->GetNbinsY(),
  42.                           cen_y-factor*dy/2,
  43.                           cen_y+factor*dy/2
  44.                           );
  45.       last_histo->Reset();
  46.     }
  47.   else
  48.     {
  49.       if(last_histo!=NULL) delete last_histo;
  50.       // allocate first view...
  51.       last_histo= new TH2F("h2",
  52.          "Mandelbrot [move mouse and  press z to zoom, u to unzoom, r to reset]",
  53.                            200,-2,2,200,-2,2);
  54.       last_histo->SetStats(0);            
  55.     }
  56.   const int max_iter=50;
  57.   for(int bx=1;bx<=last_histo->GetNbinsX();bx++)
  58.     for(int by=1;by<=last_histo->GetNbinsY();by++)
  59.       {
  60.         double x=last_histo->GetXaxis()->GetBinCenter(bx);
  61.         double y=last_histo->GetYaxis()->GetBinCenter(by);
  62.         TComplex point( x,y);
  63.         TComplex z=point;
  64.         int iter=0;    
  65.         while (z.Rho()<2){
  66.           z=z*z+point;
  67.           last_histo->Fill(x,y);
  68.           iter++;
  69.           if(iter>max_iter) break;
  70.         }
  71.       }  
  72.   last_histo->Draw("colz");
  73.   gPad->Modified();
  74.   gPad->Update();
  75.   printf("Done.\n");
  76. }
  77.  
  78. void myexec()
  79. {
  80.   // get event information
  81.   int event = gPad->GetEvent();
  82.   int px = gPad->GetEventX();
  83.   int py = gPad->GetEventY();
  84.  
  85.   // some magic to get the coordinates...
  86.   double xd = gPad->AbsPixeltoX(px);
  87.   double yd = gPad->AbsPixeltoY(py);
  88.   float x = gPad->PadtoX(xd);
  89.   float y = gPad->PadtoY(yd);
  90.  
  91.   static float last_x;
  92.   static float last_y;
  93.  
  94.   if(event!=kKeyPress)
  95.     {
  96.       last_x=x;
  97.       last_y=y;
  98.       return;
  99.     }
  100.  
  101.   const double Z=2.;
  102.   switch(px){
  103.   case 'z': // ZOOM
  104.     mygenerate(1./Z, last_x, last_y);
  105.     break;
  106.   case 'u': // UNZOOM
  107.     mygenerate(Z   , last_x, last_y);
  108.     break;
  109.   case 'r': // RESET
  110.     mygenerate(-1   , last_x, last_y);
  111.     break;
  112.   };
  113. }
  114.  
  115. void mandelbrot()
  116. {
  117.   // cosmetics...
  118.   gROOT->SetStyle("Plain");
  119.   gStyle->SetPalette(1,0);
  120.   gStyle->SetPadGridX(kTRUE);
  121.   gStyle->SetPadGridY(kTRUE);
  122.   new TCanvas("canvas","View Mandelbrot set");
  123.   gPad->SetCrosshair();
  124.   // this generates and draws the first view...
  125.   mygenerate(-1,0,0);
  126.  
  127.   // add exec
  128.   gPad->AddExec("myexec","myexec()");
  129. }
  130.  

.
Title: CERN ROOT - SB embedded
Post by: JRS on September 18, 2014, 03:24:33 AM
The next logical step (for me) is to create a wrapper (.so) for the Script BASIC API and embedded it in CERN ROOT seemlessly. I can than use all the SB ext. modules (IUP, SDL, ... ) from an interactive C [BASIC].

Something to sleep on. ZZzzz...
Title: Re: CERN ROOT - Javascript
Post by: RobbeK on September 18, 2014, 02:10:39 PM
That's interesting, John  ...

Racket Scheme has something similar -- can be rotated , stretched , change of XYZ scales etc ...

you can even copy the images (mouse-click) into documents (another app).
But no one seems interested, some people call this very advanced language a "toy"   --  (probably they never had a look on it )
-- seems the fashion, nowadays (cfr recent posts about the tiny scheme things ...    )

best Rob ,



.
Title: Re: CERN ROOT - Javascript
Post by: Mike Lobanovsky on September 18, 2014, 02:19:31 PM
That isn't fashion, that's downright shit at places that were originally meant for hosting one's brains.
Title: CERN ROOT - Future
Post by: JRS on September 18, 2014, 02:40:48 PM
Thanks Rob and Mike for your feedback.

Personally a C/C++ Shell/Debugger/Interpreter/Compiler with a high level graphics primitive that generates native JavaScript for presentation is appealing. If I can get SB embedded to extend it's flexibility, all the better.

I think it is great a group like CERN would openly share their analytical tools (with source) with the world. If that translates to shit, I don't see it.

 
Title: Re: CERN ROOT - Javascript
Post by: Mike Lobanovsky on September 18, 2014, 03:22:27 PM
This is what shit translates to:

Quote
(cfr recent posts about the tiny scheme things ...    )

and those "recent posts" on a far-away forum also identify the places originally meant for hosting the brains but actually bogged down in the aforesaid shit.
Title: Re: CERN ROOT - Javascript
Post by: JRS on September 18, 2014, 05:53:05 PM
It doesn't look like I'm going to be able to embed Script BASIC into CERN ROOT. I was worried that the extensive MACO/DEFINE nature of SB would give ROOT fits. It is still going to remain in my programmers toolbox.

If I was someone like Rob that ate and breathed MATH, ROOT would seem to be an analysis dream. The CERN scientists seem to like it.
Title: CERN ROOT - Windows 32 bit
Post by: JRS on September 18, 2014, 06:24:52 PM
Rob,

You're in luck. CERN ROOT also comes in a MSI / EXE install and supports Microsoft Visual Studio. It also includes a ROOT GUI Builder program.

Code: C
  1. #include <TFile.h>
  2. #include <TNtuple.h>
  3. #include <TH2.h>
  4. #include <TProfile.h>
  5. #include <TCanvas.h>
  6. #include <TFrame.h>
  7. #include <TROOT.h>
  8. #include <TSystem.h>
  9. #include <TRandom3.h>
  10. #include <TBenchmark.h>
  11. #include <TInterpreter.h>
  12.  
  13. TFile *hsimple(Int_t get=0)
  14. {
  15. //  This program creates :
  16. //    - a one dimensional histogram
  17. //    - a two dimensional histogram
  18. //    - a profile histogram
  19. //    - a memory-resident ntuple
  20. //
  21. //  These objects are filled with some random numbers and saved on a file.
  22. //  If get=1 the macro returns a pointer to the TFile of "hsimple.root"
  23. //          if this file exists, otherwise it is created.
  24. //  The file "hsimple.root" is created in $ROOTSYS/tutorials if the caller has
  25. //  write access to this directory, otherwise the file is created in $PWD
  26.  
  27.    TString filename = "hsimple.root";
  28.    TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
  29.    dir.ReplaceAll("hsimple.C","");
  30.    dir.ReplaceAll("/./","/");
  31.    TFile *hfile = 0;
  32.    if (get) {
  33.       // if the argument get =1 return the file "hsimple.root"
  34.       // if the file does not exist, it is created
  35.       TString fullPath = dir+"hsimple.root";
  36.       if (!gSystem->AccessPathName(fullPath,kFileExists)) {
  37.          hfile = TFile::Open(fullPath); //in $ROOTSYS/tutorials
  38.          if (hfile) return hfile;
  39.       }
  40.       //otherwise try $PWD/hsimple.root
  41.       if (!gSystem->AccessPathName("hsimple.root",kFileExists)) {
  42.          hfile = TFile::Open("hsimple.root"); //in current dir
  43.          if (hfile) return hfile;
  44.       }
  45.    }
  46.    //no hsimple.root file found. Must generate it !
  47.    //generate hsimple.root in current directory if we have write access
  48.    if (gSystem->AccessPathName(".",kWritePermission)) {
  49.       printf("you must run the script in a directory with write access\n");
  50.       return 0;
  51.    }
  52.    hfile = (TFile*)gROOT->FindObject(filename); if (hfile) hfile->Close();
  53.    hfile = new TFile(filename,"RECREATE","Demo ROOT file with histograms");
  54.  
  55.    // Create some histograms, a profile histogram and an ntuple
  56.    TH1F *hpx = new TH1F("hpx","This is the px distribution",100,-4,4);
  57.    hpx->SetFillColor(48);
  58.    TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
  59.    TProfile *hprof = new TProfile("hprof","Profile of pz versus px",100,-4,4,0,20);
  60.    TNtuple *ntuple = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i");
  61.  
  62.    gBenchmark->Start("hsimple");
  63.  
  64.    // Create a new canvas.
  65.    TCanvas *c1 = new TCanvas("c1","Dynamic Filling Example",200,10,700,500);
  66.    c1->SetFillColor(42);
  67.    c1->GetFrame()->SetFillColor(21);
  68.    c1->GetFrame()->SetBorderSize(6);
  69.    c1->GetFrame()->SetBorderMode(-1);
  70.  
  71.  
  72.    // Fill histograms randomly
  73.    TRandom3 random;
  74.    Float_t px, py, pz;
  75.    const Int_t kUPDATE = 1000;
  76.    for (Int_t i = 0; i < 25000; i++) {
  77.       random.Rannor(px,py);
  78.       pz = px*px + py*py;
  79.       Float_t rnd = random.Rndm(1);
  80.       hpx->Fill(px);
  81.       hpxpy->Fill(px,py);
  82.       hprof->Fill(px,pz);
  83.       ntuple->Fill(px,py,pz,rnd,i);
  84.       if (i && (i%kUPDATE) == 0) {
  85.          if (i == kUPDATE) hpx->Draw();
  86.          c1->Modified();
  87.          c1->Update();
  88.          if (gSystem->ProcessEvents())
  89.             break;
  90.       }
  91.    }
  92.    gBenchmark->Show("hsimple");
  93.  
  94.    // Save all objects in this file
  95.    hpx->SetFillColor(0);
  96.    hfile->Write();
  97.    hpx->SetFillColor(48);
  98.    c1->Modified();
  99.    return hfile;
  100.  
  101. // Note that the file is automatically close when application terminates
  102. // or when the file destructor is called.
  103. }
  104.  



.
Title: CERN ROOT - Windows XP
Post by: JRS on September 18, 2014, 08:05:41 PM
ROOT also runs in my XP VirtualBox I have for Linux. This demo is cool and it spins and the wave forms oscillates as well. (no video capture in my XP vbox)

Code: [Select]
//macro illustrating how to animate a picture using a Timer
//Author: Rene Brun
   
#include "TStyle.h"
#include "TCanvas.h"
#include "TF2.h"
#include "TTimer.h"   

Double_t pi;
TF2 *f2;
Float_t t = 0;
Float_t phi = 30;
void anim()
{
   gStyle->SetCanvasPreferGL(true);
   gStyle->SetFrameFillColor(42);
   TCanvas *c1 = new TCanvas("c1");
   c1->SetFillColor(17);
   pi = TMath::Pi();
   f2 = new TF2("f2","sin(2*x)*sin(2*y)*[0]",0,pi,0,pi);
   f2->SetParameter(0,1);
   f2->SetNpx(15);
   f2->SetNpy(15);
   f2->SetMaximum(1);
   f2->SetMinimum(-1);
   f2->Draw("glsurf1");
   TTimer *timer = new TTimer(20);
   timer->SetCommand("Animate()");
   timer->TurnOn();
}   
void Animate()
{
   //just in case the canvas has been deleted
   if (!gROOT->GetListOfCanvases()->FindObject("c1")) return;
   t += 0.05*pi;
   f2->SetParameter(0,TMath::Cos(t));
   phi += 2;
   gPad->SetPhi(phi);
   gPad->Modified();
   gPad->Update();
}

 

.
Title: Re: CERN ROOT - Javascript
Post by: Charles Pegge on September 19, 2014, 02:35:54 AM

Is that a Higgs-Boson? :)
Title: Re: CERN ROOT - Javascript
Post by: JRS on September 19, 2014, 07:54:02 AM
Quote from: Charles
Is that a Higgs-Boson?

(http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png)
The potential for the Higgs field, plotted as function of \phi^0 and \phi^3. It has a Mexican-hat or champagne-bottle profile at the ground.

Investigating.

Code: [Select]
// Model of a nucleus built from TGeo classes.
//
// Author: Otto Schaile

void nucleus(Int_t nProtons  = 40,Int_t  nNeutrons = 60)
{
   Double_t NeutronRadius = 60,
            ProtonRadius = 60,
            NucleusRadius,
            distance = 60;
   Double_t vol = nProtons + nNeutrons;
   vol = 3 * vol / (4 * TMath::Pi());

   NucleusRadius = distance * TMath::Power(vol, 1./3.);
//   cout << "NucleusRadius: " << NucleusRadius << endl;

   TGeoManager * geom = new TGeoManager("nucleus", "Model of a nucleus");
   geom->SetNsegments(40);
   TGeoMaterial *matEmptySpace = new TGeoMaterial("EmptySpace", 0, 0, 0);
   TGeoMaterial *matProton     = new TGeoMaterial("Proton"    , .938, 1., 10000.);
   TGeoMaterial *matNeutron    = new TGeoMaterial("Neutron"   , .935, 0., 10000.);

   TGeoMedium *EmptySpace = new TGeoMedium("Empty", 1, matEmptySpace);
   TGeoMedium *Proton     = new TGeoMedium("Proton", 1, matProton);
   TGeoMedium *Neutron    = new TGeoMedium("Neutron",1, matNeutron);

//  the space where the nucleus lives (top container volume)

   Double_t worldx = 200.;
   Double_t worldy = 200.;
   Double_t worldz = 200.;
 
   TGeoVolume *top = geom->MakeBox("WORLD", EmptySpace, worldx, worldy, worldz);
   geom->SetTopVolume(top);

   TGeoVolume * proton  = geom->MakeSphere("proton",  Proton,  0., ProtonRadius);
   TGeoVolume * neutron = geom->MakeSphere("neutron", Neutron, 0., NeutronRadius);
   proton->SetLineColor(kRed);
   neutron->SetLineColor(kBlue);

   Double_t x, y, z, dummy;
   Int_t i = 0;
   while ( i<  nProtons) {
      gRandom->Rannor(x, y);
      gRandom->Rannor(z,dummy);
      if ( TMath::Sqrt(x*x + y*y + z*z) < 1) {
         x = (2 * x - 1) * NucleusRadius;
         y = (2 * y - 1) * NucleusRadius;
         z = (2 * z - 1) * NucleusRadius;
         top->AddNode(proton, i, new TGeoTranslation(x, y, z));
         i++;
      }
   }
   i = 0;
   while ( i <  nNeutrons) {
      gRandom->Rannor(x, y);
      gRandom->Rannor(z,dummy);
      if ( TMath::Sqrt(x*x + y*y + z*z) < 1) {
         x = (2 * x - 1) * NucleusRadius;
         y = (2 * y - 1) * NucleusRadius;
         z = (2 * z - 1) * NucleusRadius;
         top->AddNode(neutron, i + nProtons, new TGeoTranslation(x, y, z));
         i++;
      }
   }
   geom->CloseGeometry();
   geom->SetVisLevel(4);
   top->Draw("ogl");
}


.
Title: Re: CERN ROOT - Javascript
Post by: Mike Lobanovsky on September 19, 2014, 11:44:38 AM
Quote from: John
(http://www.oxygenbasic.org/forum/index.php?action=dlattach;topic=1202.0;attach=3348;image)

Quote from: Charles
Is that a Higgs-Boson?

Nope, that's a Womans-Bosom. ;D
Title: Re: CERN ROOT - Javascript
Post by: JRS on September 19, 2014, 11:59:11 AM
Quote
Nope, that's a Womans-Bosom.

Mike needs to take a break from his computer and get laid.   :o
Title: Re: CERN ROOT - Javascript
Post by: Mike Lobanovsky on September 19, 2014, 12:25:07 PM
A man comes to the doctor and says:

-- Look, I think I have some trouble. Everywhere I look I see an unmade bed and a naked woman in it.

-- Well, -- says the doctor, -- what do you see in this picture:

(http://i1240.photobucket.com/albums/gg490/FbslGeek/Quad.png)

-- I see an unmade square bed and a naked woman in it.

-- Hmmm... -- says the doctor, -- and what do you see in this picture:

(http://i1240.photobucket.com/albums/gg490/FbslGeek/Circle.png)

-- I see an unmade round bed and a naked woman in it.

-- Oh, -- says the doctor a little perplexed by the gravity of the case, -- and in this one:

(http://i1240.photobucket.com/albums/gg490/FbslGeek/Box.png)

-- Hey doc, -- says the man, -- aren't you just some maniac!
Title: CERN SFT
Post by: JRS on September 19, 2014, 12:25:51 PM
Quote
The SFT (Software for Experiments) group is part of CERN (European Organization for Nuclear Research, http://www.cern.ch), and focuses on providing common software for its experiments. CERN is one of the world’s largest and most exciting centers for fundamental physics research. Experiments at CERN have probed the fundamental nature of matter and the forces which affect it. CERN is also the birthplace of the World Wide Web (http://info.cern.ch), invented by Tim Berners-Lee. The SFT group's efforts, like most of CERN's current activities, are directed towards the world’s highest-energy elementary particle accelerator - the Large Hadron Collider (LHC, http://public.web.cern.ch/public/en/lhc/lhc-en.html) and its experiments. There are four large experiments at the LHC (ALICE, ATLAS, CMS, LHCb) which seek to expand the frontiers of knowledge and complete our understanding of the constituents of matter and their interactions, of the conditions in the first instants after the Big Bang and of the differences between matter and anti-matter. During 2012, ATLAS and CMS announced the discovery of a new boson, which has been confirmed recently to have the properties of a Higgs boson - similar to the one required by the Standard Model of Particle Physics.

NOTE: The vast majority of our GSoC projects do not require any physics knowledge.

Operating the LHC and running each experiment requires a large amount of software. A large part of this software is common and open source. The open source software spans the range from system software to more specialized physics-oriented tools and toolkits.

The Root system (http://root.cern.ch/) is used to handle, store and analyze the data of all LHC experiments. The experiments store both their raw data and intermediate, processed results using Root, as it offers an open source format and is very compact. Having the data defined as a set of objects, it is possible to get access separately to particular attributes of the selected objects, without touching the remaining attributes. Root includes many tools for analysis of data, from histograming methods in an arbitrary number of dimensions, curve fitting, function evaluation, minimization, graphics and visualization. It includes also a built-in C++ interpreter the command language which is used as a scripting, or macro language.

The CERN Virtual Machine (CernVM, http://cernvm.cern.ch) is an R&D project established in the Software group of CERN’s Physics Department (PH/SFT) to investigate how virtualization technologies can be used to improve and simplify the daily interaction of physicists with experiment software frameworks and the Grid infrastructure. CernVM maintains a Virtual Software Appliance designed to provide a complete and portable environment for developing and running LHC data analysis applications on any end user computer (laptop, desktop) as well as on the Grid and on Clouds.

The Geant4 toolkit (http://cern.ch/geant4) is a key component of the common physics software. It simulates the interactions of radiation with material in any setup, including the detectors of the LHC or other High Energy Physics (HEP) experiments. Uses in other fields including medical diagnostics and to satellite engineering and planetary science. One use is assessing the effects of radiation on the electronics of satellites. Another is in designing improved medical detectors with specialised applications such as the Geant4 Application for Tomographic Emission GATE (http://www.opengatecollaboration.org). LHC experiments use Geant4 to compare the signatures of events from new physics (such as the Higgs boson and particles which are candidates for dark matter) to the signatures of events coming from known interactions which could mimic them. Geant4 is created by the Geant4 collaboration (http://geant4.org) of over 100 physicists and engineers from around the world, bringing together teams at leading High Energy Physics laboratories such as CERN (Geneva, Switzerland), Fermilab (Batavia, IL), KEK (Tsukuba, Japan), SLAC (Stanford, CA) and Triumf (Vancouver, Canada), as well as many universities and institutions. The toolkit continues to be developed to improve its precision and scope of application, and to better utilise current and emerging computer architectures.
Title: Re: CERN SFT
Post by: Mike Lobanovsky on September 19, 2014, 12:37:22 PM
CERN (European Organization for Nuclear Research) is one of the world’s largest and most exciting centers for fundamental physics research.

I hear nuclear physics does have a negative effect on man's abilities. :)
Title: Re: CERN ROOT - Javascript
Post by: JRS on September 19, 2014, 01:00:05 PM
Quote
I hear nuclear physics does have a negative effect on man's abilities.

More effective than a snip. It's magic when energy collides.