Skip to content

Commit

Permalink
TRestDetectorSingleChannelAnalysisProcess::SaveGainMetadata: use clon…
Browse files Browse the repository at this point in the history
…e TRestRun object to save to file
  • Loading branch information
nkx111 authored Dec 10, 2021
1 parent 18f55b6 commit 3688bdc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/TRestDetectorSingleChannelAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void TRestDetectorSingleChannelAnalysisProcess::FitChannelGain() {
* If we want just to have a method to export data, in principe it is possible. But
* better without using a new TRestRun instance. TRestRun should only be created for
* writting the standard processing scheme.
*
***/
void TRestDetectorSingleChannelAnalysisProcess::SaveGainMetadata(string filename) {
cout << "TRestDetectorSingleChannelAnalysisProcess: saving result..." << endl;

Expand All @@ -257,16 +257,17 @@ void TRestDetectorSingleChannelAnalysisProcess::SaveGainMetadata(string filename
fCalib->fChannelGain = fChannelGain;
fCalib->SetName("ChannelCalibration");

TRestRun* r = new TRestRun();
TRestRun* r = (TRestRun*)fRunInfo->Clone();
r->SetOutputFileName(filename);
r->AddMetadata(fCalib);
r->AddMetadata(fReadout);
r->AddMetadata(this);
r->FormOutputFile();

PrintChannelSpectrums(filename);
delete r;
}
***/


TH1D* TRestDetectorSingleChannelAnalysisProcess::GetChannelSpectrum(int id) {
if (fChannelThrIntegral.count(id) != 0) return fChannelThrIntegral[id];
Expand Down

2 comments on commit 3688bdc

@jgalan
Copy link
Member

@jgalan jgalan commented on 3688bdc Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I believe the readout should be already added and saved at TRestRun?

@jgalan
Copy link
Member

@jgalan jgalan commented on 3688bdc Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is needed to call r->AddMetadata(this)? Will not be the process stored anyway in the data processing chain?

or r->FormOutputFile(). Will not be that called at the end of the run somewhere else?

Why should the process set the filename? It is a data exporting function?

Please sign in to comment.