source: Sophya/trunk/SophyaPI/DemoPIApp/user.cc@ 1338

Last change on this file since 1338 was 1338, checked in by ansari, 25 years ago

Creation du module DemoPIApp - Macro de demo pour (s)piapp - Reza 20/11/2000

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