// ----------------------------------------------------------------------------
// $Id: LCDFastMC.cxx,v 1.2 2001/06/23 16:15:43 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDFastMC.cxx,v $
// Revision 1.2 2001/06/23 16:15:43 toshi
// In method arg. , Char_t* -> const Char_t*
//
// Revision 1.1 2001/05/10 17:55:56 toshi
// Changes C++ name convention from *.C to *.cxx to allow Windows usage.
//
//
#include <iostream.h>
#include "LCDFastMC.h"
//______________________________________________________________________
//
// LCDFastMC
//
// Manager class for Fast MC. Creates instances of specific
// modules (processors) at constructor time. Then may fetch
// events one at a time from event source and invoke the modules
ClassImp(LCDFastMC)
//______________________________________________________________________
LCDFastMC::LCDFastMC() {
Init();
}
//______________________________________________________________________
//______________________________________________________________________
LCDFastMC::LCDFastMC(LCDGetParameters* gp,
const Char_t* smearFileName,
LCDEvent* event) {
Init();
SetFastMC(gp,smearFileName,event);
}
//______________________________________________________________________
//______________________________________________________________________
LCDFastMC::LCDFastMC(const Char_t* geometryFileName,
const Char_t* smearFileName,
LCDEvent* event) {
Init();
SetFastMC(geometryFileName,smearFileName,event);
}
//______________________________________________________________________
//______________________________________________________________________
LCDFastMC::~LCDFastMC() {
if (m_mygp && m_gp) {
delete m_gp;
m_gp=0;
}
if (m_ModuleList) {
m_ModuleList->Delete();
delete m_ModuleList;
m_ModuleList=0;
}
if (m_iter) {
delete m_iter;
m_iter=0;
}
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::Init() {
m_event = 0;
m_ModuleList = 0;
m_iter = 0;
m_module = 0;
m_eventMarker = 0;
m_mcPartPrint = 0;
m_trackFullSmear = 0;
m_ipSmear = 0;
m_calRecon = 0;
m_gp = 0;
m_mygp = kFALSE;
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::SetFastMC(const Char_t* geometryFileName,
const Char_t* smearFileName,
LCDEvent* event
) {
FILE* f_geomfile = fopen(geometryFileName,"r");
LCDGetParameters* gp = new LCDGetParameters(f_geomfile);
m_mygp = kTRUE;
fclose(f_geomfile);
SetFastMC(gp,smearFileName,event);
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::SetFastMC(LCDGetParameters* gp,
const Char_t* smearFileName,
LCDEvent* event) {
// Constructor for FastMC. Modules can use parameterFile
// to set up and will write to outputFile (if non-null outputFileName
// has been supplied.)
m_event = event;
m_gp = gp;
// create list of modules to run
CreateModules(smearFileName);
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::CreateModules(const Char_t* smearFileName){
// Add modules to list. They inherit from RecModule and must have
// doit, cleanup and spew functions defined.
if (m_gp == 0) {
fprintf(stderr,
"LCDFastMC::CreateModulesYou do not set Detector Parameter...n");
}
if (m_ModuleList == 0) m_ModuleList=new TObjArray(10);
if (m_eventMarker == 0) {
m_eventMarker = new LCDEventMarker(0,0);
m_ModuleList->Add(m_eventMarker);
}
if (m_ipSmear == 0) {
m_ipSmear = new LCDIPSmear(m_gp);
m_ModuleList->Add(m_ipSmear);
}
if (m_mcPartPrint == 0) {
m_mcPartPrint = new LCDMCPartPrint();
m_ModuleList->Add(m_mcPartPrint);
}
if (m_trackFullSmear == 0) {
m_trackFullSmear = new LCDTrackFullSmear(m_gp,smearFileName);
m_ModuleList->Add(m_trackFullSmear);
}
if (m_calRecon == 0) {
m_calRecon = new LCDFMCCalRecon(m_gp);
m_ModuleList->Add(m_calRecon);
}
if (m_iter == 0)
m_iter = new TObjArrayIter(m_ModuleList);
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::Doit(LCDEvent *event) {
// Invoke each module to process event
if (event) {
m_event=event;
}
if (m_event) {
Cleanup(0);
m_iter->Reset();
while( (m_module = (LCDRecModule*) (*m_iter)()) ) {
m_module->Doit(m_event);
}
} else {
fprintf(stderr,"LCDFastMC::Doit Pointer of LCDEvent is not given!n");
}
}
//______________________________________________________________________
//______________________________________________________________________
void LCDFastMC::Cleanup(LCDEvent *event) {
// Invoke each module's cleanup method
if (event) {
m_event=event;
}
if (m_event) {
m_iter->Reset();
while( (m_module = (LCDRecModule*) (*m_iter)()) ){
m_module->Cleanup(m_event);
}
} else {
fprintf(stderr,"LCDFastMC::Clean Pointer of LCDEvent is not given!n");
}
}
//______________________________________________________________________
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.