#include "machdefs.h" #include "toimanager.h" #include "pexceptions.h" #include "ntuple.h" #include "ktoibad.h" //////////////////////////////////////////////////////////////////////// // Recherche des glitches : // INPUT: // lg : longeur maxi d'un glitch (impair, si pair lg++) // doit etre suffisamment long pour que les glitches soient <--lg--><---lm---> // doit etre suffisamment long pour avoir une bonne stabilite // des calculs (a0,a1) et suffisamment court pour ne pas // tuer la galaxie. // nsg : nombre de sigmas pour valider un glitch //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// FlagGlitch::FlagGlitch(uint_4 lg,uint_4 lm,r_8 nsg) : mLP(0), mLPsnb(-1), mLPsne(-1) { // Mise en forme des arguments if(nsg<=0) nsg = 3.; if(lg<=0) lg=3; if(lg%2==0) lg++; if(lm<3) lm = 5*lg; LGlitch = lg; LSide = lm; NSCut = nsg; Slpb[0] = Slpb[1] = NULL; DoNotLookAt(); SetFlag(); SetBuffUpd(); } FlagGlitch::~FlagGlitch() { for(int i=0;i<2;i++) {if(Slpb[i]) delete Slpb[i]; Slpb[i]=NULL;} } //////////////////////////////////////////////////////////////////////// void FlagGlitch::Print(ostream & os) { os<<"FlagGlitch::Print" <<" LGlitch="<sne) { cout<<"FlagGlitch::run() - Bad sample interval"<<--lg--><---lm---> // | c=0 | | c=1 | // ideb | | ifin // ifin ideb r_8 bolo; uint_8 fgbolo=0; int_4 ifill[2] = {sn-lgs2-1,sn+lgs2+lm}; if(lp>1) printf(">>>> sn=%d v=(%f,%ld) ifill=[%d,%d]\n" ,sn,bolog,fgbolog,ifill[0],ifill[1]); if(ifill[0]Pop(); else Slpb[0]->Push((r_8)ifill[0],bolo); if((int_4)Slpb[0]->NPoints()Pop(); else Slpb[1]->Push((r_8)ifill[1],bolo); } else Slpb[1]->Pop(); if((int_4)Slpb[1]->NPoints()Compute(mean); slin[c] = Slpb[c]->Compute(a0,a1); ypred[c] = a0+a1*sn; if(lp>1) printf("... c=%d m=%f s=%f ypred=%f slin=%f (%d)\n" ,c,mean,s[c],ypred[c],slin[c],Slpb[c]->NPoints()); if(slin[c]<0. || s[c]<0.) { putData(0,sn,bolog,fgbolog); continue; } } if(intuple>0) { xnt_[0] = sn; xnt_[1] = bolog; xnt_[2] = s[0]; xnt_[3] = s[1]; xnt_[4] = slin[0]; xnt_[5] = slin[1]; xnt_[6] = ypred[0]; xnt_[7] = ypred[1]; nt_.Fill(xnt_); } // Si les predictions ne sont pas compatibles (sig), pas de deglitch r_8 yy = ypred[1]-ypred[0]; r_8 sy = nsg*sqrt(s[0]*s[0]+s[1]*s[1]); if(lp>1) printf("... yy=|%f| > sy=%f ???\n",yy,sy); if(fabs(yy) > sy) { putData(0,sn,bolog,fgbolog); continue; } // Si la valeur est entre les 2 predictions, pas de deglitch r_8 dp0 = ypred[0]; r_8 dp1 = ypred[1]; if(ypred[1]1) printf("... %f dans [%f,%f] ???\n",bolog,dp0,dp1); if(dp01) printf("... dp0=%f > %f et dp1=%f > %f ???\n" ,dp0,slin[0],dp1,slin[1]); if(dp0 < slin[0] || dp1 < slin[1]) { putData(0,sn,bolog,fgbolog); continue; } // C'est un glitch nflag++; fgbolog |= flgGlitch; if(lp>1) printf("......... Glitch en sn=%d ... %d glitches found\n",sn,nflag); putData(0,sn,bolog,fgbolog); } if(mLP) cout<<"FlagGlitch::run(): Fin de boucle: nflag="<0) { char *fileout_ = "flagglitch.ppf"; string tag_ = "nfg"; POutPersist pos_(fileout_); pos_.PutObject(nt_,tag_); } //--------------------------------------------------------- } catch (PException & exc) { cout<<"FlagGlitch: Catched Exception "<<(string)typeid(exc).name() <<"\n .... Msg= "<