00001 #include "MakeMuonEvents.h"
00002 #include <TMuonEvent.h>
00003 #include "ModulesOptions.h"
00004 #include "definitions.h"
00005
00006 #include <iostream>
00007 #include <string>
00008 #include <map>
00009 #include <utility>
00010
00011 #include "MaxTimeDiffMEGenerator.h"
00012 #include "RegisterModule.inc"
00013 #include "TMEGeneratorFactory.h"
00014
00015 using std::string;
00016 using std::map;
00017 using std::cout;
00018 using std::endl;
00019
00020 extern MuonEventList gMuonEvents;
00021 extern SourceDetPulseMap gDetectorPulseMap;
00022
00023 MakeMuonEvents::MakeMuonEvents(modules::options* opts):
00024 BaseModule("MakeMuonEvents",opts,false),fOptions(opts){
00025 if(fOptions){
00026 fAlgorithm=fOptions->GetString("algorithm","FixedWindow");
00027 }
00028 dir->cd("/");
00029 }
00030
00031 MakeMuonEvents::~MakeMuonEvents(){
00032 }
00033
00034 int MakeMuonEvents::BeforeFirstEntry(TGlobalData *aData, const TSetupData* aSetup){
00035 if(fAlgorithm.empty()) return 1;
00036 fGenerator=TMEGeneratorFactory::Instance()->createModule(
00037 fAlgorithm,new TMEGeneratorOptions(fAlgorithm,fOptions));
00038 if(!fGenerator) return 2;
00039 return 0;
00040 }
00041
00042 int MakeMuonEvents::ProcessEntry(TGlobalData *aData, const TSetupData* aSetup){
00043
00044 int retVal=fGenerator->ProcessPulses(gMuonEvents,gDetectorPulseMap);
00045 return retVal;
00046 }
00047
00048
00049 ALCAP_REGISTER_MODULE(MakeMuonEvents,algorithm);