00001
00014 #ifndef BACKGROUND_MIXER_H
00015 #define BACKGROUND_MIXER_H
00016
00017 #include <vector>
00018 #include <string>
00019 #include <fstream>
00020
00021
00022 #include "PhotonInfo.h"
00023
00024
00025 class BackgroundMixer
00026 {
00027 public:
00031 BackgroundMixer(const std::string &grbFile, const std::string &backgroundFile,
00032 const std::string &mixedDir, const double grbOffsetTime);
00033 BackgroundMixer(const std::string &mixedFile);
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 std::string grbFile() const { return m_grbFile; }
00044 std::string backgroundFile() const { return m_backgroundFile; }
00045 std::string mixedDir() const { return m_mixedDir; }
00046 std::string mixedFile() const { return m_mixedFile; }
00047 double grbOffsetTime() const { return m_grbOffsetTime; }
00048 const std::vector<PhotonInfo> &photonData() const { return m_photonData; }
00049 long ngrb() const { return m_nGrb; }
00050 long nbck() const { return m_nBck; }
00051
00052
00053 private:
00057 void mix();
00058
00062 void readBackground();
00063
00067 void readGRB();
00068
00072 void readMixedData();
00073
00076 void writeMixedData();
00077
00078
00079
00080
00081 std::string m_grbFile;
00082 std::string m_backgroundFile;
00083 std::string m_mixedDir;
00084 std::string m_mixedFile;
00085 double m_grbOffsetTime;
00086 std::vector<PhotonInfo> m_photonData;
00087 long m_nGrb;
00088 long m_nBck;
00089 };
00090
00091
00092
00096 class timeCmp
00097 {
00098 public:
00099 bool operator()(PhotonInfo &data1, PhotonInfo &data2)
00100 {
00101 return data1.time() < data2.time();
00102 }
00103 };
00104
00105
00106
00107 #endif // BACKGROUND_MIXER_H