| 
            Last change
 on this file since 3481 was             3074, checked in by cmv, 19 years ago           | 
        
        
          | 
             
remplacement nbrandom.h (obsolete) -> srandgen.h  cmv 14/09/2006 
 
           | 
        
        
          | 
            File size:
            1.1 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | #include <stdio.h>
 | 
|---|
| 2 | #include <stdlib.h>
 | 
|---|
| 3 | #include <math.h>
 | 
|---|
| 4 | #include <iostream>
 | 
|---|
| 5 | #include <string>
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #include "sopnamsp.h"
 | 
|---|
| 8 | #include "nobjmgr.h"
 | 
|---|
| 9 | 
 | 
|---|
| 10 | #include "tvector.h"
 | 
|---|
| 11 | #include "histos.h"
 | 
|---|
| 12 | #include "histos2.h"
 | 
|---|
| 13 | #include "ntuple.h"
 | 
|---|
| 14 | 
 | 
|---|
| 15 | #include "srandgen.h"
 | 
|---|
| 16 | 
 | 
|---|
| 17 | // ---------- Fonction pour link ds piapp -----------------
 | 
|---|
| 18 | // Exemple de fonction pouvant etre linke a piapp 
 | 
|---|
| 19 | // La fonction doit etre declare extern "C"
 | 
|---|
| 20 | extern "C" {
 | 
|---|
| 21 |   void user(vector<string>& args);
 | 
|---|
| 22 | }
 | 
|---|
| 23 | 
 | 
|---|
| 24 | void user(vector<string>& args)
 | 
|---|
| 25 | {
 | 
|---|
| 26 |   // On instancie un objet NamedObjMgr
 | 
|---|
| 27 |   NamedObjMgr omg;
 | 
|---|
| 28 |   cout << " User Function user(...) nargs=" << args.size() << endl;
 | 
|---|
| 29 | 
 | 
|---|
| 30 |   // On cree un NTuple et on le remplit
 | 
|---|
| 31 |   float xnt[4];
 | 
|---|
| 32 |   char *ntn[4] = {"x","y","ex","ey"};
 | 
|---|
| 33 |   int nent,i;
 | 
|---|
| 34 |   nent = 100;
 | 
|---|
| 35 |   NTuple* nt = new NTuple(4,ntn);  // Creation NTuple (AVEC new )
 | 
|---|
| 36 |   for(i=0; i<nent; i++) {
 | 
|---|
| 37 |     xnt[0] = i*50./nent; xnt[1] = 0.2*xnt[0]*xnt[0]+(NorRand()*xnt[0]/3.);
 | 
|---|
| 38 |     xnt[2] = 0.; xnt[3] = xnt[0]/3.;
 | 
|---|
| 39 |     nt->Fill(xnt);
 | 
|---|
| 40 |   }
 | 
|---|
| 41 | 
 | 
|---|
| 42 |   // On ajoute le ntuple cree a la liste des objets geres par piapp
 | 
|---|
| 43 |   string nom = "usernt";
 | 
|---|
| 44 |   omg.AddObj(nt, nom);
 | 
|---|
| 45 |   return;
 | 
|---|
| 46 | }
 | 
|---|
| 47 | 
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.