2021-07-13 16:36:41 -04:00
|
|
|
/*
|
|
|
|
CompassRun.h
|
|
|
|
Class designed as abstraction of a collection of binary files that represent the total data in a single
|
|
|
|
Compass data run. It handles the user input (shift maps, file collection etc.) and creates a list of
|
|
|
|
CompassFiles from which to draw data. It then draws data from these files, organizes them in time,
|
|
|
|
and writes to a ROOT file for further processing.
|
|
|
|
|
|
|
|
Written by G.W. McCann Oct. 2020
|
|
|
|
*/
|
|
|
|
#ifndef COMPASSRUN_H
|
|
|
|
#define COMPASSRUN_H
|
|
|
|
|
|
|
|
#include "CompassFile.h"
|
|
|
|
#include "DataStructs.h"
|
|
|
|
#include "ShiftMap.h"
|
2021-12-16 17:38:58 -05:00
|
|
|
#include "ProgressCallback.h"
|
2022-07-13 10:26:37 -04:00
|
|
|
#include "EVBWorkspace.h"
|
|
|
|
#include "EVBParameters.h"
|
2021-07-13 16:36:41 -04:00
|
|
|
#include <TParameter.h>
|
|
|
|
|
2021-12-15 12:08:12 -05:00
|
|
|
namespace EventBuilder {
|
|
|
|
|
|
|
|
class CompassRun
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2022-07-13 10:26:37 -04:00
|
|
|
CompassRun(const EVBParameters& params, const std::shared_ptr<EVBWorkspace>& workspace);
|
2021-12-15 12:08:12 -05:00
|
|
|
~CompassRun();
|
|
|
|
inline void SetRunNumber(int n) { m_runNum = n; }
|
|
|
|
void Convert2RawRoot(const std::string& name);
|
2022-07-11 17:32:48 -04:00
|
|
|
void Convert2SortedRoot(const std::string& name);
|
|
|
|
void Convert2FastSortedRoot(const std::string& name);
|
|
|
|
void Convert2SlowAnalyzedRoot(const std::string& name);
|
|
|
|
void Convert2FastAnalyzedRoot(const std::string& name);
|
2021-12-15 12:08:12 -05:00
|
|
|
|
2021-12-16 17:38:58 -05:00
|
|
|
inline void SetProgressCallbackFunc(const ProgressCallbackFunc& function) { m_progressCallback = function; }
|
|
|
|
inline void SetProgressFraction(double frac) { m_progressFraction = frac; }
|
2021-12-15 12:08:12 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool GetBinaryFiles();
|
|
|
|
bool GetHitsFromFiles();
|
|
|
|
void SetScalers();
|
|
|
|
void ReadScalerData(const std::string& filename);
|
2022-07-11 17:32:48 -04:00
|
|
|
|
|
|
|
EVBParameters m_params;
|
2022-07-13 10:26:37 -04:00
|
|
|
std::shared_ptr<EVBWorkspace> m_workspace;
|
2021-12-15 12:08:12 -05:00
|
|
|
|
|
|
|
std::vector<CompassFile> m_datafiles;
|
|
|
|
unsigned int startIndex; //this is the file we start looking at; increases as we finish files.
|
|
|
|
ShiftMap m_smap;
|
|
|
|
std::unordered_map<std::string, TParameter<Long64_t>> m_scaler_map; //maps scaler files to the TParameter to be saved
|
|
|
|
|
|
|
|
//Potential branch variables
|
|
|
|
CompassHit hit;
|
|
|
|
CoincEvent event;
|
|
|
|
ProcessedEvent pevent;
|
|
|
|
|
|
|
|
//what run is this
|
|
|
|
int m_runNum;
|
|
|
|
unsigned int m_totalHits;
|
|
|
|
|
|
|
|
//Scaler switch
|
|
|
|
bool m_scaler_flag;
|
|
|
|
|
2021-12-16 17:38:58 -05:00
|
|
|
ProgressCallbackFunc m_progressCallback;
|
|
|
|
double m_progressFraction;
|
2021-12-15 12:08:12 -05:00
|
|
|
};
|
2021-12-13 12:28:56 -05:00
|
|
|
|
2021-12-15 12:08:12 -05:00
|
|
|
}
|
2021-07-13 16:36:41 -04:00
|
|
|
|
|
|
|
#endif
|