Skip to content
Snippets Groups Projects
Commit 6a95020d authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Add gHcParm variables for some run information

    Added variables using ENGINE names
       gen_run_number
       gen_run_starting_event
       gen_event_id_number
parent 8c5946ec
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,7 @@
analyzer->SetOutFile( "hodtest.root" );
analyzer->SetOdefFile("output.def");
analyzer->SetCutFile("hodtest_cuts.def"); // optional
analyzer->SetCountMode(2);// Counter event number same as gen_event_ID_number
// File to record cuts accounting information
// analyzer->SetSummaryFile("summary_example.log"); // optional
......
......@@ -32,6 +32,10 @@ DC Events: {hdc_tot_events}
Hit in chamber: {hdc_cham_hits[0]/hdc_tot_events:%.3f} {hdc_cham_hits[1]/hdc_tot_events:%.3f}
Hit in plane: {hdc_hits_per_plane[0]/hdc_tot_events:%.3f} {hdc_hits_per_plane[1]/hdc_tot_events:%.3f} {hdc_hits_per_plane[2]/hdc_tot_events:%.3f} {hdc_hits_per_plane[3]/hdc_tot_events:%.3f} {hdc_hits_per_plane[4]/hdc_tot_events:%.3f} {hdc_hits_per_plane[5]/hdc_tot_events:%.3f} {hdc_hits_per_plane[6]/hdc_tot_events:%.3f} {hdc_hits_per_plane[7]/hdc_tot_events:%.3f} {hdc_hits_per_plane[8]/hdc_tot_events:%.3f} {hdc_hits_per_plane[9]/hdc_tot_events:%.3f} {hdc_hits_per_plane[10]/hdc_tot_events:%.3f} {hdc_hits_per_plane[11]/hdc_tot_events:%.3f}
Run #{gen_run_number}
first event = {gen_run_starting_event}
last event = {gen_event_id_number}
Later, such things as hardware scalers will be added to the set of variables
that can be used in expressions.
......
......@@ -22,6 +22,7 @@
//////////////////////////////////////////////////////////////////////////
#include "THcAnalyzer.h"
#include "THaRunBase.h"
#include "THaBenchmark.h"
#include "TList.h"
#include "THcParmList.h"
......@@ -74,8 +75,11 @@ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile)
if(!ostr.is_open()) {
cout << "Error opening report output file " << ofile << endl;
return;
}
LoadInfo(); // Load some run information into gHcParms
// In principle, we should allow braces to be escaped. But for
// now we won't. Existing template files don't seem to output
// any braces
......@@ -128,6 +132,46 @@ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile)
return;
}
//_____________________________________________________________________________
void THcAnalyzer::LoadInfo()
{
// Copy some run information into gHcParms variables so that in can
// be used in reports.
// For example run number, first event analyzed, number of events, etc.
Int_t* runnum;
Int_t* firstevent;
Int_t* lastevent;
THaVar* varptr;
varptr = gHcParms->Find("gen_run_number");
if(varptr) {
runnum = (Int_t*) varptr->GetValuePointer(); // Assume correct type
} else {
runnum = new Int_t[1];
gHcParms->Define("gen_run_number","Run Number", *runnum);
}
*runnum = fRun->GetNumber();
varptr = gHcParms->Find("gen_run_starting_event");
if(varptr) {
firstevent = (Int_t*) varptr->GetValuePointer(); // Assume correct type
} else {
firstevent = new Int_t[1];
gHcParms->Define("gen_run_starting_event","First event analyzed", *firstevent);
}
// May not agree with engine event definintions
*firstevent = fRun->GetFirstEvent();
varptr = gHcParms->Find("gen_event_id_number");
if(varptr) {
lastevent = (Int_t*)varptr->GetValuePointer(); // Assume correct type
} else {
lastevent = new Int_t[1];
gHcParms->Define("gen_event_id_number","Last event analyzed", *lastevent);
}
// Not accurate
*lastevent = fRun->GetFirstEvent()+fRun->GetNumAnalyzed();
}
//_____________________________________________________________________________
......
......@@ -27,7 +27,8 @@ protected:
private:
// THcAnalyzer( const THcAnalyzer& );
// THcAnalyzer& operator=( const THcAnalyzer& );
void LoadInfo();
ClassDef(THcAnalyzer,0) //Hall C Analyzer Standard Event Loop
};
......
......@@ -1008,14 +1008,10 @@ void THcDC::Eff()
fTotEvents++;
for(Int_t i=0;i<fNChambers;i++) {
if(fChambers[i]->GetNHits()>0) fNChamHits[i]++;
cout << fNChamHits[i] << " ";
}
cout << endl;
for(Int_t i=0;i<fNPlanes;i++) {
if(fPlanes[i]->GetNHits() > 0) fHitsPerPlane[i]++;
cout << fHitsPerPlane[i] << " ";
}
cout << endl;
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment