// $Log: BrModuleContainer.cxx,v $
// Revision 1.3 1998/07/03 15:57:39 hagel
// Clean up g++ warnings
//
// Revision 1.2 1998/04/06 21:11:51 videbaek
// Clean up and additions for Win95
//
// Revision 1.1.1.1 1998/03/04 21:32:48 brahmlib
// Brat base
//
// $Id: BrModuleContainer.cxx,v 1.3 1998/07/03 15:57:39 hagel Exp $
//
// ROOT classes
#include "TObjArray.h"
// BRAHMS classes
#include "BrModule.h"
#include "BrModuleContainer.h"
#include <iostream.h>
ClassImp(BrModuleContainer)
///////////////////////////////////////////////////////////////////////
// //
// BrEventIO //
// //
// Class to manage modules to be executed in sequence in //
// BRAHMS analysis //
// //
// Description: //
// //
// This class is a container class for BRAHMS Analysis Modules. //
// It is meant to be used to simplify like-kinds of analyis. //
// //
// Usage: //
// The Object is created, modules previously created are added to //
// it and then is used in the event by event loop to call the //
// Event method of each module that was added. Usage of this //
// class essentially eliminates a loop. //
// //
// Example: //
// //
// asp_digitize = new BrModuleContainer("asp_digitize","Digitize Modules"); //
// asp_digitize->AddModule(t1_digitize); //add t1_digitize previously created//
// asp_digitize->AddModule(t2_digitize); //
// asp_digitize->AddModule(t3_digitize); //
// asp_digitize->AddModule(t4_digitize); //
// asp_digitize->AddModule(t5_digitize); //
// //
// Event Loop //
// . //
// . //
// Get GBRAHMS data and create BrEvent *geantevent //
// BrEvent *dig_table = new BrEvent("Digitized Table",0,0);
// //
// asp_digitize->Event(geantevent,dig_table); //
// . //
// . //
// Analyze dig_table as needed //
// . //
// . //
// delete dig_table; //
// . //
// . //
// End Event Loop //
// //
///////////////////////////////////////////////////////////////////////
class BrEventNode;
BrModuleContainer::BrModuleContainer()
{
fModuleList = new TObjArray();
fVerbose=0;
};
BrModuleContainer::BrModuleContainer(Char_t *Name, Char_t *Title)
{
//Constructor
//Set up Module list
fModuleList = new TObjArray();
SetName(Name);
if(Title)
SetTitle(Title);
else
SetTitle(Name);
};
BrModuleContainer::~BrModuleContainer()
{
// Destructor
// Delete module list if it was created
if(fModuleList)
delete fModuleList;
};
Int_t BrModuleContainer::AddModule(BrModule *Object)
{
// Routine to add a module to the list of modules to be executed
fModuleList->Add(Object);
if(fVerbose)
{
printf("Add data Object %s, total # of Objects %dn",
Object->GetName(),
fModuleList->GetSize());
}
return fModuleList->GetSize();
};
void BrModuleContainer::ListModules()
{
// Routine to list the names of all modules that have been added.
TObject *object;
TClass *cl;
Int_t num = 0;
TIter NextObject(fModuleList);
while((object = NextObject()))
{
cl = object->Class();
printf("%d: %x - %s %sn",num,object,
object->GetName(),object->GetTitle());
num++;
}
}
void BrModuleContainer::Event()
{
// The method to be used event by event in case there are no arguments in the
// Event method of the modules in the list.
BrModule *object;
TIter NextObject(fModuleList);
while((object = (BrModule*) NextObject()))
{
object->Event();
}
}
void BrModuleContainer::Event(BrEventNode* indat, BrEventNode* outdat)
{
// The method to be used event by event in case there is an input table and output
// table in the Event method of the modules in the list.
BrModule *object;
TIter NextObject(fModuleList);
while((object = (BrModule*) NextObject()))
{
object->EventStatisticsStart();
object->Event(indat, outdat);
if(fVerbose){
cout << "Calling Event " << object->GetName() << endl;
}
object->EventStatisticsEnd();
}
}
void BrModuleContainer::SetVerbose(Int_t Verbose){
// Routine to get this class to tell more about what it is up to.
fVerbose = Verbose;
}
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.