#include "sopnamsp.h" #include "machdefs.h" #include #include #include #include #include #include #include "timing.h" #include "histerr.h" #include "hist2err.h" #include "fitshisterr.h" int ObjectType(string nameh,string nameppf); int ConcatHistoErr(string nameh,vector ppfname,int wrtyp,bool do_cov); int ConcatHisto2DErr(string nameh,vector ppfname,int wrtyp); void usage(void); void usage(void) { cout <<"cmvconcherr -w wtyp -n name_histoerr file1.ppf file2.ppf ..."< ppfname; int Write_Type = 3; bool Do_Cov = false; // --- Decodage arguments char c; while((c = getopt(narg,arg,"hCn:w:")) != -1) { switch (c) { case 'n' : nameh = optarg; break; case 'w' : sscanf(optarg,"%d",&Write_Type); break; case 'C' : Do_Cov = true; break; case 'h' : default : usage(); return -1; } } if(nameh.size()<=0 || optind>=narg) {usage(); return -1;} for (int i=optind;iDataObj(); cout<<"Object type read from input PPF file : "<(obj); if(herr) return 1; Histo2DErr *herr2 = dynamic_cast(obj); if(herr2) return 2; return 0; } //--------------------------------------------------------------- int ConcatHistoErr(string nameh,vector ppfname,int wrtyp,bool do_cov) { if(ppfname.size()<=0) return 0; HistoErr *herrconc = NULL; TVector Tsum; TMatrix Tsum2; int nherr=0, nread=0, itest=0; double sum=0., sum2=0., nsum=0; for (int ifile=0;ifileWriteASCII(asname); } if(wrtyp&2 || do_cov) { // ecriture PPF string tagobs = "cmvconcherr.ppf"; POutPersist posobs(tagobs); tagobs = "herrconc"; posobs.PutObject(*herrconc,tagobs); if(do_cov) { tagobs = "mean"; posobs.PutObject(Tsum,tagobs); tagobs = "cov"; posobs.PutObject(Tsum2,tagobs); } } if(wrtyp&4) { // ecriture FITS FitsInOutFile fio("!cmvconcherr.fits",FitsInOutFile::Fits_Create); fio << *herrconc; } delete herrconc; return nread; } //--------------------------------------------------------------- int ConcatHisto2DErr(string nameh,vector ppfname,int wrtyp) { if(ppfname.size()<=0) return 0; Histo2DErr *herrconc = NULL; int nherrx=0, nherry=0, nread=0, itestx=0, itesty=0; double sum=0., sum2=0., nsum=0; for (int ifile=0;ifileNBinX()/5.+0.5); itesty = int(herrconc->NBinY()/5.+0.5); } else if(nherrx!=herr.NBinX() || nherry!=herr.NBinY()) { cout<<"BAD NUMBER OF BINS"<WriteASCII(asname); } if(wrtyp&2) { // ecriture PPF string tagobs = "cmvconcherr2.ppf"; POutPersist posobs(tagobs); tagobs = "herrconc2"; posobs.PutObject(*herrconc,tagobs); } if(wrtyp&4) { // ecriture FITS FitsInOutFile fio("!cmvconcherr2.fits",FitsInOutFile::Fits_Create); fio << *herrconc; } delete herrconc; return nread; } /* #### HistoErr 1D openppf cmvconcherr.ppf zone 2 2 disp herrconc "hbincont err" disp herrconc "hbinerr" disp herrconc "hbinent" zone n/plot herrconc.val%log10(x) x>0 ! "connectpoints" n/plot herrconc.sqrt(err2)%log10(x) x>0&&err2>0 ! "connectpoints same red" n/plot herrconc.sqrt(err2)/val%log10(x) x>0&&err2>0&&val>0 ! "connectpoints" disp mean imag cov del cor c++exec \ TMatrix cor(cov,false); cor = 0.; \ for(int i=0;i