Skip to content
Snippets Groups Projects
Commit f39f550e authored by Yakov Kulinich's avatar Yakov Kulinich
Browse files

Changed DataReader to include Run method

parent cac49d33
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,14 @@ class DataReader{ ...@@ -37,12 +37,14 @@ class DataReader{
void AddAnalysis ( Analysis* ); void AddAnalysis ( Analysis* );
void ReadListOfFiles(std::string listname); void ReadListOfFiles( std::string listname );
void Run();
void Initialize ( ); void Initialize ( );
void ProcessEvents( ); void ProcessEvents( );
void Finalize ( ); void Finalize ( );
private: private:
// output file // output file
TFile* m_fOut; TFile* m_fOut;
......
...@@ -103,6 +103,20 @@ void DataReader::ReadListOfFiles( std::string listname ){ ...@@ -103,6 +103,20 @@ void DataReader::ReadListOfFiles( std::string listname ){
} }
/** @brief Run method for DataReader
*
* Call Initialize, ProcessEvents, and Finalize
* Made so the driver class only has to call one method.
*
* @return none
*/
void DataReader::Run(){
Initialize();
ProcessEvents();
Finalize();
}
/** @brief Initialization method for DataReader /** @brief Initialization method for DataReader
* *
* Select which file(s) to read. For now just a single * Select which file(s) to read. For now just a single
......
...@@ -20,15 +20,17 @@ int main(int argc, char *argv[]){ ...@@ -20,15 +20,17 @@ int main(int argc, char *argv[]){
int runNum = 54; // !! Change for your test !! int runNum = 54; // !! Change for your test !!
string fNameIn = "TreeZDCBeamTestRun54.root"; // !! Change for your test !! string fNameIn = "TreeZDCBeamTestRun54.root"; // !! Change for your test !!
// DataReader is the main class. It reads data and also
// has analysis classes in it. User should only have to
// modify the analysis classes and add output in them.
// User has to add their analysis to DataReader.
DataReader* r = new DataReader( nCh, nSamp, fNameIn, runNum ); DataReader* r = new DataReader( nCh, nSamp, fNameIn, runNum );
r->AddAnalysis( new WFAnalysis() ); r->AddAnalysis( new WFAnalysis() );
r->Initialize(); r->Run();
r->ProcessEvents();
r->Finalize();
delete r; delete r;
return 0; return 0;
......
/** @file AnalysisExample.cpp /** @file AnalysisExample.cpp
* @brief example of a simple analysis: read and plot all the w * @brief Example of a simple analysis: read and plot all the w
* *
* This contains the prototypes and members
* for DataReader
* *
* @author Yakov Kulinich * @author Yakov Kulinich, Riccardo Longo
* @bug No known bugs. * @bug No known bugs.
*/ */
#include "DataReader.h" #include "DataReader.h"
#include "WFAnalysis.h"
using namespace std; using namespace std;
...@@ -18,15 +17,21 @@ int main(int argc, char *argv[]){ ...@@ -18,15 +17,21 @@ int main(int argc, char *argv[]){
int nCh = 20; // 5 DRS4 x 4 ch/board - 16 RPD channels int nCh = 20; // 5 DRS4 x 4 ch/board - 16 RPD channels
int nSamp = 1024; // Default number of samples? int nSamp = 1024; // Default number of samples?
int runNum = 54; // !! Change !! int runNum = 54; // !! Change for your test !!
string fNameIn = "TreeZDCBeamTestRun54.root"; string fNameIn = "TreeZDCBeamTestRun54.root"; // !! Change for your test !!
// DataReader is the main class. It reads data and also
// has analysis classes in it. User should only have to
// modify the analysis classes and add output in them.
// User has to add their analysis to DataReader.
DataReader* r = new DataReader( nCh, nSamp, fNameIn, runNum ); DataReader* r = new DataReader( nCh, nSamp, fNameIn, runNum );
r->Initialize();
r->ProcessEvents(); r->AddAnalysis( new WFAnalysis() );
r->Finalize();
r->Run();
delete r;
return 0; return 0;
} }
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