Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Anp::Draw Namespace Reference


Typedefs

typedef std::vector< Anp::StripIterSVec
typedef SVec::iterator SIterator
typedef SVec::const_iterator SIter
typedef std::vector< Anp::StdHepIterHepVec
typedef HepVec::iterator HepIterator
typedef HepVec::const_iterator HepIter

Functions

void Config (TPad *pad, const std::string &prefix, const Registry &reg)
void Config (TH1 *h, const std::string &prefix, const Registry &reg)
TH2 * CreateTH2 (const std::string &prefix, const Registry &reg, const Header &header)
TGraph * CreateTGraph (const std::string &prefix, const Registry &reg)
double Read (const std::string &key, double pvalue, const Registry &reg)
int Read (const std::string &key, int pvalue, const Registry &reg)
const std::string Read (const std::string &key, const std::string &pvalue, const Registry &reg)
int Read (const Record &record, HepVec &hvec, int beg, int end)
const VldContext GetValidity (const Header &header)


Typedef Documentation

typedef HepVec::const_iterator Anp::Draw::HepIter
 

Definition at line 29 of file DrawUtil.h.

typedef HepVec::iterator Anp::Draw::HepIterator
 

Definition at line 28 of file DrawUtil.h.

typedef std::vector<Anp::StdHepIter> Anp::Draw::HepVec
 

Definition at line 27 of file DrawUtil.h.

typedef SVec::const_iterator Anp::Draw::SIter
 

Definition at line 25 of file DrawUtil.h.

typedef SVec::iterator Anp::Draw::SIterator
 

Definition at line 24 of file DrawUtil.h.

typedef std::vector<Anp::StripIter> Anp::Draw::SVec
 

Definition at line 23 of file DrawUtil.h.


Function Documentation

void Anp::Draw::Config TH1 *  h,
const std::string &  prefix,
const Registry reg
 

Definition at line 49 of file DrawUtil.cxx.

References Read(), and reg.

Referenced by Anp::StdHepTab::Init(), Anp::SnarlTimeTab::Init(), Anp::SnarlAdcTab::Init(), Anp::EventHitTab::Init(), Anp::EventAdcTab::Init(), Anp::SnarlTimeTab::NewSnarl(), and Anp::RunModule::SetConfig().

00050 {
00051    if(!h)
00052    {
00053       return;
00054    }
00055 
00056    double YAxisTitleOffset = 0.7;
00057    double XAxisTitleOffset = 0.7;
00058 
00059    string YAxisTitle = "";
00060    string XAxisTitle = "";
00061 
00062    double YAxisTitleSize = 0.065;
00063    double XAxisTitleSize = 0.065;
00064 
00065    string ShowStats = "no";
00066 
00067    string CenterXTitle = "yes";
00068    string CenterYTitle = "yes";
00069 
00070    int LineStyle = 1;
00071    int LineColor = 1;
00072    int LineWidth = 1;
00073 
00074    int FillStyle = -1;
00075    int FillColor = 1;
00076 
00077    YAxisTitleOffset = Read(prefix + "YAxisTitleOffset", YAxisTitleOffset, reg);
00078    XAxisTitleOffset = Read(prefix + "XAxisTitleOffset", XAxisTitleOffset, reg);
00079 
00080    YAxisTitle = Read(prefix + "YAxisTitle", YAxisTitle, reg);
00081    XAxisTitle = Read(prefix + "XAxisTitle", XAxisTitle, reg); 
00082 
00083    YAxisTitleSize = Read(prefix + "YAxisTitleSize", YAxisTitleSize, reg);
00084    XAxisTitleSize = Read(prefix + "XAxisTitleSize", XAxisTitleSize, reg);
00085 
00086    ShowStats = Read(prefix + "ShowStats", ShowStats, reg);
00087 
00088    CenterXTitle = Read(prefix + "CenterXTitle", CenterXTitle, reg);
00089    CenterYTitle = Read(prefix + "CenterYTitle", CenterYTitle, reg);
00090 
00091    LineStyle = Read(prefix + "LineStyle", LineStyle, reg);
00092    LineColor = Read(prefix + "LineColor", LineColor, reg);
00093    LineWidth = Read(prefix + "LineWidth", LineWidth, reg);
00094 
00095    FillStyle = Read(prefix + "FillStyle", FillStyle, reg);
00096    FillColor = Read(prefix + "FillColor", FillColor, reg);
00097 
00098    h -> GetXaxis() -> SetTitleOffset(XAxisTitleOffset);
00099    h -> GetYaxis() -> SetTitleOffset(YAxisTitleOffset);
00100 
00101    h -> GetXaxis() -> SetTitle(XAxisTitle.c_str());
00102    h -> GetYaxis() -> SetTitle(YAxisTitle.c_str()); 
00103 
00104    h -> GetXaxis() -> SetTitleSize(XAxisTitleSize);
00105    h -> GetYaxis() -> SetTitleSize(YAxisTitleSize);
00106 
00107    if(LineStyle > 0)
00108    {
00109       h -> SetLineStyle(LineStyle);
00110       h -> SetLineColor(LineColor);
00111       h -> SetLineWidth(LineWidth);
00112    }
00113    if(FillStyle > 0)
00114    {
00115       h -> SetFillStyle(FillStyle);
00116       h -> SetFillColor(FillColor);
00117    }   
00118 
00119    if(ShowStats == "yes")
00120    {
00121       h -> SetStats(kTRUE);
00122    }
00123    else if(ShowStats == "no")
00124    {
00125       h -> SetStats(kFALSE);
00126    }
00127 
00128    if(CenterXTitle == "yes")
00129    {
00130       h -> GetXaxis() -> CenterTitle();
00131    }
00132    if(CenterYTitle == "yes")
00133    {
00134       h -> GetYaxis() -> CenterTitle();
00135    }
00136 }

