#ifndef __CINT__ submitcalibration() #endif { #include //__________________________________________________________________ BrAppOptionManager* optionManager = BrAppOptionManager::Instance(); BrAppStringOption* parametersOption = new BrAppStringOption('p', "parameters", "Parameters file name", "DetectorParameters.txt"); BrAppIntOption* runOption = new BrAppIntOption('r', "run", "Run number", 0); BrAppIntOption* eventsOption = new BrAppIntOption('e', "events", "Max events", 0); BrAppStringOption* tpcOption = new BrAppStringOption('t', "tpc", "Tpc name to commit", NULL); BrAppStringOption* fileOption = new BrAppStringOption('f', "file", "File name to commit", NULL); BrAppStringOption* maindbhostOption = new BrAppStringOption('M', "maindb-host", "Main DB host name", "brahms-db0.rcf.bnl.gov"); BrAppStringOption* maindbnameOption = new BrAppStringOption('D', "maindb-name", "Main DB name", "BrahmsMain"); BrAppStringOption* maindbuserOption = new BrAppStringOption('U', "maindb-user", "Main DB user name", "insert"); BrAppIntOption* verboseOption = new BrAppIntOption('v', "verbose", "Verbosity", 0); BrAppIntOption* debugOption = new BrAppIntOption('d', "debug", "Debug level", 0); if (!optionManager->ProcessCommandLine()) { Warning("submitcalibration", "Bad command line, try --help option"); return; } if (fileOption->GetNValues() != tpcOption->GetNValues()) { Warning("submitcalibration", "Bad command line! Mismatch number of submitfiles and TPC. Try --help option"); return; } // Database section BrMainDb* mainDb = BrMainDb::Instance(); mainDb->SetUserName(maindbuserOption->GetValue()); mainDb->SetHostName(maindbhostOption->GetValue()); mainDb->SetDbName(maindbnameOption->GetValue()); if (!mainDb->Connect()) return; if (!mainDb->ConnectToCalib()) return; if (!mainDb->ConnectToRun()) return; if (!mainDb->ConnectToGeom()) return; // Parameter and geometry managers BrParameterDbManager *parameterManager = BrParameterDbManager::Instance(); parameterManager->SetDbParameterFileName(parametersOption->GetValue()); parameterManager->SetDebugLevel(debugOption->GetValue()); BrGeometryDbManager* geometryManager = BrGeometryDbManager::Instance(); geometryManager->SetDbModeMySQL(); Int_t nRuns = runOption->GetNValues(); BrRunInfoManager* runInfoManager = BrRunInfoManager::Instance(); runInfoManager->SetDebugLevel(debugOption->GetValue()); for (Int_t i = 0; i < nRuns; i++) runInfoManager->Register(runOption->GetValue(i)); // The main module BrMainModule* mainModule = new BrMainModule("tpcCalibration", "Main calibrator of tpc", "Truls M Larsen", 1, 0, 0); mainModule->SetMaxEvents(eventsOption->GetValue()); mainModule->SetMaxRuns(1); // Module: BrDbUpdateModule BrDbUpdateModule* dbUpdateModule = new BrDbUpdateModule("dbUpdate", "Update from DB when needed"); mainModule->AddModule(dbUpdateModule); // Needed modules should go here. for (Int_t i=0; iGetNValues(); i++) { BrTpcTimeCalModule *tpctimemodule = new BrTpcTimeCalModule(tpcOption->GetValue(i), "Drift Fib Calibration Module"); tpctimemodule->SetCommitAscii(kTRUE); tpctimemodule->SetCalibFile(fileOption->GetValue(i)); mainModule->AddModule(tpctimemodule); } // Module: BrDbCommitModule BrDbCommitModule* dbCommitModule = new BrDbCommitModule("dbcommit", "Db Commit Module"); dbCommitModule->SetInitialRun(runOption->GetValue()); dbCommitModule->SetFinalRun(runOption->GetValue()); mainModule->AddModule(dbCommitModule); // Debug and verbosity mainModule->SetVerbose(verboseOption->GetValue()); mainModule->SetDebugLevel(debugOption->GetValue()); // For ROOT debug information. if (debugOption->GetValue() > 30) gDebug = 1; }