File NPDetectorManager.h
File List > core > NPDetectorManager.h
Go to the documentation of this file
#ifndef NPDetectorManager_h
#define NPDetectorManager_h
#include "NPVDataInput.h"
#include "NPVDataOutput.h"
#include "NPVDetector.h"
#include <future>
#include <map>
#include <memory>
#include <string>
namespace nptool {
class Application;
class DetectorManager {
public:
DetectorManager() : m_nbr_det(0), m_allowMT(true){};
~DetectorManager(){};
private:
size_t m_nbr_det;
std::map<std::string, std::shared_ptr<nptool::VDetector>> m_detectors;
std::shared_ptr<nptool::Application> m_app;
bool m_allowMT;
std::vector<std::future<bool>> m_res;
public:
// House keeping
void InitDetectorManager();
void ReadConfiguration(std::string file);
void AddDetector(std::string, std::shared_ptr<VDetector>){};
std::shared_ptr<VDetector> GetDetector(std::string);
std::map<std::string, std::shared_ptr<VDetector>> GetAllDetectors() { return m_detectors; };
void DisableMT() { m_allowMT = false; }
void EnableMT() { m_allowMT = true; }
// Conversion
// last flag is used to disable MT if the method is not thread safe (depend on the type of input)
void BuildRawEvent(const std::string& daq_name, const std::string& label, void* ptr_to_data, bool allow_MT = true);
// Analysis
void BuildPhysicalEvent(bool allow_MT = true);
// Simulation
void InitSimulation(std::string simtype);
void ConstructGeometry();
void InitializeScorers();
void ReadSensitive();
// Data I/O
void InitializeDataInputConversion(std::shared_ptr<nptool::VDataInput>);
void InitializeDataInputRaw(std::shared_ptr<nptool::VDataInput>);
void InitializeDataInputPhysics(std::shared_ptr<nptool::VDataInput>);
void InitializeDataOutputRaw(std::shared_ptr<nptool::VDataOutput>);
void InitializeDataOutputPhysics(std::shared_ptr<nptool::VDataOutput>);
void ClearEventPhysics(bool allow_MT = true);
void ClearEventData(bool allow_MT = true);
// Spectra
void InitSpectra();
void FillSpectra();
void WriteSpectra();
void CheckSpectra();
void ClearSpectra();
};
} // namespace nptool
#endif