Changeset 3058 in Sophya for trunk/SophyaPI/PIext/pawexecut.cc


Ignore:
Timestamp:
Aug 13, 2006, 3:15:57 PM (19 years ago)
Author:
cmv
Message:

pawexecutor: copie dans Histo des projections assiciees a un Histo2D cmv 13/8/2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pawexecut.cc

    r2817 r3058  
    218218kw = "h/plot/2d";
    219219usage = "Specific plot for 2D histogrammes";
    220 usage += "\n h/plot/2d nameh2d show        : infos on 2D histogramme";
     220usage += "\n h/plot/2d nameh2d show        : infos on 2D histogramme projections";
    221221usage += "\n h/plot/2d nameh2d h    [dopt] : plot 2D histogramme";
    222222usage += "\n h/plot/2d nameh2d px   [dopt] : plot X projection";
     
    227227usage += "\n h/plot/2d nameh2d sy n [dopt] : plot Y slice number n";
    228228usage += "\n                      n < 0 means Show Info";
     229piac->RegisterCommand(kw,usage,this,hgrp);
     230
     231kw = "h/2d/geth";
     232usage = "Get histo projections, bandes and slices";
     233usage += "\n h/2d/geth nameh2d         : infos on 2D histogramme projections";
     234usage += "\n h/2d/geth h nameh2d px    : copy X projection into histo h";
     235usage += "\n h/2d/geth h nameh2d py    : copy Y projection into histo h";
     236usage += "\n h/2d/geth h nameh2d bx n  : copy X band number n into histo h";
     237usage += "\n h/2d/geth h nameh2d by n  : copy Y band number n into histo h";
     238usage += "\n h/2d/geth h nameh2d sx n  : copy X slice number n into histo h";
     239usage += "\n h/2d/geth h nameh2d sy n  : copy Y slice number n into histo h";
     240usage += "\n  Related commands: h/plot/2d"; 
    229241piac->RegisterCommand(kw,usage,this,hgrp);
    230242
     
    346358} else if(kw == "h/plot/2d") {
    347359  h_plot_2d(tokens); return(0);
     360} else if(kw == "h/2d/geth") {
     361  h_2d_geth(tokens); return(0);
    348362} else if(kw == "h/put_vec") {
    349363  h_put_vec(tokens); return(0);
     
    18371851
    18381852/* methode */
     1853void 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 */
    18391915int_4 PAWExecutor::decodepawstring(string tokens,string& nameobj
    18401916                                ,string& xexp,string& yexp,string& zexp)
Note: See TracChangeset for help on using the changeset viewer.