mirror of
https://github.com/sesps/SPS_SABRE_EventBuilder.git
synced 2024-11-22 18:18:52 -05:00
Completed style overhaul and cleaned up extraneous code. Minor mods to ChannelMap and variable mapping.
This commit is contained in:
parent
afcdd3bb8c
commit
a904f8c0f2
|
@ -1,4 +1,4 @@
|
|||
Format: scaler_param_name assoc_binary_file_name_without_runID
|
||||
NOTE: As of this version, scalers are pure counting parameters (the total events will be counted and saved as a TParameter with the data)
|
||||
CH0@V1730_89_Data t1
|
||||
|
||||
CH5@V1730_89_Data t2
|
|
@ -9,17 +9,16 @@
|
|||
#ifndef CHANNELMAP_H
|
||||
#define CHANNELMAP_H
|
||||
|
||||
struct Channel
|
||||
//Detector part/type identifiers for use in the code
|
||||
enum DetType
|
||||
{
|
||||
int detectorType; //What kind of detector we're looking at
|
||||
int detectorID; //Which specific detector we're looking at
|
||||
int detectorPart; //Which specific part we're looking at
|
||||
Sabre,
|
||||
FocalPlane,
|
||||
NoneType
|
||||
};
|
||||
|
||||
//Detector part/type identifiers for use in the code
|
||||
enum class DetAttribute
|
||||
enum DetAttribute
|
||||
{
|
||||
FocalPlane,
|
||||
ScintLeft,
|
||||
ScintRight,
|
||||
AnodeFront,
|
||||
|
@ -30,30 +29,45 @@ enum class DetAttribute
|
|||
DelayBL,
|
||||
Cathode,
|
||||
Monitor,
|
||||
SabreRing = 88, //These are offset to avoid interference at the variable mapping phase
|
||||
SabreWedge = 99 //Just don't add any new attributes with values greater than 88
|
||||
SabreRing0,
|
||||
SabreRing1,
|
||||
SabreRing2,
|
||||
SabreRing3,
|
||||
SabreRing4,
|
||||
SabreWedge0,
|
||||
SabreWedge1,
|
||||
SabreWedge2,
|
||||
SabreWedge3,
|
||||
SabreWedge4,
|
||||
NoneAttr
|
||||
};
|
||||
|
||||
struct Channel
|
||||
{
|
||||
DetType type;
|
||||
DetAttribute attribute; //What kind of detector we're looking at
|
||||
int local_channel; //Which specific piece of detector we're looking at
|
||||
};
|
||||
|
||||
class ChannelMap
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::unordered_map<DetAttribute, Channel> Containter;
|
||||
typedef std::unordered_map<DetAttribute, Channel>::iterator Iterator;
|
||||
typedef std::unordered_map<int, Channel> Containter;
|
||||
typedef std::unordered_map<int, Channel>::iterator Iterator;
|
||||
|
||||
ChannelMap();
|
||||
ChannelMap(const std::string& filename);
|
||||
~ChannelMap();
|
||||
bool FillMap(const std::string& filename);
|
||||
inline const Containter* GetCMap() { return &cmap; };
|
||||
inline Iterator FindChannel(int key) { return cmap.find(key); };
|
||||
inline Iterator End() { return cmap.end(); };
|
||||
inline bool IsValid() { return is_valid; };
|
||||
inline const Containter* GetCMap() { return &m_cmap; };
|
||||
inline Iterator FindChannel(int key) { return m_cmap.find(key); };
|
||||
inline Iterator End() { return m_cmap.end(); };
|
||||
inline bool IsValid() { return m_validFlag; };
|
||||
|
||||
private:
|
||||
Containter cmap;
|
||||
bool is_valid;
|
||||
Containter m_cmap;
|
||||
bool m_validFlag;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef COMPASS_HIT_H
|
||||
#define COMPASS_HIT_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct CompassHit
|
||||
{
|
||||
uint16_t board = 400;
|
||||
|
|
|
@ -25,9 +25,9 @@ public:
|
|||
CompassRun();
|
||||
CompassRun(const std::string& dir);
|
||||
~CompassRun();
|
||||
inline void SetDirectory(const std::string& dir) { directory = dir; }
|
||||
inline void SetDirectory(const std::string& dir) { m_directory = dir; }
|
||||
inline void SetScalerInput(const std::string& filename) { m_scalerinput = filename; }
|
||||
inline void SetRunNumber(int n) { runNum = n; }
|
||||
inline void SetRunNumber(int n) { m_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, const std::string& mapfile, double window);
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
void ReadScalerData(const std::string& filename);
|
||||
void SetProgressBar();
|
||||
|
||||
std::string directory, m_scalerinput;
|
||||
std::string m_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;
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
ProcessedEvent pevent;
|
||||
|
||||
//what run is this
|
||||
int runNum;
|
||||
int m_runNum;
|
||||
unsigned int m_totalHits;
|
||||
|
||||
//Scaler switch
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
~CutHandler();
|
||||
void SetCuts(const std::string& filename);
|
||||
bool IsValid() { return validFlag; }
|
||||
bool IsInside(ProcessedEvent* eaddress);
|
||||
bool IsInside(const ProcessedEvent* eaddress);
|
||||
std::vector<TCutG*> GetCuts() { return cut_array; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
#include <TGProgressBar.h>
|
||||
#include <TTimer.h>
|
||||
#include <TGComboBox.h>
|
||||
#include "GWMEventBuilder.h"
|
||||
#include "EVBApp.h"
|
||||
|
||||
|
||||
class EVBMainFrame : public TGMainFrame {
|
||||
class EVBMainFrame : public TGMainFrame
|
||||
{
|
||||
public:
|
||||
EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h);
|
||||
virtual ~EVBMainFrame();
|
||||
|
@ -47,31 +48,32 @@ public:
|
|||
void EnableAllInput();
|
||||
|
||||
|
||||
enum WidgetId {
|
||||
WORKDIR,
|
||||
CMAP,
|
||||
SMAP,
|
||||
SCALER,
|
||||
CUT,
|
||||
PLOTF,
|
||||
BFIELD,
|
||||
BKE,
|
||||
THETA,
|
||||
enum WidgetId
|
||||
{
|
||||
WorkDir,
|
||||
Cmap,
|
||||
Smap,
|
||||
Scaler,
|
||||
Cut,
|
||||
PlotF,
|
||||
BField,
|
||||
Bke,
|
||||
Theta,
|
||||
ZT,
|
||||
AT,
|
||||
ZP,
|
||||
AP,
|
||||
ZE,
|
||||
AE,
|
||||
SLOWWIND,
|
||||
FASTWIND_IC,
|
||||
FASTWIND_SABRE,
|
||||
TYPEBOX,
|
||||
RMIN,
|
||||
RMAX,
|
||||
M_LOAD_CONFIG,
|
||||
M_SAVE_CONFIG,
|
||||
M_EXIT
|
||||
SlowWind,
|
||||
FastWind_IC,
|
||||
FastWind_Sabre,
|
||||
TypeBox,
|
||||
RMin,
|
||||
RMax,
|
||||
M_Load_Config,
|
||||
M_Save_Config,
|
||||
M_Exit
|
||||
};
|
||||
|
||||
ClassDef(EVBMainFrame, 0);
|
||||
|
@ -92,7 +94,7 @@ private:
|
|||
|
||||
TGPopupMenu *fFileMenu;
|
||||
|
||||
GWMEventBuilder fBuilder;
|
||||
EVBApp fBuilder;
|
||||
|
||||
int counter;
|
||||
UInt_t MAIN_W, MAIN_H;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
bool GrabAllFiles();
|
||||
bool GrabFilesInRange();
|
||||
std::string GrabFile(int runNum);
|
||||
inline std::string GetSearchDir() { return directory; }
|
||||
inline std::string GetSearchDir() { return m_directory; }
|
||||
inline std::string GetSearchPrefix() { return m_prefix; }
|
||||
inline std::string GetSearchSuffix() { return m_suffix; }
|
||||
inline int GetRunMin() { return m_minRun; }
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
~SFPPlotter();
|
||||
inline void AttachProgressBar(TGProgressBar* pb) { m_pb = pb; }
|
||||
inline void ApplyCutlist(const std::string& listname) { cutter.SetCuts(listname); }
|
||||
void Run(const std::vector<std::string>& files, const string& output);
|
||||
void Run(const std::vector<std::string>& files, const std::string& output);
|
||||
|
||||
private:
|
||||
void SetProgressBar(long total);
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
void SetFile(const std::string& filename);
|
||||
inline bool IsValid() { return m_validFlag; }
|
||||
inline std::string GetFilename() { return m_filename; }
|
||||
Long64_t GetShift(int gchan);
|
||||
uint64_t GetShift(int gchan);
|
||||
|
||||
private:
|
||||
void ParseFile();
|
||||
|
|
|
@ -14,43 +14,40 @@
|
|||
#include "DataStructs.h"
|
||||
#include "ChannelMap.h"
|
||||
#include <TH2.h>
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
class SlowSort
|
||||
{
|
||||
|
||||
class SlowSort {
|
||||
public:
|
||||
SlowSort();
|
||||
SlowSort(double windowSize, const std::string& mapfile);
|
||||
~SlowSort();
|
||||
inline void SetWindowSize(double window) { m_coincWindow = window; }
|
||||
inline bool SetMapFile(const std::string& mapfile) { return cmap.FillMap(mapfile); }
|
||||
bool AddHitToEvent(CompassHit& mhit);
|
||||
const CoincEvent& GetEvent();
|
||||
inline TH2F* GetEventStats() { return event_stats; }
|
||||
void FlushHitsToEvent(); //For use with *last* hit list
|
||||
inline bool IsEventReady() { return m_eventFlag; }
|
||||
|
||||
public:
|
||||
SlowSort();
|
||||
SlowSort(double windowSize, const string& mapfile);
|
||||
~SlowSort();
|
||||
inline void SetWindowSize(double window) { coincWindow = window; };
|
||||
inline bool SetMapFile(const std::string& mapfile) { return cmap.FillMap(mapfile); };
|
||||
bool AddHitToEvent(CompassHit& mhit);
|
||||
CoincEvent GetEvent();
|
||||
inline TH2F* GetEventStats() { return event_stats; };
|
||||
void FlushHitsToEvent(); //For use with *last* hit list
|
||||
inline bool IsEventReady() { return eventFlag; };
|
||||
private:
|
||||
void InitVariableMaps();
|
||||
void Reset();
|
||||
void ProcessEvent();
|
||||
|
||||
private:
|
||||
void InitVariableMaps();
|
||||
void Reset();
|
||||
void StartEvent();
|
||||
void ProcessEvent();
|
||||
double m_coincWindow;
|
||||
std::vector<DPPChannel> m_hitList;
|
||||
bool m_eventFlag;
|
||||
CoincEvent m_event;
|
||||
CoincEvent m_blank;
|
||||
|
||||
double startTime, previousHitTime;
|
||||
std::unordered_map<DetAttribute, std::vector<DetectorHit>*> varMap;
|
||||
|
||||
double coincWindow;
|
||||
vector<DPPChannel> hitList;
|
||||
bool eventFlag;
|
||||
DPPChannel hit;
|
||||
CoincEvent event;
|
||||
CoincEvent blank;
|
||||
|
||||
double startTime, previousHitTime;
|
||||
unordered_map<int, vector<DetectorHit>*> fpVMap;
|
||||
unordered_map<int, vector<DetectorHit>*> sabreVMap;
|
||||
TH2F* event_stats;
|
||||
|
||||
TH2F* event_stats;
|
||||
|
||||
ChannelMap cmap;
|
||||
ChannelMap cmap;
|
||||
|
||||
};
|
||||
|
||||
|
|
10
input.txt
10
input.txt
|
@ -1,10 +1,10 @@
|
|||
-------Data Location----------
|
||||
WorkspaceDirectory: /data1/gwm17/10B3He/Feb2021/
|
||||
WorkspaceDirectory: /media/gordon/GordonData/gwm17/9BFeb2021
|
||||
-------------------------------
|
||||
------Experimental Inputs------
|
||||
ChannelMapFile: /home/gwm17/GWM_EventBuilder/etc/orig_ChannelMap_Feb2021_SABRE.txt
|
||||
ScalerFile: /home/gwm17/GWM_EventBuilder/etc/orig_ScalerFile_Feb2021_SABRE.txt
|
||||
CutListFile: /home/gwm17/GWM_EventBuilder/etc/new_CutList_Feb202110B3hea.txt
|
||||
ChannelMapFile: /home/gordon/SPS_SABRE_EventBuilder/etc/ChannelMap_Feb2021_SABRE.txt
|
||||
ScalerFile: /home/gordon/SPS_SABRE_EventBuilder/etc/ScalerFile_Feb2021_SABRE.txt
|
||||
CutListFile: /home/gordon/SPS_SABRE_EventBuilder/etc/CutList_Feb2021_10B3hea.txt
|
||||
ZT: 5
|
||||
AT: 10
|
||||
ZP: 2
|
||||
|
@ -16,7 +16,7 @@ BeamKE(MeV): 24
|
|||
Theta(deg): 15
|
||||
-------------------------------
|
||||
-------Timing Information------
|
||||
BoardOffsetFile: /home/gwm17/GWM_EventBuilder/etc/orig_ShiftMap_Feb2021_SABRE.txt
|
||||
BoardOffsetFile: /home/gordon/SPS_SABRE_EventBuilder/etc/ShiftMap_Feb2021_SABRE.txt
|
||||
SlowCoincidenceWindow(ps): 1.5e+06
|
||||
FastCoincidenceWindow_IonCh(ps): 250000
|
||||
FastCoincidenceWindow_SABRE(ps): 150000
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include "ChannelMap.h"
|
||||
|
||||
ChannelMap::ChannelMap() :
|
||||
is_valid(false)
|
||||
m_validFlag(false)
|
||||
{
|
||||
}
|
||||
|
||||
ChannelMap::ChannelMap(const std::string& name) :
|
||||
is_valid(false)
|
||||
m_validFlag(false)
|
||||
{
|
||||
FillMap(name);
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ bool ChannelMap::FillMap(const std::string& name)
|
|||
std::ifstream input(name);
|
||||
if(!input.is_open())
|
||||
{
|
||||
is_valid = false;
|
||||
return is_valid;
|
||||
m_validFlag = false;
|
||||
return m_validFlag;
|
||||
}
|
||||
std::string junk, type, partname;
|
||||
int gchan, id;
|
||||
|
@ -39,42 +39,56 @@ bool ChannelMap::FillMap(const std::string& name)
|
|||
while(input>>gchan)
|
||||
{
|
||||
//Set default values
|
||||
this_chan.detectorType = -1;
|
||||
this_chan.detectorID = -1;
|
||||
this_chan.detectorPart = -1;
|
||||
this_chan.type = DetType::NoneType;
|
||||
this_chan.local_channel = -1;
|
||||
this_chan.attribute = DetAttribute::NoneAttr;
|
||||
input>>id>>type>>partname;
|
||||
if(type == "SABRERING")
|
||||
if(type == "SABRERING")
|
||||
{
|
||||
this_chan.detectorType = DetAttribute::SabreRing;
|
||||
this_chan.detectorID = id;
|
||||
this_chan.detectorPart = std::stoi(partname);
|
||||
this_chan.type = DetType::Sabre;
|
||||
switch(id)
|
||||
{
|
||||
case 0: this_chan.attribute = DetAttribute::SabreRing0; break;
|
||||
case 1: this_chan.attribute = DetAttribute::SabreRing1; break;
|
||||
case 2: this_chan.attribute = DetAttribute::SabreRing2; break;
|
||||
case 3: this_chan.attribute = DetAttribute::SabreRing3; break;
|
||||
case 4: this_chan.attribute = DetAttribute::SabreRing4; break;
|
||||
}
|
||||
this_chan.local_channel = std::stoi(partname);
|
||||
}
|
||||
else if(type == "SABREWEDGE")
|
||||
{
|
||||
this_chan.detectorType = DetAttribute::SabreWedge;
|
||||
this_chan.detectorID = id;
|
||||
this_chan.detectorPart = std::stoi(partname);
|
||||
this_chan.type = DetType::Sabre;
|
||||
switch(id)
|
||||
{
|
||||
case 0: this_chan.attribute = DetAttribute::SabreWedge0; break;
|
||||
case 1: this_chan.attribute = DetAttribute::SabreWedge1; break;
|
||||
case 2: this_chan.attribute = DetAttribute::SabreWedge2; break;
|
||||
case 3: this_chan.attribute = DetAttribute::SabreWedge3; break;
|
||||
case 4: this_chan.attribute = DetAttribute::SabreWedge4; break;
|
||||
}
|
||||
this_chan.local_channel = std::stoi(partname);
|
||||
}
|
||||
else if (type == "FOCALPLANE")
|
||||
{
|
||||
this_chan.detectorType = FOCALPLANE;
|
||||
this_chan.detectorID = id;
|
||||
if(partname == "SCINTRIGHT") this_chan.detectorPart = DetAttribute::ScintRight;
|
||||
else if(partname == "SCINTLEFT") this_chan.detectorPart = DetAttribute::ScintLeft;
|
||||
else if(partname == "DELAYFR") this_chan.detectorPart = DetAttribute::DelayFR;
|
||||
else if(partname == "DELAYFL") this_chan.detectorPart = DetAttribute::DelayFL;
|
||||
else if(partname == "DELAYBR") this_chan.detectorPart = DetAttribute::DelayBR;
|
||||
else if(partname == "DELAYBL") this_chan.detectorPart = DetAttribute::DelayBL;
|
||||
else if(partname == "CATHODE") this_chan.detectorPart = DetAttribute::Cathode;
|
||||
else if(partname == "ANODEFRONT") this_chan.detectorPart = DetAttribute::AnodeFront;
|
||||
else if(partname == "ANODEBACK") this_chan.detectorPart = DetAttribute::AnodeBack;
|
||||
else if(partname == "MONITOR") this_chan.detectorPart = DetAttribute::Monitor;
|
||||
this_chan.type = DetType::FocalPlane;
|
||||
this_chan.local_channel = id;
|
||||
if(partname == "SCINTRIGHT") this_chan.attribute = DetAttribute::ScintRight;
|
||||
else if(partname == "SCINTLEFT") this_chan.attribute = DetAttribute::ScintLeft;
|
||||
else if(partname == "DELAYFR") this_chan.attribute = DetAttribute::DelayFR;
|
||||
else if(partname == "DELAYFL") this_chan.attribute = DetAttribute::DelayFL;
|
||||
else if(partname == "DELAYBR") this_chan.attribute = DetAttribute::DelayBR;
|
||||
else if(partname == "DELAYBL") this_chan.attribute = DetAttribute::DelayBL;
|
||||
else if(partname == "CATHODE") this_chan.attribute = DetAttribute::Cathode;
|
||||
else if(partname == "ANODEFRONT") this_chan.attribute = DetAttribute::AnodeFront;
|
||||
else if(partname == "ANODEBACK") this_chan.attribute = DetAttribute::AnodeBack;
|
||||
else if(partname == "MONITOR") this_chan.attribute = DetAttribute::Monitor;
|
||||
}
|
||||
|
||||
cmap[gchan] = this_chan;
|
||||
m_cmap[gchan] = this_chan;
|
||||
}
|
||||
|
||||
input.close();
|
||||
is_valid = true;
|
||||
return is_valid;
|
||||
m_validFlag = true;
|
||||
return m_validFlag;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include "FlagHandler.h"
|
||||
|
||||
CompassRun::CompassRun() :
|
||||
directory(""), m_scalerinput(""), runNum(0), m_scaler_flag(false), m_pb(nullptr)
|
||||
m_directory(""), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_pb(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CompassRun::CompassRun(const std::string& dir) :
|
||||
directory(dir), m_scalerinput(""), runNum(0), m_scaler_flag(false), m_pb(nullptr)
|
||||
m_directory(dir), m_scalerinput(""), m_runNum(0), m_scaler_flag(false), m_pb(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void CompassRun::SetScalers()
|
|||
while(input>>filename)
|
||||
{
|
||||
input>>varname;
|
||||
filename = directory+filename+"_run_"+to_string(runNum)+".bin";
|
||||
filename = m_directory+filename+"_run_"+std::to_string(m_runNum)+".bin";
|
||||
m_scaler_map[filename] = TParameter<Long64_t>(varname.c_str(), init);
|
||||
}
|
||||
input.close();
|
||||
|
@ -58,15 +58,15 @@ bool CompassRun::GetBinaryFiles()
|
|||
{
|
||||
std::string prefix = "";
|
||||
std::string suffix = ".bin"; //binaries
|
||||
RunCollector grabber(directory, prefix, suffix);
|
||||
RunCollector grabber(m_directory, prefix, suffix);
|
||||
grabber.GrabAllFiles();
|
||||
|
||||
m_datafiles.clear(); //so that the CompassRun can be reused
|
||||
m_datafiles.reserve(grabber.filelist.size());
|
||||
m_datafiles.reserve(grabber.GetFileList().size());
|
||||
bool scalerd;
|
||||
m_totalHits = 0; //reset total run size
|
||||
|
||||
for(auto& entry : grabber.filelist)
|
||||
for(auto& entry : grabber.GetFileList())
|
||||
{
|
||||
//Handle scaler files, if they exist
|
||||
if(m_scaler_flag)
|
||||
|
@ -74,9 +74,9 @@ bool CompassRun::GetBinaryFiles()
|
|||
scalerd = false;
|
||||
for(auto& scaler_pair : m_scaler_map)
|
||||
{
|
||||
if(std::string(entry.Data()) == scaler_pair.first)
|
||||
if(entry == scaler_pair.first)
|
||||
{
|
||||
ReadScalerData(entry.Data());
|
||||
ReadScalerData(entry);
|
||||
scalerd = true;
|
||||
break;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ bool CompassRun::GetBinaryFiles()
|
|||
continue;
|
||||
}
|
||||
|
||||
m_datafiles.emplace_back(entry.Data());
|
||||
m_datafiles.emplace_back(entry);
|
||||
m_datafiles[m_datafiles.size()-1].AttachShiftMap(&m_smap);
|
||||
//Any time we have a file that fails to be found, we terminate the whole process
|
||||
if(!m_datafiles[m_datafiles.size() - 1].IsOpen())
|
||||
|
@ -132,26 +132,25 @@ void CompassRun::ReadScalerData(const std::string& filename)
|
|||
bool CompassRun::GetHitsFromFiles()
|
||||
{
|
||||
|
||||
std::pair<CompassHit, bool*> earliestHit = make_pair(CompassHit(), nullptr);
|
||||
std::pair<CompassHit, bool*> earliestHit = std::make_pair(CompassHit(), nullptr);
|
||||
for(unsigned int i=startIndex; i<m_datafiles.size(); i++)
|
||||
{
|
||||
if(m_datafiles[i].CheckHitHasBeenUsed())
|
||||
{
|
||||
m_datafiles[i].GetNextHit();
|
||||
}
|
||||
|
||||
if(m_datafiles[i].IsEOF())
|
||||
{
|
||||
if(i == startIndex) startIndex++;
|
||||
if(i == startIndex)
|
||||
startIndex++;
|
||||
continue;
|
||||
}
|
||||
else if(i == startIndex)
|
||||
{
|
||||
earliestHit = make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr());
|
||||
earliestHit = std::make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr());
|
||||
}
|
||||
else if(m_datafiles[i].GetCurrentHit().timestamp < earliestHit.first.timestamp)
|
||||
{
|
||||
earliestHit = make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr());
|
||||
earliestHit = std::make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +172,7 @@ void CompassRun::Convert2RawRoot(const std::string& name) {
|
|||
outtree->Branch("Timestamp", &hit.timestamp);
|
||||
outtree->Branch("Flags", &hit.flags);
|
||||
|
||||
if(!m_smap.IsSet())
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
std::cerr<<"Bad shift map at CompassRun::Convert()."<<std::endl;
|
||||
std::cerr<<"Shifts will be locked to 0"<<std::endl;
|
||||
|
@ -233,7 +232,7 @@ void CompassRun::Convert2SortedRoot(const std::string& name, const std::string&
|
|||
|
||||
outtree->Branch("event", &event);
|
||||
|
||||
if(!m_smap.IsSet())
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
std::cerr<<"Bad shift map at CompassRun::Convert()."<<std::endl;
|
||||
std::cerr<<"Shifts will be locked to 0"<<std::endl;
|
||||
|
@ -307,7 +306,7 @@ void CompassRun::Convert2FastSortedRoot(const std::string& name, const std::stri
|
|||
|
||||
outtree->Branch("event", &event);
|
||||
|
||||
if(!m_smap.IsSet())
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
std::cerr<<"Bad shift map at CompassRun::Convert()."<<std::endl;
|
||||
std::cerr<<"Shifts will be locked to 0"<<std::endl;
|
||||
|
@ -400,7 +399,7 @@ void CompassRun::Convert2SlowAnalyzedRoot(const std::string& name, const std::st
|
|||
|
||||
outtree->Branch("event", &pevent);
|
||||
|
||||
if(!m_smap.IsSet())
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
std::cerr<<"Bad shift map at CompassRun::Convert()."<<std::endl;
|
||||
std::cerr<<"Shifts will be locked to 0"<<std::endl;
|
||||
|
@ -422,7 +421,7 @@ void CompassRun::Convert2SlowAnalyzedRoot(const std::string& name, const std::st
|
|||
SlowSort coincidizer(window, mapfile);
|
||||
SFPAnalyzer analyzer(zt, at, zp, ap, ze, ae, bke, theta, b);
|
||||
|
||||
vector<TParameter<Double_t>> parvec;
|
||||
std::vector<TParameter<Double_t>> parvec;
|
||||
parvec.reserve(9);
|
||||
parvec.emplace_back("ZT", zt);
|
||||
parvec.emplace_back("AT", at);
|
||||
|
@ -500,7 +499,7 @@ void CompassRun::Convert2FastAnalyzedRoot(const std::string& name, const std::st
|
|||
|
||||
outtree->Branch("event", &pevent);
|
||||
|
||||
if(!m_smap.IsSet())
|
||||
if(!m_smap.IsValid())
|
||||
{
|
||||
std::cerr<<"Bad shift map at CompassRun::Convert()."<<std::endl;
|
||||
std::cerr<<"Shifts will be locked to 0"<<std::endl;
|
||||
|
@ -524,7 +523,7 @@ void CompassRun::Convert2FastAnalyzedRoot(const std::string& name, const std::st
|
|||
FastSort speedyCoincidizer(fsi_window, fic_window);
|
||||
SFPAnalyzer analyzer(zt, at, zp, ap, ze, ae, bke, theta, b);
|
||||
|
||||
vector<TParameter<Double_t>> parvec;
|
||||
std::vector<TParameter<Double_t>> parvec;
|
||||
parvec.reserve(9);
|
||||
parvec.emplace_back("ZT", zt);
|
||||
parvec.emplace_back("AT", at);
|
||||
|
|
|
@ -78,7 +78,7 @@ void CutHandler::InitVariableMap()
|
|||
varmap["cathode"] = &m_event.cathode;
|
||||
}
|
||||
|
||||
bool CutHandler::IsInside(ProcessedEvent* eaddress)
|
||||
bool CutHandler::IsInside(const ProcessedEvent* eaddress)
|
||||
{
|
||||
m_event = *eaddress;
|
||||
std::string x, y;
|
||||
|
|
|
@ -120,7 +120,7 @@ void EVBApp::WriteConfigFile(const std::string& fullpath)
|
|||
void EVBApp::PlotHistograms()
|
||||
{
|
||||
std::string analyze_dir = m_workspace+"/analyzed/";
|
||||
std::string plot_file = m_workspace+"/histograms/run_"+to_string(m_rmin)+"_"+to_string(m_rmax)+".root";
|
||||
std::string plot_file = m_workspace+"/histograms/run_"+std::to_string(m_rmin)+"_"+std::to_string(m_rmax)+".root";
|
||||
SFPPlotter grammer;
|
||||
grammer.ApplyCutlist(m_cutList);
|
||||
std::cout<<"-------------GWM Event Builder-------------"<<std::endl;
|
||||
|
@ -136,7 +136,7 @@ void EVBApp::PlotHistograms()
|
|||
if(grabber.GrabFilesInRange())
|
||||
{
|
||||
std::cout<<"Working...";
|
||||
grammer.Run(grabber.filelist, plot_file);
|
||||
grammer.Run(grabber.GetFileList(), plot_file);
|
||||
std::cout<<" Complete."<<std::endl;
|
||||
}
|
||||
else
|
||||
|
@ -183,7 +183,7 @@ void EVBApp::Convert2RawRoot()
|
|||
converter.SetRunNumber(i);
|
||||
std::cout<<"Converting file: "<<binfile<<std::endl;
|
||||
|
||||
rawfile = rawroot_dir + "compass_run_"+ to_string(i) + ".root";
|
||||
rawfile = rawroot_dir + "compass_run_"+ std::to_string(i) + ".root";
|
||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||
wipe_command = "rm -r "+unpack_dir+"*.bin";
|
||||
|
||||
|
@ -199,7 +199,7 @@ void EVBApp::Convert2RawRoot()
|
|||
|
||||
void EVBApp::MergeROOTFiles()
|
||||
{
|
||||
std::string merge_file = m_workspace+"/merged/run_"+to_string(m_rmin)+"_"+to_string(m_rmax)+".root";
|
||||
std::string merge_file = m_workspace+"/merged/run_"+std::to_string(m_rmin)+"_"+std::to_string(m_rmax)+".root";
|
||||
std::string file_dir = m_workspace+"/analyzed/";
|
||||
std::cout<<"-------------GWM Event Builder-------------"<<std::endl;
|
||||
std::cout<<"Merging ROOT files into single ROOT file"<<std::endl;
|
||||
|
@ -256,7 +256,7 @@ void EVBApp::Convert2SortedRoot()
|
|||
converter.SetRunNumber(i);
|
||||
std::cout<<"Converting file: "<<binfile<<std::endl;
|
||||
|
||||
sortfile = sortroot_dir +"run_"+to_string(i)+ ".root";
|
||||
sortfile = sortroot_dir +"run_"+std::to_string(i)+ ".root";
|
||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||
wipe_command = "rm -r "+unpack_dir+"*.bin";
|
||||
|
||||
|
@ -305,7 +305,7 @@ void EVBApp::Convert2FastSortedRoot() {
|
|||
converter.SetRunNumber(i);
|
||||
std::cout<<"Converting file: "<<binfile<<std::endl;
|
||||
|
||||
sortfile = sortroot_dir + "run_" + to_string(i) + ".root";
|
||||
sortfile = sortroot_dir + "run_" + std::to_string(i) + ".root";
|
||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||
wipe_command = "rm -r "+unpack_dir+"*.bin";
|
||||
|
||||
|
@ -353,7 +353,7 @@ void EVBApp::Convert2SlowAnalyzedRoot() {
|
|||
converter.SetRunNumber(i);
|
||||
std::cout<<"Converting file: "<<binfile<<std::endl;
|
||||
|
||||
sortfile = sortroot_dir + "run_" + to_string(i) + ".root";
|
||||
sortfile = sortroot_dir + "run_" + std::to_string(i) + ".root";
|
||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||
wipe_command = "rm -r "+unpack_dir+"*.bin";
|
||||
|
||||
|
@ -405,7 +405,7 @@ void EVBApp::Convert2FastAnalyzedRoot()
|
|||
converter.SetRunNumber(i);
|
||||
std::cout<<"Converting file: "<<binfile<<std::endl;
|
||||
|
||||
sortfile = sortroot_dir + "run_" + to_string(i) + ".root";
|
||||
sortfile = sortroot_dir + "run_" + std::to_string(i) + ".root";
|
||||
unpack_command = "tar -xzf "+binfile+" --directory "+unpack_dir;
|
||||
wipe_command = "rm -r "+unpack_dir+"*.bin";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "FastSort.h"
|
||||
|
||||
//windows given in picoseconds, converted to nanoseconds
|
||||
FastSort::FastSort(float si_windowSize, float ion_windowSize)
|
||||
FastSort::FastSort(float si_windowSize, float ion_windowSize) :
|
||||
si_coincWindow(si_windowSize/1.0e3), ion_coincWindow(ion_windowSize/1.0e3), event_address(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ std::vector<CoincEvent> FastSort::GetFastEvents(CoincEvent& event)
|
|||
sizeArray[4] = slowEvent.focalPlane.anodeF.size();
|
||||
sizeArray[5] = slowEvent.focalPlane.anodeB.size();
|
||||
sizeArray[6] = slowEvent.focalPlane.cathode.size();
|
||||
unsigned int maxSize = *max_element(sizeArray, sizeArray+7);
|
||||
unsigned int maxSize = *std::max_element(sizeArray, sizeArray+7);
|
||||
//loop over scints
|
||||
for(unsigned int i=0; i<slowEvent.focalPlane.scintL.size(); i++)
|
||||
{
|
||||
|
|
|
@ -21,15 +21,16 @@ MassLookup::MassLookup()
|
|||
std::ifstream massfile("./etc/mass.txt");
|
||||
if(massfile.is_open())
|
||||
{
|
||||
int Z;
|
||||
int Z,A;
|
||||
std::string junk, element, key;
|
||||
double atomicMassBig, atomicMassSmall, isotopicMass;
|
||||
getline(massfile,junk);
|
||||
getline(massfile,junk);
|
||||
std::getline(massfile,junk);
|
||||
std::getline(massfile,junk);
|
||||
while(massfile>>junk)
|
||||
{
|
||||
massfile>>Z>>A>>element>>atomicMassBig>>atomicMassSmall;
|
||||
isotopicMass = (atomicMassBig + atomicMassSmall*1e-6 - Z*electron_mass)*u_to_mev;
|
||||
std::string key = "("+std::to_string(Z)+","+A+")";
|
||||
key = "("+std::to_string(Z)+","+A+")";
|
||||
massTable[key] = isotopicMass;
|
||||
elementTable[Z] = element;
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
#include <cstdio>
|
||||
|
||||
RunCollector::RunCollector():
|
||||
m_initFlag(false), m_directory(""), m_prefix(""), m_suffix(""), m_maxRun(0), m_minRun(0)
|
||||
m_initFlag(false), m_directory(""), m_prefix(""), m_suffix(""), m_minRun(0), m_maxRun(0)
|
||||
{
|
||||
}
|
||||
|
||||
RunCollector::RunCollector(const std::string& dirname, const std::string& prefix, const std::string& suffix)
|
||||
RunCollector::RunCollector(const std::string& dirname, const std::string& prefix, const std::string& suffix) :
|
||||
m_initFlag(true), m_directory(dirname), m_prefix(prefix), m_suffix(suffix), m_minRun(0), m_maxRun(0)
|
||||
{
|
||||
}
|
||||
|
||||
RunCollector::RunCollector(const std::string& dirname, const std::string& prefix, const std::string& suffix, int min, int max)
|
||||
RunCollector::RunCollector(const std::string& dirname, const std::string& prefix, const std::string& suffix, int min, int max) :
|
||||
m_initFlag(true), m_directory(dirname), m_prefix(prefix), m_suffix(suffix), m_minRun(min), m_maxRun(max)
|
||||
{
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ bool RunCollector::GrabAllFiles()
|
|||
|
||||
if(!flist) //Make sure list is real. If not, means no directory
|
||||
{
|
||||
cerr<<"Unable to find any files in directory; check name given to the input.txt"<<endl;
|
||||
std::cerr<<"Unable to find any files in directory; check name given to the input.txt"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,12 @@ bool RunCollector::GrabAllFiles()
|
|||
while((file = (TSystemFile*)next_element()))
|
||||
{
|
||||
temp = file->GetName();
|
||||
if(temp.size() < prefix.size() || temp.size() < suffix.size())
|
||||
if(temp.size() < m_prefix.size() || temp.size() < m_suffix.size())
|
||||
continue;
|
||||
else if(!file->IsDirectory() && !temp.compare(0,prefix.size(),prefix) &&
|
||||
!temp.compare(temp.size()-(1+suffix.size()), suffix.size(), suffix))
|
||||
else if(!file->IsDirectory() && !temp.compare(0,m_prefix.size(),m_prefix) &&
|
||||
!temp.compare(temp.size()-m_suffix.size(), m_suffix.size(), m_suffix))
|
||||
{
|
||||
fname = dir+temp;
|
||||
fname = m_directory+temp;
|
||||
m_filelist.push_back(fname);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ bool RunCollector::GrabAllFiles()
|
|||
return true;
|
||||
else
|
||||
{
|
||||
cerr<<"Unable to find files with matching run name in directory; check input.txt"<<endl;
|
||||
std::cerr<<"Unable to find files with matching run name in directory; check input.txt"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ bool RunCollector::GrabAllFiles()
|
|||
std::string RunCollector::GrabFile(int runNum) {
|
||||
if(!m_initFlag)
|
||||
return "";
|
||||
TSystemDirectory sysdir(dir.Data(), dir.Data());
|
||||
TSystemDirectory sysdir(m_directory.c_str(), m_directory.c_str());
|
||||
TList* flist = sysdir.GetListOfFiles();
|
||||
|
||||
if(!flist)
|
||||
|
@ -85,7 +85,7 @@ std::string RunCollector::GrabFile(int runNum) {
|
|||
|
||||
TSystemFile *file;
|
||||
std::string fname = "", temp;
|
||||
std::string runno = "_"+to_string(runNum)+m_suffix;
|
||||
std::string runno = "_"+std::to_string(runNum)+m_suffix;
|
||||
TIter next_element(flist);
|
||||
while((file = (TSystemFile*)next_element()))
|
||||
{
|
||||
|
@ -93,9 +93,9 @@ std::string RunCollector::GrabFile(int runNum) {
|
|||
if(temp.size() < m_prefix.size() || temp.size() < runno.size())
|
||||
continue;
|
||||
else if(!file->IsDirectory() && !temp.compare(0,m_prefix.size(),m_prefix) &&
|
||||
!temp.compare(temp.size()-(1+runno.size()),runno.size(), runno))
|
||||
!temp.compare(temp.size()-runno.size(),runno.size(), runno))
|
||||
{
|
||||
fname = dir+temp;
|
||||
fname = m_directory+temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -105,19 +105,18 @@ std::string RunCollector::GrabFile(int runNum) {
|
|||
}
|
||||
|
||||
/*Grabs all files within a specified run range*/
|
||||
int RunCollector::GrabFilesInRange()
|
||||
bool RunCollector::GrabFilesInRange()
|
||||
{
|
||||
if(!m_initFlag)
|
||||
return false;
|
||||
|
||||
TSystemDirectory sysdir(dir.Data(), dir.Data());
|
||||
TSystemDirectory sysdir(m_directory.c_str(), m_directory.c_str());
|
||||
TList *flist = sysdir.GetListOfFiles();
|
||||
m_filelist.clear();
|
||||
int counter = 0;
|
||||
|
||||
if(!flist)
|
||||
{
|
||||
cerr<<"Unable to find any files in directory; check name given to input.txt"<<endl;
|
||||
std::cerr<<"Unable to find any files in directory; check name given to input.txt"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -127,17 +126,16 @@ int RunCollector::GrabFilesInRange()
|
|||
for(int i=m_minRun; i<=m_maxRun; i++) //loop over range
|
||||
{
|
||||
TIter next_element(flist);//list iterator
|
||||
runno = "_"+to_string(i) + m_suffix; //suffix is now _#.suffix
|
||||
runno = "_"+std::to_string(i) + m_suffix; //suffix is now _#.suffix
|
||||
while((file = (TSystemFile*)next_element())) //look through directory until file found
|
||||
{
|
||||
temp = file->GetName();
|
||||
if(temp.size() < m_prefix.size() || temp.size() < runno.size())
|
||||
continue;
|
||||
else if(!file->IsDirectory() && !temp.compare(0,m_prefix.size(),m_prefix) &&
|
||||
!temp.compare(temp.size()-(1+runno.size()),runno.size(), runno))
|
||||
!temp.compare(temp.size()-runno.size(),runno.size(), runno))
|
||||
{
|
||||
counter++;
|
||||
fname = dir+temp;
|
||||
fname = m_directory+temp;
|
||||
m_filelist.push_back(fname);
|
||||
break; //if we find the file, break out of iterator loop
|
||||
}
|
||||
|
@ -145,11 +143,11 @@ int RunCollector::GrabFilesInRange()
|
|||
}
|
||||
|
||||
delete flist;
|
||||
if(counter>0)
|
||||
if(m_filelist.size()>0)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
cerr<<"Unable to find files with matching run name in directory; check input.txt"<<endl;
|
||||
std::cerr<<"Unable to find files with matching run name in directory; check input.txt"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -158,18 +156,18 @@ int RunCollector::GrabFilesInRange()
|
|||
bool RunCollector::Merge_hadd(const std::string& outname)
|
||||
{
|
||||
if(!m_initFlag)
|
||||
false;
|
||||
return false;
|
||||
|
||||
if(m_maxRun == 0)
|
||||
{
|
||||
if(GrabAllFiles())
|
||||
{
|
||||
std::string clump = "hadd "+outname;
|
||||
for(unsigned int i=0; i<filelist.size(); i++)
|
||||
clump += " "+filelist[i];
|
||||
cout<<"Merging runs into single file..."<<endl;
|
||||
std::system(clump);
|
||||
cout<<"Finished merging"<<endl;
|
||||
for(unsigned int i=0; i<m_filelist.size(); i++)
|
||||
clump += " "+m_filelist[i];
|
||||
std::cout<<"Merging runs into single file..."<<std::endl;
|
||||
std::system(clump.c_str());
|
||||
std::cout<<"Finished merging"<<std::endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -180,11 +178,11 @@ bool RunCollector::Merge_hadd(const std::string& outname)
|
|||
if(GrabFilesInRange())
|
||||
{
|
||||
std::string clump = "hadd "+outname;
|
||||
for(unsigned int i=0; i<filelist.size(); i++)
|
||||
clump += " "+filelist[i];
|
||||
cout<<"Merging runs "<<m_minRun<<" to "<<m_maxRun<<" into a single file..."<<endl;
|
||||
system(clump);
|
||||
cout<<"Finished merging"<<endl;
|
||||
for(unsigned int i=0; i<m_filelist.size(); i++)
|
||||
clump += " "+m_filelist[i];
|
||||
std::cout<<"Merging runs "<<m_minRun<<" to "<<m_maxRun<<" into a single file..."<<std::endl;
|
||||
std::system(clump.c_str());
|
||||
std::cout<<"Finished merging"<<std::endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -204,10 +202,10 @@ bool RunCollector::Merge_TChain(const std::string& outname)
|
|||
if(GrabAllFiles())
|
||||
{
|
||||
for(unsigned int i=0; i<m_filelist.size(); i++)
|
||||
chain->Add(m_filelist[i].Data());
|
||||
cout<<"Merging runs into single file..."<<endl;
|
||||
chain->Add(m_filelist[i].c_str());
|
||||
std::cout<<"Merging runs into single file..."<<std::endl;
|
||||
chain->Merge(output,0,"fast");
|
||||
cout<<"Finished merging"<<endl;
|
||||
std::cout<<"Finished merging"<<std::endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -218,10 +216,10 @@ bool RunCollector::Merge_TChain(const std::string& outname)
|
|||
if(GrabFilesInRange())
|
||||
{
|
||||
for(unsigned int i=0; i<m_filelist.size(); i++)
|
||||
chain->Add(m_filelist[i]);
|
||||
cout<<"Merging runs "<<m_minRun<<" to "<<m_maxRun<<" into a single file..."<<endl;
|
||||
chain->Add(m_filelist[i].c_str());
|
||||
std::cout<<"Merging runs "<<m_minRun<<" to "<<m_maxRun<<" into a single file..."<<std::endl;
|
||||
chain->Merge(output,0,"fast");
|
||||
cout<<"Finished merging"<<endl;
|
||||
std::cout<<"Finished merging"<<std::endl;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
|
|
@ -44,7 +44,7 @@ void SFPAnalyzer::GetWeights()
|
|||
{
|
||||
w1 = (Wire_Dist()/2.0-zfp)/Wire_Dist();
|
||||
w2 = 1.0-w1;
|
||||
cout<<"w1: "<<w1<<" w2: "<<w2<<endl;
|
||||
std::cout<<"w1: "<<w1<<" w2: "<<w2<<std::endl;
|
||||
}
|
||||
|
||||
/*2D histogram fill wrapper for use with THashTable (faster)*/
|
||||
|
@ -143,7 +143,7 @@ void SFPAnalyzer::AnalyzeEvent(CoincEvent& event)
|
|||
pevent.fp1_tdiff = (event.focalPlane.delayFL[0].Time-event.focalPlane.delayFR[0].Time)*0.5;
|
||||
pevent.fp1_tsum = (event.focalPlane.delayFL[0].Time+event.focalPlane.delayFR[0].Time);
|
||||
pevent.fp1_tcheck = (pevent.fp1_tsum)/2.0-pevent.anodeFrontTime;
|
||||
pevent.delayFrontMaxTime = max(event.focalPlane.delayFL[0].Time, event.focalPlane.delayFR[0].Time);
|
||||
pevent.delayFrontMaxTime = std::max(event.focalPlane.delayFL[0].Time, event.focalPlane.delayFR[0].Time);
|
||||
pevent.x1 = pevent.fp1_tdiff*1.0/2.10; //position from time, based on total delay
|
||||
MyFill("x1",1200,-300,300,pevent.x1);
|
||||
MyFill("x1 vs anodeBack",600,-300,300,pevent.x1,512,0,4096,pevent.anodeBack);
|
||||
|
@ -153,7 +153,7 @@ void SFPAnalyzer::AnalyzeEvent(CoincEvent& event)
|
|||
pevent.fp2_tdiff = (event.focalPlane.delayBL[0].Time-event.focalPlane.delayBR[0].Time)*0.5;
|
||||
pevent.fp2_tsum = (event.focalPlane.delayBL[0].Time+event.focalPlane.delayBR[0].Time);
|
||||
pevent.fp2_tcheck = (pevent.fp2_tsum)/2.0-pevent.anodeBackTime;
|
||||
pevent.delayBackMaxTime = max(event.focalPlane.delayBL[0].Time, event.focalPlane.delayBR[0].Time);
|
||||
pevent.delayBackMaxTime = std::max(event.focalPlane.delayBL[0].Time, event.focalPlane.delayBR[0].Time);
|
||||
pevent.x2 = pevent.fp2_tdiff*1.0/1.98; //position from time, based on total delay
|
||||
MyFill("x2",1200,-300,300,pevent.x2);
|
||||
MyFill("x2 vs anodeBack",600,-300,300,pevent.x2,512,0,4096,pevent.anodeBack);
|
||||
|
|
|
@ -13,10 +13,7 @@
|
|||
/*Generates storage and initializes pointers*/
|
||||
SFPPlotter::SFPPlotter()
|
||||
{
|
||||
rootObj = new THashTable();
|
||||
rootObj->SetOwner(false);//THashTable doesnt own members; avoid double delete
|
||||
event_address = new ProcessedEvent();
|
||||
chain = new TChain("SPSTree");
|
||||
m_pb = nullptr;
|
||||
}
|
||||
|
||||
|
@ -29,28 +26,28 @@ SFPPlotter::~SFPPlotter()
|
|||
void SFPPlotter::MyFill(THashTable* table, const std::string& name, int binsx, double minx, double maxx, double valuex,
|
||||
int binsy, double miny, double maxy, double valuey)
|
||||
{
|
||||
TH2F *histo = (TH2F*) rootObj->FindObject(name.c_str());
|
||||
TH2F *histo = (TH2F*) table->FindObject(name.c_str());
|
||||
if(histo != nullptr)
|
||||
histo->Fill(valuex, valuey);
|
||||
else
|
||||
{
|
||||
TH2F *h = new TH2F(name.c_str(), name.c_str(), binsx, minx, maxx, binsy, miny, maxy);
|
||||
h->Fill(valuex, valuey);
|
||||
rootObj->Add(h);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
/*1D histogram fill wrapper*/
|
||||
void SFPPlotter::MyFill(THashTable* table, const std::string& name, int binsx, double minx, double maxx, double valuex)
|
||||
{
|
||||
TH1F *histo = (TH1F*) rootObj->FindObject(name.c_str());
|
||||
TH1F *histo = (TH1F*) table->FindObject(name.c_str());
|
||||
if(histo != nullptr)
|
||||
histo->Fill(valuex);
|
||||
else
|
||||
{
|
||||
TH1F *h = new TH1F(name.c_str(), name.c_str(), binsx, minx, maxx);
|
||||
h->Fill(valuex);
|
||||
rootObj->Add(h);
|
||||
table->Add(h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,12 +244,12 @@ void SFPPlotter::Run(const std::vector<std::string>& files, const std::string& o
|
|||
for(unsigned int i=0; i<files.size(); i++)
|
||||
chain->Add(files[i].c_str());
|
||||
chain->SetBranchAddress("event", &event_address);
|
||||
THastTable* table = new THashTable();
|
||||
THashTable* table = new THashTable();
|
||||
|
||||
long blentries = chain->GetEntries();
|
||||
if(m_pb)
|
||||
SetProgressBar(blentries);
|
||||
cout<<"Total number of events: "<<blentries<<endl;
|
||||
std::cout<<"Total number of events: "<<blentries<<std::endl;
|
||||
|
||||
long count=0, flush_val=blentries*0.01, flush_count=0;
|
||||
|
||||
|
@ -272,19 +269,19 @@ void SFPPlotter::Run(const std::vector<std::string>& files, const std::string& o
|
|||
}
|
||||
}
|
||||
chain->GetEntry(i);
|
||||
MakeUncutHistograms(*event_address);
|
||||
if(cutter.IsValid()) MakeCutHistograms(*event_address);
|
||||
MakeUncutHistograms(*event_address, table);
|
||||
if(cutter.IsValid()) MakeCutHistograms(*event_address, table);
|
||||
}
|
||||
cout<<endl;
|
||||
std::cout<<std::endl;
|
||||
outfile->cd();
|
||||
rootObj->Write();
|
||||
table->Write();
|
||||
if(cutter.IsValid())
|
||||
{
|
||||
auto clist = cutter.GetCuts();
|
||||
for(unsigned int i=0; i<clist.size(); i++)
|
||||
clist[i]->Write();
|
||||
}
|
||||
delete rootObj;
|
||||
delete table;
|
||||
outfile->Close();
|
||||
delete outfile;
|
||||
}
|
||||
|
|
|
@ -11,156 +11,170 @@
|
|||
#include "SlowSort.h"
|
||||
|
||||
/*Sort the Sabre Data in order of descending energy*/
|
||||
bool SabreSort(DetectorHit i, DetectorHit j) {
|
||||
bool SabreSort(const DetectorHit& i, const DetectorHit& j) {
|
||||
return (i.Long>j.Long);
|
||||
}
|
||||
|
||||
/*Constructor takes input of coincidence window size, and fills sabre channel map*/
|
||||
SlowSort::SlowSort() :
|
||||
coincWindow(-1.0), eventFlag(false), event(), cmap()
|
||||
m_coincWindow(-1.0), m_eventFlag(false)
|
||||
{
|
||||
event_stats = new TH2F("coinc_event_stats","coinc_events_stats;global channel;number of coincident hits;counts",144,0,144,20,0,20);
|
||||
event_stats = new TH2F("coinc_event_stats","coinc_events_stats;global channel;number of coincident hits;counts",144,0,144,20,0,20);
|
||||
}
|
||||
|
||||
SlowSort::SlowSort(double windowSize, const string& mapfile) :
|
||||
coincWindow(windowSize), eventFlag(false), event(), cmap(mapfile)
|
||||
SlowSort::SlowSort(double windowSize, const std::string& mapfile) :
|
||||
m_coincWindow(windowSize), m_eventFlag(false), m_event(), cmap(mapfile)
|
||||
{
|
||||
event_stats = new TH2F("coinc_event_stats","coinc_events_stats;global channel;number of coincident hits;counts",144,0,144,20,0,20);
|
||||
InitVariableMaps();
|
||||
event_stats = new TH2F("coinc_event_stats","coinc_events_stats;global channel;number of coincident hits;counts",144,0,144,20,0,20);
|
||||
InitVariableMaps();
|
||||
}
|
||||
|
||||
SlowSort::~SlowSort() {
|
||||
}
|
||||
SlowSort::~SlowSort() {}
|
||||
|
||||
/**EXPERIMENT MODS go here**/
|
||||
void SlowSort::InitVariableMaps() {
|
||||
void SlowSort::InitVariableMaps()
|
||||
{
|
||||
|
||||
/*For SABRE: Each SABRE det has ring&wedge, so add the detID to the
|
||||
SABRERING/WEDGE attribute to differentiate*/
|
||||
for(int i=0; i<5; i++) {
|
||||
sabreVMap[SABRERING + i] = &event.sabreArray[i].rings;
|
||||
sabreVMap[SABREWEDGE + i] = &event.sabreArray[i].wedges;
|
||||
}
|
||||
/*For SABRE: Each SABRE det has ring&wedge, so add the detID to the
|
||||
SABRERING/WEDGE attribute to differentiate*/
|
||||
varMap[DetAttribute::SabreRing0] = &m_event.sabreArray[0].rings;
|
||||
varMap[DetAttribute::SabreRing1] = &m_event.sabreArray[1].rings;
|
||||
varMap[DetAttribute::SabreRing2] = &m_event.sabreArray[2].rings;
|
||||
varMap[DetAttribute::SabreRing3] = &m_event.sabreArray[3].rings;
|
||||
varMap[DetAttribute::SabreRing4] = &m_event.sabreArray[4].rings;
|
||||
varMap[DetAttribute::SabreWedge0] = &m_event.sabreArray[0].wedges;
|
||||
varMap[DetAttribute::SabreWedge1] = &m_event.sabreArray[1].wedges;
|
||||
varMap[DetAttribute::SabreWedge2] = &m_event.sabreArray[2].wedges;
|
||||
varMap[DetAttribute::SabreWedge3] = &m_event.sabreArray[3].wedges;
|
||||
varMap[DetAttribute::SabreWedge4] = &m_event.sabreArray[4].wedges;
|
||||
|
||||
/*For focal plane: Only one focal plane, so each variable is uniquely
|
||||
identified by its attribute
|
||||
*/
|
||||
fpVMap[SCINTLEFT] = &event.focalPlane.scintL;
|
||||
fpVMap[SCINTRIGHT] = &event.focalPlane.scintR;
|
||||
fpVMap[CATHODE] = &event.focalPlane.cathode;
|
||||
fpVMap[DELAYFR] = &event.focalPlane.delayFR;
|
||||
fpVMap[DELAYFL] = &event.focalPlane.delayFL;
|
||||
fpVMap[DELAYBL] = &event.focalPlane.delayBL;
|
||||
fpVMap[DELAYBR] = &event.focalPlane.delayBR;
|
||||
fpVMap[ANODEFRONT] = &event.focalPlane.anodeF;
|
||||
fpVMap[ANODEBACK] = &event.focalPlane.anodeB;
|
||||
fpVMap[MONITOR] = &event.focalPlane.monitor;
|
||||
/*For focal plane: Only one focal plane, so each variable is uniquely
|
||||
identified by its attribute
|
||||
*/
|
||||
varMap[DetAttribute::ScintLeft] = &m_event.focalPlane.scintL;
|
||||
varMap[DetAttribute::ScintRight] = &m_event.focalPlane.scintR;
|
||||
varMap[DetAttribute::Cathode] = &m_event.focalPlane.cathode;
|
||||
varMap[DetAttribute::DelayFR] = &m_event.focalPlane.delayFR;
|
||||
varMap[DetAttribute::DelayFL] = &m_event.focalPlane.delayFL;
|
||||
varMap[DetAttribute::DelayBL] = &m_event.focalPlane.delayBL;
|
||||
varMap[DetAttribute::DelayBR] = &m_event.focalPlane.delayBR;
|
||||
varMap[DetAttribute::AnodeFront] = &m_event.focalPlane.anodeF;
|
||||
varMap[DetAttribute::AnodeBack] = &m_event.focalPlane.anodeB;
|
||||
varMap[DetAttribute::Monitor] = &m_event.focalPlane.monitor;
|
||||
|
||||
}
|
||||
|
||||
/*Reset output structure to blank*/
|
||||
void SlowSort::Reset() {
|
||||
event = blank;
|
||||
void SlowSort::Reset()
|
||||
{
|
||||
m_event = m_blank;
|
||||
}
|
||||
|
||||
bool SlowSort::AddHitToEvent(CompassHit& mhit) {
|
||||
DPPChannel curHit;
|
||||
curHit.Timestamp = mhit.timestamp;
|
||||
curHit.Energy = mhit.lgate;
|
||||
curHit.EnergyShort = mhit.sgate;
|
||||
curHit.Channel = mhit.channel;
|
||||
curHit.Board = mhit.board;
|
||||
curHit.Flags = mhit.flags;
|
||||
bool SlowSort::AddHitToEvent(CompassHit& mhit)
|
||||
{
|
||||
DPPChannel curHit;
|
||||
curHit.Timestamp = mhit.timestamp;
|
||||
curHit.Energy = mhit.lgate;
|
||||
curHit.EnergyShort = mhit.sgate;
|
||||
curHit.Channel = mhit.channel;
|
||||
curHit.Board = mhit.board;
|
||||
curHit.Flags = mhit.flags;
|
||||
|
||||
if(hitList.empty()) {
|
||||
startTime = curHit.Timestamp;
|
||||
hitList.push_back(curHit);
|
||||
} else if (curHit.Timestamp < previousHitTime) {
|
||||
return false;
|
||||
} else if ((curHit.Timestamp - startTime) < coincWindow) {
|
||||
hitList.push_back(curHit);
|
||||
} else {
|
||||
ProcessEvent();
|
||||
hitList.clear();
|
||||
startTime = curHit.Timestamp;
|
||||
hitList.push_back(curHit);
|
||||
eventFlag = true;
|
||||
}
|
||||
if(m_hitList.empty())
|
||||
{
|
||||
startTime = curHit.Timestamp;
|
||||
m_hitList.push_back(curHit);
|
||||
}
|
||||
else if (curHit.Timestamp < previousHitTime)
|
||||
return false;
|
||||
else if ((curHit.Timestamp - startTime) < m_coincWindow)
|
||||
m_hitList.push_back(curHit);
|
||||
else
|
||||
{
|
||||
ProcessEvent();
|
||||
m_hitList.clear();
|
||||
startTime = curHit.Timestamp;
|
||||
m_hitList.push_back(curHit);
|
||||
m_eventFlag = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SlowSort::FlushHitsToEvent() {
|
||||
if(hitList.empty()) {
|
||||
eventFlag = false;
|
||||
return;
|
||||
}
|
||||
void SlowSort::FlushHitsToEvent()
|
||||
{
|
||||
if(m_hitList.empty())
|
||||
{
|
||||
m_eventFlag = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessEvent();
|
||||
hitList.clear();
|
||||
eventFlag = true;
|
||||
ProcessEvent();
|
||||
m_hitList.clear();
|
||||
m_eventFlag = true;
|
||||
}
|
||||
|
||||
CoincEvent SlowSort::GetEvent() {
|
||||
eventFlag = false;
|
||||
return event;
|
||||
}
|
||||
|
||||
/*Function called when a start of a coincidence event is detected*/
|
||||
void SlowSort::StartEvent() {
|
||||
if(hitList.size() != 0) {
|
||||
cerr<<"Attempting to initalize hitList when not cleared!! Check processing order."<<endl;
|
||||
}
|
||||
startTime = hit.Timestamp;
|
||||
hitList.push_back(hit);
|
||||
const CoincEvent& SlowSort::GetEvent()
|
||||
{
|
||||
m_eventFlag = false;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
/*Function called when an event outside the coincidence window is detected
|
||||
*Process all of the hits in the list, and write them to the sorted tree
|
||||
*/
|
||||
void SlowSort::ProcessEvent() {
|
||||
Reset();
|
||||
DetectorHit dhit;
|
||||
int gchan;
|
||||
int size = hitList.size();
|
||||
for(DPPChannel& curHit: hitList) {
|
||||
gchan = curHit.Channel + curHit.Board*16; //global channel
|
||||
event_stats->Fill(gchan, size);
|
||||
dhit.Time = curHit.Timestamp/1.0e3;
|
||||
dhit.Ch = gchan;
|
||||
dhit.Long = curHit.Energy;
|
||||
dhit.Short = curHit.EnergyShort;
|
||||
auto channel_info = cmap.FindChannel(gchan);
|
||||
if(channel_info == cmap.End()) {
|
||||
continue;
|
||||
}
|
||||
if(channel_info->second.detectorType == SABRERING || channel_info->second.detectorType == SABREWEDGE) {
|
||||
void SlowSort::ProcessEvent()
|
||||
{
|
||||
Reset();
|
||||
DetectorHit dhit;
|
||||
int gchan;
|
||||
int size = m_hitList.size();
|
||||
for(DPPChannel& curHit: m_hitList)
|
||||
{
|
||||
gchan = curHit.Channel + curHit.Board*16; //global channel
|
||||
event_stats->Fill(gchan, size);
|
||||
dhit.Time = curHit.Timestamp/1.0e3;
|
||||
dhit.Ch = gchan;
|
||||
dhit.Long = curHit.Energy;
|
||||
dhit.Short = curHit.EnergyShort;
|
||||
auto channel_info = cmap.FindChannel(gchan);
|
||||
|
||||
auto variable = sabreVMap.find(channel_info->second.detectorType + channel_info->second.detectorID);
|
||||
if(variable != sabreVMap.end()) {
|
||||
variable->second->push_back(dhit);
|
||||
}
|
||||
|
||||
} else if(channel_info->second.detectorType == FOCALPLANE) {
|
||||
|
||||
auto variable = fpVMap.find(channel_info->second.detectorPart);
|
||||
if(variable != fpVMap.end()) {
|
||||
variable->second->push_back(dhit);
|
||||
}
|
||||
|
||||
} else {
|
||||
std::cout<<std::endl;
|
||||
std::cout<<"------Data Assignment Error!-------"<<std::endl;
|
||||
std::cout<<"Channel is present in channel map, but does not have a variable assigned in variable map!"<<std::endl;
|
||||
std::cout<<"global channel number: "<<gchan<<" channel detector type: "<<channel_info->second.detectorType<<std::endl;
|
||||
std::cout<<"Skipping this hit..."<<std::endl;
|
||||
std::cout<<"-----------------------------------"<<std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
//Organize the SABRE data in descending energy order
|
||||
for(int s=0; s<5; s++) {
|
||||
sort(event.sabreArray[s].rings.begin(), event.sabreArray[s].rings.end(), SabreSort);
|
||||
sort(event.sabreArray[s].wedges.begin(), event.sabreArray[s].wedges.end(), SabreSort);
|
||||
}
|
||||
if(channel_info == cmap.End())
|
||||
{
|
||||
std::cout<<std::endl;
|
||||
std::cout<<"------Data Assignment Error!-------"<<std::endl;
|
||||
std::cout<<"Global channel number "<<gchan<<" found in data stream, but not assigned in ChannelMap!"<<std::endl;
|
||||
std::cout<<"Skipping this hit..."<<std::endl;
|
||||
std::cout<<"-----------------------------------"<<std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(channel_info->second.type == DetType::FocalPlane)
|
||||
{
|
||||
auto variable = varMap.find(channel_info->second.attribute);
|
||||
if(variable != varMap.end())
|
||||
variable->second->push_back(dhit);
|
||||
}
|
||||
else if(channel_info->second.type == DetType::Sabre)
|
||||
{
|
||||
auto variable = varMap.find(channel_info->second.attribute);
|
||||
if(variable != varMap.end())
|
||||
variable->second->push_back(dhit);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<std::endl;
|
||||
std::cout<<"------Data Assignment Error!-------"<<std::endl;
|
||||
std::cout<<"Channel is present in channel map, but does not have a variable assigned in variable map!"<<std::endl;
|
||||
std::cout<<"global channel number: "<<gchan<<" channel detector type: "<<channel_info->second.type<<" attribute: "<<channel_info->second.attribute<<std::endl;
|
||||
std::cout<<"Skipping this hit..."<<std::endl;
|
||||
std::cout<<"-----------------------------------"<<std::endl;
|
||||
}
|
||||
}
|
||||
//Organize the SABRE data in descending energy order
|
||||
for(int s=0; s<5; s++)
|
||||
{
|
||||
sort(m_event.sabreArray[s].rings.begin(), m_event.sabreArray[s].rings.end(), SabreSort);
|
||||
sort(m_event.sabreArray[s].wedges.begin(), m_event.sabreArray[s].wedges.end(), SabreSort);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *WorkFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
|
||||
TGLabel* workLabel = new TGLabel(WorkFrame, "Workspace Directory:");
|
||||
fWorkField = new TGTextEntry(WorkFrame, new TGTextBuffer(120), WORKDIR);
|
||||
fWorkField = new TGTextEntry(WorkFrame, new TGTextBuffer(120), WorkDir);
|
||||
fWorkField->Resize(w*0.25, fWorkField->GetDefaultHeight());
|
||||
fWorkField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateWorkdir()");
|
||||
fOpenWorkButton = new TGTextButton(WorkFrame, "Open");
|
||||
|
@ -39,7 +39,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *CMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
|
||||
TGLabel* cmaplabel = new TGLabel(CMapFrame, "Channel Map File:");
|
||||
fCMapField = new TGTextEntry(CMapFrame, new TGTextBuffer(120), CMAP);
|
||||
fCMapField = new TGTextEntry(CMapFrame, new TGTextBuffer(120), Cmap);
|
||||
fCMapField->Resize(w*0.25, fCMapField->GetDefaultHeight());
|
||||
fCMapField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateCMap()");
|
||||
fOpenCMapButton = new TGTextButton(CMapFrame, "Open");
|
||||
|
@ -50,7 +50,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *SMapFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
|
||||
TGLabel* smaplabel = new TGLabel(SMapFrame, "Board Shift File:");
|
||||
fSMapField = new TGTextEntry(SMapFrame, new TGTextBuffer(120), SMAP);
|
||||
fSMapField = new TGTextEntry(SMapFrame, new TGTextBuffer(120), Smap);
|
||||
fSMapField->Resize(w*0.25, fSMapField->GetDefaultHeight());
|
||||
fSMapField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateSMap()");
|
||||
fOpenSMapButton = new TGTextButton(SMapFrame, "Open");
|
||||
|
@ -61,7 +61,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *ScalerFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
|
||||
TGLabel* sclabel = new TGLabel(ScalerFrame, "Scaler File: ");
|
||||
fScalerField = new TGTextEntry(ScalerFrame, new TGTextBuffer(120), SCALER);
|
||||
fScalerField = new TGTextEntry(ScalerFrame, new TGTextBuffer(120), Scaler);
|
||||
fScalerField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateScaler()");
|
||||
fOpenScalerButton = new TGTextButton(ScalerFrame, "Open");
|
||||
fOpenScalerButton->Connect("Clicked()","EVBMainFrame", this, "DoOpenScalerfile()");
|
||||
|
@ -71,7 +71,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *CutFrame = new TGHorizontalFrame(NameFrame, w, h*0.1);
|
||||
TGLabel* clabel = new TGLabel(CutFrame, "Cut List: ");
|
||||
fCutField = new TGTextEntry(CutFrame, new TGTextBuffer(120), CUT);
|
||||
fCutField = new TGTextEntry(CutFrame, new TGTextBuffer(120), Cut);
|
||||
fCutField->Connect("ReturnPressed()","EVBMainFrame",this,"UpdateCut()");
|
||||
fOpenCutButton = new TGTextButton(CutFrame, "Open");
|
||||
fOpenCutButton->Connect("Clicked()","EVBMainFrame",this,"DoOpenCutfile()");
|
||||
|
@ -88,11 +88,11 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *ParamFrame = new TGHorizontalFrame(InputFrame, w, h*0.1);
|
||||
TGLabel *bkelabel = new TGLabel(ParamFrame, "Beam KE (MeV):");
|
||||
fBKEField = new TGNumberEntryField(ParamFrame, BKE, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
fBKEField = new TGNumberEntryField(ParamFrame, Bke, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *bfieldlabel = new TGLabel(ParamFrame, "B-Field (G):");
|
||||
fBField = new TGNumberEntryField(ParamFrame, BFIELD, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
fBField = new TGNumberEntryField(ParamFrame, BField, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *thetalabel = new TGLabel(ParamFrame, "Angle (deg):");
|
||||
fThetaField = new TGNumberEntryField(ParamFrame, THETA, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
fThetaField = new TGNumberEntryField(ParamFrame, Theta, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *ztlabel = new TGLabel(ParamFrame, "ZT:");
|
||||
fZTField = new TGNumberEntryField(ParamFrame, ZT, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *atlabel = new TGLabel(ParamFrame, "AT:");
|
||||
|
@ -126,11 +126,11 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *WindowFrame = new TGHorizontalFrame(InputFrame, w, h*0.1);
|
||||
TGLabel *slowlabel = new TGLabel(WindowFrame, "Slow Coincidence Window (ps):");
|
||||
fSlowWindowField = new TGNumberEntryField(WindowFrame, SLOWWIND, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
fSlowWindowField = new TGNumberEntryField(WindowFrame, SlowWind, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *fasticlabel = new TGLabel(WindowFrame, "Fast Coincidence Window IC (ps):");
|
||||
fFastICField = new TGNumberEntryField(WindowFrame, FASTWIND_IC, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
fFastICField = new TGNumberEntryField(WindowFrame, FastWind_IC, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *fastsabrelabel = new TGLabel(WindowFrame, "Fast Coincidence Window SABRE (ps):");
|
||||
fFastSABREField = new TGNumberEntryField(WindowFrame, FASTWIND_SABRE, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
fFastSABREField = new TGNumberEntryField(WindowFrame, FastWind_Sabre, 0, TGNumberEntry::kNESReal, TGNumberEntry::kNEANonNegative);
|
||||
WindowFrame->AddFrame(slowlabel, lhints);
|
||||
WindowFrame->AddFrame(fSlowWindowField, fhints);
|
||||
WindowFrame->AddFrame(fasticlabel, lhints);
|
||||
|
@ -140,21 +140,21 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGHorizontalFrame *RunFrame = new TGHorizontalFrame(InputFrame, w, h*0.1);
|
||||
TGLabel *typelabel = new TGLabel(RunFrame, "Operation Type:");
|
||||
fTypeBox = new TGComboBox(RunFrame, TYPEBOX);
|
||||
fTypeBox = new TGComboBox(RunFrame, TypeBox);
|
||||
//Needs modification for new conversion based sorting GWM -- Dec 2020
|
||||
fTypeBox->AddEntry("Convert Slow", GWMEventBuilder::CONVERT_S);
|
||||
fTypeBox->AddEntry("Convert Fast", GWMEventBuilder::CONVERT_F);
|
||||
fTypeBox->AddEntry("Convert SlowA", GWMEventBuilder::CONVERT_SA);
|
||||
fTypeBox->AddEntry("Convert FastA", GWMEventBuilder::CONVERT_FA);
|
||||
fTypeBox->AddEntry("Convert", GWMEventBuilder::CONVERT);
|
||||
fTypeBox->AddEntry("Merge ROOT", GWMEventBuilder::MERGE);
|
||||
fTypeBox->AddEntry("Plot", GWMEventBuilder::PLOT);
|
||||
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->Resize(200,20);
|
||||
fTypeBox->Connect("Selected(Int_t, Int_t)","EVBMainFrame",this,"HandleTypeSelection(Int_t,Int_t)");
|
||||
TGLabel *rminlabel = new TGLabel(RunFrame, "Min Run:");
|
||||
fRMinField = new TGNumberEntryField(RunFrame, RMIN, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
|
||||
fRMinField = new TGNumberEntryField(RunFrame, RMin, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
|
||||
TGLabel *rmaxlabel = new TGLabel(RunFrame, "Max Run:");
|
||||
fRMaxField = new TGNumberEntryField(RunFrame, RMAX, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
|
||||
fRMaxField = new TGNumberEntryField(RunFrame, RMax, 0, TGNumberEntry::kNESInteger, TGNumberEntry::kNEANonNegative);
|
||||
fRunButton = new TGTextButton(RunFrame, "Run!");
|
||||
fRunButton->SetState(kButtonDisabled);
|
||||
fRunButton->Connect("Clicked()","EVBMainFrame",this,"DoRun()");
|
||||
|
@ -182,9 +182,9 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
TGMenuBar* menuBar = new TGMenuBar(this, w, h*0.1);
|
||||
fFileMenu = new TGPopupMenu(gClient->GetRoot());
|
||||
fFileMenu->AddEntry("Load...", M_LOAD_CONFIG);
|
||||
fFileMenu->AddEntry("Save...", M_SAVE_CONFIG);
|
||||
fFileMenu->AddEntry("Exit", M_EXIT);
|
||||
fFileMenu->AddEntry("Load...", M_Load_Config);
|
||||
fFileMenu->AddEntry("Save...", M_Save_Config);
|
||||
fFileMenu->AddEntry("Exit", M_Exit);
|
||||
fFileMenu->Connect("Activated(Int_t)","EVBMainFrame", this, "HandleMenuSelection(Int_t)");
|
||||
menuBar->AddPopup("File", fFileMenu, mhints);
|
||||
|
||||
|
@ -199,82 +199,94 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
|
|||
|
||||
}
|
||||
|
||||
EVBMainFrame::~EVBMainFrame() {
|
||||
EVBMainFrame::~EVBMainFrame()
|
||||
{
|
||||
Cleanup();
|
||||
delete this;
|
||||
}
|
||||
|
||||
void EVBMainFrame::CloseWindow() {
|
||||
void EVBMainFrame::CloseWindow()
|
||||
{
|
||||
gApplication->Terminate();
|
||||
}
|
||||
|
||||
void EVBMainFrame::HandleMenuSelection(int id) {
|
||||
if(id == M_SAVE_CONFIG) new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_SAVE_CONFIG);
|
||||
else if(id == M_LOAD_CONFIG) new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_LOAD_CONFIG);
|
||||
else if(id == M_EXIT) CloseWindow();
|
||||
void EVBMainFrame::HandleMenuSelection(int id)
|
||||
{
|
||||
if(id == M_Save_Config)
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_Save_Config);
|
||||
else if(id == M_Load_Config)
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_Load_Config);
|
||||
else if(id == M_Exit)
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoOpenWorkdir() {
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, WORKDIR);
|
||||
void EVBMainFrame::DoOpenWorkdir()
|
||||
{
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, WorkDir);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoOpenCMapfile() {
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, CMAP);
|
||||
void EVBMainFrame::DoOpenCMapfile()
|
||||
{
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Cmap);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoOpenSMapfile() {
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, SMAP);
|
||||
void EVBMainFrame::DoOpenSMapfile()
|
||||
{
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Smap);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoOpenScalerfile() {
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, SCALER);
|
||||
void EVBMainFrame::DoOpenScalerfile()
|
||||
{
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Scaler);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoOpenCutfile() {
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, CUT);
|
||||
void EVBMainFrame::DoOpenCutfile()
|
||||
{
|
||||
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, Cut);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DoRun() {
|
||||
void EVBMainFrame::DoRun()
|
||||
{
|
||||
|
||||
DisableAllInput();
|
||||
|
||||
SetParameters();
|
||||
|
||||
int type = fTypeBox->GetSelected();
|
||||
fBuilder.SetAnalysisType(type);
|
||||
|
||||
switch(type) {
|
||||
case GWMEventBuilder::PLOT :
|
||||
switch(type)
|
||||
{
|
||||
case EVBApp::Operation::Plot :
|
||||
{
|
||||
RunPlot();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::CONVERT :
|
||||
case EVBApp::Operation::Convert :
|
||||
{
|
||||
fBuilder.Convert2RawRoot();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::MERGE :
|
||||
case EVBApp::Operation::Merge :
|
||||
{
|
||||
fBuilder.MergeROOTFiles();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::CONVERT_S :
|
||||
case EVBApp::Operation::ConvertSlow :
|
||||
{
|
||||
fBuilder.Convert2SortedRoot();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::CONVERT_F :
|
||||
case EVBApp::Operation::ConvertFast :
|
||||
{
|
||||
fBuilder.Convert2FastSortedRoot();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::CONVERT_SA :
|
||||
case EVBApp::Operation::ConvertSlowA :
|
||||
{
|
||||
fBuilder.Convert2SlowAnalyzedRoot();
|
||||
break;
|
||||
}
|
||||
case GWMEventBuilder::CONVERT_FA :
|
||||
case EVBApp::Operation::ConvertFastA :
|
||||
{
|
||||
fBuilder.Convert2FastAnalyzedRoot();
|
||||
break;
|
||||
|
@ -284,11 +296,13 @@ void EVBMainFrame::DoRun() {
|
|||
EnableAllInput();
|
||||
}
|
||||
|
||||
void EVBMainFrame::HandleTypeSelection(int box, int entry) {
|
||||
void EVBMainFrame::HandleTypeSelection(int box, int entry)
|
||||
{
|
||||
fRunButton->SetState(kButtonUp);
|
||||
}
|
||||
|
||||
bool EVBMainFrame::SetParameters() {
|
||||
bool EVBMainFrame::SetParameters()
|
||||
{
|
||||
fBuilder.SetRunRange(fRMinField->GetIntNumber(), fRMaxField->GetIntNumber());
|
||||
fBuilder.SetSlowCoincidenceWindow(fSlowWindowField->GetNumber());
|
||||
fBuilder.SetFastWindowIonChamber(fFastICField->GetNumber());
|
||||
|
@ -306,37 +320,44 @@ bool EVBMainFrame::SetParameters() {
|
|||
return test;
|
||||
}
|
||||
|
||||
void EVBMainFrame::DisplayWorkdir(const char* dir) {
|
||||
void EVBMainFrame::DisplayWorkdir(const char* dir)
|
||||
{
|
||||
fWorkField->SetText(dir);
|
||||
fBuilder.SetWorkDirectory(dir);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DisplayCMap(const char* file) {
|
||||
void EVBMainFrame::DisplayCMap(const char* file)
|
||||
{
|
||||
fCMapField->SetText(file);
|
||||
fBuilder.SetChannelMap(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DisplaySMap(const char* file) {
|
||||
void EVBMainFrame::DisplaySMap(const char* file)
|
||||
{
|
||||
fSMapField->SetText(file);
|
||||
fBuilder.SetBoardShiftFile(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DisplayScaler(const char* file) {
|
||||
void EVBMainFrame::DisplayScaler(const char* file)
|
||||
{
|
||||
fScalerField->SetText(file);
|
||||
fBuilder.SetScalerFile(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::DisplayCut(const char* file) {
|
||||
void EVBMainFrame::DisplayCut(const char* file)
|
||||
{
|
||||
fCutField->SetText(file);
|
||||
fBuilder.SetCutList(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::SaveConfig(const char* file) {
|
||||
void EVBMainFrame::SaveConfig(const char* file)
|
||||
{
|
||||
std::string filename = file;
|
||||
fBuilder.WriteConfigFile(filename);
|
||||
}
|
||||
|
||||
void EVBMainFrame::LoadConfig(const char* file) {
|
||||
void EVBMainFrame::LoadConfig(const char* file)
|
||||
{
|
||||
std::string filename = file;
|
||||
fBuilder.ReadConfigFile(filename);
|
||||
|
||||
|
@ -365,38 +386,45 @@ void EVBMainFrame::LoadConfig(const char* file) {
|
|||
|
||||
}
|
||||
|
||||
void EVBMainFrame::UpdateWorkdir() {
|
||||
void EVBMainFrame::UpdateWorkdir()
|
||||
{
|
||||
const char* dir = fWorkField->GetText();
|
||||
fBuilder.SetWorkDirectory(dir);
|
||||
}
|
||||
|
||||
void EVBMainFrame::UpdateSMap() {
|
||||
void EVBMainFrame::UpdateSMap()
|
||||
{
|
||||
const char* file = fSMapField->GetText();
|
||||
fBuilder.SetBoardShiftFile(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::UpdateCMap() {
|
||||
void EVBMainFrame::UpdateCMap()
|
||||
{
|
||||
const char* file = fCMapField->GetText();
|
||||
fBuilder.SetChannelMap(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::UpdateScaler() {
|
||||
void EVBMainFrame::UpdateScaler()
|
||||
{
|
||||
const char* file = fScalerField->GetText();
|
||||
fBuilder.SetScalerFile(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::UpdateCut() {
|
||||
void EVBMainFrame::UpdateCut()
|
||||
{
|
||||
const char* file = fCutField->GetText();
|
||||
fBuilder.SetCutList(file);
|
||||
}
|
||||
|
||||
void EVBMainFrame::RunPlot() {
|
||||
void EVBMainFrame::RunPlot()
|
||||
{
|
||||
fBuilder.PlotHistograms();
|
||||
}
|
||||
|
||||
void EVBMainFrame::RunMerge(const char* file, const char* dir) {}
|
||||
|
||||
void EVBMainFrame::DisableAllInput() {
|
||||
void EVBMainFrame::DisableAllInput()
|
||||
{
|
||||
fRunButton->SetState(kButtonDisabled);
|
||||
fOpenWorkButton->SetState(kButtonDisabled);
|
||||
fOpenCMapButton->SetState(kButtonDisabled);
|
||||
|
@ -431,7 +459,8 @@ void EVBMainFrame::DisableAllInput() {
|
|||
fFastSABREField->SetState(false);
|
||||
}
|
||||
|
||||
void EVBMainFrame::EnableAllInput() {
|
||||
void EVBMainFrame::EnableAllInput()
|
||||
{
|
||||
fRunButton->SetState(kButtonUp);
|
||||
fOpenWorkButton->SetState(kButtonUp);
|
||||
fOpenCMapButton->SetState(kButtonUp);
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
#include <TGLabel.h>
|
||||
#include <TTimer.h>
|
||||
|
||||
FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, UInt_t h, EVBMainFrame *parent, int type) {
|
||||
FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, UInt_t h, EVBMainFrame *parent, int type)
|
||||
{
|
||||
fMain = new TGTransientFrame(p,main,w,h);
|
||||
fMain->SetCleanup(kDeepCleanup); //delete all child frames
|
||||
fMain->DontCallClose(); //Close button on window disabled
|
||||
|
@ -23,10 +24,13 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
|
|||
dirFlag = false;
|
||||
bool rootFlag = false;
|
||||
suffix = ".txt";
|
||||
if(type == EVBMainFrame::WORKDIR) {
|
||||
if(type == EVBMainFrame::WorkDir)
|
||||
{
|
||||
dirFlag = true;
|
||||
suffix = ".NOTHING";
|
||||
} else if(type == EVBMainFrame::PLOTF) {
|
||||
}
|
||||
else if(type == EVBMainFrame::PlotF)
|
||||
{
|
||||
rootFlag = true;
|
||||
suffix = ".root";
|
||||
}
|
||||
|
@ -48,8 +52,10 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
|
|||
/*Add in text options*/
|
||||
TGVerticalFrame *NameFrame = new TGVerticalFrame(fMain, w, h*0.25);
|
||||
TGLabel *nameLabel;
|
||||
if(dirFlag) nameLabel = new TGLabel(NameFrame, "Dir:");
|
||||
else nameLabel = new TGLabel(NameFrame, "File:");
|
||||
if(dirFlag)
|
||||
nameLabel = new TGLabel(NameFrame, "Dir:");
|
||||
else
|
||||
nameLabel = new TGLabel(NameFrame, "File:");
|
||||
TGTextBuffer* fNameBuffer;
|
||||
fNameField = new TGTextEntry(NameFrame, fNameBuffer = new TGTextBuffer(50));
|
||||
fNameField->Resize(w*0.5, fNameField->GetDefaultHeight());
|
||||
|
@ -70,14 +76,22 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
|
|||
fMain->AddFrame(ButtonFrame, fbhints);
|
||||
|
||||
/*Send signal to appropriate location*/
|
||||
if(type == EVBMainFrame::WORKDIR) Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayWorkdir(const char*)");
|
||||
else if(type == EVBMainFrame::CMAP) Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayCMap(const char*)");
|
||||
else if(type == EVBMainFrame::SMAP) Connect("SendText(const char*)","EVBMainFrame",parent,"DisplaySMap(const char*)");
|
||||
else if(type == EVBMainFrame::SCALER) Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayScaler(const char*)");
|
||||
else if(type == EVBMainFrame::CUT) Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayCut(const char*)");
|
||||
else if(type == EVBMainFrame::M_LOAD_CONFIG) Connect("SendText(const char*)","EVBMainFrame",parent,"LoadConfig(const char*)");
|
||||
else if(type == EVBMainFrame::M_SAVE_CONFIG) Connect("SendText(const char*)","EVBMainFrame",parent,"SaveConfig(const char*)");
|
||||
else if(type == EVBMainFrame::PLOTF) Connect("SendText(const char*)","EVBMainFrame",parent,"RunPlot(const char*)");
|
||||
if(type == EVBMainFrame::WorkDir)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayWorkdir(const char*)");
|
||||
else if(type == EVBMainFrame::Cmap)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayCMap(const char*)");
|
||||
else if(type == EVBMainFrame::Smap)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"DisplaySMap(const char*)");
|
||||
else if(type == EVBMainFrame::Scaler)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayScaler(const char*)");
|
||||
else if(type == EVBMainFrame::Cut)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"DisplayCut(const char*)");
|
||||
else if(type == EVBMainFrame::M_Load_Config)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"LoadConfig(const char*)");
|
||||
else if(type == EVBMainFrame::M_Save_Config)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"SaveConfig(const char*)");
|
||||
else if(type == EVBMainFrame::PlotF)
|
||||
Connect("SendText(const char*)","EVBMainFrame",parent,"RunPlot(const char*)");
|
||||
|
||||
fMain->SetWindowName("Select File");
|
||||
fMain->MapSubwindows();
|
||||
|
@ -97,16 +111,19 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
|
|||
fMain->Resize();
|
||||
}
|
||||
|
||||
FileViewFrame::~FileViewFrame() {
|
||||
FileViewFrame::~FileViewFrame()
|
||||
{
|
||||
fMain->Cleanup(); //delete children
|
||||
fMain->DeleteWindow();
|
||||
}
|
||||
|
||||
void FileViewFrame::CloseWindow() {
|
||||
void FileViewFrame::CloseWindow()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void FileViewFrame::DoOk() {
|
||||
void FileViewFrame::DoOk()
|
||||
{
|
||||
/*Prevent user from doing something dumb*/
|
||||
fOkButton->SetState(kButtonDisabled);
|
||||
fCancelButton->SetState(kButtonDisabled);
|
||||
|
@ -115,7 +132,8 @@ void FileViewFrame::DoOk() {
|
|||
TString fullpath;
|
||||
if(!dirFlag) fullpath = TString(fContents->GetDirectory()) + "/" + filename;
|
||||
else fullpath = filename;
|
||||
if(fullpath == "") { //check validity
|
||||
if(fullpath == "") //check validity
|
||||
{
|
||||
std::cerr<<"Need to give a name!"<<std::endl;
|
||||
fOkButton->SetState(kButtonUp);
|
||||
fCancelButton->SetState(kButtonUp);
|
||||
|
@ -127,7 +145,8 @@ void FileViewFrame::DoOk() {
|
|||
TTimer::SingleShot(150,"FileViewFrame",this,"CloseWindow()");
|
||||
}
|
||||
|
||||
void FileViewFrame::DoCancel() {
|
||||
void FileViewFrame::DoCancel()
|
||||
{
|
||||
/*Prevent user from doing something dumb*/
|
||||
fOkButton->SetState(kButtonDisabled);
|
||||
fCancelButton->SetState(kButtonDisabled);
|
||||
|
@ -137,7 +156,8 @@ void FileViewFrame::DoCancel() {
|
|||
}
|
||||
|
||||
//Handle directory selection
|
||||
void FileViewFrame::DisplayDir(const TString& name) {
|
||||
void FileViewFrame::DisplayDir(const TString& name)
|
||||
{
|
||||
fContents->SetDefaultHeaders();
|
||||
fContents->ChangeDirectory(name);
|
||||
fContents->DisplayDirectory();
|
||||
|
@ -146,23 +166,28 @@ void FileViewFrame::DisplayDir(const TString& name) {
|
|||
}
|
||||
|
||||
//Handle double click
|
||||
void FileViewFrame::DoDoubleClick(TGLVEntry *entry, int id) {
|
||||
if( id != kButton1) return;
|
||||
void FileViewFrame::DoDoubleClick(TGLVEntry *entry, int id)
|
||||
{
|
||||
if( id != kButton1)
|
||||
return;
|
||||
TString dirname(fContents->GetDirectory());
|
||||
TString entryname(entry->GetTitle());
|
||||
|
||||
if(entryname.EndsWith(suffix.c_str())) { //check if its a file
|
||||
if(entryname.EndsWith(suffix.c_str())) //check if its a file
|
||||
{
|
||||
TString name = entryname;
|
||||
fNameField->SetText(name.Data());
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayDir(entryname);
|
||||
if(dirFlag) {
|
||||
if(dirFlag)
|
||||
fNameField->SetText((dirname+"/"+entryname).Data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*SIGNAL*/
|
||||
void FileViewFrame::SendText(const char* text) {
|
||||
void FileViewFrame::SendText(const char* text)
|
||||
{
|
||||
Emit("SendText(const char*)", text);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
#include <TApplication.h>
|
||||
#include "EVBMainFrame.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TApplication app("app", &argc, argv);
|
||||
UInt_t h = 400;
|
||||
UInt_t w = 400;
|
||||
|
|
Loading…
Reference in New Issue
Block a user