source: Sophya/trunk/FrEROS/AnaLC/nbsreadu_ppf.cc@ 3572

Last change on this file since 3572 was 3572, checked in by cmv, 17 years ago

char* -> const char* pour regler les problemes de deprecated string const... + comparaison unsigned signed + suppression EVOL_PLANCK rz+cmv 07/02/2009

  • Property svn:executable set to *
File size: 8.8 KB
Line 
1/*
2- Creation de NTuple et de courbes de lumieres:
3nbsreadu_squel fichier.dataccd -prt 1 \
4 -mc 2 -u0 0.01,0.5 -t0 1,-1,-1 -tau 2,10,-1 -tf 2,0,2 -bl 1
5*/
6#include "sopnamsp.h"
7#include "machdefs.h"
8#include <iostream>
9#include <stdlib.h>
10#include <math.h>
11#include <stdio.h>
12#include <string.h>
13
14#include "fsvcache.h"
15#include "fsvst.h"
16#include "fmath.h"
17#include "nbmath.h"
18#include "nbrandom.h"
19#include "nbsread.h"
20#include "nbgene.h"
21
22#include "ntuple.h"
23#include "tvector.h"
24
25POutPersist *pos_ = NULL;
26NTuple *ntsti_[2] = {NULL,NULL};
27
28/*================================================================*/
29void UINIT(void)
30{
31 printf("UINIT\n");
32 pos_ = new POutPersist("nbsread_ppf.ppf");
33}
34
35/*=================== ============================================*/
36void UDATCLEAN(int coul)
37/*
38 Attention ici coul = 1,2
39 donc pour tuer une image pour la couleur coul:
40 date[coul-1][...] = GRAND2;
41*/
42{
43 int ic = coul - 1;
44 cout<<"UDATCLEAN: couleur "<<coul<<", indice tableau "<<ic<<endl;
45 if(nmes[ic]<=0) return;
46
47 TVector<r_8> vdate(nmes[ic]); vdate = 0;
48 for(int i=0;i<nmes[ic];i++) {
49 vdate(i) = date[ic][i];
50 if(date[ic][i]<0.) date[ic][i] = GRAND2;
51 if(timeu[ic][i].FgCalib<=0) date[ic][i] = GRAND2;
52 }
53
54 char str[16]; sprintf(str,"date%d",ic);
55 pos_->PutObject(vdate,str);
56
57}
58
59/*================================================================*/
60void UINITCCD(void)
61{
62 printf("UINITCCD: Debut de l'etude du CCD %d %d\n",numccd,ccdnum);
63
64 // Fill TimeInfoU into NTuple
65 const int nxtn = 12;
66 const char *nament[nxtn] =
67 {"ts","texp","fd","sfd","sx","sy","rho","dx","dy","absor","amass","fgcal"};
68 r_8 xnt[nxtn];
69 NTuple nttinf(nxtn,nament);
70
71 for(int ic=0;ic<NCOULMX;ic++) {
72 if(nmesure[ic]<=0) continue;
73 NTuple nttinf(nxtn,nament);
74 for(int j=0;j<nmesure[ic];j++) {
75 int i = indexu[ic][j];
76 xnt[0] = timeu[ic][i].TStart/86400.;
77 xnt[1] = timeu[ic][i].Expose;
78 xnt[2] = timeu[ic][i].Fond;
79 xnt[3] = timeu[ic][i].SigFond;
80 xnt[4] = timeu[ic][i].SigX;
81 xnt[5] = timeu[ic][i].SigY;
82 xnt[6] = timeu[ic][i].Rho;
83 xnt[7] = timeu[ic][i].DelX;
84 xnt[8] = timeu[ic][i].DelY;
85 xnt[9] = timeu[ic][i].Absorption;
86 xnt[10] = timeu[ic][i].AirMass;
87 xnt[11] = timeu[ic][i].FgCalib;
88 nttinf.Fill(xnt);
89 }
90 char str[16]; sprintf(str,"tinf%d",ic);
91 pos_->PutObject(nttinf,str);
92 }
93
94 // Create NTuple for StarInfo
95 const int nsti = 12;
96 const char *namentsti[nsti] =
97 {"net","xref","fmean","fsig","fref","xp","yp","dm","dm2","dm2r","fgref","nbvois"};
98 for(int ic=0;ic<NCOULMX;ic++) {
99 cout<<"...Creating NTuple for StarInfo ic="<<ic<<endl;
100 if(ntsti_[ic] == NULL) delete ntsti_[ic];
101 ntsti_[ic] = new NTuple(nsti,namentsti);
102 }
103
104}
105
106/*================================================================*/
107void UEVT(void)
108{
109 printf("****> Et=%d (%d) %d (%d) fref=%g %g nmes=%d %d nmesure=%d %d\n"
110 ,iet[0],staru[0].XRef,iet[1],staru[1].XRef,staru[0].FluxRef,staru[1].FluxRef
111 ,nmes[0],nmes[1],nmesure[0],nmesure[1]);
112
113 // Fill StarInfo information into NTuple
114 for(int ic=0;ic<NCOULMX;ic++) {
115 if(iet[ic]<=0) continue; // pas d'etoile associee
116 int n = ntsti_[ic]->NVar();
117 if(n<=0) continue;
118 r_8 *xnt = new r_8[n];
119 xnt[0] = staru[ic].NumEt;
120 xnt[1] = staru[ic].XRef;
121 xnt[2] = staru[ic].FlxMean;
122 xnt[3] = staru[ic].FlxSig;
123 xnt[4] = staru[ic].FluxRef;
124 xnt[5] = staru[ic].XPos;
125 xnt[6] = staru[ic].YPos;
126 xnt[7] = staru[ic].DisMin;
127 xnt[8] = staru[ic].DisM2;
128 xnt[9] = staru[ic].DisM2R;
129 xnt[10] = staru[ic].FgRef;
130 xnt[11] = staru[ic].NbVois;
131 ntsti_[ic]->Fill(xnt);
132 delete [] xnt;
133 }
134
135 // Fill light curve into NTuple
136 if(FgSelSt==iet[0]) {
137 cout<<"...Writing light curve for "<<iet[0]<<" "<<iet[1]<<endl;
138
139 const int nxtn = 15;
140 const char *nament[nxtn] =
141 {"ic",
142 "ts","fd","sx","sy","rho",
143 "f","fb","xi2","ef","efb","fdl","s9p","pxm",
144 "fr"
145 };
146 r_8 xnt[nxtn];
147 NTuple nt(nxtn,nament);
148
149 for(int ic=0;ic<NCOULMX;ic++) {
150 if(iet[ic]<=0) continue; // pas d'etoile associee
151 if(nmesure[ic]<=0) continue;
152 for(int j=0;j<nmesure[ic];j++) {
153 int i = indexu[ic][j];
154 xnt[0] = ic;
155 xnt[1] = timeu[ic][i].TStart/24.;
156 xnt[2] = timeu[ic][i].Fond;
157 xnt[3] = timeu[ic][i].SigX;
158 xnt[4] = timeu[ic][i].SigY;
159 xnt[5] = timeu[ic][i].Rho;
160 xnt[6] = mesu[ic][i].Flux;
161 xnt[7] = mesu[ic][i].FluxB;
162 xnt[8] = mesu[ic][i].Xi2;
163 xnt[9] = mesu[ic][i].ErrFlux;
164 xnt[10] = mesu[ic][i].ErrFluxB;
165 xnt[11] = mesu[ic][i].Fond;
166 xnt[12] = mesu[ic][i].S9Pix;
167 xnt[13] = mesu[ic][i].PixMax;
168 xnt[14] = staru[ic].FluxRef;
169 nt.Fill(xnt);
170 }
171 }
172 if(nt.NEntry()>0) {
173 char str[64]; sprintf(str,"e%d",iet[0]);
174 pos_->PutObject(nt,str);
175 }
176
177 }
178
179}
180
181/*================================================================*/
182void UENDCCD(void)
183{
184 printf("UENDCCD: Fin de l'etude du CCD %d %d\n",numccd,ccdnum);
185 if(ntsti_[0]->NEntry()>0) pos_->PutObject(*ntsti_[0],"sti0");
186 if(ntsti_[1]->NEntry()>0) pos_->PutObject(*ntsti_[1],"sti1");
187 if(ntsti_[0]!=NULL) delete ntsti_[0]; ntsti_[0] = NULL;
188 if(ntsti_[1]!=NULL) delete ntsti_[1]; ntsti_[1] = NULL;
189}
190
191/*================================================================*/
192void UEND(void)
193{
194 printf("UEND: Fin du job\n");
195 if(pos_!=NULL) delete pos_; pos_ = NULL;
196}
197
198
199/*
200
201openppf nbsread_ppf.ppf
202
203zone 1 2
204n/plot date0.val%n val>0
205n/plot date1.val%n val>0
206
207#### timeinfo
208zone 1 2
209
210n/plot tinf0.fd%ts ! ! "circlemarker3 red"
211n/plot tinf1.fd%ts ! ! "circlemarker3 blue"
212
213n/plot tinf0.sx%ts ! ! "circlemarker3 red"
214n/plot tinf1.sx%ts ! ! "circlemarker3 blue"
215
216n/plot tinf0.sy%ts ! ! "circlemarker3 red"
217n/plot tinf1.sy%ts ! ! "circlemarker3 blue"
218
219n/plot tinf0.rho%ts ! ! "circlemarker3 red"
220n/plot tinf1.rho%ts ! ! "circlemarker3 blue"
221
222n/plot tinf0.dx%ts ! ! "circlemarker3 red"
223n/plot tinf1.dx%ts ! ! "circlemarker3 blue"
224
225n/plot tinf0.dy%ts ! ! "circlemarker3 red"
226n/plot tinf1.dy%ts ! ! "circlemarker3 blue"
227
228n/plot tinf0.absor%ts ! ! "circlemarker3 red"
229n/plot tinf1.absor%ts ! ! "circlemarker3 blue"
230
231n/plot tinf0.amass%ts ! ! "circlemarker3 red"
232n/plot tinf1.amass%ts ! ! "circlemarker3 blue"
233
234n/plot tinf0.fgcal%ts ! ! "circlemarker3 red"
235n/plot tinf1.fgcal%ts ! ! "circlemarker3 blue"
236
237#### starinfo
238zone
239
240n/plot sti0.yp%xp ! ! "nsta red crossmarker5"
241n/plot sti1.yp%xp ! ! "nsta blue circlemarker5 same"
242
243n/plot sti0.log10(fref) fref>0 ! ! "red"
244n/plot sti1.log10(fref) fref>0 ! ! "blue keepbin same"
245
246n/plot sti0.dm xref>0 ! ! "red"
247n/plot sti1.dm xref>0 ! ! "blue keepbin same"
248
249n/plot sti0.dm2 xref>0 ! ! "red"
250n/plot sti1.dm2 xref>0 ! ! "blue keepbin same"
251
252n/plot sti0.nbvois ! ! ! "red"
253n/plot sti1.nbvois ! ! ! "blue keepbin same"
254
255n/plot sti0.dm2%dm xref>0 ! "nsta red crossmarker5"
256n/plot sti1.dm2%dm xref>0 ! "nsta blue circlemarker5"
257
258#### light curve
259set et 2005
260
261zone 1 2
262n/plot e$et.f%ts ic==0 ! "nsta connectpoints red circlemarker3"
263n/plot e$et.f%ts ic==1 ! "nsta connectpoints blue circlemarker3"
264
265n/plot e$et.ef%ts ic==0 ! "nsta connectpoints red circlemarker3"
266n/plot e$et.ef%ts ic==1 ! "nsta connectpoints blue circlemarker3"
267
268n/plot e$et.fb%ts ic==0 ! "nsta connectpoints red circlemarker3"
269n/plot e$et.fb%ts ic==1 ! "nsta connectpoints blue circlemarker3"
270
271n/plot e$et.efb%ts ic==0 ! "nsta connectpoints red circlemarker3"
272n/plot e$et.efb%ts ic==1 ! "nsta connectpoints blue circlemarker3"
273
274n/plot e$et.(f-fb)/f%ts ic==0&&f>0 ! "nsta connectpoints red circlemarker3"
275n/plot e$et.(f-fb)/f%ts ic==1&&f>0 ! "nsta connectpoints blue circlemarker3"
276
277n/plot e$et.fd%ts ic==0 ! "nsta connectpoints red circlemarker3"
278n/plot e$et.fd%ts ic==1 ! "nsta connectpoints blue circlemarker3"
279
280n/plot e$et.fdl%ts ic==0 ! "nsta connectpoints red circlemarker3"
281n/plot e$et.fdl%ts ic==1 ! "nsta connectpoints blue circlemarker3"
282
283n/plot e$et.s9p%ts ic==0 ! "nsta connectpoints red circlemarker3"
284n/plot e$et.s9p%ts ic==1 ! "nsta connectpoints blue circlemarker3"
285
286n/plot e$et.pxm%ts ic==0 ! "nsta connectpoints red circlemarker3"
287n/plot e$et.pxm%ts ic==1 ! "nsta connectpoints blue circlemarker3"
288
289# Distributions
290zone
291
292n/plot e$et.fb ic==0
293n/plot e$et.f ic==0 ! ! "keepbin same red"
294n/plot e$et.fb ic==1
295n/plot e$et.f ic==1 ! ! "keepbin same blue"
296
297n/plot e$et.fdl ic==0 ! ! "red"
298n/plot e$et.fdl ic==1 ! ! "keepbin same blue"
299
300n/plot e$et.s9p ic==0 ! ! "red"
301n/plot e$et.s9p ic==1 ! ! "keepbin same blue"
302
303n/plot e$et.pxm ic==0 ! ! "red"
304n/plot e$et.pxm ic==1 ! ! "keepbin same blue"
305
306# Correlations
307zone
308
309n/plot e$et.f%fb ic==0 ! "red circlemarker3"
310func x 0 1000 10000 "same"
311n/plot e$et.f%fb ic==1 ! "blue circlemarker3"
312func x 0 1000 10000 "same"
313
314n/plot e$et.s9p%fb ic==0 ! "red circlemarker3"
315func x 0 1000 10000 "same"
316n/plot e$et.s9p%fb ic==1 ! "blue circlemarker3"
317func x 0 1000 10000 "same"
318
319n/plot e$et.pxm%fb ic==0 ! "red circlemarker3"
320func x 0 1000 10000 "same"
321n/plot e$et.pxm%fb ic==1 ! "blue circlemarker3"
322func x 0 1000 10000 "same"
323func x 0 1000 10000 "same"
324
325 */
Note: See TracBrowser for help on using the repository browser.