Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

MarlinSteerCheck.h

00001 #ifndef MARLINSTEERCHECK_H
00002 #define MARLINSTEERCHECK_H
00003 
00004 #include "marlin/CCProcessor.h"
00005 #include "marlin/CCCollection.h"
00006 #include "marlin/CMProcessor.h"
00007 #include "marlin/XMLParser.h"
00008 
00009 //comment out the line below if your terminal
00010 //doesn't support colored output
00011 #define TERM_COLOR
00012 
00013 #ifdef TERM_COLOR
00014 
00015 #define clrscr() printf("\033[2J")
00016 #define dblue() printf("\x1b[34m")
00017 #define dred() printf("\x1b[31m")
00018 #define dyellow() printf("\x1b[33m")
00019 #define dgreen() printf("\x1b[32m")
00020 #define dunderline() printf("\x1b[4m")
00021 #define ditalic() printf("\x1b[3m")
00022 #define ddunkel() printf("\x1b[2m")
00023 #define dhell() printf("\x1b[1m")
00024 #define dblink() printf("\x1b[5m")
00025 #define endcolor() printf("\x1b[m")
00026 
00027 #else
00028 
00029 #define clrscr()
00030 #define dblue()
00031 #define dred()
00032 #define dyellow()
00033 #define dgreen()
00034 #define dunderline()
00035 #define ditalic()
00036 #define ddunkel()
00037 #define dhell()
00038 #define dblink()
00039 #define endcolor()
00040 
00041 #endif
00042 
00043 #define MAXEVENTS 30
00044 
00045 namespace marlin {
00046 
00047   class CCCollection;
00048   class CCProcessor;
00049 
00050   typedef std::vector< CCProcessor* > ProcVec;
00051 
00072   class MarlinSteerCheck{
00073 
00074   public:
00075 
00076     // Constructor
00077     MarlinSteerCheck( const char* steerFileName=NULL );
00078 
00079     // Destructor
00080     ~MarlinSteerCheck();
00081 
00083     CMProcessor* getMProcs() { return _marlinProcs; };
00084     
00086     ProcVec& getAProcs() { return _aProc; };
00087     
00089     ProcVec& getIProcs() { return _iProc; };
00090 
00095     int existsProcessor( const std::string& type, const std::string& name="" );
00096     
00098     ColVec& getLCIOCols() const;
00099     
00101     StringVec& getLCIOFiles(){ return _lcioFiles; }
00102 
00104     sSet& getColsSet( const std::string& type, const std::string& name, CCProcessor* proc );
00105 
00107     StringParameters* getGlobalParameters(){ return _gparam; }
00108     
00110     void dumpColErrors( unsigned int i, std::ostream& stream, bool separators=false );
00111   
00113     int addLCIOFile( const std::string& file );
00114 
00116     void remLCIOFile( const std::string& file );
00117     
00119     void changeLCIOFilePos( unsigned int pos, unsigned int newPos );
00120  
00122     void addProcessor( bool status, const std::string& name, const std::string& type, StringParameters* p=NULL );
00123 
00125     void remProcessor( unsigned int index, bool status );
00126 
00128     void activateProcessor( unsigned int index );
00129     
00131     void deactivateProcessor( unsigned int index );
00132 
00134     void changeProcessorPos( unsigned int pos, unsigned int newPos );
00135     
00137     void consistencyCheck();
00138 
00141     bool saveAsXMLFile( const std::string& file );
00142 
00143     /* Returns the relative path of the XML file */
00144     const std::string getXMLFileRelPath(){ return _XMLFileRelPath; }
00145     
00146     /* Returns the absolute path of the XML file */
00147     const std::string getXMLFileAbsPath(){ return _XMLFileAbsPath; }
00148     
00149     /* Returns the XML fileName */
00150     const std::string getXMLFileName(){ return _XMLFileName; }
00151     
00152     /* Returns the XML file as given by the user in the command prompt */
00153     const std::string getXMLFile(){ return _steeringFile; }
00154     
00156     void dump_information();
00157 
00159     sSet& getErrors(){ return _errors; };
00160 
00162     sSet& getPConditions(){ return _pConditions; };
00163 
00165     const std::string getCondition( unsigned int index );
00166     
00168     void addCondition( const std::string& condition );
00169     
00171     void repCondition( const std::string& oldCond, const std::string& newCond );
00172     
00174     void remCondition( const std::string& condition );
00175     
00177     bool saveAsDOTFile(const std::string& file);
00178     
00179   private:
00180     
00182     //METHODS
00184 
00185     // Return all available collections from the active or inactive processors
00186     ColVec& getProcCols( const ProcVec& v, const std::string& iotype ) const;
00187 
00188     // Return all available collections found in LCIO files and active/inactive processors
00189     ColVec& getAllCols() const;
00190    
00191     // Return all available collections found in LCIO files and active/inactive processors
00192     ProcVec& getAllProcs() const;
00193     
00194     // Parse the given steering file
00195     bool parseXMLFile( const std::string& file );
00196     
00197     // Pop a processor out of a vector from processors
00198     CCProcessor* popProc(ProcVec& v, CCProcessor* p);
00199 
00200     // Find matching collections of a given type and value in a vector of collections for a given processor
00201     ColVec& findMatchingCols( ColVec& v, CCProcessor* srcProc, 
00202             const std::string& type, const std::string& value="UNDEFINED", const std::string& name="UNDEFINED" );
00203     
00205     //VARIABLES
00207 
00208     sSet _errors;                       //XML File parsing error
00209                                         //LCIO Files loading error
00210                                         //GEAR File loading error
00211                                         //Some Processors have no parameters
00212                                         //Some Active Processors are not installed
00213                                         //Some Active Processors have collection errors
00214                                         //Warning: Some Inactive Processors are not installed
00215 
00216     IParser* _parser;                   //parser
00217     StringParameters* _gparam;          //global parameters (without LCIO Files)
00218     
00219     std::string _steeringFile;          //steering file name + path as passed by the user in the command line
00220     std::string _XMLFileName;           //steering file name
00221     std::string _XMLFileAbsPath;        //steering file (absolute path without filename)
00222     std::string _XMLFileRelPath;        //steering file (relative path without filename)
00223 
00224     ProcVec _aProc;                     //active processors
00225     ProcVec _iProc;                     //inactive processors
00226     sColVecMap _lcioCols;               //LCIO collections
00227     StringVec _lcioFiles;               //LCIO filenames
00228     
00229     sSet _colValues;                    //all available collection values for a given type (use in ComboBox)
00230 
00231     sSet _pConditions;                  //all processor's conditions
00232 
00233     CMProcessor* _marlinProcs;          //Sigleton class containing all marlin processors
00234   };
00235 
00236 } // namespace
00237 #endif

Generated on Mon Jan 12 09:48:51 2009 for Marlin by doxygen 1.3.5