/* definitions */ #define NbossMAX 400 /* type de recherche de bosse */ #define BOSSEN /* define FILTMED */ #include "sopnamsp.h" #include "machdefs.h" #include #include #include #include #include "nomfits.h" #include "fsvcache.h" #include "nbtri.h" #include "nbrandom.h" #include "nbmath.h" #include "fmath.h" #include "filtccd.h" #include "hbook.h" #include "fsvst.h" #include "transfost.h" #include "nbsread.h" #include "nbgene.h" #include "ntuple.h" void FILL_USER(void); float *TimeU[NCOULMX],*FluxU[NCOULMX],*eFluxU[NCOULMX] ,*FluxflU[NCOULMX],*eFluxflU[NCOULMX]; int_4 npt[NCOULMX]; int nslues,nsgood; POutPersist *pos_ = NULL; NTuple *ntbosse = NULL; /*==========================================================================*/ void UINIT(void) { pos_ = new POutPersist("nbsread_bosse.ppf"); } /*===========================================================================*/ #define NXNT 48 void UINITCCD(void) { int_4 ic,n; nslues = nsgood = 0; for(ic=0;ic 0 ) ? nmesure[ic] : 1 ; TimeU[ic] = (float*) malloc((size_t) n*sizeof(float)); FluxU[ic] = (float*) malloc((size_t) n*sizeof(float)); eFluxU[ic] = (float*) malloc((size_t) n*sizeof(float)); FluxflU[ic] = (float*) malloc((size_t) n*sizeof(float)); eFluxflU[ic] = (float*) malloc((size_t) n*sizeof(float)); } // Create NTuple const char *nament[NXNT] = { "etr","etb","fr","fb", "dmin1","dmin2","dm21","dm22", "x1","y1","nptr","nptb", "mostr","mostb","sintr","sintb", "u0","t0","tau","a0", "nbosr","nbosb", "t1Pr","t2Pr","pkPr","nPr","i1Pr","i2Pr", "t1Pb","t2Pb","pkPb","nPb","i1Pb","i2Pb", "t1Sr","t2Sr","pkSr","nSr","i1Sr","i2Sr", "t1Sb","t2Sb","pkSb","nSb","i1Sb","i2Sb", "rec1","rec2" }; if(ntbosse == NULL) delete ntbosse; ntbosse = new NTuple(NXNT,nament); } /*=========================================================================*/ void UDATCLEAN(int coul) /* pour tuer une photo selon des criteres utilisateur, mettre date a GRAND2 */ { int_4 ic = coul-1; if(nmes[ic]<=0) return; for(int i=0;i0) if(staru[1].FluxRef<= 0.) return; FILL_USER(); /* nombre de mesures suffisant */ if( npt[0]<3 || npt[1]<3 ) return; if( iet[0]%50 == 0 ) printf("UEVT: et=[%7d,%7d] pt nmesure=[%5d,%5d] npt=[%5d,%5d]\n" ,iet[0],iet[1],nmesure[0],nmesure[1],npt[0],npt[1]); nsgood++; /****************** Filtre Median *******************************/ for(ic=0;ic0) { I[ic]= classB[ic][0]; I1[ic]= ideb[ic][I[ic]]; I2[ic]= ifin[ic][I[ic]]; t1p[ic] = TimeU[ic][I1[ic]]; t2p[ic] = TimeU[ic][I2[ic]]; if(nbosse[ic]>1) { II[ic]= classB[ic][1]; II1[ic]= ideb[ic][II[ic]]; II2[ic]= ifin[ic][II[ic]]; t1s[ic] = TimeU[ic][II1[ic]]; t2s[ic] = TimeU[ic][II2[ic]]; } } } /********************** calcul du recouvrement R/B ************************/ recouv1 = -1.; if (nbosse[0]>0 && nbosse[1]>0) { dt0 = t2p[0] - t1p[1]; dt1 = t2p[1] - t1p[0]; if ((t2p[0]-t1p[0]) < (t2p[1]-t1p[1])) { min = (t2p[0]-t1p[0]); max = (t2p[1]-t1p[1]); } else { min = (t2p[1]-t1p[1]); max = (t2p[0]-t1p[0]); } if ( dt0*dt1 < 0.) recouv1 = 0.; else if ((mindt1) ? dt1/dt0 : dt0/dt1; } recouv2 = -1.; if (nbosse[0]>1 && nbosse[1]>1) { dt0 = t2s[0] - t1s[1]; dt1 = t2s[1] - t1s[0]; if ((t2s[0]-t1s[0]) < (t2s[1]-t1s[1])) { min = (t2s[0]-t1s[0]); max = (t2s[1]-t1s[1]); } else { min = (t2s[1]-t1s[1]); max = (t2s[0]-t1s[0]); } if ( dt0*dt1 < 0.) recouv2 = 0.; else if ((mindt1) ? dt1/dt0 : dt0/dt1; } /********************** on remplit le ntuple de selection **********************/ for(i=0;i0) { xnt[22] = t1p[0]; /* t1Pr */ xnt[23] = t2p[0]; /* t2Pr */ xnt[24] = Probchi2[0][I[0]]; /* pkPr */ xnt[25] = npoint[0][I[0]]; /* nPr */ xnt[26] = I1[0]; /* i1Pr */ xnt[27] = I2[0]; /* i2Pr */ } /* bosse bleue 1ere */ if(nbosse[1]>0) { xnt[28] = t1p[1]; /* t1Pb */ xnt[29] = t2p[1]; /* t2Pb */ xnt[30] = Probchi2[1][I[1]]; /* pkPb */ xnt[31] = npoint[1][I[1]]; /* nPb */ xnt[32] = I1[1]; /* i1Pb */ xnt[33] = I2[1]; /* i2Pb */ } /* bosse rouge 2sd */ if(nbosse[0]>1) { xnt[34] = t1s[0]; /* t1Sr */ xnt[35] = t2s[0]; /* t2Sr */ xnt[36] = Probchi2[0][II[0]]; /* pkSr */ xnt[37] = npoint[0][II[0]]; /* nSr */ xnt[38] = II1[0]; /* i1Sr */ xnt[39] = II2[0]; /* i2Sr */ } /* bosse bleue 2sd */ if(nbosse[1]>1) { xnt[40] = t1s[1]; /* t1Sb */ xnt[41] = t2s[1]; /* t2Sb */ xnt[42] = Probchi2[1][II[1]]; /* pkSb */ xnt[43] = npoint[1][II[1]]; /* nSb */ xnt[44] = II1[1]; /* i1Sb */ xnt[45] = II2[1]; /* i2Sb */ } /* recouvrement 1ere 2sd */ xnt[46] = recouv1; /* rec1 */ xnt[47] = recouv2; /* rec2 */ ntbosse->Fill(xnt); } /*=========================================================================*/ void UENDCCD(void) { int ic; printf("Nombre d etoiles lues= %d, bonnes= %d, mauvaises=%d\n" ,nslues,nsgood,nslues-nsgood); fflush(stdout); for(ic=0;icNEntry()>0) pos_->PutObject(*ntbosse,"ntbosse"); if(ntbosse!=NULL) delete ntbosse; ntbosse = NULL; } /*=========================================================================*/ void UEND(void) { if(pos_!=NULL) delete pos_; pos_ = NULL; } /*=========================================================================*/ void FILL_USER(void) { int ic,i,j; double Flux,FluxB,Xi2,ErrFlux; for(ic=0;ic 0) Flux *= ampli[ic][j]; FluxU[ic][npt[ic]] = Flux; eFluxU[ic][npt[ic]] = ErrFlux; npt[ic]++; } } }