Changeset 3058 in Sophya for trunk/SophyaPI/PIext/pawexecut.cc
- Timestamp:
- Aug 13, 2006, 3:15:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pawexecut.cc
r2817 r3058 218 218 kw = "h/plot/2d"; 219 219 usage = "Specific plot for 2D histogrammes"; 220 usage += "\n h/plot/2d nameh2d show : infos on 2D histogramme ";220 usage += "\n h/plot/2d nameh2d show : infos on 2D histogramme projections"; 221 221 usage += "\n h/plot/2d nameh2d h [dopt] : plot 2D histogramme"; 222 222 usage += "\n h/plot/2d nameh2d px [dopt] : plot X projection"; … … 227 227 usage += "\n h/plot/2d nameh2d sy n [dopt] : plot Y slice number n"; 228 228 usage += "\n n < 0 means Show Info"; 229 piac->RegisterCommand(kw,usage,this,hgrp); 230 231 kw = "h/2d/geth"; 232 usage = "Get histo projections, bandes and slices"; 233 usage += "\n h/2d/geth nameh2d : infos on 2D histogramme projections"; 234 usage += "\n h/2d/geth h nameh2d px : copy X projection into histo h"; 235 usage += "\n h/2d/geth h nameh2d py : copy Y projection into histo h"; 236 usage += "\n h/2d/geth h nameh2d bx n : copy X band number n into histo h"; 237 usage += "\n h/2d/geth h nameh2d by n : copy Y band number n into histo h"; 238 usage += "\n h/2d/geth h nameh2d sx n : copy X slice number n into histo h"; 239 usage += "\n h/2d/geth h nameh2d sy n : copy Y slice number n into histo h"; 240 usage += "\n Related commands: h/plot/2d"; 229 241 piac->RegisterCommand(kw,usage,this,hgrp); 230 242 … … 346 358 } else if(kw == "h/plot/2d") { 347 359 h_plot_2d(tokens); return(0); 360 } else if(kw == "h/2d/geth") { 361 h_2d_geth(tokens); return(0); 348 362 } else if(kw == "h/put_vec") { 349 363 h_put_vec(tokens); return(0); … … 1837 1851 1838 1852 /* methode */ 1853 void PAWExecutor::h_2d_geth(vector<string>& tokens) 1854 // copy bandx/y, slicex/y or projx/y from an 2D histo into a 1D histo 1855 { 1856 NamedObjMgr omg; 1857 1858 if(tokens.size()==1) { 1859 AnyDataObj* mobj = omg.GetObj(tokens[0]); 1860 Histo2D* h2 = dynamic_cast<Histo2D*>(mobj); 1861 if(!h2) return; 1862 h2->ShowProj(); 1863 h2->ShowBand(2); 1864 h2->ShowSli(2); 1865 return; 1866 } 1867 1868 if(tokens.size()<3) 1869 {cout<<"Usage: h/2d/geth h nameh2d [px,py,bx n,by n,sx n,sy n]"<<endl; return;} 1870 1871 string nameh1 = tokens[0]; 1872 string nameh2 = tokens[1]; 1873 string proj = tokens[2]; 1874 int_4 nump = (tokens.size()>3)? atoi(tokens[3].c_str()): -1; 1875 1876 // Decodage Histo2D 1877 AnyDataObj* mobj = omg.GetObj(tokens[1]); 1878 if(mobj==NULL) 1879 {cout<<"PAWExecutor::h_2d_geth Error: unknow object"<<tokens[1]<<endl; 1880 return;} 1881 Histo2D* h2 = dynamic_cast<Histo2D*>(mobj); 1882 if(!h2) 1883 {cout<<"PAWExecutor::h_plot_2d Error: "<<tokens[1]<<" not an Histo2D"<<endl; 1884 return;} 1885 1886 // Remplissage histo 1D avec la projection demandee 1887 Histo *h1p; 1888 if(proj == "px") { 1889 if((h1p=h2->HProjX())) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1890 else h2->ShowProj(); 1891 } else if(proj == "py") { 1892 if((h1p=h2->HProjY())) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1893 else h2->ShowProj(); 1894 } else if(proj == "bx" && nump>=0) { 1895 if((h1p=h2->HBandX(nump))) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1896 else h2->ShowBand(); 1897 } else if(proj == "by" && nump>=0) { 1898 if((h1p=h2->HBandY(nump))) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1899 else h2->ShowBand(); 1900 } else if(proj == "sx" && nump>=0) { 1901 if((h1p=h2->HSliX(nump))) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1902 else h2->ShowSli(); 1903 } else if(proj == "sy" && nump>=0) { 1904 if((h1p=h2->HSliY(nump))) {Histo* h=new Histo(*h1p); omg.AddObj(h,nameh1);} 1905 else h2->ShowSli(); 1906 } else { 1907 cout<<"PAWExecutor::h_2d_geth Error: Unknown proj name "<<proj 1908 <<" or bad projection number "<<nump<<endl; 1909 } 1910 1911 return; 1912 } 1913 1914 /* methode */ 1839 1915 int_4 PAWExecutor::decodepawstring(string tokens,string& nameobj 1840 1916 ,string& xexp,string& yexp,string& zexp)
Note:
See TracChangeset
for help on using the changeset viewer.