source: Sophya/trunk/ArchTOIPipe/ProcWSophya/toi2ring.cc@ 2319

Last change on this file since 2319 was 2319, checked in by cecile, 23 years ago

* empty log message *

File size: 2.9 KB
Line 
1// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
2// Eric Aubourg
3// Christophe Magneville
4// Reza Ansari
5// $Id: toi2ring.cc,v 1.2 2003-01-30 17:19:25 cecile Exp $
6
7#include "toimanager.h"
8#include "pexceptions.h"
9#include "ctimer.h"
10#include "toi2ring.h"
11// La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta
12#include "smathconst.h"
13
14////////////////////////////////////////////////////////////////////////
15Toi2RING::Toi2RING(long n)
16 :totnscount(0), nRings(0)
17{
18 setNSamples(n);
19}
20
21Toi2RING::~Toi2RING()
22{
23}
24
25
26////////////////////////////////////////////////////////////////////////
27void Toi2RING::Print(::ostream & os)
28{
29}
30
31////////////////////////////////////////////////////////////////////////
32void Toi2RING::init() {
33 cout << "Toi2RING::init" << endl;
34 declareInput("Theta"); // input index 0
35 declareInput("Phi"); // input index 0
36 declareInput("Phase"); // input index 0
37 declareInput("Value"); // input index 1
38 declareOutput("CircTheta"); // output index 0
39 declareOutput("CircPhi"); // output index 0
40 declareOutput("Rvalue"); // output index 0
41 // declareOutput("WRvalue"); // output index 1
42}
43
44////////////////////////////////////////////////////////////////////////
45void Toi2RING::run() {
46
47long snb = getMinIn();
48long sne = getMaxIn();
49if(snb>sne) {
50 cout<<"Toi2RING::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
51 throw ParmError("Toi2RING::run() - Bad sample interval");
52}
53
54//---------------------------------------------------------
55try {
56
57
58uint_4 mSnRead=0, mSnFilled=0, BadCoorRange=0;
59 int_8 Nrings=0,i;
60
61 double phi_prec=-1.;
62 double* r = new double[Nsamples];
63 double* wr = new double[Nsamples];
64 for(i=0;i<Nsamples;i++) {
65 wr[i]=0;
66 r[i]=0;
67 }
68
69
70
71for(int k=snb;k<=sne;k++) {
72
73 uint_8 flg = 0;
74 double ctheta = getData(0,k);
75 double cphi = getData(1,k);
76 double phi = getData(2,k);
77 double val = getData(3,k);
78 mSnRead++;
79
80 i=(int)(phi*Nsamples/360.);
81 r[i]+= val;
82 wr[i]++;
83
84 cout << phi << " " << phi_prec << " " << Nrings <<endl;
85
86 if(phi < phi_prec){
87
88 putData(0,Nrings,ctheta);
89 putData(1,Nrings,cphi);
90
91 for(i=0;i<Nsamples;i++) {
92 if(wr[i] == 0) r[i] = -999999.;
93 cout << i << " " << Nrings << " " << Nsamples << " " << ctheta << " " << cphi << " " << r[i]<< endl;
94 putData(2,Nrings*Nsamples+i,r[i]);
95 // putData(1,Nrings*Nsamples+i,wr[i]);
96 wr[i]=0;
97 r[i]=0.;
98 }
99
100 Nrings++;
101 }
102
103
104 phi_prec=phi;
105 totnscount++;
106}
107
108cout<<"RING2Toi::run: Samples Read "<<mSnRead
109 <<" Filled "<<mSnFilled
110 <<" BadCoorRange="<<BadCoorRange<<endl;
111
112//---------------------------------------------------------
113} catch (PException & exc) {
114 cout<<"Toi2RING: Catched Exception "<<(string)typeid(exc).name()
115 <<"\n .... Msg= "<<exc.Msg()<<endl;
116}
117
118return;
119}
Note: See TracBrowser for help on using the repository browser.