// -*- mode: c++ -*- // // $Id$ // $Author$ // $Date$ // $Copyright: (C) 2003 BRAHMS Collaboration // #ifndef __CINT__ fiberDst() #endif { #include //__________________________________________________________________ BrAppOptionManager* optionManager = BrAppOptionManager::Instance(); BrAppStringOption* inputOption = new BrAppStringOption('i', "input", "Input file name", ""); BrAppStringOption* outputOption = new BrAppStringOption('o', "output", "output file name", ""); BrAppStringOption* histogramOption = new BrAppStringOption('H', "histogram", "Histogram file name", ""); BrAppStringOption* includeOption = new BrAppStringOption('I', "include", "Path to look for input files", "."); BrAppStringOption* geometryOption = new BrAppStringOption('g', "geometry", "Geometry file name", ""); BrAppStringOption* magnetOption = new BrAppStringOption('m', "magnet", "Magnet file name", ""); 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", 100000000); BrAppIntOption* maxrunsOption = new BrAppIntOption('R', "max-runs", "Max runs", 1); BrAppStringOption* maindbhostOption = new BrAppStringOption('M', "maindb-host", "Main DB host name", "rcas0005.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", "query"); BrAppIntOption* verboseOption = new BrAppIntOption('v', "verbose", "Verbosity", 0); BrAppIntOption* debugOption = new BrAppIntOption('d', "debug", "Debug level", 0); if (!optionManager->ProcessCommandLine()) { Warning("fiberDst", "Bad command line, try --help option"); return; } //________________________________________________________________ // // Database section // BrMainDb* mainDb = BrMainDb::Instance(); mainDb->SetUserName(maindbuserOption->GetValue()); mainDb->SetHostName(maindbhostOption->GetValue()); mainDb->SetDbName(maindbnameOption->GetValue()); // Un comment if you need access to database if (!mainDb->Connect()) return; if (!mainDb->ConnectToCalib()) return; if (!mainDb->ConnectToRun()) return; //__________________________________________________________________ // // Parameter and geometry managers // // A detector parameter manager. Should probably replaced by an // interface to a database. BrParameterDbManager *parameterManager = BrParameterDbManager::Instance(); parameterManager->SetDbParameterFileName(parametersOption->GetValue()); parameterManager->SetDebugLevel(debugOption->GetValue()); BrGeometryDbManager* geometryManager = BrGeometryDbManager::Instance(); geometryManager->SetDbFileName(geometryOption->GetValue()); geometryManager->SetDbFileName(magnetOption->GetValue()); Int_t nRuns = runOption->GetNValues(); // Un comment if you need access to the run database 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("fiberDst", "Make Fiber Dst", "Peter H Christiansen", 0, 1, 0); mainModule->SetMaxEvents(eventsOption->GetValue()); mainModule->SetMaxRuns(maxrunsOption->GetValue()); //__________________________________________________________________ // // The input module // The below is only suitable for single file input. // TString in(inputOption->GetValue()); in.ToLower(); BrIOModule* inputModule = 0; if (in.EndsWith(".dat")) { inputModule = new BrRawDataInput("rawInput", "Raw Data Input"); inputModule->SetIOMode(BrIOModule::kBrJobFile| BrRawDataInput::kBrRawDiskFile); } else { if (in.EndsWith(".cdat")) inputModule = new BrGeantInput("geantInput"); else inputModule = new BrEventIO("eventInput"); inputModule->SetIOMode(BrIOModule::kBrJobFile| BrIOModule::kBrReadFile); } inputModule->AddFile(inputOption->GetValue()); // // These lines are suitable for multifile input of RDO or similar // files. Simple modification will allow input of CDAT or RAW // data files. // // BrIOModule* inputModule = // new BrEventIO("inputModule", "Input Module"); // inputModule->SetIOMode(BrIOModule::kBrRunFile| // BrIOModule::kBrReadFile); // for (Int_t j = 0; j < nRuns; j++) // inputModule->AddFileSet(includeOption->GetValue(), // Form("^run%06d.*\\.root", // runOption->GetValue(i))); mainModule->AddModule(inputModule); //__________________________________________________________________ // // Histogram IO module // if (histogramOption->GetValue()[0] != '\0') { BrHistIOModule* histModule = new BrHistIOModule("histograms", "Some histograms"); histModule->AddFile(histogramOption->GetValue()); mainModule->AddModule(histModule); mainModule->SetHistOn(); } //__________________________________________________________________ // Module: BrDbUpdateModule // Uncomment if you need DB access BrDbUpdateModule* dbUpdateModule = new BrDbUpdateModule("dbUpdate", "Update from DB when needed"); mainModule->AddModule(dbUpdateModule); //__________________________________________________________________ // // Needed modules should go here. // // You can add both BRAT modules, such as BrTileRdoModule, Filters, // Such as BrTriggerFilter, and user defined modules, say MyModule. // User defined modules a used via loading, via TSystem::Load, a // shared library containing that module. // //__________________________________________________________________ // Module: BrOutputTreeModule BrOutputTreeModule* outputTreeModule = new BrOutputTreeModule("outputmodule", "Output Module"); outputTreeModule-> SetIOMode(BrIOModule::kBrJobFile | BrIOModule::kBrRecreateFile); outputTreeModule->AddFile(Form("fibers_%d.root", runOption->GetValue())); outputTreeModule->AddElement("BrTpcFibDig", "T1F", "TpcFibDig T1F", kFALSE); outputTreeModule->AddElement("BrTpcFibDig", "T2B", "TpcFibDig T2B", kFALSE); mainModule->AddModule(outputTreeModule); //__________________________________________________________________ // // Output module // if (outputOption->GetValue()[0] != '\0') { BrIOModule* outputModule = new BrEventIO("ouputModule", "Output module"); outputModule->SetIOMode(BrIOModule::kBrJobFile| BrIOModule::kBrRecreateFile); outputModule->AddFile(outputOption->GetValue()); mainModule->AddModule(outputModule); } //__________________________________________________________________ // // Debug and verbosity mainModule->SetVerbose(verboseOption->GetValue()); mainModule->SetDebugLevel(debugOption->GetValue()); // For ROOT debug information. if (debugOption->GetValue() > 30) gDebug = 1; } //____________________________________________________________________ // // $Log$ //