Commit b4383bfa authored by Administrator's avatar Administrator
Browse files

Different parameter files for input and output

Allow to use different parameter files for input and output. In digitization
all parameter containers are copied from the input parameter file to the
output parameter file. All newly created parameters are properly stored in the
output file such that this file contains a complete set of parameters for the
later stages.
parent 34cce724
......@@ -93,7 +93,8 @@ void run_digi(TString inputEvents = "", Int_t nEvents = -1, TString output = "",
TString evntFile = inputEvents + ".tra.root";
TString signFile = inputSignal + ".tra.root";
TString beamFile = inputBeam + ".tra.root";
TString parFile = inputEvents + ".par.root";
TString parInFile = inputEvents + ".par.root";
TString parOutFile = inputEvents + ".digi.par.root";
if (output.IsNull()) output = inputEvents;
TString outFile = output + ".raw.root";
TString moniFile = output + ".moni_digi.root";
......@@ -136,7 +137,8 @@ void run_digi(TString inputEvents = "", Int_t nEvents = -1, TString output = "",
}
run.SetOutputFile(outFile, overwrite);
run.SetMonitorFile(moniFile);
run.SetParameterRootFile(parFile);
run.SetParameterOutputRootFile(parOutFile);
run.SetParameterRootFile(parInFile);
run.SetTimeSliceLength(tsLength);
run.SetEventMode(eventMode);
run.SetProduceNoise(kFALSE);
......
......@@ -117,7 +117,7 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice =
TString outFile = output + ".reco.root";
TString monFile = output + ".moni_reco.root";
if (paramFile.IsNull()) paramFile = input;
TString parFile = paramFile + ".par.root";
TString parFile = paramFile + ".digi.par.root";
std::cout << "Inputfile " << rawFile << std::endl;
std::cout << "Outfile " << outFile << std::endl;
std::cout << "Parfile " << parFile << std::endl;
......
......@@ -49,6 +49,7 @@ CbmDigitization::CbmDigitization()
, fSource(new CbmDigitizationSource())
, fOutFile()
, fParRootFile()
, fParOutRootFile()
, fParAsciiFiles()
, fMoniFile()
, fOverwriteOutput(kFALSE)
......@@ -403,17 +404,25 @@ void CbmDigitization::Run(Int_t event1, Int_t event2)
LOG(info) << fName << ": Setting runtime DB ";
LOG(info) << fName << ": ROOT I/O is " << fParRootFile;
FairRuntimeDb* rtdb = run->GetRuntimeDb();
FairParRootFileIo* parIoRoot = new FairParRootFileIo();
parIoRoot->open(fParRootFile.Data(), "UPDATE");
FairParRootFileIo* parIoRootIn = new FairParRootFileIo();
FairParRootFileIo* parIoRootOut = new FairParRootFileIo();
if (fParOutRootFile.IsNull()) {
parIoRootIn->open(fParRootFile.Data(), "UPDATE");
}
else {
parIoRootIn->open(fParRootFile.Data(), "READ");
parIoRootOut->open(fParOutRootFile.Data(), "UPDATE");
}
if (fParAsciiFiles.IsEmpty()) {
LOG(info) << fName << ": No ASCII input to parameter database";
rtdb->setFirstInput(parIoRoot);
rtdb->setFirstInput(parIoRootIn);
} //? ASCII parameter file list empty
else {
FairParAsciiFileIo* parIoAscii = new FairParAsciiFileIo();
parIoAscii->open(&fParAsciiFiles, "in");
rtdb->setFirstInput(parIoAscii);
rtdb->setSecondInput(parIoRoot);
rtdb->setSecondInput(parIoRootIn);
} //? ASCII parameter file list not empty
LOG(info) << "===================================================";
......@@ -423,8 +432,14 @@ void CbmDigitization::Run(Int_t event1, Int_t event2)
LOG(info) << "===================================================";
LOG(info) << fName << ": Initialising run...";
run->Init();
rtdb->setOutput(parIoRoot);
if (fParOutRootFile.IsNull()) {
rtdb->setOutput(parIoRootIn);
}
else {
rtdb->setOutput(parIoRootOut);
}
rtdb->saveOutput();
rtdb->print();
LOG(info) << fName << ": Initialising run...finished";
LOG(info) << "===================================================";
......
......@@ -179,10 +179,19 @@ public:
/** @brief Set the parameter file name
** @param fileName Name of output file
** @param fileName Name of input/output file
**/
void SetParameterRootFile(TString fileName);
/** @brief Set the output parameter file name
** @param fileName Name of output file
**/
void SetParameterOutputRootFile(TString fileName)
{
fParOutRootFile = fileName;
}
// --------------------------------------------------------------------------
/** @brief Set production of inter-event noise
** @param Choice If kTRUE, the digitizer will produce noise
......@@ -240,6 +249,7 @@ private:
CbmDigitizationSource* fSource; ///< Input source
TString fOutFile; ///< Output data (digis)
TString fParRootFile; ///< ROOT parameter file
TString fParOutRootFile; ///< ROOT parameter output file
TList fParAsciiFiles; ///< ASCII parameter files
TString fMoniFile; ///< Resource monitoring information
Bool_t fOverwriteOutput;
......@@ -291,7 +301,7 @@ private:
void SetDefaultBranches();
ClassDef(CbmDigitization, 3);
ClassDef(CbmDigitization, 4);
};
#endif /* CBMDIGITIZATION_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment