From 9e6fa3a533a9f7ef83a0ebaffdb690e6bb96d912 Mon Sep 17 00:00:00 2001 From: Ralitsa Sharankova Date: Wed, 18 Sep 2019 13:50:59 -0500 Subject: [PATCH 1/3] porting crttrack and crthit from uboonecode --- core/Base/DataFormatConstants.h | 3 + core/DataFormat/DataFormat-TypeDef.h | 6 ++ core/DataFormat/LinkDef.h | 8 +++ core/DataFormat/crthit.cxx | 46 ++++++++++++ core/DataFormat/crthit.h | 92 ++++++++++++++++++++++++ core/DataFormat/crttrack.cxx | 62 ++++++++++++++++ core/DataFormat/crttrack.h | 102 +++++++++++++++++++++++++++ 7 files changed, 319 insertions(+) create mode 100644 core/DataFormat/crthit.cxx create mode 100644 core/DataFormat/crthit.h create mode 100644 core/DataFormat/crttrack.cxx create mode 100644 core/DataFormat/crttrack.h diff --git a/core/Base/DataFormatConstants.h b/core/Base/DataFormatConstants.h index 4ff846e9e..3ea9a9f6d 100644 --- a/core/Base/DataFormatConstants.h +++ b/core/Base/DataFormatConstants.h @@ -64,6 +64,8 @@ namespace larlite{ kRawDigit, ///< raw::RawDigit kWire, ///< recob::Wire kHit, ///< recob::Hit + kCRTHit, ///< crt::CRTHit + kCRTTrack, ///< crt::CRTTrack kCosmicTag, ///< anab::CosmicTag kOpHit, ///< opdet::OpHit kOpFlash, ///< opdet::OpFlash @@ -130,6 +132,7 @@ namespace larlite{ "rawdigit", "wire", "hit", + "crthit", "cosmictag", "ophit", "opflash", diff --git a/core/DataFormat/DataFormat-TypeDef.h b/core/DataFormat/DataFormat-TypeDef.h index 28e7c05fb..d2dba2d69 100644 --- a/core/DataFormat/DataFormat-TypeDef.h +++ b/core/DataFormat/DataFormat-TypeDef.h @@ -26,6 +26,12 @@ namespace larlite{ 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..a53db5515 100644 --- a/core/DataFormat/LinkDef.h +++ b/core/DataFormat/LinkDef.h @@ -67,6 +67,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..1ae27d143 --- /dev/null +++ b/core/DataFormat/crthit.cxx @@ -0,0 +1,46 @@ +#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; + + 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..a73be6313 --- /dev/null +++ b/core/DataFormat/crthit.h @@ -0,0 +1,92 @@ +/** + * \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; + + uint32_t ts0_s; + int8_t ts0_s_corr; + + uint32_t ts0_ns; + int32_t ts0_ns_corr; + + int32_t ts1_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..19aaa6b42 --- /dev/null +++ b/core/DataFormat/crttrack.cxx @@ -0,0 +1,62 @@ +#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; + + 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..92da445cf --- /dev/null +++ b/core/DataFormat/crttrack.h @@ -0,0 +1,102 @@ +/** + * \class CRTHit + * + * \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; + + uint32_t ts0_s; + uint16_t ts0_s_err; + + uint32_t ts0_ns; + uint16_t ts0_ns_err; + + 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; + + uint32_t ts0_ns_h1; + uint16_t ts0_ns_err_h1; + uint32_t ts0_ns_h2; + uint16_t ts0_ns_err_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 From 8ef3cd53d54c9c777c0c0a67d6978a5b42893bc6 Mon Sep 17 00:00:00 2001 From: Ralitsa Sharankova Date: Fri, 20 Sep 2019 12:03:07 -0500 Subject: [PATCH 2/3] adding crt hit time in TPC frame variable --- core/DataFormat/crthit.cxx | 4 +++- core/DataFormat/crthit.h | 9 ++++++++- core/DataFormat/crttrack.cxx | 3 +++ core/DataFormat/crttrack.h | 18 ++++++++++++++---- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/core/DataFormat/crthit.cxx b/core/DataFormat/crthit.cxx index 1ae27d143..94f189a20 100644 --- a/core/DataFormat/crthit.cxx +++ b/core/DataFormat/crthit.cxx @@ -21,7 +21,9 @@ namespace larlite { ts0_ns_corr=0; ts1_ns=0; - + + ts2_ns=0; + plane=-1; x_pos=-1; x_err=-1; diff --git a/core/DataFormat/crthit.h b/core/DataFormat/crthit.h index a73be6313..0a677784e 100644 --- a/core/DataFormat/crthit.h +++ b/core/DataFormat/crthit.h @@ -35,14 +35,21 @@ namespace larlite { 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; diff --git a/core/DataFormat/crttrack.cxx b/core/DataFormat/crttrack.cxx index 19aaa6b42..e30ebd82a 100644 --- a/core/DataFormat/crttrack.cxx +++ b/core/DataFormat/crttrack.cxx @@ -46,6 +46,9 @@ namespace larlite { ts0_ns_h2=0; ts0_ns_err_h2=0; + + ts2_ns_h1=0; + ts2_ns_h2=0; clear_data(); } diff --git a/core/DataFormat/crttrack.h b/core/DataFormat/crttrack.h index 92da445cf..a0a5f1fdb 100644 --- a/core/DataFormat/crttrack.h +++ b/core/DataFormat/crttrack.h @@ -1,5 +1,5 @@ /** - * \class CRTHit + * \class CRTTrack * * \ingroup larlite * @@ -34,16 +34,18 @@ namespace larlite { 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; @@ -64,11 +66,19 @@ namespace larlite { 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 From 7c022d074d2afed007de2d65d160d2ea9ef46890 Mon Sep 17 00:00:00 2001 From: Ralitsa Sharankova Date: Fri, 27 Sep 2019 11:34:20 -0500 Subject: [PATCH 3/3] porting DAQHeaderTimeUBooNE class --- core/Base/DataFormatConstants.h | 5 +- core/DataFormat/DataFormat-TypeDef.h | 3 + core/DataFormat/LinkDef.h | 4 + core/DataFormat/daqheadertimeuboone.cxx | 43 ++++++++ core/DataFormat/daqheadertimeuboone.h | 139 ++++++++++++++++++++++++ 5 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 core/DataFormat/daqheadertimeuboone.cxx create mode 100644 core/DataFormat/daqheadertimeuboone.h diff --git a/core/Base/DataFormatConstants.h b/core/Base/DataFormatConstants.h index 3ea9a9f6d..9f42d408e 100644 --- a/core/Base/DataFormatConstants.h +++ b/core/Base/DataFormatConstants.h @@ -62,10 +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 + kCRTTrack, ///< crt::CRTTrack kCosmicTag, ///< anab::CosmicTag kOpHit, ///< opdet::OpHit kOpFlash, ///< opdet::OpFlash @@ -130,9 +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 d2dba2d69..275b18124 100644 --- a/core/DataFormat/DataFormat-TypeDef.h +++ b/core/DataFormat/DataFormat-TypeDef.h @@ -20,6 +20,9 @@ namespace larlite{ class rawdigit; class event_rawdigit; + class daqheadertimeuboone; + class event_daqheadertimeuboone; + class wire; class event_wire; diff --git a/core/DataFormat/LinkDef.h b/core/DataFormat/LinkDef.h index a53db5515..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+; 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