void Anp::Draw::Config TPad *  pad,
const std::string &  prefix,
const Registry reg
 

Definition at line 25 of file DrawUtil.cxx.

References Read(), and reg.

00026 {
00027    if(!pad)
00028    {
00029       return;
00030    }
00031 
00032    double PadRightMargin = 0.15;
00033    double PadLeftMargin = 0.12;
00034    double PadTopMargin = 0.02;
00035    double PadBottomMargin = 0.12;   
00036 
00037    PadRightMargin = Read(prefix + "PadRightMargin", PadRightMargin, reg);
00038    PadLeftMargin = Read(prefix + "PadLeftMargin", PadLeftMargin, reg);
00039    PadTopMargin = Read(prefix + "PadTopMargin", PadTopMargin, reg);
00040    PadBottomMargin = Read(prefix + "PadBottomMargin", PadBottomMargin, reg);
00041 
00042    pad -> SetRightMargin(PadRightMargin);
00043    pad -> SetLeftMargin(PadLeftMargin);
00044    pad -> SetTopMargin(PadTopMargin);
00045    pad -> SetBottomMargin(PadBottomMargin);
00046 }

TGraph * Anp::Draw::CreateTGraph const std::string &  prefix,
const Registry reg
 

Definition at line 283 of file DrawUtil.cxx.

References Read(), and reg.

Referenced by Anp::EventHitTab::Init().

00284 {
00285    double MarkerSize = 1.0;
00286    int MarkerStyle = 8;
00287    int MarkerColor = 3;
00288 
00289    MarkerSize = Read(prefix + "MarkerSize", MarkerSize, reg);
00290    MarkerStyle = Read(prefix + "MarkerStyle", MarkerStyle, reg);
00291    MarkerColor = Read(prefix + "MarkerColor", MarkerColor, reg);
00292 
00293    TGraph *g = new TGraph(0);
00294    
00295    g -> SetMarkerSize(MarkerSize);
00296    g -> SetMarkerStyle(MarkerStyle);
00297    g -> SetMarkerColor(MarkerColor);
00298 
00299    return g;
00300 }

TH2 * Anp::Draw::CreateTH2 const std::string &  prefix,
const Registry reg,
const Header header
 

Definition at line 139 of file DrawUtil.cxx.

References UgliPlnHandle::GetPlaneView(), UgliPlnHandle::GetPlexPlaneId(), UgliGeomHandle::GetScintPlnHandleVector(), UgliScintPlnHandle::GetStripHandleVector(), UgliStripHandle::GetTPos(), UgliPlnHandle::GetZ0(), PlexPlaneId::IsNearSpect(), Anp::Read(), Read(), and reg.

Referenced by Anp::HistMan::CreateTH2(), Anp::HistMan::GetTH2(), Anp::StdHepTab::Init(), Anp::SnarlAdcTab::Init(), Anp::EventHitTab::Init(), and Anp::EventAdcTab::Init().

