EventBuilder_Skeleton/include/CompassRun.h

65 lines
1.9 KiB
C
Raw Normal View History

2021-07-14 11:54:17 -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 "RunCollector.h"
#include "ShiftMap.h"
#include <TParameter.h>
#include <TGProgressBar.h>
#include <TSystem.h>
class CompassRun {
public:
CompassRun();
CompassRun(const std::string& dir, unsigned int bsize);
~CompassRun();
inline void SetDirectory(const std::string& dir) { directory = dir; };
inline void SetScalerInput(const std::string& filename) { m_scalerinput = filename; };
inline void SetRunNumber(int n) { runNum = n; };
inline void SetShiftMap(const std::string& filename) { m_smap.SetFile(filename); };
void Convert2RawRoot(const std::string& name);
void Convert2SortedRoot(const std::string& name, double window);
inline void AttachProgressBar(TGProgressBar* pb) { m_pb = pb; };
private:
bool GetBinaryFiles();
bool GetHitsFromFiles();
void SetScalers();
void ReadScalerData(const std::string& filename);
void SetProgressBar();
std::string directory, m_scalerinput;
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;
std::vector<DPPChannel> event;
//what run is this
int runNum;
unsigned int m_totalHits;
unsigned int m_buffersize;
//Scaler switch
bool m_scaler_flag;
//GUI progress bar, if attached
TGProgressBar* m_pb;
};
#endif