Namespace encapsulated evb with name EventBuilder

This commit is contained in:
Gordon McCann 2021-12-15 12:08:12 -05:00
parent 1c6addb941
commit b9ed82a593
39 changed files with 3177 additions and 3061 deletions

View File

@ -14,7 +14,9 @@ Then, in the `build` directory, run the following command to build and install t
`cmake -DCMAKE_BUILD_TYPE=Release .. && make install`
This will compile and link all event builder programs and dependencies. The executables will be installed to the `bin` directory of the SPS_SABRE_EventBuilder directory, shared libraries for ROOT dictionaries will be in the `lib` directory (with necessary .pcm files), and the header files for the shared libraries will be installed to the `include` directory.
This will compile and link all event builder programs and dependencies. The executables will be installed to the `bin` directory of the SPS_SABRE_EventBuilder directory, shared libraries for ROOT dictionaries will be in the `lib` directory (with necessary .pcm files), and the header files for the shared libraries will be installed to the `include` directory. To rebuild the program after a change to the code (assuming no files were added), simply run
`make clean && make install`
## GWMEVB vs. GWMEVB_CL
There are two programs provided. They are `EventBuilderGui` and `EventBuilder`. The first is a full GUI version of the event builder. The GUI supports all conversion methods and the plotting tool.

View File

@ -94,7 +94,7 @@ private:
TGPopupMenu *fFileMenu;
EVBApp fBuilder;
EventBuilder::EVBApp fBuilder;
int counter;
UInt_t MAIN_W, MAIN_H;

View File

@ -9,6 +9,8 @@
#include "EventBuilder.h"
#include "ChannelMap.h"
namespace EventBuilder {
ChannelMap::ChannelMap() :
m_validFlag(false)
{
@ -92,3 +94,4 @@ bool ChannelMap::FillMap(const std::string& name)
m_validFlag = true;
return m_validFlag;
}
}

View File

@ -9,6 +9,7 @@
#ifndef CHANNELMAP_H
#define CHANNELMAP_H
namespace EventBuilder {
//Detector part/type identifiers for use in the code
enum DetType
{
@ -69,6 +70,6 @@ private:
Containter m_cmap;
bool m_validFlag;
};
}
#endif

View File

@ -11,6 +11,8 @@
#include "EventBuilder.h"
#include "CompassFile.h"
namespace EventBuilder {
CompassFile::CompassFile() :
m_filename(""), bufferIter(nullptr), bufferEnd(nullptr), m_smap(nullptr), hitUsedFlag(true), m_file(std::make_shared<std::ifstream>()), eofFlag(false)
{
@ -165,3 +167,5 @@ void CompassFile::ParseNextHit()
}
}
}

View File

@ -15,6 +15,8 @@
#include "ShiftMap.h"
#include <memory>
namespace EventBuilder {
class CompassFile
{
@ -67,5 +69,6 @@ private:
};
}
#endif

View File

@ -1,6 +1,8 @@
#ifndef COMPASS_HIT_H
#define COMPASS_HIT_H
namespace EventBuilder {
struct CompassHit
{
uint16_t board = 400;
@ -12,4 +14,6 @@ struct CompassHit
uint32_t Ns = 0;
};
}
#endif

View File

@ -17,6 +17,8 @@
#include "SFPAnalyzer.h"
#include "FlagHandler.h"
namespace EventBuilder {
CompassRun::CompassRun() :
m_directory(""), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_pb(nullptr)
{
@ -607,3 +609,5 @@ void CompassRun::SetProgressBar()
m_pb->SetPosition(0);
gSystem->ProcessEvents();
}
}

View File

@ -18,6 +18,8 @@
#include <TGProgressBar.h>
#include <TSystem.h>
namespace EventBuilder {
class CompassRun
{
@ -68,4 +70,6 @@ private:
TGProgressBar* m_pb;
};
}
#endif

View File

@ -1,6 +1,8 @@
#include "EventBuilder.h"
#include "CutHandler.h"
namespace EventBuilder {
CutHandler::CutHandler() :
validFlag(false)
{
@ -102,3 +104,5 @@ bool CutHandler::IsInside(const ProcessedEvent* eaddress)
return true;
}
}

View File

@ -1,7 +1,9 @@
#ifndef CUTHANDLER_H
#define CUTHANDLER_H
#include "DataStructs.h"
#include "../spsdict/DataStructs.h"
namespace EventBuilder {
class CutHandler {
public:
@ -21,7 +23,8 @@ private:
std::unordered_map<std::string, double*> varmap;
bool validFlag;
ProcessedEvent m_event;
};
}
#endif