00140 {
00141    float MinT = -4.0;
00142    float MaxT = +4.0;
00143 
00144    float MinZ = 0.0;
00145    float MaxZ = 16.0;
00146 
00147    float WidthT = 0.0410;
00148    float WidthZ = 0.0571;
00149 
00150    MinT = Read(prefix + "MinT", MinT, reg);
00151    MaxT = Read(prefix + "MaxT", MaxT, reg);
00152    
00153    MinZ = Read(prefix + "MinZ", MinZ, reg);
00154    MaxZ = Read(prefix + "MaxZ", MaxZ, reg);   
00155    
00156    //
00157    // Get detector range using geomtry database
00158    //
00159    bool use_ugli = true, only_cal = true;
00160    Anp::Read(reg, "UseUgli", use_ugli);
00161    Anp::Read(reg, "OnlyCal", only_cal);
00162 
00163    if(use_ugli)
00164    {
00165       vector<float> Uvec, Vvec, Zvec;
00166 
00167       UgliGeomHandle uhand(Draw::GetValidity(header));
00168       
00169       //
00170       // Get all scint planes
00171       //
00172       vector<UgliScintPlnHandle> pvec = uhand.GetScintPlnHandleVector();
00173 
00174       for(unsigned int iplane = 0; iplane < pvec.size(); ++iplane)
00175       {
00176          UgliScintPlnHandle phand = pvec[iplane];
00177          const PlexPlaneId planeid = phand.GetPlexPlaneId();
00178 
00179          //
00180          // Get Z range
00181          //
00182          if(only_cal && planeid.IsNearSpect())
00183          {
00184             continue;
00185          }
00186 
00187          Zvec.push_back(phand.GetZ0());
00188 
00189          //
00190          // Get all strips
00191          //
00192          vector<UgliStripHandle> svec = phand.GetStripHandleVector();
00193 
00194          for(unsigned int istrip = 0; istrip < svec.size(); ++istrip)
00195          {
00196             UgliStripHandle pstrip = svec[istrip];
00197             
00198             //
00199             // Get strip position
00200             //
00201             const float tpos = pstrip.GetTPos();
00202 
00203             if(phand.GetPlaneView() == PlaneView::kU)
00204             {
00205                Uvec.push_back(tpos);
00206             }
00207             else if(phand.GetPlaneView() == PlaneView::kV)
00208             {
00209                Vvec.push_back(tpos);
00210             }
00211          }
00212       }
00213 
00214       if(prefix.find("U") != string::npos && !Uvec.empty())
00215       {
00216          MinT = *std::min_element(Uvec.begin(), Uvec.end());
00217          MaxT = *std::max_element(Uvec.begin(), Uvec.end());
00218       }
00219       if(prefix.find("V") != string::npos && !Vvec.empty())
00220       {
00221          MinT = *std::min_element(Vvec.begin(), Vvec.end());
00222          MaxT = *std::max_element(Vvec.begin(), Vvec.end());
00223       }
00224 
00225       if(!Zvec.empty())
00226       {
00227          MinZ = *std::min_element(Zvec.begin(), Zvec.end());
00228          MaxZ = *std::max_element(Zvec.begin(), Zvec.end());
00229       }
00230    }
00231 
00232    WidthT = Read(prefix + "WidthT", WidthT, reg);
00233    WidthZ = Read(prefix + "WidthZ", WidthZ, reg);
00234 
00235    if(!(WidthT > 0.0)) WidthT = 0.0410;
00236    if(!(WidthZ > 0.0)) WidthZ = 0.0410;
00237 
00238    string Name = "TView";
00239    string Title = "T view";
00240    string XTitle = "Z position (m)";
00241    string YTitle = "T position (m)";
00242 
00243    //
00244    // Read strings
00245    //
00246    Anp::Read(reg, prefix+"XTitle", XTitle);
00247    Anp::Read(reg, prefix+"YTitle", YTitle);
00248 
00249    TH2 *h = new TH2F(Name.c_str(), Title.c_str(), 
00250                      static_cast<int>((MaxZ-MinZ)/WidthZ), MinZ, MaxZ,
00251                      static_cast<int>((MaxT-MinT)/WidthT), MinT, MaxT);
00252 
00253    h -> SetDirectory(0);
00254    h -> SetStats(kFALSE);
00255 
00256    h -> GetXaxis() -> SetTitle(XTitle.c_str());
00257    h -> GetXaxis() -> CenterTitle();
00258    h -> GetYaxis() -> SetTitle(YTitle.c_str());
00259    h -> GetYaxis() -> CenterTitle();
00260 
00261    double XAxisTitleOffset = 0.7;
00262    double YAxisTitleOffset = 0.7;
00263 
00264    double XAxisTitleSize = 0.065;
00265    double YAxisTitleSize = 0.065;   
00266 
00267    XAxisTitleOffset = Read("XAxisTitleOffset", XAxisTitleOffset, reg);
00268    YAxisTitleOffset = Read("YAxisTitleOffset", YAxisTitleOffset, reg);
00269 
00270    XAxisTitleSize = Read("XAxisTitleSize", XAxisTitleSize, reg);
00271    YAxisTitleSize = Read("YAxisTitleSize", YAxisTitleSize, reg);
00272 
00273    h -> GetXaxis() -> SetTitleOffset(XAxisTitleOffset);
00274    h -> GetYaxis() -> SetTitleOffset(YAxisTitleOffset);
00275 
00276    h -> GetXaxis() -> SetTitleSize(XAxisTitleSize);
00277    h -> GetYaxis() -> SetTitleSize(YAxisTitleSize);
00278 
00279    return h;
00280 }

