Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,26 @@ else
$(error "Unable to find HDF5 headers and libraries")
endif

CCFITSCXXFLAGS =
CCFITSLIBS =
ifeq ("$(shell pkg-config --exists CCfits 1>&2 2> /dev/null; echo $$?)", "0")
CCFITSCXXFLAGS += $(shell pkg-config --cflags CCfits)
CCFITSLIBS += $(shell pkg-config --libs CCfits)
else
$(error "Unable to find CCfits headers and libraries")
endif


#----------------------------------------------------------------
# Definitions based on architecture and user options
#

CMD=""
CXXFLAGS += -I$(IN) -I$(MEGALIB)/include -I/opt/local/include $(H5CXXFLAGS)
CXXFLAGS += -I$(IN) -I$(MEGALIB)/include -I/opt/local/include $(H5CXXFLAGS) $(CCFITSCXXFLAGS)
# Comment this line out if you want to accept warnings
#CXXFLAGS += -Werror -Wno-unused-variable

LIBS += $(H5LIBS)
LIBS += $(H5LIBS) $(CCFITSLIBS)

# Definitions
NUCLEARIZER_DIR := $(NUCLEARIZER)
Expand Down Expand Up @@ -162,7 +171,7 @@ $(NUCLEARIZER_DICT): $(FRETALON_H_FILES) $(NUCLEARIZER_H_FILES)
@echo "Generating LinkDef ..."
@$(BN)/generatelinkdef -o $(NUCLEARIZER_LINKDEF) -i $(NUCLEARIZER_H_FILES) $(FRETALON_H_FILES)
@echo "Generating dictionary ..."
@rootcling -f $@ -I$(IN) -I$(MEGALIB)/include $(H5CXXFLAGS) -D___CLING___ -rmf $(NUCLEARIZER_ROOTMAP) -s libNuclearizer -c $(NUCLEARIZER_H_FILES) $(FRETALON_H_FILES) $(NUCLEARIZER_LINKDEF)
@rootcling -f $@ -I$(IN) -I$(MEGALIB)/include $(H5CXXFLAGS) $(CCFITSCXXFLAGS) -D___CLING___ -rmf $(NUCLEARIZER_ROOTMAP) -s libNuclearizer -c $(NUCLEARIZER_H_FILES) $(FRETALON_H_FILES) $(NUCLEARIZER_LINKDEF)
@mv $(NUCLEARIZER_ROOTPCM) $(LB)

$(NUCLEARIZER_DICT_LIB): $(NUCLEARIZER_DICT)
Expand Down
87 changes: 87 additions & 0 deletions include/MGUIOptionsLoaderMeasurementsFITS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* MGUIOptionsLoaderMeasurementsFITS.h
*
* Copyright (C) by Andreas Zoglauer.
* All rights reserved.
*
* Please see the source-file for the copyright-notice.
*
*/


#ifndef __MGUIOptionsLoaderMeasurementsFITS__
#define __MGUIOptionsLoaderMeasurementsFITS__


////////////////////////////////////////////////////////////////////////////////


// ROOT libs:
#include <TROOT.h>
#include <TVirtualX.h>
#include <TGWindow.h>
#include <TObjArray.h>
#include <TGFrame.h>
#include <TGButton.h>
#include <MString.h>
#include <TGClient.h>

// MEGAlib libs:
#include "MGlobal.h"
#include "MGUIEFileSelector.h"
#include "MGUIOptions.h"

// Nuclearizer libs:
#include "MModule.h"


// Forward declarations:


////////////////////////////////////////////////////////////////////////////////


//! UI settings for the FITS measurements loader
class MGUIOptionsLoaderMeasurementsFITS : public MGUIOptions
{
// public Session:
public:
//! Default constructor
MGUIOptionsLoaderMeasurementsFITS(MModule* Module);
//! Default destructor
virtual ~MGUIOptionsLoaderMeasurementsFITS();

//! Process all button, etc. messages
virtual bool ProcessMessage(long Message, long Parameter1, long Parameter2);

//! The creation part which gets overwritten
virtual void Create();

// protected methods:
protected:

//! Actions after the Apply or OK button has been pressed
virtual bool OnApply();


// protected members:
protected:

// private members:
private:
//! Select which FITS file to load
MGUIEFileSelector* m_FileSelectorFITS;



#ifdef ___CLING___
public:
ClassDef(MGUIOptionsLoaderMeasurementsFITS, 1) // basic class for dialog windows
#endif

};

#endif


////////////////////////////////////////////////////////////////////////////////
87 changes: 87 additions & 0 deletions include/MGUIOptionsSaverMeasurementsFITS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* MGUIOptionsSaverMeasurementsFITS.h
*
* Copyright (C) by Andreas Zoglauer.
* All rights reserved.
*
* Please see the source-file for the copyright-notice.
*
*/


#ifndef __MGUIOptionsSaverMeasurementsFITS__
#define __MGUIOptionsSaverMeasurementsFITS__


////////////////////////////////////////////////////////////////////////////////


