Changeset View
Changeset View
Standalone View
Standalone View
examples/SimFitCoordinator.cc
- This file was moved from examples/Master.cc.
Show All 26 Lines | |||||
#include <vector> | #include <vector> | ||||
#include "TFile.h" | #include "TFile.h" | ||||
#include "TRandom.h" | #include "TRandom.h" | ||||
#include "TString.h" | #include "TString.h" | ||||
#include "TSystem.h" | #include "TSystem.h" | ||||
#include "LauSimFitMaster.hh" | #include "LauSimFitCoordinator.hh" | ||||
void usage( std::ostream& out, const TString& progName ) | void usage( std::ostream& out, const TString& progName ) | ||||
{ | { | ||||
out<<"Usage:\n"; | out<<"Usage:\n"; | ||||
out<<progName<<" <iFit> <nExpt> [firstExpt = 0] [numSlaves = 2] [port = 0]\n"; | out<<progName<<" <iFit> <nExpt> [firstExpt = 0] [numTasks = 2] [port = 0]\n"; | ||||
} | } | ||||
int main(const int argc, const char ** argv) | int main(const int argc, const char ** argv) | ||||
{ | { | ||||
if ( argc < 3 ) { | if ( argc < 3 ) { | ||||
usage( std::cerr, argv[0] ); | usage( std::cerr, argv[0] ); | ||||
return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
} | } | ||||
UInt_t iFit = atoi( argv[1] ); | UInt_t iFit = atoi( argv[1] ); | ||||
UInt_t nExpt = atoi( argv[2] ); | UInt_t nExpt = atoi( argv[2] ); | ||||
UInt_t firstExpt = 0; | UInt_t firstExpt = 0; | ||||
UInt_t nSlaves = 2; | UInt_t nTasks = 2; | ||||
UInt_t port = 0; | UInt_t port = 0; | ||||
Bool_t useAsymmErrors = kFALSE; | Bool_t useAsymmErrors = kFALSE; | ||||
Bool_t twoStageFit = kFALSE; | Bool_t twoStageFit = kFALSE; | ||||
if ( argc > 3 ) { | if ( argc > 3 ) { | ||||
firstExpt = atoi( argv[3] ); | firstExpt = atoi( argv[3] ); | ||||
if ( argc > 4 ) { | if ( argc > 4 ) { | ||||
nSlaves = atoi( argv[4] ); | nTasks = atoi( argv[4] ); | ||||
if ( argc > 5 ) { | if ( argc > 5 ) { | ||||
port = atoi( argv[5] ); | port = atoi( argv[5] ); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
TString ntupleName = "master-ntuple-"; | TString ntupleName = "coordinator-ntuple-"; | ||||
ntupleName += iFit; | ntupleName += iFit; | ||||
ntupleName += ".root"; | ntupleName += ".root"; | ||||
LauSimFitMaster master( nSlaves, port ); | LauSimFitCoordinator coordinator( nTasks, port ); | ||||
master.runSimFit( ntupleName, nExpt, firstExpt, useAsymmErrors, twoStageFit ); | coordinator.runSimFit( ntupleName, nExpt, firstExpt, useAsymmErrors, twoStageFit ); | ||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||
} | } |