/* Distributions de masse pour n=1,2,3,... tirages */ #include "sopnamsp.h" #include "machdefs.h" // Pour faire les histogrammes des distributions de masses // pour ntirages: // ex: on a un pixel qui a N galaxies, quelle est la distribution // statistique de masse dans un tel pixel ? // > cmvschdist -a -v -m 1e+7,1e+14 -n 140 -r 200 -N 100000 #include #include #include #include #include #include #include "timing.h" #include "histos.h" #include "ntuple.h" #include "srandgen.h" #include "perandom.h" #include "geneutils.h" #include "cosmocalc.h" #include "schechter.h" #include void usage(void); void usage(void) { cout<<"cmvschdist -m xmin,xmax -a -n nbin -r ngmax,ngmin -N nalea"<xmax) xmax=10.*xmin; break; case 'r' : sscanf(optarg,"%d,%d",&ngmax,&ngmin); if(ngmin<=0) ngmin=1; if(ngmax<=0) ngmax=ngmin; if(ngmin>ngmax) ngmin=ngmax; break; case 'n' : sscanf(optarg,"%d",&npt); if(npt<=0) npt = 100; break; case 'N' : sscanf(optarg,"%llu",&nalea); if(nalea<=0) nalea=10000; break; case 'v' : verif = true; break; case 'a' : Auto_Ini_Ranf(5); break; case 'h' : default : usage(); return -1; } } double lnx1=log10(xmin), lnx2=log10(xmax), dlnx = (lnx2-lnx1)/npt; cout<<"xmin="< Schechter m*dn/dm nstar="< Creating "< vhisto; vector vhname; for(int i=ngmin;i<=ngmax;i++) { Histo h(hmdndm); h.Zero(); vhisto.push_back(h); char str[32]; sprintf(str,"h%d",i); vhname.push_back(string(str)); } //------- Random InitTim(); cout<<"> Random: "<0) { bigsum /= (double)nbigsum; cout<<"Mean mass : "< vtir; vector vtname; vector vthisto; vector vthname; if(verif) { cout<<"> Creating "< Checking tirage"<0) for(unsigned int i=0;i0) pos.PutObject(vhisto[i],vhname[i]); if(vthisto.size()>0) for(unsigned int i=0;i0) pos.PutObject(vthisto[i],vthname[i]); return 0; } /* delobjs * openppf cmvschdist.ppf set n 70 echo ${h70.vmax} set h h$n set th th$n disp $h disp $th "same red" n/plot $h.val%x ! ! "connectpoints" n/plot $th.val%x ! ! "nsta connectpoints same red" n/plot $h.log10(val)%x val>0. ! "connectpoints" n/plot $th.log10(val)%x val>0. ! "nsta connectpoints same red" c++exec \ for(int i=0;i<$h.NBins();i++) \ if($h(i)>0.) { \ cout<