| 1 | // ArchTOIPipe           (C)     CEA/DAPNIA/SPP IN2P3/LAL
 | 
|---|
| 2 | //                               Eric Aubourg
 | 
|---|
| 3 | //                               Christophe Magneville
 | 
|---|
| 4 | //                               Reza Ansari
 | 
|---|
| 5 | // $Id: ring2cout.cc,v 1.6 2003-04-24 13:33:05 aubourg Exp $
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #include "toimanager.h"
 | 
|---|
| 8 | #include "pexceptions.h"
 | 
|---|
| 9 | #include "ctimer.h"
 | 
|---|
| 10 | #include "ring2cout.h"
 | 
|---|
| 11 | // La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta
 | 
|---|
| 12 | #include "smathconst.h"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | ////////////////////////////////////////////////////////////////////////
 | 
|---|
| 15 | Ring2cout::Ring2cout(long ns, long nr)
 | 
|---|
| 16 |   :totnscount(0)
 | 
|---|
| 17 | {
 | 
|---|
| 18 |   setNSamples(ns);
 | 
|---|
| 19 |   setNRings(nr);
 | 
|---|
| 20 | }
 | 
|---|
| 21 | 
 | 
|---|
| 22 | Ring2cout::~Ring2cout()
 | 
|---|
| 23 | {
 | 
|---|
| 24 | }
 | 
|---|
| 25 | 
 | 
|---|
| 26 | 
 | 
|---|
| 27 | ////////////////////////////////////////////////////////////////////////
 | 
|---|
| 28 | void Ring2cout::Print(::ostream & os)
 | 
|---|
| 29 | {
 | 
|---|
| 30 | }
 | 
|---|
| 31 | 
 | 
|---|
| 32 | ////////////////////////////////////////////////////////////////////////
 | 
|---|
| 33 | void Ring2cout::init() {
 | 
|---|
| 34 |   cout << "Ring2cout::init" << endl;
 | 
|---|
| 35 |   declareInput("Phase");     // input  index 0
 | 
|---|
| 36 | }
 | 
|---|
| 37 | 
 | 
|---|
| 38 | ////////////////////////////////////////////////////////////////////////
 | 
|---|
| 39 | void Ring2cout::run() {
 | 
|---|
| 40 | 
 | 
|---|
| 41 | //---------------------------------------------------------
 | 
|---|
| 42 |   double* val=NULL;
 | 
|---|
| 43 | try {
 | 
|---|
| 44 |   uint_4 mSnRead=0, mSnFilled=0, BadCoorRange=0;
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   cout << " ring " << Nrings << " ns " << Nsamples<< endl;
 | 
|---|
| 47 |   val = new double[Nsamples];
 | 
|---|
| 48 |   for (int k=0; k<Nrings; k++) {
 | 
|---|
| 49 |     
 | 
|---|
| 50 |     double theta= getData(0,k*(Nsamples+2)+0);
 | 
|---|
| 51 |     double phi  = getData(0,k*(Nsamples+2)+1);
 | 
|---|
| 52 |     cout << Nrings << " " << k <<" " <<theta <<" " <<phi<< endl;
 | 
|---|
| 53 |     getData(0,k*(Nsamples+2)+2,Nsamples,val);
 | 
|---|
| 54 |     mSnRead ++;
 | 
|---|
| 55 |     
 | 
|---|
| 56 |     for (int i=0; i< Nsamples;i++)
 | 
|---|
| 57 |       cout <<  i << " " << val[i]<< endl;
 | 
|---|
| 58 |     totnscount+=Nsamples+2;
 | 
|---|
| 59 |     
 | 
|---|
| 60 |   }
 | 
|---|
| 61 |  
 | 
|---|
| 62 |   cout<<"RING2cout::run: Samples Read "<<mSnRead
 | 
|---|
| 63 |       <<" Filled "<<mSnFilled
 | 
|---|
| 64 |       <<" BadCoorRange="<<BadCoorRange<<endl;
 | 
|---|
| 65 |   
 | 
|---|
| 66 |   //---------------------------------------------------------
 | 
|---|
| 67 | } catch (PException & exc) {
 | 
|---|
| 68 |   cout<<"Ring2cout: Catched Exception "<<(string)typeid(exc).name()
 | 
|---|
| 69 |       <<"\n .... Msg= "<<exc.Msg()<<endl;
 | 
|---|
| 70 | }
 | 
|---|
| 71 | 
 | 
|---|
| 72 |  delete[] val; 
 | 
|---|
| 73 |  
 | 
|---|
| 74 | 
 | 
|---|
| 75 |  return;
 | 
|---|
| 76 | }
 | 
|---|
| 77 | 
 | 
|---|
| 78 | 
 | 
|---|
| 79 | 
 | 
|---|
| 80 | 
 | 
|---|
| 81 | 
 | 
|---|
| 82 | 
 | 
|---|
| 83 | 
 | 
|---|
| 84 | 
 | 
|---|
| 85 | 
 | 
|---|
| 86 | 
 | 
|---|
| 87 | 
 | 
|---|
| 88 | 
 | 
|---|
| 89 | 
 | 
|---|
| 90 | 
 | 
|---|
| 91 | 
 | 
|---|
| 92 | 
 | 
|---|
| 93 | 
 | 
|---|
| 94 | 
 | 
|---|