#include "FullRecon.h"
#include "TCollection.h"
#include "TObjArray.h"
#include "Event.h"
#include <stdio.h>
#include "GetParameters.h"
#include "readRootFile.h"


 ClassImp(FullRecon)
 FullRecon::FullRecon(EventSource* eventSource,
	       char* parameterFileName,
	       char* outputFileName
	       ) {

  // If running interactively in Root, may not have an output file
  m_ofile = 0;
  if (outputFileName)  m_ofile =  fopen(outputFileName,"w");
  
   m_parfile =  fopen(parameterFileName,"r");

   GetParameters* gp = new GetParameters(m_parfile);

   // create list of modules to run

   // add modules to list. They inherit from RecModule and must have 
   // doit, cleanup and spew functions defined.

    m_eventMarker = new EventMarker(0,0);
    m_ModuleList.Add(m_eventMarker);

    m_mcPartPrint = new MCPartPrint();
    m_ModuleList.Add(m_mcPartPrint); 

    m_trackRecSmear = new TrackRecSmear(gp);
    m_ModuleList.Add(m_trackRecSmear); 

    m_ClusterSystem = new ClusterSystem(gp);
    m_ModuleList.Add(m_ClusterSystem);

    m_iter = new TObjArrayIter(&m_ModuleList);

    m_source = eventSource;
    m_event = 0;

};

 FullRecon::~FullRecon() {

  int parfileStatus = fclose(m_parfile);
  int ofileStatus;
  
  if (m_ofile) ofileStatus = fclose(m_ofile);

};

 Int_t FullRecon::DoEventNewstyle() {


  // translate to Root event format

  // clean up previous event
  if (m_event) m_event->Clear();

  int ierr = m_source->getEvent(m_event);
  if (!ierr) return ierr;
  m_event = ((readRootFile*)m_source)->getEventPointer();;
  

  Cleanup();        // All modules get ready
  Doit(m_event);      // All modules process
  Spew();           // All modules output
  
  
  return 1;
} 

 Int_t FullRecon::FetchEvent(Event *evt) {
  return m_source->getEvent(evt);
}

 void FullRecon::Doit(Event *event) {
  m_iter->Reset();
  
  while (m_module = (RecModule*) (*m_iter)()) {
    m_module->doit(event);
  }
}



 void  FullRecon::Spew() {
  if (m_ofile) {
    m_iter->Reset();

    while (m_module = (RecModule*)(*m_iter)()) {
      m_module->spew(m_ofile);
    }
  }
}


 void  FullRecon::Cleanup() {
  m_iter->Reset();

  while (m_module = (RecModule*) (*m_iter)()) {

    m_module->cleanup();
  }
}


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.