Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MarlinSteerCheck.cc
Go to the documentation of this file.
2 #include "marlin/CMProcessor.h"
3 
4 // LCIO INCLUDES ///////////////
5 #include "lcio.h"
6 #include "IO/LCReader.h"
7 #include "EVENT/LCCollection.h"
9 
10 // MARLIN INCLUDES /////////////
11 //#include "marlin/ProcessorLoader.h"
12 #include "marlin/ProcessorMgr.h"
13 #include "marlin/XMLParser.h"
14 #include "marlin/Parser.h"
15 #include "marlin/tinyxml.h"
16 #include "marlin/Global.h"
18 
19 #include <iomanip>
20 #include <sstream>
21 #include <fstream>
22 #include <iostream>
23 #include <string>
24 #include <cstdlib>
25 #include <algorithm>
26 
27 using namespace std;
28 
29 namespace marlin{
30 
31  // Constructor
32  MarlinSteerCheck::MarlinSteerCheck( const char* steeringFile, const CommandLineParametersMap * cmdlineparams ) : _parser(NULL), _gparam(NULL), _steeringFile("Untitled.xml") {
33 
34  if( steeringFile != 0 ){
35  _steeringFile=steeringFile;
36 
37  if(!parseXMLFile( steeringFile, cmdlineparams )){
38  _errors.insert("XML File parsing error");
39  }
40  }
41 
42  //create Global Parameters
43  else{
44  _gparam = std::make_shared<StringParameters>();
45  StringVec value;
46  value.push_back("5001");
47  _gparam->add("MaxRecordNumber", value);
48  value.clear();
49  value.push_back("0");
50  _gparam->add("SkipNEvents", value);
51  value.clear();
52  value.push_back("false");
53  _gparam->add("SupressCheck", value);
54  value.clear();
55  value.push_back("gear_ldc.xml");
56  _gparam->add("GearXMLFile", value);
57  value.clear();
58  value.push_back("MESSAGE");
59  _gparam->add("Verbosity", value);
60  }
61 
62 // _XMLFileAbsPath="/";
63 // _XMLFileRelPath="";
64 
65 // //save the fileName and erase it from the Path
66 // StringVec path;
67 // CMProcessor::instance()->tokenize(_steeringFile, path, "/");
68 // _XMLFileName=path[path.size()-1];
69 // path.erase(path.end());
70 
71 // //if the path is relative
72 // if(_steeringFile[0]!='/'){
73 // string absPath=getenv("PWD");
74 // StringVec absPathT;
75 // CMProcessor::instance()->tokenize(absPath, absPathT, "/");
76 // for( unsigned int i=0; i<path.size(); i++ ){
77 // if(path[i]!="."){
78 // _XMLFileRelPath+=path[i];
79 // _XMLFileRelPath+="/";
80 
81 // if(path[i]==".."){
82 // absPathT.erase(absPathT.end());
83 // }
84 // else{
85 // absPathT.push_back(path[i]);
86 // }
87 // }
88 // }
89 // for( unsigned int i=0; i<absPathT.size(); i++ ){
90 // _XMLFileAbsPath+=absPathT[i];
91 // _XMLFileAbsPath+="/";
92 // }
93 // }
94 // else{
95 // for( unsigned int i=0; i<path.size(); i++ ){
96 // _XMLFileAbsPath+=path[i];
97 // _XMLFileAbsPath+="/";
98 // }
99 // }
100 
101 // //parse the file
102 // if( steeringFile != 0 ){
103 // if(!parseXMLFile( steeringFile )){
104 // _errors.insert("XML File parsing error");
105 // }
106 // }
107 
109 
110  }
111 
112  // Destructor
114  if(_parser){
115  delete _parser;
116  _parser=NULL;
117  }
118  }
119 
120  // Returns a list of all available Collections of a given Type
121  // for a given Processor (to use in a ComboBox)
122  sSet& MarlinSteerCheck::getColsSet( const string& type, const string& name, CCProcessor* proc ){
123 
124  _colValues.clear();
125 
126  ColVec v;
127  if(!proc->isActive()){
128 
129  v = findMatchingCols( getAllCols(), proc, type );
130  for( unsigned int i=0; i<v.size(); i++ ){
131  //check if collection already exists
132  CCProcessor tmp(ACTIVE, "Temporary", "Temporary", std::shared_ptr<StringParameters>());
133  if( findMatchingCols( proc->getCols( INPUT ), &tmp, type, v[i]->getValue(), name ).size() == 0 ){
134  _colValues.insert( v[i]->getValue() );
135  }
136  }
137  }
138  else{
139  //get LCIO collections
140  v = getLCIOCols();
141 
142  //insert collections from previous active processors
143  for( unsigned int i=0; i<_aProc.size(); i++ ){
144 
145  //abort if we reach the processor
146  if( _aProc[i] == proc ){ break; }
147 
148  ColVec av = _aProc[i]->getCols( OUTPUT );
149  v.insert( v.end(), av.begin(), av.end() );
150  }
151 
152  //create temporary processor to find matching collections
153  CCProcessor tmp(ACTIVE, "Temporary", "Temporary", std::shared_ptr<StringParameters>());
154 
155  for( unsigned int i=0; i<v.size(); i++ ){
156  if( v[i]->getType() == type ){
157  //check if collection already exists
158  if( findMatchingCols( proc->getCols( INPUT ), &tmp, type, v[i]->getValue(), name ).size() == 0 ){
159  _colValues.insert( v[i]->getValue() );
160  }
161  }
162  }
163  }
164 
165  return _colValues;
166  }
167 
168  // Add LCIO file and read all collections inside it
169  int MarlinSteerCheck::addLCIOFile( const string& file ){
170 
171 // string fileName="/";
172 
173 // //if path is relative concatenate XMLFileAbsPath with relative path of file
174 // if(file[0]!='/'){
175 // StringVec LCIOFilePath;
176 // //initialize LCIOFilePath with the absolute path of the xml file
177 // CMProcessor::instance()->tokenize(_XMLFileAbsPath, LCIOFilePath, "/");
178 
179 // StringVec path;
180 // CMProcessor::instance()->tokenize(file, path, "/");
181 // for( unsigned int i=0; i<path.size(); i++ ){
182 // if(path[i]!="."){
183 // LCIOFilePath.push_back(path[i]);
184 // }
185 // }
186 // for( unsigned int i=0; i<LCIOFilePath.size()-1; i++ ){
187 // fileName+=LCIOFilePath[i];
188 // fileName+="/";
189 // }
190 // //add the filename to the path
191 // fileName+=LCIOFilePath[LCIOFilePath.size()-1];
192 // }
193 // else{
194 // fileName=file;
195 // }
196 
197  HANDLE_LCIO_EXCEPTIONS;
198  ColVec newCols;
199 
200  LCReader* lcReader = LCFactory::getInstance()->createLCReader();
201  try{
202  lcReader->open( file );
203  //
204  StringVec readCols ;
205  _gparam->getStringVals( "LCIOReadCollectionNames" , readCols );
206  if( ! readCols.empty() )
207  lcReader->setReadCollectionNames( readCols ) ;
208  }
209  catch( Exception& e){
210  stringstream error;
211  error << "Error opening LCIO file [" << file << "]. File doesn't exist, or link is not valid!!";
212  _errors.insert(error.str());
213  cerr << "addLCIOFile Exception: " << e.what() << endl;
214  _lcioFiles.push_back(file); // we still add the file without collections
215  lcReader->close();
216  delete lcReader;
217  return 0;
218  }
219 
220  LCEvent* evt;
221  int nEvents=0;
222 
223  cout << "Loading LCIO file [" << file << "]\n";
224  cout << "Reading Events...";
225 
226  while( ((evt = lcReader->readNextEvent()) != 0) && nEvents < MAXEVENTS ){
227  cout << ".";
228  cout.flush();
229 
230  const StringVec* strVec = evt->getCollectionNames();
231  StringVec::const_iterator name;
232 
233  for( name = strVec->begin(); name != strVec->end(); name++ ){
234  LCCollection* col = evt->getCollection( *name ) ;
235 
236  //check if collection already exists
237  CCProcessor tmp(ACTIVE, "Temporary", "Temporary", std::shared_ptr<StringParameters>());
238  if( findMatchingCols(newCols, &tmp, col->getTypeName(), *name).size() == 0 ){
239  //store the LCIO Filename in the unused name variable from the processor parameters
240  CCCollection* newCol = new CCCollection( *name, col->getTypeName(), file);
241 
242  newCols.push_back( newCol );
243  }
244  }
245 
246  nEvents++;
247  }
248 
249  //add the new Collections vector to the vector of LCIO file's Collections
250  _lcioCols[file]=newCols;
251 
252  //add the file to the list of LCIO files
253  _lcioFiles.push_back(file);
254 
255  lcReader->close();
256  delete lcReader;
257 
258  cout << "\nLCIO file [" << file << "] was loaded successfully\n";
259 
261 
262  return 1;
263  }
264 
265  // Remove lcio file and all collections associated to it
266  void MarlinSteerCheck::remLCIOFile( const string& file ){
267 
268  //erase the allocated memory for the collections associated to the file
269  sColVecMap::const_iterator q=_lcioCols.find( file );
270  for( unsigned int i=0; i<q->second.size(); i++ ){
271  delete q->second[i];
272  }
273 
274  //delete the file from the map
275  _lcioCols.erase( file );
276 
277  //delete the file from the list of files
278  for( StringVec::iterator p=_lcioFiles.begin(); p != _lcioFiles.end(); p++ ){
279  if( (*p) == file ){
280  _lcioFiles.erase(p);
281  break;
282  }
283  }
284 
286  }
287 
288  // Change LCIO File position
289  void MarlinSteerCheck::changeLCIOFilePos( unsigned int pos, unsigned int newPos ){
290 
291  //check if positions are valid
292  if( pos != newPos && pos < _lcioFiles.size() && newPos < _lcioFiles.size() ){
293 
294  string file = _lcioFiles[pos];
295 
296  for( StringVec::iterator p=_lcioFiles.begin(); p != _lcioFiles.end(); p++ ){
297  if( (*p) == file ){
298  _lcioFiles.erase(p);
299  break;
300  }
301  }
302 
303  if(newPos == _lcioFiles.size() ){
304  _lcioFiles.push_back( file );
305  }
306  else{
307  StringVec v;
308 
309  for( unsigned int i=0; i<_lcioFiles.size(); i++ ){
310  if( i == newPos ){
311  v.push_back( file );
312  }
313  v.push_back( _lcioFiles[i] );
314  }
315  _lcioFiles = v;
316  }
317  }
318  else{
319  cerr << "changeLCIOFilePos: Index out of bounds!!" << endl;
320  }
321  }
322 
323  // Add a new Processor
324  void MarlinSteerCheck::addProcessor( bool status, const string& name, const string& type, std::shared_ptr<StringParameters> p ){
325 
326  CCProcessor* newProc = new CCProcessor(status, name, type, p);
327 
328  if( status == ACTIVE ){
329  _aProc.push_back( newProc );
330  }
331  else{
332  _iProc.push_back( newProc );
333  }
335  }
336 
337  // Remove a Processor
338  void MarlinSteerCheck::remProcessor( unsigned int index, bool status ){
339 
340  if( status == ACTIVE ){
341  if( index < _aProc.size() ){
342  CCProcessor *p=popProc( _aProc, _aProc[index] );
343  delete p;
344  }
345  }
346  else{
347  if( index < _iProc.size() ){
348  CCProcessor *p=popProc( _iProc, _iProc[index] );
349  delete p;
350  }
351  }
353  }
354 
355  //0 = does not exist ; 1 = exists and is active ; 2 = exists and is inactive
356  int MarlinSteerCheck::existsProcessor( const string& type, const string& name ){
357  for( unsigned int i=0; i<_aProc.size(); i++ ){
358  if(( name == "" && _aProc[i]->getType() == type ) || ( _aProc[i]->getType() == type && _aProc[i]->getName() == name )){
359  return 1;
360  }
361  }
362  for( unsigned int i=0; i<_iProc.size(); i++ ){
363  if(( name == "" && _iProc[i]->getType() == type ) || ( _iProc[i]->getType() == type && _iProc[i]->getName() == name )){
364  return 2;
365  }
366  }
367  return 0;
368  }
369 
370  // Activate a processor
371  void MarlinSteerCheck::activateProcessor( unsigned int index ){
372 
373  if( index < _iProc.size() ){
374 
375  //changes the processor status
376  _iProc[index]->changeStatus();
377 
378  //adds the processor to the active processors vector
379  _aProc.push_back( popProc( _iProc, _iProc[index] ));
380 
382  }
383  else{
384  cerr << "activateProcessor: Index out of bounds!!" << endl;
385  }
386  }
387 
388  // Deactivate a processor
389  void MarlinSteerCheck::deactivateProcessor( unsigned int index ){
390 
391  if( index < _aProc.size() ){
392 
393  //changes the processor status
394  _aProc[index]->changeStatus();
395 
396  //clear processor conditions
397  if( _aProc[index]->getConditions().size() != 0 ){
398  _aProc[index]->getConditions().clear();
399  }
400 
401  //adds the processor to the inactive processors vector
402  _iProc.push_back( popProc( _aProc, _aProc[index] ));
403 
405  }
406  else{
407  cerr << "activateProcessor: Index out of bounds!!" << endl;
408  }
409  }
410 
411  // Change an active processor's position
412  void MarlinSteerCheck::changeProcessorPos( unsigned int pos, unsigned int newPos ){
413  //check if positions are valid
414  if( pos != newPos && pos < _aProc.size() && newPos < _aProc.size() ){
415 
416  CCProcessor* p = popProc(_aProc, _aProc[pos] );
417 
418  if(newPos == _aProc.size() ){
419  _aProc.push_back( p );
420  }
421  else{
422  ProcVec v;
423 
424  for( unsigned int i=0; i<_aProc.size(); i++ ){
425  if( i == newPos ){
426  v.push_back( p );
427  }
428  v.push_back( _aProc[i] );
429  }
430  _aProc = v;
431  }
433  }
434  else{
435  cerr << "changeProcessorPos: Index out of bounds!!" << endl;
436  }
437  }
438 
439  // Check active processors for unavailable collections
441  //the availableCols vector will contain all the available collections read from LCIO files
442  //and all output collections from active processors found before the processor being checked
443  ColVec availableCols = getLCIOCols();
444  ColVec inputCols, outputCols, matchCols;
445 
446  //loop through all active processors and check for unavailable collections
447  for( unsigned int i=0; i<_aProc.size(); i++ ){
448  //first clear the processor collection errors
449  _aProc[i]->clearError( COL_ERRORS );
450 
451  //initialize input collections for every processor
452  inputCols.clear();
453  inputCols = _aProc[i]->getCols( INPUT );
454 
455  //initialize output collections for every processor
456  outputCols.clear();
457  outputCols = _aProc[i]->getCols( OUTPUT );
458 
459  //loop through all required collections
460  for( unsigned int j=0; j<inputCols.size(); j++ ){
461  matchCols.clear();
462  //check if required collections are found in available collections
463  matchCols = findMatchingCols( availableCols, _aProc[i], inputCols[j]->getType(), inputCols[j]->getValue() );
464  //if the collection is not available
465  if( matchCols.size() == 0 ){
466  //add it to the unavailable collections list of the processor
467  _aProc[i]->addUCol( inputCols[j] );
468  }
469  }
470 
471  //loop through all output collections
472  for( unsigned int j=0; j<outputCols.size(); j++ ){
473  matchCols.clear();
474  //check if output collections are found in available collections
475  matchCols = findMatchingCols( availableCols, _aProc[i], outputCols[j]->getType(), outputCols[j]->getValue() );
476  //if the collection is already available
477  if( matchCols.size() != 0 ){
478  //add it to the duplicate collections list of the processor
479  _aProc[i]->addDCol( outputCols[j] );
480  }
481  }
482 
483  //insert all Output Collections from this processor into availableCols
484  availableCols.insert( availableCols.end(), outputCols.begin(), outputCols.end() );
485  }
486  }
487 
489  // UTILITY METHODS
491 
492  //parse an xml file and initialize data
493  bool MarlinSteerCheck::parseXMLFile( const string& file, const CommandLineParametersMap * cmdlineparams ){
494 
495  stringstream cmd;
496  cmd << "ls " << file << " >/dev/null 2>/dev/null";
497  if( system( cmd.str().c_str() ) ){
498  cerr << "parseXMLFile: Failed to load file: " << _steeringFile << endl;
499  return false;
500  }
501 
502  StringVec lcioFiles, availableProcs, activeProcs, conditions;
503 
504  //============================================================
505  //PARSE THE XML FILE
506  //============================================================
507 
508  //fg: allow xml and old steering files
509  std::string filen( file ) ;
510 
511  if( filen.rfind(".xml") == std::string::npos || // .xml not found at all
512  !( filen.rfind(".xml")
513  + strlen(".xml") == filen.length() ) ) {
514  _parser = new Parser( file ) ;
515 
516  } else {
517  //test if file is valid
518  TiXmlDocument doc( file );
519  if( !doc.LoadFile() ){
520  cerr << "parseXMLFile: Failed to load file: " << _steeringFile << endl;
521  return false;
522  }
523  _parser = new XMLParser( file, true ) ;
524  if( cmdlineparams != NULL ){
525  // tell parser to take into account any options defined on the command line
526  _parser->setCmdLineParameters( *cmdlineparams ) ;
527  }
528 
529  }
530  try{
531  _parser->parse();
532  }
533  catch( Exception& e ){
534  cerr << "parseXMLFile: Failed to load file: " << e.what() << endl;
535  return false;
536  }
537  _gparam = _parser->getParameters( "Global" );
538 
539  //============================================================
540  //READ PARAMETERS
541  //============================================================
542 
543  //add default values if there are none
544  StringVec value;
545  _gparam->getStringVals( "MaxRecordNumber" , value );
546  if( value.size() == 0 ){
547  value.push_back("5001");
548  _gparam->add("MaxRecordNumber", value);
549  }
550  value.clear();
551  _gparam->getStringVals( "SkipNEvents" , value );
552  if( value.size() == 0 ){
553  value.push_back("0");
554  _gparam->add("SkipNEvents", value);
555  }
556  value.clear();
557  _gparam->getStringVals( "SupressCheck" , value );
558  if( value.size() == 0 ){
559  value.push_back("false");
560  _gparam->add("SupressCheck", value);
561  }
562  value.clear();
563 
564  //check GEAR File
565  _gparam->getStringVals( "GearXMLFile" , value );
566  if( value.size() == 0 ){
567  value.push_back("__unknown_gear_file__");
568  _gparam->add("GearXMLFile", value);
569  }
570  //remove other files if there are any
571  if( value.size() > 1 ){
572  string gfile=value[0];
573  value.clear();
574  value.push_back(gfile);
575  _gparam->erase( "GearXMLFile" );
576  _gparam->add( "GearXMLFile", value );
577  }
578 
579  cmd.str("");
580  cmd << "ls " << value[0] << " >/dev/null 2>/dev/null";
581 
582  if( system( cmd.str().c_str() )){
583  stringstream error;
584  error << "Error opening GEAR file [" << value[0] << "]. File doesn't exist, or link is not valid!!";
585  _errors.insert(error.str());
586  }
587 
588  //list of lcio files defined in the global section
589  _gparam->getStringVals( "LCIOInputFiles" , lcioFiles );
590  _gparam->erase("LCIOInputFiles");
591 
592  //list of all processors defined in the body of the xml file
593  //(NOT including the ones in the execute section)
594  _gparam->getStringVals( "AvailableProcessors" , availableProcs );
595  _gparam->erase("AvailableProcessors");
596 
597  //list of all processors defined in the execute section
598  _gparam->getStringVals( "ActiveProcessors" , activeProcs );
599  _gparam->erase("ActiveProcessors");
600 
601  //get the processor's conditions
602  _gparam->getStringVals( "ProcessorConditions" , conditions );
603  _gparam->erase("ProcessorConditions");
604 
605  //============================================================
606  //ADD LCIO FILES
607  //============================================================
608 
609  for( unsigned int i=0; i<lcioFiles.size(); i++ ){
610  addLCIOFile( lcioFiles[i] );
611  }
612 
613  //============================================================
614  //INITIALIZE PROCESSORS
615  //============================================================
616 
617  for( unsigned int i=0; i<availableProcs.size(); i++ ){
618 
619  //get StringParameters from xml file for the name of the Processor
620  std::shared_ptr<StringParameters> p = _parser->getParameters( availableProcs[i] );
621 
622  //get type of processor from the parameters
623  string type = p->getStringVal( "ProcessorType" );
624 
625  //add this new processor
626  addProcessor( INACTIVE, availableProcs[i], type, p);
627  }
628 
629  //activate the processors in the execute section
630  for( unsigned int i=0; i<activeProcs.size(); i++ ){
631 
632  bool found = false;
633  //search all available processors to check if there are processors
634  //defined in the execute section that have no parameters
635  for( unsigned int j=0; j<_iProc.size(); j++ ){
636  if( activeProcs[i] == _iProc[j]->getName() ){
638  found = true;
639  }
640  }
641  //if processor has no parameters set the type to "Undefined!!"
642  if( !found ){
643  //add the processor to the active processors
644  addProcessor( ACTIVE, activeProcs[i], "Undefined!!", std::shared_ptr<StringParameters>() );
645  _errors.insert("Some Processors have no parameters");
646  }
647  }
648 
649  //============================================================
650  //do a consistency check
651  //============================================================
652 
654 
655  for( unsigned int i=0; i<_aProc.size(); i++ ){
656 
657  //add processor conditions
658  if( conditions.size() == _aProc.size() )
659  _aProc[i]->setConditions( conditions[i] );
660  else
661  _aProc[i]->setConditions( "true" ); // fix for old steering files
662 
663  for( sSet::const_iterator p=_aProc[i]->getConditions().begin();
664  p!=_aProc[i]->getConditions().end(); p++ ){
665  _pConditions.insert( *p );
666  }
667 
668  if( !_aProc[i]->isInstalled() ){
669  _errors.insert("Some Active Processors are not installed");
670  }
671  if( _aProc[i]->hasErrorCols() ){
672  _errors.insert("Some Active Processors have collection errors");
673  }
674  }
675  for( unsigned int i=0; i<_iProc.size(); i++ ){
676  if( !_iProc[i]->isInstalled() ){
677  _errors.insert("Warning: Some Inactive Processors are not installed");
678  }
679  }
680  return true;
681  }
682 
683  //find matching collections on the given vector
684  ColVec& MarlinSteerCheck::findMatchingCols( ColVec& v, CCProcessor* srcProc, const string& type, const string& value, const string& name ){
685  static ColVec cols;
686 
687  cols.clear();
688  for( unsigned int i=0; i<v.size(); i++ ){
689  if( v[i]->getSrcProc() != srcProc && v[i]->getType() == type ){
690  if( value != "UNDEFINED" ){
691  if( v[i]->getValue() == value ){
692  if( name != "UNDEFINED" ){
693  if( v[i]->getName() == name ){
694  cols.push_back( v[i] );
695  }
696  }
697  else{
698  cols.push_back( v[i] );
699  }
700  }
701  }
702  //if value == "UNDEFINED" it means we want all collections of a given type
703  else{
704  cols.push_back( v[i] );
705  }
706  }
707  }
708  return cols;
709  }
710 
711  //pop a processor out of the given vector
713  //test if the vector is empty
714  if( v.size() == 0 ){
715  return p;
716  }
717 
718  ProcVec newVec;
719  for( unsigned int i=0; i<v.size(); i++ ){
720  if( v[i] != p ){
721  newVec.push_back( v[i] );
722  }
723  }
724 
725  v.assign( newVec.begin(), newVec.end() );
726 
727  return p;
728  }
729 
730  //all processors
732  static ProcVec procs;
733 
734  procs.clear();
735 
736  procs.assign( _aProc.begin(), _aProc.end() );
737  procs.insert( procs.end(), _iProc.begin(), _iProc.end() );
738 
739  return procs;
740  }
741 
742  const string MarlinSteerCheck::getCondition( unsigned int index ){
743  if( index < _pConditions.size()){
744  sSet::const_iterator p;
745  advance( p=_pConditions.begin(), index );
746  return *p;
747  }
748  return "";
749  }
750 
751  void MarlinSteerCheck::addCondition( const std::string& condition ){
752  _pConditions.insert( condition );
753  }
754 
755  void MarlinSteerCheck::repCondition( const std::string& oldCond, const std::string& newCond ){
756  _pConditions.erase( oldCond );
757  _pConditions.insert( newCond );
758 
759  for( unsigned int i=0; i<_aProc.size(); i++ ){
760  if( _aProc[i]->hasCondition( oldCond )){
761  _aProc[i]->getConditions().erase( oldCond );
762  _aProc[i]->getConditions().insert( newCond );
763  }
764  }
765  }
766 
767  void MarlinSteerCheck::remCondition( const std::string& condition ){
768  _pConditions.erase( condition );
769 
770  for( unsigned int i=0; i<_aProc.size(); i++ ){
771  if( _aProc[i]->hasCondition( condition )){
772  _aProc[i]->getConditions().erase( condition );
773  }
774  }
775  }
776 
778  // COLLECTIONS RETRIEVAL METHODS
780 
781  //lcio collections
783  static ColVec cols;
784 
785  cols.clear();
786 
787  for( sColVecMap::const_iterator p=_lcioCols.begin(); p!=_lcioCols.end(); p++ ){
788  cols.insert( cols.end(), p->second.begin(), p->second.end() );
789  }
790  return cols;
791  }
792 
793  //processor's available collections
794  ColVec& MarlinSteerCheck::getProcCols( const ProcVec& v, const string& iotype ) const {
795  static ColVec cols;
796 
797  cols.clear();
798  for( unsigned int i=0; i<v.size(); i++ ){
799  cols.insert( cols.end(), v[i]->getCols( iotype ).begin(), v[i]->getCols( iotype ).end() );
800  }
801  return cols;
802  }
803 
804  //all available collections
806  static ColVec cols;
807 
808  ColVec lcCols = getLCIOCols();
809  ColVec aPCols = getProcCols( _aProc, OUTPUT );
810  ColVec iPCols = getProcCols( _iProc, OUTPUT );
811 
812  cols.assign( lcCols.begin(), lcCols.end() );
813  cols.insert( cols.end(), aPCols.begin(), aPCols.end() );
814  cols.insert( cols.end(), iPCols.begin(), iPCols.end() );
815 
816  return cols;
817  }
818 
819  // Saves the data to an XML file with the given name
820  bool MarlinSteerCheck::saveAsXMLFile( const string& file ){
821 
822  if( file.size() == 0 ){ return false; }
823 
824  ofstream outfile;
825  outfile.open( file.c_str() );
826 
827  //abort if file cannot be created or modified
828  if( !outfile ){
829  cerr << "MarlinSteerCheck::saveAsXMLFile: Error creating or modifying XML File [" << file << "]\n";
830  return false;
831  }
832 
833  const time_t* pnow;
834  time_t now;
835  time(&now);
836  pnow=&now;
837 
838  outfile << "<?xml version=\"1.0\" encoding=\"us-ascii\"?>" << endl;
839  outfile << "<!-- ?xml-stylesheet type=\"text/xsl\" href=\"http://ilcsoft.desy.de/marlin/marlin.xsl\"? -->" << endl;
840  outfile << "<!-- ?xml-stylesheet type=\"text/xsl\" href=\"marlin.xsl\"? -->" << endl << endl;
841 
842  outfile << "<!--\n";
843  outfile << "============================================================================================================================\n";
844  outfile << " Steering File generated by Marlin GUI on " << ctime(pnow) << endl;
845  outfile << " WARNING: - Please be aware that comments made in the original steering file were lost.\n";
846  outfile << " - Processors that are not installed in your Marlin binary lost their parameter's descriptions and types as well.\n";
847  outfile << " - Extra parameters that aren't categorized as default in a processor lost their description and type.\n";
848  outfile << "============================================================================================================================\n";
849  outfile << "-->\n";
850 
851  outfile << "\n\n<marlin xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
852  outfile << "xsi:noNamespaceSchemaLocation=\"http://ilcsoft.desy.de/marlin/marlin.xsd\">" << endl << endl;
853 
854  //============================================================
855  // execute section
856  //============================================================
857 
858  outfile << " <execute>\n";
859 
860  //Conditions variables
861  vector< pair<sSet, int> > openConditions;
862 
863  for( unsigned int i=0; i<_aProc.size(); i++ ){
864  //if processor has conditions
865  if( _aProc[i]->getConditions().size() != 0 ){
866  map<int, sSet> condLength;
867  //get length of conditions
868  for( sSet::const_iterator p=_aProc[i]->getConditions().begin(); p!=_aProc[i]->getConditions().end(); p++ ){
869  int length=1;
870  //check if processors below have the same condition
871  for( unsigned int j=(i+1); j<_aProc.size(); j++ ){
872  if( _aProc[j]->hasCondition(*p) ){
873  length++;
874  }
875  else{
876  //abort searching if chain is broken
877  break;
878  }
879  }
880  bool found=false;
881  //check if the condition is already open
882  for( unsigned int j=0; j<openConditions.size(); j++ ){
883  if( openConditions[j].first.find(*p) != openConditions[j].first.end() ){
884  found=true;
885  break;
886  }
887  }
888  if(!found){
889  //add condition length to a map
890  condLength[length].insert(*p);
891  }
892  }
893  //update open conditions
894  for( unsigned int j=0; j<openConditions.size(); j++ ){
895  openConditions[j].second--;
896  }
897  //push new conditions into open conditions and write them to the xml file
898  for( map<int, sSet>::reverse_iterator p=condLength.rbegin(); p!=condLength.rend(); p++ ){
899  openConditions.push_back( make_pair( p->second, p->first ));
900 
901  outfile << string( (openConditions.size()+1)*3,' ') << "<if condition=\"";
902  unsigned int size=0;
903  if( p->second.size() != 1 ){
904  for( sSet::const_iterator q=p->second.begin(); q!=p->second.end(); q++ ){
905  if( ((*q).find('&',0)!=string::npos) || ((*q).find('|',0)!=string::npos) || ((*q).find('!',0)!=string::npos) ){
906  outfile << "(" << *q << ")";
907  }
908  else{
909  outfile << *q;
910  }
911  if( ++size < p->second.size() ){
912  outfile << " && ";
913  }
914  }
915  }
916  else{
917  outfile << *p->second.begin();
918  }
919  outfile << "\">\n";
920  }
921  outfile << string( (openConditions.size()+2)*3,' ') << "<processor name=\"" << _aProc[i]->getName() << "\"/>\n";
922 
923  //check if there are final conditions
924  unsigned int pos;
925  for( pos=0; pos<openConditions.size(); pos++ ){
926  if( openConditions[pos].second==1 ){
927  break;
928  }
929  }
930  if( pos != openConditions.size() ){
931  for( unsigned int j=openConditions.size(); j>pos; j-- ){
932  outfile << string( (openConditions.size()+1)*3,' ') << "</if>\n";
933  openConditions.pop_back();
934  }
935  }
936  }
937  else{
938  outfile << " <processor name=\"" << _aProc[i]->getName() << "\"/>\n";
939  }
940  }
941  for( unsigned int i=0; i<_iProc.size(); i++ ){
942  outfile << " <!--processor name=\"" << _iProc[i]->getName() << "\"/-->\n";
943  }
944 
945  outfile << " </execute>\n\n";
946 
947  //============================================================
948  // global section
949  //============================================================
950 
951  outfile << " <global>\n";
952 
953  //LCIO Files
954  outfile << " <parameter name=\"LCIOInputFiles\">";
955 
956  for( unsigned int i=0; i<getLCIOFiles().size(); i++ ){
957  outfile << " " << getLCIOFiles()[i];
958  }
959  outfile << " </parameter>\n";
960 
961  StringVec keys;
962  _gparam->getStringKeys( keys );
963 
964  //Other parameters
965  for( unsigned int i=0; i<keys.size(); i++ ){
966  outfile << " <parameter name=\"" << keys[i] << "\"";
967 
968  StringVec values;
969  //get the values for the given key
970  _gparam->getStringVals( keys[i], values );
971 
972  outfile << ( values.size() == 1 ? " value=\"" : ">" );
973 
974  for( unsigned int j=0; j<values.size(); j++ ){
975  outfile << ( values.size() == 1 ? "" : " ") << values[j];
976  }
977  outfile << ( values.size() == 1 ? "\"/>\n" : " </parameter>\n" );
978  }
979 
980  outfile << " </global>\n\n";
981 
982  //============================================================
983  // processors (active + inactive)
984  //============================================================
985 
986  for( unsigned int i=0; i<_aProc.size(); i++ ){
987  _aProc[i]->writeToXML( outfile );
988  }
989  for( unsigned int i=0; i<_iProc.size(); i++ ){
990  _iProc[i]->writeToXML( outfile );
991  }
992 
993  outfile << "</marlin>\n";
994 
995  return true;
996  }
997 
998  // Saves steering file in dot format
1000 
1001  if( _errors.find("XML File parsing error") != _errors.end() ){
1002  return false;
1003  }
1004 
1005  if( file.size() == 0 ){ return false; }
1006 
1007  ofstream dotfile;
1008  dotfile.open( file.c_str() );
1009 
1010  //abort if file cannot be created or modified
1011  if( !dotfile ){
1012  cerr << "MarlinSteerCheck::saveAsDOTFile: Error creating or modifying DOT File [" << file << "]\n";
1013  return false;
1014  }
1015 
1016  //Header of dot file
1017  dotfile << "digraph MarlinSteering {\n"
1018  << "node [ fontname = \"Helvetica\","
1019  << "style = filled ];\n";
1020 
1021  //LCIO File (just the first one)
1022  if (!getLCIOFiles().empty())
1023  dotfile << "LCIOFile [color=darkgreen, fontcolor=white, label=\"" << getLCIOFiles()[0] << "\"]\n";
1024  else
1025  dotfile << "LCIOFile [color=darkgreen, fontcolor=white, label=\"LCIO File\"]\n";
1026 
1027  //This map holds the last processor to output a collection with this name
1028  map<string,string> producer_of;
1029  map<string,string> type_of;
1030 
1031  //Keep track of used outputs (we don't display the unused ones)
1032  vector<string> used_outputs;
1033 
1034  //We start with the collections produced by the LCIO file
1035  ColVec lcioCols = getLCIOCols();
1036  for( unsigned int i=0; i<lcioCols.size(); i++ ){
1037  producer_of[lcioCols[i]->getValue()] = "LCIOFile";
1038  type_of[lcioCols[i]->getValue()] = lcioCols[i]->getType();
1039  }
1040 
1041  //Loop over the processors finding where their inputs come from and
1042  //adding their outputs to the list of producers
1043  for( unsigned int i=0; i<_aProc.size(); i++ ){
1044  ColVec inputCols,outputCols;
1045  inputCols = _aProc[i]->getCols( INPUT );
1046  outputCols = _aProc[i]->getCols( OUTPUT );
1047  for( unsigned int j=0; j<inputCols.size(); j++ ){
1048  string producer = producer_of[inputCols[j]->getValue()];
1049  if (producer.size() > 0){
1050  //Producer found, create link
1051  dotfile << inputCols[j]->getValue() << " -> " << _aProc[i]->getName() << ";\n";
1052  //Note that this collection was used
1053  used_outputs.push_back(inputCols[j]->getValue());
1054  }
1055  else
1056  cout << inputCols[j]->getValue() << " not found for " << _aProc[i]->getName() << "\n";
1057  }
1058  for( unsigned int j=0; j<outputCols.size(); j++ ){
1059  producer_of[outputCols[j]->getValue()] = _aProc[i]->getName();
1060  type_of[outputCols[j]->getValue()] = outputCols[j]->getType();
1061  }
1062  }
1063 
1064  //Nodes for used collections and links from producers to output collections
1065  sort(used_outputs.begin(), used_outputs.end());
1066  vector<string>::iterator new_end = unique(used_outputs.begin(), used_outputs.end());
1067  for(int i=0; i<new_end-used_outputs.begin(); i++ ){
1068  dotfile << used_outputs[i] << " [color=lightsteelblue2, label=<<TABLE BORDER=\"0\"><TR><TD>"
1069  << used_outputs[i] << "</TD></TR><TR><TD><FONT POINT-SIZE=\"11.0\">"
1070  << type_of[used_outputs[i]] << "</FONT></TD></TR></TABLE>>];\n";
1071  dotfile << producer_of[used_outputs[i]] << " -> " << used_outputs[i] << ";\n";
1072  }
1073 
1074  //Processor Nodes
1075  for( unsigned int i=0; i<_aProc.size(); i++ ){
1076  if (_aProc[i]->getType() != "LCIOOutputProcessor")
1077  dotfile << _aProc[i]->getName() << " [color=navyblue, fontcolor=white, label=\""
1078  << _aProc[i]->getName() << "\"shape=rectangle];\n";
1079  }
1080 
1081  //Footer
1082  dotfile << "};\n";
1083 
1084  dotfile.close();
1085  cout << "DOT File written...\n";
1086  cout << "Now run dot eg: dot -Tps " << file << " > "<< file << ".ps\n";
1087  return true;
1088  }
1089 
1090 
1092  // DUMP METHODS
1094 
1095  // Dumps all information read from the steering file to stdout
1097  {
1098  if( _errors.find("XML File parsing error") != _errors.end() ){
1099  return;
1100  }
1101  //steering file
1102  dunderline(); cout << "\nSteering File:" << endl; endcolor();
1103  dhell(); dblue(); cout << _steeringFile << endl; endcolor();
1104 
1105  //LCIO files
1106  dunderline(); cout << "\nLCIO Input Files:" << endl; endcolor();
1107  dhell(); dblue();
1108 
1109  for( unsigned int i=0; i<getLCIOFiles().size(); i++ ){
1110  cout << getLCIOFiles()[i] << endl;
1111  }
1112 
1113  endcolor();
1114 
1115  //LCIO Collections
1116  dunderline(); cout << "\nLCIO Available Collections:" << endl; endcolor();
1117  dhell(); dblue();
1118  //ColVec lcCols = getLCIOCols();
1119  for( unsigned int i=0; i<getLCIOCols().size(); i++){
1120  cout << setw(40) << left << getLCIOCols()[i]->getValue();
1121  cout << setw(30) << left << getLCIOCols()[i]->getType();
1122  cout << getLCIOCols()[i]->getName() << endl;
1123  }
1124  endcolor();
1125 
1126  //Active Processors
1127  for( unsigned int i=0; i<_aProc.size(); i++ ){
1128 
1129  //print title
1130  if( i == 0 ){ dunderline(); cout << "\nActive Processors:" << endl; endcolor(); }
1131 
1132  if( !_aProc[i]->hasErrors() ){ dgreen(); }
1133  else{ dred(); }
1134 
1135  cout << setw(40) << left << _aProc[i]->getName() <<
1136  setw(30) << left << _aProc[i]->getType() <<
1137  " [ " << _aProc[i]->getStatusDesc() << " ] ";
1138 
1139  //print processor errors
1140  if( _aProc[i]->hasErrors() ){
1141  cout << " ( " << _aProc[i]->getError() << " )";
1142  /*
1143  for( unsigned int j=0; j<_aProc[i]->getErrors().size(); j++ ){
1144  cout << " : " << _aProc[i]->getErrors()[j];
1145  }
1146  */
1147  }
1148  cout << endl;
1149  endcolor();
1150  }
1151 
1152  //Inactive Processors
1153  for( unsigned int i=0; i<_iProc.size(); i++ ){
1154 
1155  //print title
1156  if( i == 0 ){ dunderline(); cout << "\nInactive Processors:" << endl; endcolor(); }
1157 
1158  ddunkel(); dyellow();
1159 
1160  cout << setw(40) << left << _iProc[i]->getName() <<
1161  setw(30) << left << _iProc[i]->getType() <<
1162  " [ " << _iProc[i]->getStatusDesc() << " ] ";
1163 
1164  //print processor errors
1165  if( _iProc[i]->hasErrors() ){
1166  cout << " ( " << _iProc[i]->getError() << " )";
1167  /*
1168  for( unsigned int j=0; j<_iProc[i]->getErrors().size(); j++ ){
1169  cout << " : " << _iProc[i]->getErrors()[j];
1170  }
1171  */
1172  }
1173 
1174  cout << endl;
1175  endcolor();
1176  }
1177 
1178  cout << endl;
1179 
1180  for( unsigned int i=0; i<_aProc.size(); i++ ){
1181  dumpColErrors( i, cout );
1182  }
1183 
1184  cout << endl << endl;
1185 
1186  for( sSet::const_iterator p=_errors.begin(); p!=_errors.end(); p++){
1187  dred();
1188  cout << (*p) << endl;
1189  endcolor();
1190  }
1191 
1192  if( _errors.size()==0 || (_errors.size()==1 && (_errors.find("Warning: Some Inactive Processors are not installed")!=_errors.end()))){
1193  cout << "\nNo Errors were found :)" << endl;
1194  }
1195  else{
1196  cout << "\nErrors were found (see above)..." << endl;
1197  }
1198 
1199  cout << endl;
1200  }
1201 
1202  // Returns the Errors for an Active Processor at the given index
1203  void MarlinSteerCheck::dumpColErrors( unsigned int i, ostream& stream, bool separators ){
1204 
1205  //skip if index is not valid or processor has no col errors
1206  if( i<_aProc.size() && _aProc[i]->hasErrorCols() ){
1207 
1208  dred(); dunderline();
1209  stream << "\nProcessor [" <<
1210  _aProc[i]->getName() << "] of type [" <<
1211  _aProc[i]->getType() << "] has following errors:" <<
1212  endl;
1213  endcolor();
1214 
1215  sSet dTypes = _aProc[i]->getColTypeNames( DUPLICATE );
1216 
1217  for( sSet::const_iterator q=dTypes.begin(); q!=dTypes.end(); q++){
1218  stream << "\n* Following Collections of type [";
1219  dhell(); dblue(); stream << (*q); endcolor();
1220  stream << "] were already found in the event:\n";
1221  if( separators ){
1222  stream << string( 170, '-') << endl;
1223  }
1224 
1225  ColVec dCols = _aProc[i]->getCols( DUPLICATE, (*q) );
1226  for( unsigned int j=0; j<dCols.size(); j++ ){
1227  stream << " -> [";
1228  dyellow(); stream << dCols[j]->getValue(); endcolor();
1229  stream << "]\n";
1230  }
1231  stream << "\n * Following collections are in conflict with this collection:\n";
1232  for( unsigned int j=0; j<dCols.size(); j++ ){
1233 
1234  ColVec lcioCols = findMatchingCols( getLCIOCols(), _aProc[i], dCols[j]->getType(), dCols[j]->getValue() );
1235  if( lcioCols.size() != 0 ){
1236  for( unsigned int k=0; k<lcioCols.size(); k++ ){
1237  stream << " -> [";
1238  dyellow(); stream << lcioCols[k]->getValue(); endcolor();
1239  stream << "] in LCIO file: [" << lcioCols[k]->getName() << "]\n";
1240  }
1241  }
1242  ColVec oCols = findMatchingCols( getProcCols(_aProc, OUTPUT), _aProc[i], dCols[j]->getType(), dCols[j]->getValue() );
1243  if( oCols.size() != 0 ){
1244  for( unsigned int k=0; k<oCols.size(); k++ ){
1245  stream << " -> [";
1246  dyellow(); stream << oCols[k]->getValue(); endcolor();
1247  stream << "] in [Active] Processor [" << oCols[k]->getSrcProc()->getName()
1248  << "] of Type [" << oCols[k]->getSrcProc()->getType() << "]\n";
1249  }
1250  }
1251  }
1252  if( separators ){
1253  stream << string( 170, '-') << endl;
1254  }
1255  }
1256 
1257  sSet uTypes = _aProc[i]->getColTypeNames( UNAVAILABLE );
1258 
1259  for( sSet::const_iterator p=uTypes.begin(); p!=uTypes.end(); p++){
1260  stream << "\n* Following Collections of type [";
1261  dhell(); dblue(); stream << (*p); endcolor();
1262  stream << "] are unavailable:\n";
1263  if( separators ){
1264  stream << string( 170, '-') << endl;
1265  }
1266 
1267  ColVec uCols = _aProc[i]->getCols( UNAVAILABLE, (*p) );
1268  for( unsigned int j=0; j<uCols.size(); j++ ){
1269  stream << " -> [";
1270  dyellow(); stream << uCols[j]->getValue(); endcolor();
1271  stream << "]\n";
1272  }
1273  stream << endl;
1274 
1275  //find collections that match the type of the unavailable collection
1276  ColVec avCols = findMatchingCols( getAllCols(), _aProc[i], (*p) );
1277 
1278  if( avCols.size() != 0 ){
1279  dgreen();
1280  stream << " * Following available collections of the same type were found:" << endl;
1281  endcolor();
1282  for( unsigned int k=0; k<avCols.size(); k++ ){
1283  stream << " -> [";
1284 
1285  for( unsigned int j=0; j<uCols.size(); j++ ){
1286  if( avCols[k]->getValue() == uCols[j]->getValue() ){ dyellow(); }
1287  }
1288  stream << avCols[k]->getValue();
1289  endcolor();
1290 
1291  if( avCols[k]->getSrcProc() == 0 ){
1292  stream << "] in LCIO file: [" << avCols[k]->getName() << "]" << endl;
1293  }
1294  else{
1295  stream << "] in [" <<
1296  avCols[k]->getSrcProc()->getStatusDesc() << "] Processor [" <<
1297  avCols[k]->getSrcProc()->getName() << "] of Type [" <<
1298  avCols[k]->getSrcProc()->getType() << "]" <<
1299  endl;
1300  }
1301  }
1302  }
1303  //no collections that match the unavailable collection were found
1304  else{
1305  stream << " * Sorry, no suitable collections were found." << endl;
1306  }
1307  if( separators ){
1308  stream << string( 170, '-') << endl;
1309  }
1310  }
1311  }
1312  }
1313 
1314 } // namespace
XML parser for Marlin steering files.
Definition: XMLParser.h:106
T ctime(T...args)
T empty(T...args)
virtual void setCmdLineParameters(const CommandLineParametersMap &cmdlineparams)=0
set command line parameters
T open(T...args)
void remProcessor(unsigned int index, bool status)
Remove processor with the given status at the given index.
#define dgreen()
static CMProcessor * instance()
return the instance of this class
Definition: CMProcessor.cc:11
void repCondition(const std::string &oldCond, const std::string &newCond)
Replace a Condition.
#define endcolor()
ColVec & getProcCols(const ProcVec &v, const std::string &iotype) const
T system(T...args)
T rend(T...args)
handles information about LCIO collections needed by MarlinSteerCheck
Definition: CCCollection.h:17
T advance(T...args)
T rfind(T...args)
T endl(T...args)
ColVec & getLCIOCols() const
Returns the collections read from LCIO files.
ColVec & findMatchingCols(ColVec &v, CCProcessor *srcProc, const std::string &type, const std::string &value="UNDEFINED", const std::string &name="UNDEFINED")
#define MAXEVENTS
T left(T...args)
void remCondition(const std::string &condition)
Removes the given condition.
T end(T...args)
std::shared_ptr< StringParameters > _gparam
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Load a file using the current document value.
Definition: tinyxml.cc:915
virtual void parse()=0
Parse the input file.
#define INACTIVE
Definition: CCProcessor.h:11
T unique(T...args)
T time(T...args)
CCProcessor * popProc(ProcVec &v, CCProcessor *p)
handles information about marlin processors and their collections needed by MarlinSteerCheck ...
Definition: CCProcessor.h:39
void dump_information()
Dumps all information read from the steering file to stdout.
const std::string getCondition(unsigned int index)
Returns the condition for a given index.
Simple parser class for Marlin.
Definition: Parser.h:36
T setw(T...args)
void activateProcessor(unsigned int index)
Activate processor at the given index.
bool parseXMLFile(const std::string &file, const CommandLineParametersMap *cmdlineparams=NULL)
STL class.
sSet & getColsSet(const std::string &type, const std::string &name, CCProcessor *proc)
Returns a list of all available Collections for a given type, name and processor (to use in a ComboBo...
#define ddunkel()
T push_back(T...args)
STL class.
#define dhell()
ColVec & getAllCols() const
T strlen(T...args)
#define dred()
T close(T...args)
bool saveAsDOTFile(const std::string &file)
Saves steering file in dot format.
T erase(T...args)
T pop_back(T...args)
Always the top level node.
Definition: tinyxml.h:1366
void addProcessor(bool status, const std::string &name, const std::string &type, std::shared_ptr< StringParameters > p)
Add a new processor.
T str(T...args)
T make_pair(T...args)
T clear(T...args)
bool saveAsXMLFile(const std::string &file)
Saves the data to an XML file with the given name Returns false if error occured. ...
ColVec & getCols(const std::string &iotype, const std::string &type_name="ALL_COLLECTIONS")
Returns collections of a given iotype ( INPUT, OUTPUT, UNAVAILABLE, DUPLICATE ) for a given name or t...
Definition: CCProcessor.cc:352
void consistencyCheck()
Performs a check at all active processors to search for unavailable collections.
T insert(T...args)
#define UNAVAILABLE
Definition: CCProcessor.h:17
T find(T...args)
T size(T...args)
ProcVec & getAllProcs() const
T assign(T...args)
void changeProcessorPos(unsigned int pos, unsigned int newPos)
Change the active processor at the given index to the new given position.
#define COL_ERRORS
Definition: CCProcessor.h:14
void dumpColErrors(unsigned int i, std::ostream &stream, bool separators=false)
Writes the collection errors for the active processor with given index to the given stream...
T begin(T...args)
#define dyellow()
void deactivateProcessor(unsigned int index)
Deactivate processor at the given index.
T c_str(T...args)
LCReader * lcReader
#define DUPLICATE
Definition: CCProcessor.h:18
#define dblue()
T sort(T...args)
#define dunderline()
#define INPUT
Definition: CCProcessor.h:15
virtual std::shared_ptr< StringParameters > getParameters(const std::string &sectionName) const =0
Return the StringParameters defined for this section of the steering file.
StringVec & getLCIOFiles()
Returns the names of the LCIO files found in the global section.
bool isActive()
Returns true if the processor is active.
Definition: CCProcessor.h:68
#define ACTIVE
Definition: CCProcessor.h:10
void changeLCIOFilePos(unsigned int pos, unsigned int newPos)
Change the LCIO File at the given index to the new given position.
void addCondition(const std::string &condition)
Add a new Condition.
STL class.
int addLCIOFile(const std::string &file)
Add LCIO file and read all collections inside it.
void remLCIOFile(const std::string &file)
Remove LCIO file and all collections associated to it.
#define OUTPUT
Definition: CCProcessor.h:16
int existsProcessor(const std::string &type, const std::string &name="")
Check if a processor of the given type with the given name already exists Returns 0 if the processor ...
T rbegin(T...args)