// ROOT libs:
#include <TROOT.h>
#include <TVirtualX.h>
#include <TGWindow.h>
#include <TObjArray.h>
#include <TGFrame.h>
#include <TGButton.h>
#include <MString.h>
#include <TGClient.h>

// MEGAlib libs:
#include "MGlobal.h"
#include "MGUIEFileSelector.h"
#include "MGUIOptions.h"

// Nuclearizer libs:
#include "MModule.h"


// Forward declarations:


////////////////////////////////////////////////////////////////////////////////


//! UI settings for the FITS measurements saver
class MGUIOptionsSaverMeasurementsFITS : public MGUIOptions
{
// public Session:
public:
//! Default constructor
MGUIOptionsSaverMeasurementsFITS(MModule* Module);
//! Default destructor
virtual ~MGUIOptionsSaverMeasurementsFITS();

//! Process all button, etc. messages
virtual bool ProcessMessage(long Message, long Parameter1, long Parameter2);

//! The creation part which gets overwritten
virtual void Create();

// protected methods:
protected:

//! Actions after the Apply or OK button has been pressed
virtual bool OnApply();


// protected members:
protected:

// private members:
private:
//! Select which FITS file to save to
MGUIEFileSelector* m_FileSelectorFITS;



#ifdef ___CLING___
public:
ClassDef(MGUIOptionsSaverMeasurementsFITS, 1) // basic class for dialog windows
#endif

};

#endif


////////////////////////////////////////////////////////////////////////////////
139 changes: 139 additions & 0 deletions include/MModuleLoaderMeasurementsFITS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* MModuleLoaderMeasurementsFITS.h
*
* Copyright (C) by Andreas Zoglauer.
* All rights reserved.
*
* Please see the source-file for the copyright-notice.
*
*/


#ifndef __MModuleLoaderMeasurementsFITS__
#define __MModuleLoaderMeasurementsFITS__


////////////////////////////////////////////////////////////////////////////////


// Standard libs:
#include <vector>
#include <valarray>

// ROOT libs:

// MEGAlib libs:
#include "MGlobal.h"
#include "MFileReadOuts.h"

// Nuclearizer libs:
#include "MModuleLoaderMeasurements.h"

// CCfits libs
#include <CCfits/CCfits>
using namespace CCfits;


////////////////////////////////////////////////////////////////////////////////

//! A module to load FITS data files
class MModuleLoaderMeasurementsFITS : public MModuleLoaderMeasurements
{
// public interface:
public:
//! Default constructor
MModuleLoaderMeasurementsFITS();
//! Default destructor
virtual ~MModuleLoaderMeasurementsFITS();

//! Create a new object of this class
virtual MModuleLoaderMeasurementsFITS* Clone() { return new MModuleLoaderMeasurementsFITS(); }

//! Initialize the module
virtual bool Initialize();

//! Finalize the module
virtual void Finalize();

//! Main data analysis routine, which updates the event to a new level
virtual bool AnalyzeEvent(MReadOutAssembly* Event);

//! Show the options GUI
virtual void ShowOptionsGUI();

//! Read the configuration data from an XML node
virtual bool ReadXmlConfiguration(MXmlNode* Node);
//! Create an XML node tree from the configuration
virtual MXmlNode* CreateXmlConfiguration();


// protected methods:
protected:
//! Open the FITS file
bool OpenFITSFile(MString FileName);
//! Read next event (loads new batch if needed)
bool ReadBatch();

// private methods:
private:


// protected members:
protected:


// private members:
private:
//! The FITS file object pointer
FITS* m_FITSFile;

//! Primary HDU (HDU 0) - header/metadata
const PHDU* m_PrimaryHDU;

//! Compton L1a table extension (extension 1)
const ExtHDU* m_ComptonTable;

//! Current row number in the FITS table
long m_CurrentRow;

//! Total number of rows in the FITS table
long m_TotalRows;

//! Batch size for reading FITS data
static const long m_BatchSize = 100;

//! Current batch start row
long m_BatchStartRow = 1;

//! Current event index within the batch
long m_CurrentEventInBatch = 0;

//! Number of events in current batch
long m_BatchEventCount = 0;

//! Batch data storage for scalar columns
std::vector<double> m_BatchTIME;
std::vector<uint8_t> m_BatchEVENTTYPE;
std::vector<uint8_t> m_BatchNUMSTRIPHIT;

//! Batch data storage for variable-length array columns
std::vector<std::valarray<uint8_t>> m_BatchTYPEHIT;
std::vector<std::valarray<int>> m_BatchDETID;
std::vector<std::valarray<int>> m_BatchSTRIPID;
std::vector<std::valarray<int>> m_BatchSIDEID;
std::vector<std::valarray<uint8_t>> m_BatchFASTTIME;
std::vector<std::valarray<int>> m_BatchPHA;
std::vector<std::valarray<int>> m_BatchTAC;


#ifdef ___CLING___
public:
ClassDef(MModuleLoaderMeasurementsFITS, 0) // no description
#endif

};

#endif


////////////////////////////////////////////////////////////////////////////////
Loading