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

Anp::DrawSnarl Class Reference

#include <DrawSnarl.h>

Inheritance diagram for Anp::DrawSnarl:

Anp::AlgSnarl Anp::Base List of all members.

Public Member Functions

 DrawSnarl ()
virtual ~DrawSnarl ()
bool Run (Record &record)
void Config (const Registry &reg)

Private Types

typedef std::vector< Anp::EventTabPtrTabVec

Private Attributes

TabVec fTabs
Registry fConfig
bool fDrawSnarlEmpty

Member Typedef Documentation

typedef std::vector<Anp::EventTabPtr> Anp::DrawSnarl::TabVec [private]
 

Definition at line 32 of file DrawSnarl.h.


Constructor & Destructor Documentation

Anp::DrawSnarl::DrawSnarl  ) 
 

Definition at line 23 of file DrawSnarl.cxx.

00024    :fDrawSnarlEmpty(false)
00025 {
00026 }

Anp::DrawSnarl::~DrawSnarl  )  [virtual]
 

Definition at line 29 of file DrawSnarl.cxx.

00030 {
00031   cout<<" create instance of display"<<endl;
00032    EventDisplay::Instance().Init();
00033 }


Member Function Documentation

void Anp::DrawSnarl::Config const Registry reg  )  [virtual]
 

Reimplemented from Anp::AlgSnarl.

Definition at line 52 of file DrawSnarl.cxx.

References Anp::EventTabPtr, fConfig, fDrawSnarlEmpty, fTabs, Registry::Get(), Nav::GetName(), infile, Registry::KeyExists(), Anp::ReadRegistry(), reg, UtilString::StringTok(), and Anp::Handle< T >::valid().

00053 {
00054    vector<string> tablist;
00055 
00056    const char *value_char = 0;
00057    if(reg.Get("DrawSnarlEmpty", value_char) && value_char)
00058    {
00059       if(strcmp(value_char, "yes") == 0)
00060       {
00061          fDrawSnarlEmpty = true;
00062       }
00063       else if(strcmp(value_char, "no") == 0)
00064       {
00065          fDrawSnarlEmpty = false;
00066       }
00067    }
00068 
00069    value_char = 0;
00070    if(reg.Get("EventTabList", value_char) && value_char)
00071    {
00072       UtilString::StringTok(tablist, string(value_char), ", ");
00073    }
00074    else
00075    {
00076       cerr << "DrawSnarl::Config() - EventTabList Registry key doesn't exist" << endl;
00077       return;
00078    }
00079    
00080    for(vector<string>::const_iterator sit = tablist.begin(); sit != tablist.end(); ++sit)
00081    {
00082       EventTabPtr tab = EventDisplay::Instance().Add(*sit);
00083       
00084       if(tab.valid())
00085       {
00086          fTabs.push_back(tab);
00087          cout << "Created and adopted tab: " << *sit << endl;
00088       }
00089    }
00090 
00091    string tpath;
00092 
00093    value_char = 0;
00094    if(reg.Get("TabConfigPath", value_char) && value_char)
00095    {
00096       tpath = value_char;
00097    }
00098    else
00099    {
00100       tpath = std::string(std::getenv("SRT_PRIVATE_CONTEXT")) + "/PhysicsNtuple/Draw";
00101    }
00102    
00103    if(!ReadRegistry(tpath + "/TabConfig.txt", fConfig, false))
00104    {
00105       cerr << "DrawSnarl::Config - failed to read Registry with configurations" << endl;
00106    }
00107 
00108    for(TabVec::const_iterator cit = fTabs.begin(); cit != fTabs.end(); ++cit) 
00109    {
00110       const string cpath = tpath + "/" + (*cit) -> GetName() + ".txt";
00111       ifstream infile(cpath.c_str(), ios::in);
00112 
00113       if(infile && infile.is_open())
00114       {
00115          Registry reg;
00116          if(ReadRegistry(cpath, reg, false))
00117          {
00118             (*cit) -> Config(reg);
00119          }
00120       }
00121       else
00122       {
00123          (*cit) -> Config(fConfig);
00124       }
00125 
00126       infile.close();
00127    }
00128 
00129    if(reg.KeyExists("PrintConfig"))
00130    {
00131       cout << "DrawSnarl::Config" << endl
00132            << "   DrawSnarlEmpty = " << fDrawSnarlEmpty << endl;
00133    }
00134 }

bool Anp::DrawSnarl::Run Record record  )  [virtual]
 

Implements Anp::AlgSnarl.

Definition at line 36 of file DrawSnarl.cxx.

References fDrawSnarlEmpty, Anp::Record::GetHeader(), Anp::Record::GetNEvents(), and Anp::Header::IsValid().

00037 {
00038    if(!fDrawSnarlEmpty && record.GetNEvents() < 1)
00039    {
00040       return true;
00041    }
00042 
00043    if(record.GetHeader().IsValid())
00044    {
00045        EventDisplay::Instance().Add(record);
00046    }
00047 
00048    return true;
00049 }


Member Data Documentation

Registry Anp::DrawSnarl::fConfig [private]
 

Definition at line 36 of file DrawSnarl.h.

Referenced by Config().

bool Anp::DrawSnarl::fDrawSnarlEmpty [private]
 

Definition at line 38 of file DrawSnarl.h.

Referenced by Config(), and Run().

TabVec Anp::DrawSnarl::fTabs [private]
 

Definition at line 34 of file DrawSnarl.h.

Referenced by Config().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:31 2010 for loon by  doxygen 1.3.9.1