diff --git a/core/Base/DataFormatConstants.h b/core/Base/DataFormatConstants.h index 4ff846e9e..9f42d408e 100644 --- a/core/Base/DataFormatConstants.h +++ b/core/Base/DataFormatConstants.h @@ -62,8 +62,11 @@ namespace larlite{ kSimChannel, ///< sim::SimChannel kMCShower, ///< sim::MCShower kRawDigit, ///< raw::RawDigit + kDAQHeaderTimeUBooNE,///< raw::DAQHeaderTimeUBooNE kWire, ///< recob::Wire kHit, ///< recob::Hit + kCRTHit, ///< crt::CRTHit + kCRTTrack, ///< crt::CRTTrack kCosmicTag, ///< anab::CosmicTag kOpHit, ///< opdet::OpHit kOpFlash, ///< opdet::OpFlash @@ -128,8 +131,11 @@ namespace larlite{ "simch", "mcshower", "rawdigit", + "daqheadertimeuboone", "wire", "hit", + "crthit", + "crttrack", "cosmictag", "ophit", "opflash", diff --git a/core/DataFormat/DataFormat-TypeDef.h b/core/DataFormat/DataFormat-TypeDef.h index 28e7c05fb..275b18124 100644 --- a/core/DataFormat/DataFormat-TypeDef.h +++ b/core/DataFormat/DataFormat-TypeDef.h @@ -20,12 +20,21 @@ namespace larlite{ class rawdigit; class event_rawdigit; + class daqheadertimeuboone; + class event_daqheadertimeuboone; + class wire; class event_wire; class hit; class event_hit; + class crthit; + class event_crthit; + + class crttrack; + class event_crttrack; + class cosmictag; class event_cosmictag; diff --git a/core/DataFormat/LinkDef.h b/core/DataFormat/LinkDef.h index 470d8314a..4164f9489 100644 --- a/core/DataFormat/LinkDef.h +++ b/core/DataFormat/LinkDef.h @@ -59,6 +59,10 @@ #pragma link C++ class std::vector+; #pragma link C++ class larlite::event_rawdigit+; +#pragma link C++ class larlite::daqheadertimeuboone+; +#pragma link C++ class std::vector+; +#pragma link C++ class larlite::event_daqheadertimeuboone+; + #pragma link C++ class larlite::wire+; #pragma link C++ class std::vector+; #pragma link C++ class larlite::event_wire+; @@ -67,6 +71,14 @@ #pragma link C++ class std::vector+; #pragma link C++ class larlite::event_hit+; +#pragma link C++ class larlite::crthit+; +#pragma link C++ class std::vector+; +#pragma link C++ class larlite::event_crthit+; + +#pragma link C++ class larlite::crttrack+; +#pragma link C++ class std::vector+; +#pragma link C++ class larlite::event_crttrack+; + #pragma link C++ class larlite::t0+; #pragma link C++ class std::vector+; #pragma link C++ class larlite::event_t0+; diff --git a/core/DataFormat/crthit.cxx b/core/DataFormat/crthit.cxx new file mode 100644 index 000000000..94f189a20 --- /dev/null +++ b/core/DataFormat/crthit.cxx @@ -0,0 +1,48 @@ +#ifndef LARLITE_CRTHIT_CXX +#define LARLITE_CRTHIT_CXX + +#include "crthit.h" + +namespace larlite { + + //################################################# + crthit::crthit() : data_base(data::kCRTHit) + //################################################# + { + feb_id.clear(); + pesmap.clear(); + + peshit=0; + + ts0_s=0; + ts0_s_corr=0; + + ts0_ns=0; + ts0_ns_corr=0; + + ts1_ns=0; + + ts2_ns=0; + + plane=-1; + x_pos=-1; + x_err=-1; + y_pos=-1; + y_err=-1; + z_pos=-1; + z_err=-1; + + + clear_data(); + } + + //########################################################################## + void crthit::clear_data() + //########################################################################## + { + data_base::clear_data(); + } + +} +#endif +//nothing to do here diff --git a/core/DataFormat/crthit.h b/core/DataFormat/crthit.h new file mode 100644 index 000000000..0a677784e --- /dev/null +++ b/core/DataFormat/crthit.h @@ -0,0 +1,99 @@ +/** + * \class CRTHit + * + * \ingroup larlite + * + * \brief CRT Hit Info + * + * \author $Author: David Lorca $ + * + */ + + +#ifndef LARLITE_CRTHIT_H +#define LARLITE_CRTHIT_H + +#include "data_base.h" +#include +#include +#include + +namespace larlite { + + class crthit : public data_base { + public: + + /// Default constructor + crthit(); + + /// Default destructor + virtual ~crthit(){} + + void clear_data(); + + //struct CRTHit{ + std::vector feb_id; + std::map< uint8_t, std::vector > > pesmap; + float peshit; + + // CRT GPS clock in s + uint32_t ts0_s; + int8_t ts0_s_corr; + + // CRT GPS clock in ns + uint32_t ts0_ns; + int32_t ts0_ns_corr; + + // CRT time w.r.t. BNB trigger + int32_t ts1_ns; + + // CRT hit time in TPC time frame + // can be directly compared to TPC and optical object timing + float ts2_ns; + + int plane; + float x_pos; + float x_err; + float y_pos; + float y_err; + float z_pos; + float z_err; + + //uint16_t event_flag; + //std::map< uint8_t, uint16_t > lostcpu_map; + //std::map< uint8_t, uint16_t > lostfpga_map; + //uint16_t pollms; + + //CRTHit() {} + + }; + /** + \class event_crthit + A collection storage class of multiple hits. + */ + class event_crthit : public std::vector, + public event_base { + + public: + + /// Default constructor + event_crthit(std::string name="noname") : event_base(data::kCRTHit,name) { clear_data(); } + + /// Default copy constructor + event_crthit(const event_crthit& original) : std::vector(original), event_base(original) + {} + + /// Default destructor + ~event_crthit(){} + + /// Method to clear currently held data contents in the buffer + virtual void clear_data(){event_base::clear_data(); clear();} + + private: + + }; + + +} + +#endif diff --git a/core/DataFormat/crttrack.cxx b/core/DataFormat/crttrack.cxx new file mode 100644 index 000000000..e30ebd82a --- /dev/null +++ b/core/DataFormat/crttrack.cxx @@ -0,0 +1,65 @@ +#ifndef LARLITE_CRTTRACK_CXX +#define LARLITE_CRTTRACK_CXX + +#include "crttrack.h" + +namespace larlite { + + //################################################# + crttrack::crttrack() : data_base(data::kCRTTrack) + //################################################# + { + + feb_id.clear(); + pesmap.clear(); + peshit=0; + + ts0_s=0; + ts0_s_err=0; + + ts0_ns=0; + ts0_ns_err=0; + + ts1_ns=0; + ts1_ns_err=0; + + plane1=-1; + plane2=-1; + x1_pos=-1; + x1_err=-1; + y1_pos=-1; + y1_err=-1; + z1_pos=-1; + z1_err=-1; + x2_pos=-1; + x2_err=-1; + y2_pos=-1; + y2_err=-1; + z2_pos=-1; + z2_err=-1; + length=-1; + thetaxy=-1; + phiz=-1; + + ts0_ns_h1=0; + ts0_ns_err_h1=0; + + ts0_ns_h2=0; + ts0_ns_err_h2=0; + + ts2_ns_h1=0; + ts2_ns_h2=0; + + clear_data(); + } + + //########################################################################## + void crttrack::clear_data() + //########################################################################## + { + data_base::clear_data(); + } + +} +#endif +//nothing to do here diff --git a/core/DataFormat/crttrack.h b/core/DataFormat/crttrack.h new file mode 100644 index 000000000..a0a5f1fdb --- /dev/null +++ b/core/DataFormat/crttrack.h @@ -0,0 +1,112 @@ +/** + * \class CRTTrack + * + * \ingroup larlite + * + * \brief CRT Track Info + * + * + */ + + +#ifndef LARLITE_CRTTRACK_H +#define LARLITE_CRTTRACK_H + +#include "data_base.h" +#include +#include +#include + +namespace larlite { + + class crttrack : public data_base { + public: + + /// Default constructor + crttrack(); + + /// Default destructor + virtual ~crttrack(){} + + void clear_data(); + + //struct CRTTrack{ + std::vector feb_id; + std::map< uint8_t, std::vector > > pesmap; + float peshit; + + // CRT GPS clock in s + uint32_t ts0_s; + uint16_t ts0_s_err; + // CRT GPS clock in ns + uint32_t ts0_ns; + uint16_t ts0_ns_err; + + // CRT hit time w.r.t. BNB trigger + int32_t ts1_ns; + uint16_t ts1_ns_err; + + int plane1; + int plane2; + + float x1_pos; + float x1_err; + float y1_pos; + float y1_err; + float z1_pos; + float z1_err; + float x2_pos; + float x2_err; + float y2_pos; + float y2_err; + float z2_pos; + float z2_err; + + float length; + float thetaxy; + float phiz; + + // CRT GPS time of 1st hit + uint32_t ts0_ns_h1; + uint16_t ts0_ns_err_h1; + // CRT GPS time of 1nd hit + uint32_t ts0_ns_h2; + uint16_t ts0_ns_err_h2; + + // time of 1st hit in TPC time frame + float ts2_ns_h1; + // time of 2nd hit in TPC time frame + float ts2_ns_h2; + + + }; + /** + \class event_crttrack + A collection storage class of multiple tracks. + */ + class event_crttrack : public std::vector, + public event_base { + + public: + + /// Default constructor + event_crttrack(std::string name="noname") : event_base(data::kCRTTrack,name) { clear_data(); } + + /// Default copy constructor + event_crttrack(const event_crttrack& original) : std::vector(original), event_base(original) + {} + + /// Default destructor + ~event_crttrack(){} + + /// Method to clear currently held data contents in the buffer + virtual void clear_data(){event_base::clear_data(); clear();} + + private: + + }; + + +} + +#endif diff --git a/core/DataFormat/daqheadertimeuboone.cxx b/core/DataFormat/daqheadertimeuboone.cxx new file mode 100644 index 000000000..05b8d77c3 --- /dev/null +++ b/core/DataFormat/daqheadertimeuboone.cxx @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////////////////// +// +// DAQHeaderTimeUBooNE class +// +// Copied & modified from ubobj/RawData/DAQHeaderTimeUbooNE.cxx +// +//////////////////////////////////////////////////////////////////////// + +#include "daqheadertimeuboone.h" + +#ifndef LARLITE_DAQHEADERTIMEUBOONE_CXX +#define LARLITE_DAQHEADERTIMEUBOONE_CXX + +namespace larlite{ + + //---------------------------------------------------------------------- + // Default constructor. + + daqheadertimeuboone::daqheadertimeuboone() : data_base(data::kDAQHeaderTimeUBooNE){ + fGPSTime=0; + fNTPTime=0; + fPPSsec=0; + fPPSmicro=0; + fPPSnano=0; + fTrigFrame=0; + fTrigSample=0; + fTrigDiv=0; + fTrigPPSFrame=0; + fTrigPPSSample=0; + fTrigPPSDiv=0; + fTimeStamp=0; + + clear_data(); + } + + void daqheadertimeuboone::clear_data() + //########################################################################## + { + data_base::clear_data(); + } + +} +#endif diff --git a/core/DataFormat/daqheadertimeuboone.h b/core/DataFormat/daqheadertimeuboone.h new file mode 100644 index 000000000..77abdec6c --- /dev/null +++ b/core/DataFormat/daqheadertimeuboone.h @@ -0,0 +1,139 @@ +//////////////////////////////////////////////////////////////////////// +// Name: DAQHeaderTimeUBooNE.h +// +// Purpose: Class to hold extended DAQ header information, in particular +// GPS and NTP (host) event time stamp. +// +// Copied & modified from ubobj/RawData/DAQHeaderTimeUBooNE.h +// +//////////////////////////////////////////////////////////////////////// + +#ifndef LARLITE_DAQHEADERTIMEUBOONE_H +#define LARLITE_DAQHEADERTIMEUBOONE_H + +#include +#include "data_base.h" +#include + +namespace larlite { + + class daqheadertimeuboone : public data_base { + public: + + // Constructors. + + daqheadertimeuboone(); + virtual ~daqheadertimeuboone() {}; + + void clear_data(); + + //Set Methods + + void SetGPSTime(time_t t); + void SetNTPTime(time_t t); + void SetPPSTime(uint32_t sec, uint32_t micro, uint32_t nano); + void SetTrigTime(uint32_t frame, uint16_t sample, uint16_t div); + void SetTrigPPSTime(uint32_t frame, uint16_t sample, uint16_t div); + void SetEventTimeStamp(time_t t); + + // Accessors. + + time_t gps_time() const {return fGPSTime;} + time_t ntp_time() const {return fNTPTime;} + + uint32_t pps_sec() const {return fPPSsec;} + uint32_t pps_micro() const {return fPPSmicro;} + uint32_t pps_nano() const {return fPPSnano;} + + uint32_t trig_frame() const {return fTrigFrame;} + uint16_t trig_sample() const {return fTrigSample;} + uint16_t trig_div() const {return fTrigDiv;} + + uint32_t trig_pps_frame() const {return fTrigPPSFrame;} + uint16_t trig_pps_sample() const {return fTrigPPSSample;} + uint16_t trig_pps_div() const {return fTrigPPSDiv;} + + time_t evt_timestamp() const {return fTimeStamp;} + + private: + + // Data members. + + // Complete event times. + + time_t fGPSTime; // (high, low)=(seconds, nanoseconds) + time_t fNTPTime; // (high, low)=(seconds, nanoseconds) + + // GPS PPS. + + uint32_t fPPSsec; // PPS seconds. + uint32_t fPPSmicro; // PPS microseconds. + uint32_t fPPSnano; // PPS nanoseconds. + + // Trigger event time. + + uint32_t fTrigFrame; // Event frame (1.6 ms). + uint16_t fTrigSample; // Event sample (2 MHz). + uint16_t fTrigDiv; // Event division (16 MHz). + + // Trigger PPS time. + + uint32_t fTrigPPSFrame; // PPS frame (1.6 ms). + uint16_t fTrigPPSSample; // PPS sample (2 MHz). + uint16_t fTrigPPSDiv; // PPS division (16 MHz). + + // Event time stamp (copied over from DAQHeader) + time_t fTimeStamp; + + }; + + /* + Class event_daqheadertimeuboone + */ + class event_daqheadertimeuboone : public std::vector, + public event_base { + + public: + + /// Default constructor + event_daqheadertimeuboone(std::string name="noname") : event_base(data::kDAQHeaderTimeUBooNE,name) { clear_data(); } + + /// Default copy constructor + event_daqheadertimeuboone(const event_daqheadertimeuboone& original) : std::vector(original), event_base(original) + {} + + /// Default destructor + ~event_daqheadertimeuboone(){} + + /// Method to clear currently held data contents in the buffer + virtual void clear_data(){event_base::clear_data(); clear();} + + private: + + }; +} + +inline void larlite::daqheadertimeuboone::SetGPSTime(time_t t) { fGPSTime = t; } +inline void larlite::daqheadertimeuboone::SetNTPTime(time_t t) { fNTPTime = t; } +inline void larlite::daqheadertimeuboone::SetPPSTime(uint32_t sec, uint32_t micro, uint32_t nano) +{ + fPPSsec=sec; + fPPSmicro=micro; + fPPSnano=nano; +} +inline void larlite::daqheadertimeuboone::SetTrigTime(uint32_t frame, uint16_t sample, uint16_t div) +{ + fTrigFrame=frame; + fTrigSample=sample; + fTrigDiv=div; +} +inline void larlite::daqheadertimeuboone::SetTrigPPSTime(uint32_t frame, uint16_t sample, uint16_t div) +{ + fTrigPPSFrame=frame; + fTrigPPSSample=sample; + fTrigPPSDiv=div; +} + +inline void larlite::daqheadertimeuboone::SetEventTimeStamp(time_t t){ fTimeStamp = t;} + +#endif // DAQHEADERTIMEUBOONE_H