View File

@ -16,6 +16,8 @@
#include "SFPAnalyzer.h"
#include "SFPPlotter.h"
namespace EventBuilder {
EVBApp::EVBApp() :
m_rmin(0), m_rmax(0), m_ZT(0), m_AT(0), m_ZP(0), m_AP(0), m_ZE(0), m_AE(0), m_ZR(0), m_AR(0),
m_B(0), m_Theta(0), m_BKE(0), m_workspace("none"), m_mapfile("none"), m_shiftfile("none"),
@ -434,3 +436,5 @@ bool EVBApp::SetKinematicParameters(int zt, int at, int zp, int ap, int ze, int
return true;
}
}

View File

@ -12,6 +12,8 @@
#include "RunCollector.h"
#include <TGProgressBar.h>
namespace EventBuilder {
class EVBApp {
public:
EVBApp();
@ -95,4 +97,5 @@ private:
};
}
#endif

View File

@ -36,6 +36,8 @@
#include "MassLookup.h"
#include "FP_kinematics.h"
namespace EventBuilder {
//requires (Z,A) for T, P, and E, as well as energy of P,
// spectrograph angle of interest, and field value
double Delta_Z(int ZT, int AT, int ZP, int AP, int ZE, int AE,
@ -103,3 +105,4 @@ double Delta_Z(int ZT, int AT, int ZP, int AP, int ZE, int AE,
double Wire_Dist() {return 4.28625;} //cm
}

View File

@ -32,6 +32,8 @@
#ifndef FP_KINEMATICS
#define FP_KINEMATICS
namespace EventBuilder {
//requires (Z,A) for T, P, and E, as well as energy of P,
// spectrograph angle of interest, and field value
double Delta_Z(int ZT, int AT, int ZP, int AP, int ZE, int AE,
@ -39,4 +41,6 @@ double Delta_Z(int ZT, int AT, int ZP, int AP, int ZE, int AE,
double Wire_Dist();
}
#endif

View File

@ -1,6 +1,7 @@
#include "EventBuilder.h"
#include "FastSort.h"
namespace EventBuilder {
//windows given in picoseconds, converted to nanoseconds
FastSort::FastSort(float si_windowSize, float ion_windowSize) :
si_coincWindow(si_windowSize/1.0e3), ion_coincWindow(ion_windowSize/1.0e3), event_address(nullptr)
@ -123,3 +124,5 @@ std::vector<CoincEvent> FastSort::GetFastEvents(CoincEvent& event)
}
return fast_events;
}
}

View File

@ -9,6 +9,8 @@
#include "DataStructs.h"
#include <TH2.h>
namespace EventBuilder {
class FastSort
{
@ -31,4 +33,5 @@ private:
};
}
#endif

View File

@ -1,6 +1,8 @@
#include "EventBuilder.h"
#include "FlagHandler.h"
namespace EventBuilder {
FlagHandler::FlagHandler() :
log("./event_log.txt")
{
@ -103,4 +105,4 @@ void FlagHandler::WriteLog()
log<<"-----------------------------"<<std::endl;
}
}
}

View File

@ -3,6 +3,8 @@
#include <map>
namespace EventBuilder {
struct FlagCount
{
long total_counts=0;
@ -58,4 +60,5 @@ private:
void WriteLog();
};
}
#endif

View File

@ -11,6 +11,7 @@ Written by G.W. McCann Aug. 2020
#include "EventBuilder.h"
#include "MassLookup.h"
namespace EventBuilder {
/*
Read in AMDC mass file, preformated to remove excess info. Here assumes that by default
@ -73,3 +74,4 @@ std::string MassLookup::FindSymbol(int Z, int A)
std::string fullsymbol = std::to_string(A) + data->second;
return fullsymbol;
}
}

View File

@ -11,6 +11,8 @@ Written by G.W. McCann Aug. 2020
#ifndef MASS_LOOKUP_H
#define MASS_LOOKUP_H
namespace EventBuilder {
class MassLookup
{
@ -32,4 +34,6 @@ private:
//static instance for use throught program
static MassLookup MASS;
}
#endif

View File

@ -8,6 +8,8 @@
#include "EventBuilder.h"
#include "OrderChecker.h"
namespace EventBuilder {
OrderChecker::OrderChecker()
{
}
@ -38,3 +40,5 @@ bool OrderChecker::IsOrdered(const std::string& filename)
file->Close();
return true;
}
}

View File

@ -8,6 +8,8 @@
#ifndef ORDERCHECKER_H
#define ORDERCHECKER_H
namespace EventBuilder {
class OrderChecker
{
public:
@ -16,4 +18,6 @@ public:
bool IsOrdered(const std::string& filename);
};
}
#endif

View File

@ -7,6 +7,8 @@
#include <cstdlib>
#include <cstdio>
namespace EventBuilder {
RunCollector::RunCollector():
m_initFlag(false), m_directory(""), m_prefix(""), m_suffix(""), m_minRun(0), m_maxRun(0)
{
@ -229,3 +231,5 @@ bool RunCollector::Merge_TChain(const std::string& outname)
output->Close();
return false;
}
}

View File

@ -10,6 +10,8 @@
#ifndef RUNCOLLECTOR_H
#define RUNCOLLECTOR_H
namespace EventBuilder {
class RunCollector
{
public:
@ -41,4 +43,5 @@ private:
};
}
#endif

View File

@ -12,6 +12,7 @@
#include "EventBuilder.h"
#include "SFPAnalyzer.h"
namespace EventBuilder {
/*Constructor takes in kinematic parameters for generating focal plane weights*/
SFPAnalyzer::SFPAnalyzer(int zt, int at, int zp, int ap, int ze, int ae, double ep,
@ -203,3 +204,5 @@ ProcessedEvent SFPAnalyzer::GetProcessedEvent(CoincEvent& event)
AnalyzeEvent(event);
return pevent;
}
}

View File

@ -13,6 +13,7 @@
#include "DataStructs.h"
#include "FP_kinematics.h"
namespace EventBuilder {
class SFPAnalyzer
{
@ -42,4 +43,6 @@ private:
THashTable *rootObj; //root storage
};
}
#endif

View File

@ -10,6 +10,8 @@
#include "SFPPlotter.h"
#include <TSystem.h>
namespace EventBuilder {
/*Generates storage and initializes pointers*/
SFPPlotter::SFPPlotter()
{
@ -294,3 +296,5 @@ void SFPPlotter::SetProgressBar(long total)
m_pb->SetPosition(0);
gSystem->ProcessEvents();
}
}

View File

@ -13,6 +13,8 @@
#include "CutHandler.h"
#include <TGProgressBar.h>
namespace EventBuilder {
class SFPPlotter
{
public:
@ -42,4 +44,6 @@ private:
};
}
#endif

View File

@ -12,6 +12,8 @@
#include "EventBuilder.h"
#include "ShiftMap.h"
namespace EventBuilder {
ShiftMap::ShiftMap() :
m_filename(""), m_validFlag(false)
{
@ -79,3 +81,5 @@ void ShiftMap::ParseFile()
m_validFlag = true;
}
}

View File

@ -12,6 +12,8 @@
#ifndef SHIFTMAP_H
#define SHIFTMAP_H
namespace EventBuilder {
class ShiftMap
{
public:
@ -33,4 +35,6 @@ private:
};
}
#endif

View File

@ -10,6 +10,8 @@
#include "EventBuilder.h"
#include "SlowSort.h"
namespace EventBuilder {
/*Sort the Sabre Data in order of descending energy*/
bool SabreSort(const DetectorHit& i, const DetectorHit& j) {
return (i.Long>j.Long);
@ -178,3 +180,5 @@ void SlowSort::ProcessEvent()
sort(m_event.sabreArray[s].wedges.begin(), m_event.sabreArray[s].wedges.end(), SabreSort);
}
}
}