const VldContext Anp::Draw::GetValidity const Header header  ) 
 

Definition at line 367 of file DrawUtil.cxx.

References Anp::Header::IsData(), Anp::Header::IsFar(), Anp::Header::IsNear(), Anp::Header::NSec(), and Anp::Header::Sec().

00368 {
00369    //
00370    // Convert Anp::Header to VldContext
00371    //
00372 
00373    const VldTimeStamp time(header.Sec(), header.NSec());
00374    if(header.IsData())
00375    {
00376       if     (header.IsNear()) return VldContext(Detector::kNear, SimFlag::kData, time);
00377       else if(header.IsFar())  return VldContext(Detector::kFar, SimFlag::kData, time);
00378    }
00379    else
00380    {
00381       if     (header.IsNear()) return VldContext(Detector::kNear, SimFlag::kMC, time);
00382       else if(header.IsFar())  return VldContext(Detector::kFar, SimFlag::kMC, time);
00383    }
00384 
00385    return VldContext(Detector::kUnknown, SimFlag::kUnknown, time);  
00386 }

int Anp::Draw::Read const Record &  record,
HepVec hvec,
int  beg,
int  end
 

Definition at line 339 of file DrawUtil.cxx.

References count, Read(), Anp::Record::StdHepBeg(), Anp::Record::StdHepEnd(), and Anp::StdHepIter.

Referenced by Anp::SnarlAdcTab::Add(), Anp::StdHepTab::CreateArrows(), Plot::Hist::Get(), Anp::SnarlTimeTab::NewSnarl(), Anp::StdHepTab::Set(), Plot::Hist::SetLH(), Anp::StdHepTab::ZoomIn(), Anp::SnarlAdcTab::ZoomIn(), Anp::EventHitTab::ZoomIn(), and Anp::EventAdcTab::ZoomIn().

00340 {
00341    if(beg > end)
00342    {
00343       cerr << "Draw::ReadStdHep - invalid StdHep index range" << endl;
00344       return 0;
00345    }
00346 
00347    int count = 0;
00348 
00349    for(StdHepIter it = record.StdHepBeg(); it != record.StdHepEnd(); ++it)
00350    {
00351       if(it -> StdHepIndex() < beg || it -> StdHepIndex() > end)
00352       {
00353          continue;
00354       }
00355 
00356       ++count;
00357       
00358       hvec.push_back(it);
00359 
00360       count += Anp::Draw::Read(record, hvec, it -> ChildBeg(), it -> ChildEnd());
00361    }
00362    
00363    return count;
00364 }

const string Anp::Draw::Read const std::string &  key,
const std::string &  pvalue,
const Registry reg
 

Definition at line 327 of file DrawUtil.cxx.

References Registry::Get(), Registry::KeyExists(), and reg.

00328 {
00329    const char *value = 0;
00330    if(reg.KeyExists(key.c_str()) && reg.Get(key.c_str(), value))
00331    {
00332       return value;
00333    }
00334    
00335    return pvalue;
00336 }

int Anp::Draw::Read const std::string &  key,
int  pvalue,
const Registry reg
 

Definition at line 315 of file DrawUtil.cxx.

References Registry::Get(), Registry::KeyExists(), and reg.

00316 {
00317    int value = 0;
00318    if(reg.KeyExists(key.c_str()) && reg.Get(key.c_str(), value))
00319    {
00320       return value;
00321    }
00322    
00323    return pvalue;
00324 }

double Anp::Draw::Read const std::string &  key,
double  pvalue,
const Registry reg
 

Definition at line 303 of file DrawUtil.cxx.

References Registry::Get(), Registry::KeyExists(), and reg.

Referenced by Config(), CreateTGraph(), CreateTH2(), and Read().

00304 {
00305    double value = 0.0;
00306    if(reg.KeyExists(key.c_str()) && reg.Get(key.c_str(), value))
00307    {
00308       return value;
00309    }
00310    
00311    return pvalue;
00312 }


Generated on Mon Feb 15 11:10:36 2010 for loon by  doxygen 1.3.9.1