Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jlab
hallc
analyzer_software
hcana
Commits
b151dfe5
Commit
b151dfe5
authored
7 years ago
by
Stephen A. Wood
Browse files
Options
Downloads
Patches
Plain Diff
THcPeriodicReport a physics module to generate report periodically
parent
a7635441
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/groups.md
+1
-0
1 addition, 0 deletions
docs/groups.md
src/THcPeriodicReport.cxx
+121
-0
121 additions, 0 deletions
src/THcPeriodicReport.cxx
src/THcPeriodicReport.h
+41
-0
41 additions, 0 deletions
src/THcPeriodicReport.h
with
163 additions
and
0 deletions
docs/groups.md
+
1
−
0
View file @
b151dfe5
\d
efgroup Detectors Main detector classes
\d
efgroup DetSupport Classes supporting detectors
\d
efgroup Base hcana infrastructure
\d
efgroup PhysMods Physics modules
This diff is collapsed.
Click to expand it.
src/THcPeriodicReport.cxx
0 → 100644
+
121
−
0
View file @
b151dfe5
/**
\class THcPeriodicReport
\ingroup PhysMods
\brief A physics module to generate periodic reports from a template
This class is a physics module, but does not do analysis. It repeatedly
outputs a report file from a template using an event count or time based
period. This report file could be displayed or used by a GUI to show
a realtime status of an analysis.
The THcAnalyzer::PrintReport method is used to generate the report.
By default this report is generated every two seconds.
*/
/**
\fn THcPeriodicReport::THcPeriodicReport(
const char* name, const char* description="",
const char *templatefile, const char* ofile)
\brief A constructor
\param[in] name Name of the apparatus. Is typically named after spectrometer
whose trigger data is collecting; like "HMS".
\param[in] description Description of the report
\param[in] templatefile Name of file containing report templte
\parma[in] ofile File to write the report to
*/
/**
\fn virtual THcPeriodicReport::~THcPeriodicReport()
\brief A destructor.
*/
/**
\fn virtual void SetEventPeriod(Int_t ev)
\brief Set report print out periodicity
\param[in] ev Print out report every ev events
*/
/**
\fn virtual void SetTimePeriod(UInt_t t)
\brief Set report print out periodicity
\param[in] t Print out report ever t seconds
*/
#include
"THcPeriodicReport.h"
#include
<iostream>
using
namespace
std
;
//_____________________________________________________________________________
THcPeriodicReport
::
THcPeriodicReport
(
const
char
*
name
,
const
char
*
description
,
const
char
*
templatefile
,
const
char
*
ofile
)
:
THaPhysicsModule
(
name
,
description
),
fTimePeriod
(
2
),
fEventPeriod
(
0
),
fDoPrint
(
kFALSE
),
fAnalyzer
(
0
)
{
// Constructor
fTemplateFilename
=
templatefile
;
fOutputFilename
=
ofile
;
}
//_____________________________________________________________________________
THcPeriodicReport
::~
THcPeriodicReport
()
{
// destructor
}
//_____________________________________________________________________________
THaAnalysisObject
::
EStatus
THcPeriodicReport
::
Init
(
const
TDatime
&
run_time
)
{
// Standard initialization. Calls this object's DefineVariables().
if
(
THaPhysicsModule
::
Init
(
run_time
)
!=
kOK
)
return
fStatus
;
fAnalyzer
=
static_cast
<
THcAnalyzer
*>
(
THcAnalyzer
::
GetInstance
());
return
fStatus
=
kOK
;
}
//_____________________________________________________________________________
Int_t
THcPeriodicReport
::
Begin
(
THaRunBase
*
)
{
fDoPrint
=
kTRUE
;
// Generate report on first event
fLastPrintTime
=
TDatime
().
Convert
();
fEventsSincePrint
=
0
;
return
0
;
}
//_____________________________________________________________________________
Int_t
THcPeriodicReport
::
End
(
THaRunBase
*
)
{
// Print out the report a final time
PrintReport
();
return
0
;
}
//_____________________________________________________________________________
Int_t
THcPeriodicReport
::
Process
(
const
THaEvData
&
)
{
UInt_t
now
=
TDatime
().
Convert
();
fEventsSincePrint
++
;
if
(
!
fDoPrint
&&
(
fTimePeriod
>
0
)
&&
((
now
-
fLastPrintTime
)
>=
fTimePeriod
))
{
fDoPrint
=
kTRUE
;
}
if
(
!
fDoPrint
&&
(
fEventPeriod
>
0
)
&&
(
fEventsSincePrint
>=
fEventPeriod
))
{
fDoPrint
=
kTRUE
;
}
if
(
fDoPrint
)
{
fLastPrintTime
=
now
;
fEventsSincePrint
=
0
;
PrintReport
();
fDoPrint
=
kFALSE
;
}
return
(
0
);
}
//_____________________________________________________________________________
void
THcPeriodicReport
::
PrintReport
()
{
fAnalyzer
->
PrintReport
(
fTemplateFilename
,
fOutputFilename
);
}
///////////////////////////////////////////////////////////////////////////////
ClassImp
(
THcPeriodicReport
)
This diff is collapsed.
Click to expand it.
src/THcPeriodicReport.h
0 → 100644
+
41
−
0
View file @
b151dfe5
#ifndef ROOT_THcPeriodicReport
#define ROOT_THcPeriodicReport
//////////////////////////////////////////////////////////////////////////
//
// THcPeriodicReport
//
//////////////////////////////////////////////////////////////////////////
#include
"THaPhysicsModule.h"
#include
"THcAnalyzer.h"
class
THcPeriodicReport
:
public
THaPhysicsModule
{
public:
THcPeriodicReport
(
const
char
*
name
,
const
char
*
description
,
const
char
*
templatefile
,
const
char
*
ofile
);
virtual
~
THcPeriodicReport
();
virtual
EStatus
Init
(
const
TDatime
&
run_time
);
virtual
Int_t
Begin
(
THaRunBase
*
r
=
0
);
virtual
Int_t
End
(
THaRunBase
*
r
=
0
);
virtual
Int_t
Process
(
const
THaEvData
&
);
void
PrintReport
();
virtual
void
SetEventPeriod
(
Int_t
ev
)
{
fEventPeriod
=
ev
;
}
virtual
void
SetTimePeriod
(
UInt_t
t
)
{
fTimePeriod
=
t
;
}
protected
:
UInt_t
fLastPrintTime
;
Int_t
fEventsSincePrint
;
UInt_t
fTimePeriod
;
Int_t
fEventPeriod
;
Bool_t
fDoPrint
;
THcAnalyzer
*
fAnalyzer
;
TString
fTemplateFilename
;
TString
fOutputFilename
;
ClassDef
(
THcPeriodicReport
,
0
)
};
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment