Changeset View
Changeset View
Standalone View
Standalone View
examples/SimFitTaskRooFit.cc
- This file was moved from examples/SlaveRooFit.cc.
Show All 31 Lines | |||||
#include "RooExponential.h" | #include "RooExponential.h" | ||||
#include "RooDataSet.h" | #include "RooDataSet.h" | ||||
#include "RooArgList.h" | #include "RooArgList.h" | ||||
#include "RooArgSet.h" | #include "RooArgSet.h" | ||||
#include "TFile.h" | #include "TFile.h" | ||||
#include "TString.h" | #include "TString.h" | ||||
#include "TTree.h" | #include "TTree.h" | ||||
#include "LauRooFitSlave.hh" | #include "LauRooFitTask.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<<" gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n"; | out<<progName<<" gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n"; | ||||
out<<"or\n"; | out<<"or\n"; | ||||
out<<progName<<" fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]"<<std::endl; | out<<progName<<" fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]"<<std::endl; | ||||
} | } | ||||
int main( int argc, char** argv ) | int main( int argc, char** argv ) | ||||
{ | { | ||||
// Process command-line arguments | // Process command-line arguments | ||||
// Usage: | // Usage: | ||||
// ./SlaveRooFit gen <category = DD or LL> [nExpt = 1] [firstExpt = 0] | // ./SimFitTaskRooFit gen <category = DD or LL> [nExpt = 1] [firstExpt = 0] | ||||
// or | // or | ||||
// ./SlaveRooFit fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0] | // ./SimFitTaskRooFit fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0] | ||||
if ( argc < 3 ) { | if ( argc < 3 ) { | ||||
usage( std::cerr, argv[0] ); | usage( std::cerr, argv[0] ); | ||||
return EXIT_FAILURE; | return EXIT_FAILURE; | ||||
} | } | ||||
TString command = argv[1]; | TString command = argv[1]; | ||||
command.ToLower(); | command.ToLower(); | ||||
TString category = argv[2]; | TString category = argv[2]; | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | int main( int argc, char** argv ) | ||||
RooRealVar sigYield( "signalEvents"+category, "", nSigEvents, -2.0*nTotEvents, 2.0*nTotEvents ); | RooRealVar sigYield( "signalEvents"+category, "", nSigEvents, -2.0*nTotEvents, 2.0*nTotEvents ); | ||||
RooRealVar combYield( "CombinatorialEvents"+category, "", nCombBgEvents, -2.0*nTotEvents, 2.0*nTotEvents ); | RooRealVar combYield( "CombinatorialEvents"+category, "", nCombBgEvents, -2.0*nTotEvents, 2.0*nTotEvents ); | ||||
RooAddPdf model( "model", "", RooArgList( sigPDF, combPDF ), RooArgList( sigYield, combYield ) ); | RooAddPdf model( "model", "", RooArgList( sigPDF, combPDF ), RooArgList( sigYield, combYield ) ); | ||||
// Execute the generation/fit | // Execute the generation/fit | ||||
if ( command == "fit" ) { | if ( command == "fit" ) { | ||||
// Create the slave instance | // Create the task instance | ||||
LauRooFitSlave fitModel(model, kTRUE, RooArgSet(mB)); | LauRooFitTask fitModel(model, kTRUE, RooArgSet(mB)); | ||||
fitModel.runSlave( dataFile, treeName, rootFileName, tableFileName, "localhost", port ); | fitModel.runTask( dataFile, treeName, rootFileName, tableFileName, "localhost", port ); | ||||
} else { | } else { | ||||
std::cerr << "Can't do this yet" << std::endl; | std::cerr << "Can't do this yet" << std::endl; | ||||
//RooDataSet* data = model.generate( RooArgSet(mB), nTotEvents ); | //RooDataSet* data = model.generate( RooArgSet(mB), nTotEvents ); | ||||
} | } | ||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||
} | } |