View File

@ -16,6 +16,8 @@
#include <TH2.h>
#include <unordered_map>
namespace EventBuilder {
class SlowSort
{
@ -51,4 +53,6 @@ private:
};
}
#endif

View File

@ -8,6 +8,8 @@
#include "EventBuilder.h"
#include "Stopwatch.h"
namespace EventBuilder {
Stopwatch::Stopwatch()
{
start_time = Clock::now();
@ -35,3 +37,5 @@ double Stopwatch::GetElapsedMilliseconds()
{
return std::chrono::duration_cast<std::chrono::duration<double>>(stop_time-start_time).count()*1000.0;
}
}

View File

@ -10,6 +10,8 @@
#include <chrono>
namespace EventBuilder {
class Stopwatch
{
public:
@ -27,4 +29,6 @@ private:
Time start_time, stop_time;
};
}
#endif

View File

@ -1,7 +1,7 @@
#include "EventBuilder.h"
#include "evb/EventBuilder.h"
#include "spsdict/DataStructs.h"
#include <TApplication.h>
#include "EVBMainFrame.h"
#include "guidict/EVBMainFrame.h"
int main(int argc, char** argv)
{

View File

@ -142,13 +142,13 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
TGLabel *typelabel = new TGLabel(RunFrame, "Operation Type:");
fTypeBox = new TGComboBox(RunFrame, TypeBox);
//Needs modification for new conversion based sorting GWM -- Dec 2020
fTypeBox->AddEntry("Convert Slow", EVBApp::Operation::ConvertSlow);
fTypeBox->AddEntry("Convert Fast", EVBApp::Operation::ConvertFast);
fTypeBox->AddEntry("Convert SlowA", EVBApp::Operation::ConvertSlowA);
fTypeBox->AddEntry("Convert FastA", EVBApp::Operation::ConvertFastA);
fTypeBox->AddEntry("Convert", EVBApp::Operation::Convert);
fTypeBox->AddEntry("Merge ROOT", EVBApp::Operation::Merge);
fTypeBox->AddEntry("Plot", EVBApp::Operation::Plot);
fTypeBox->AddEntry("Convert Slow", EventBuilder::EVBApp::Operation::ConvertSlow);
fTypeBox->AddEntry("Convert Fast", EventBuilder::EVBApp::Operation::ConvertFast);
fTypeBox->AddEntry("Convert SlowA", EventBuilder::EVBApp::Operation::ConvertSlowA);
fTypeBox->AddEntry("Convert FastA", EventBuilder::EVBApp::Operation::ConvertFastA);
fTypeBox->AddEntry("Convert", EventBuilder::EVBApp::Operation::Convert);
fTypeBox->AddEntry("Merge ROOT", EventBuilder::EVBApp::Operation::Merge);
fTypeBox->AddEntry("Plot", EventBuilder::EVBApp::Operation::Plot);
fTypeBox->Resize(200,20);
fTypeBox->Connect("Selected(Int_t, Int_t)","EVBMainFrame",this,"HandleTypeSelection(Int_t,Int_t)");
TGLabel *rminlabel = new TGLabel(RunFrame, "Min Run:");
@ -256,37 +256,37 @@ void EVBMainFrame::DoRun()
switch(type)
{
case EVBApp::Operation::Plot :
case EventBuilder::EVBApp::Operation::Plot :
{
RunPlot();
break;
}
case EVBApp::Operation::Convert :
case EventBuilder::EVBApp::Operation::Convert :
{
fBuilder.Convert2RawRoot();
break;
}
case EVBApp::Operation::Merge :
case EventBuilder::EVBApp::Operation::Merge :
{
fBuilder.MergeROOTFiles();
break;
}
case EVBApp::Operation::ConvertSlow :
case EventBuilder::EVBApp::Operation::ConvertSlow :
{
fBuilder.Convert2SortedRoot();
break;
}
case EVBApp::Operation::ConvertFast :
case EventBuilder::EVBApp::Operation::ConvertFast :
{
fBuilder.Convert2FastSortedRoot();
break;
}
case EVBApp::Operation::ConvertSlowA :
case EventBuilder::EVBApp::Operation::ConvertSlowA :
{
fBuilder.Convert2SlowAnalyzedRoot();
break;
}
case EVBApp::Operation::ConvertFastA :
case EventBuilder::EVBApp::Operation::ConvertFastA :
{
fBuilder.Convert2FastAnalyzedRoot();
break;

View File

@ -94,7 +94,7 @@ private:
TGPopupMenu *fFileMenu;
EVBApp fBuilder;
EventBuilder::EVBApp fBuilder;
int counter;
UInt_t MAIN_W, MAIN_H;

View File

@ -1,7 +1,7 @@
#include "EventBuilder.h"
#include "evb/EventBuilder.h"
#include "spsdict/DataStructs.h"
#include "EVBApp.h"
#include "Stopwatch.h"
#include "evb/EVBApp.h"
#include "evb/Stopwatch.h"
int main(int argc, char** argv)
{
@ -27,11 +27,11 @@ int main(int argc, char** argv)
Plot (generate a default histogram file from analyzed data)
*/
EVBApp theBuilder;
EventBuilder::EVBApp theBuilder;
theBuilder.ReadConfigFile(filename);
Stopwatch timer;
EventBuilder::Stopwatch timer;
timer.Start();
if(operation == "Convert")
theBuilder.Convert2RawRoot();