84 #include "TRestSummaryProcess.h"
111 LoadConfig(configFilename);
123 SetName(this->ClassName());
124 SetTitle(
"Default config");
140 if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
173 Int_t nEntries = GetFullAnalysisTree()->GetEntries();
174 Double_t startTime = fRunInfo->GetStartTimestamp();
175 Double_t endTime = fRunInfo->GetEndTimestamp();
177 fMeanRate = nEntries / (endTime - startTime);
178 fMeanRateSigma = TMath::Sqrt(nEntries) / (endTime - startTime);
180 for (
auto const& x : fAverage) {
181 TVector2 range = fAverageRange[x.first];
182 fAverage[x.first] = this->GetFullAnalysisTree()->GetObservableAverage(x.first, range.X(), range.Y());
185 for (
auto const& x : fRMS) {
186 TVector2 range = fRMSRange[x.first];
187 fRMS[x.first] = this->GetFullAnalysisTree()->GetObservableRMS(x.first, range.X(), range.Y());
190 for (
auto const& x : fMaximum) {
191 TVector2 range = fMaximumRange[x.first];
192 fMaximum[x.first] = this->GetFullAnalysisTree()->GetObservableMaximum(x.first, range.X(), range.Y());
195 for (
auto const& x : fMinimum) {
196 TVector2 range = fMinimumRange[x.first];
197 fMinimum[x.first] = this->GetFullAnalysisTree()->GetObservableMinimum(x.first, range.X(), range.Y());
210 while ((definition = GetKEYDefinition(
"average", pos)) !=
"") {
211 TString obsName = GetFieldValue(
"obsName", definition);
213 fAverage[obsName] = 0;
214 fAverageRange[obsName] =
StringTo2DVector(GetFieldValue(
"range", definition));
218 while ((definition = GetKEYDefinition(
"rms", pos)) !=
"") {
219 TString obsName = GetFieldValue(
"obsName", definition);
226 while ((definition = GetKEYDefinition(
"maximum", pos)) !=
"") {
227 TString obsName = GetFieldValue(
"obsName", definition);
229 fMaximum[obsName] = 0;
230 fMaximumRange[obsName] =
StringTo2DVector(GetFieldValue(
"range", definition));
234 while ((definition = GetKEYDefinition(
"minimum", pos)) !=
"") {
235 TString obsName = GetFieldValue(
"obsName", definition);
237 fMinimum[obsName] = 0;
238 fMinimumRange[obsName] =
StringTo2DVector(GetFieldValue(
"range", definition));
249 RESTMetadata <<
" - Mean rate : " << fMeanRate <<
" Hz" << RESTendl;
250 RESTMetadata <<
" - Mean rate sigma : " << fMeanRateSigma <<
" Hz" << RESTendl;
251 for (
auto const& x : fAverage) {
252 RESTMetadata <<
" " << RESTendl;
253 RESTMetadata << x.first <<
" average:" << x.second << RESTendl;
254 TVector2 a = fAverageRange[x.first];
255 if (a.X() != -1 && a.Y() != -1)
256 RESTMetadata <<
" range : (" << a.X() <<
", " << a.Y() <<
")" << RESTendl;
258 for (
auto const& x : fRMS) {
259 RESTMetadata <<
" " << RESTendl;
260 RESTMetadata << x.first <<
" RMS:" << x.second << RESTendl;
261 TVector2 a = fRMSRange[x.first];
262 if (a.X() != -1 && a.Y() != -1)
263 RESTMetadata <<
" range : (" << a.X() <<
", " << a.Y() <<
")" << RESTendl;
265 for (
auto const& x : fMaximum) {
266 RESTMetadata <<
" " << RESTendl;
267 RESTMetadata << x.first <<
" Maximum:" << x.second << RESTendl;
268 TVector2 a = fMaximumRange[x.first];
269 if (a.X() != -1 && a.Y() != -1)
270 RESTMetadata <<
" range : (" << a.X() <<
", " << a.Y() <<
")" << RESTendl;
272 for (
auto const& x : fMinimum) {
273 RESTMetadata <<
" " << RESTendl;
274 RESTMetadata << x.first <<
" Minimum:" << x.second << RESTendl;
275 TVector2 a = fMinimumRange[x.first];
276 if (a.X() != -1 && a.Y() != -1)
277 RESTMetadata <<
" range : (" << a.X() <<
", " << a.Y() <<
")" << RESTendl;
A base class for any REST event.
@ REST_Info
+show most of the information for each steps
A process to define basic data members to serve as a metadata summary in a data processing chain.
void EndProcess() override
Function to use when all events have been processed.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestSummaryProcess section.
void Initialize() override
Function to initialize input/output event members and define the section name and library version.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestSummaryProcess()
Default constructor.
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
~TRestSummaryProcess()
Default destructor.
TVector2 StringTo2DVector(std::string in)
Gets a 2D-vector from a string.