Skip to content
Snippets Groups Projects
Commit 52291839 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Florian Uhlig
Browse files

Make CbmEvent, CbmDigiData and CbmDigiEvent streamable for mCBM MQ devices

- Add copy constructor to CbmEvent
- Define DigiData types and add members for the other CBM detectors in CbmDigiData(!MUCH beamtime digi usage!)
- Add vector of CbmEvents, all DigiData types, CbmDigiEvent and vector of CbmDigiEvent to LinkDef to get ROOT streamers (needed to write to ROOT file)
parent 131815dc
No related branches found
No related tags found
1 merge request!643Add other Digi types in CbmEvent, CbmDigiData and CbmDigiEvent
......@@ -137,6 +137,9 @@ Set(NO_DICT_SRCS
# Mask warning from file provided by STAR
SET_SOURCE_FILES_PROPERTIES(tof/etof/star_rhicf.c PROPERTIES COMPILE_FLAGS -Wno-pointer-sign)
CHANGE_FILE_EXTENSION(*.cxx *.h HEADERS "${SRCS}")
list(APPEND HEADERS base/CbmDigiData.h global/CbmDigiEvent.h)
set(LINKDEF DataLinkDef.h)
set(LIBRARY_NAME CbmData)
set(DEPENDENCIES Base)
......
......@@ -14,6 +14,20 @@
#include <string> // for char_traits
#include <utility> // for pair
// ----- Add data to event ---------------------------------------------
CbmEvent::CbmEvent(const CbmEvent& rhs)
: TObject(rhs)
, fNumber(rhs.fNumber)
, fTimeStart(rhs.fTimeStart)
, fTimeEnd(rhs.fTimeEnd)
, fNofData(rhs.fNofData)
, fVertex(rhs.fVertex)
, fMatch(nullptr)
, fIndexMap(rhs.fIndexMap)
{
if (fMatch) fMatch = new CbmMatch(*(rhs.fMatch));
}
// -------------------------------------------------------------------------
// ----- Add data to event ---------------------------------------------
void CbmEvent::AddData(ECbmDataType type, uint32_t index)
......
......@@ -54,6 +54,8 @@ public:
{
}
CbmEvent(const CbmEvent&);
CbmEvent(CbmEvent&&) = default;
/** Destructor **/
......@@ -207,10 +209,8 @@ private:
/** Arrays of indices to data types **/
std::map<ECbmDataType, std::vector<uint32_t>> fIndexMap;
CbmEvent(const CbmEvent&);
CbmEvent& operator=(const CbmEvent&);
ClassDef(CbmEvent, 2);
};
......
......@@ -133,6 +133,17 @@
#pragma link C++ class CbmDigiVector < CbmPsdDsp> + ;
#pragma link C++ class vector < CbmEventStore> + ;
#pragma link C++ class std::vector < CbmEvent > + ;
#pragma link C++ class StsDigiData + ;
#pragma link C++ class MuchDigiData + ;
#pragma link C++ class RichDigiData + ;
#pragma link C++ class TrdDigiData + ;
#pragma link C++ class TofDigiData + ;
#pragma link C++ class PsdDigiData + ;
#pragma link C++ class CbmDigiData + ;
#pragma link C++ class CbmDigiEvent + ;
#pragma link C++ class std::vector < CbmDigiEvent > + ;
/* clang-format off */
#pragma read sourceClass="CbmStsDigi" version="[7]" targetClass="CbmStsDigi" \
source="int64_t fTime; int32_t fAddress; uint16_t fChannel; uint16_t fCharge" \
......
......@@ -6,7 +6,12 @@
#ifndef CBMDIGIDATA_H
#define CBMDIGIDATA_H 1
#include "CbmMuchDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
#include "CbmStsDigi.h"
#include "CbmTofDigi.h"
#include "CbmTrdDigi.h"
#include <boost/serialization/access.hpp>
#include <boost/serialization/vector.hpp>
......@@ -35,6 +40,11 @@ struct DigiVec {
/** Unless a detector-specific implementation for the digi data is present, the
** simplest form (std::vector) will be used. **/
typedef DigiVec<CbmStsDigi> StsDigiData;
typedef DigiVec<CbmMuchDigi> MuchDigiData;
typedef DigiVec<CbmRichDigi> RichDigiData;
typedef DigiVec<CbmTrdDigi> TrdDigiData;
typedef DigiVec<CbmTofDigi> TofDigiData;
typedef DigiVec<CbmPsdDigi> PsdDigiData;
/** @struct CbmDigiData
......@@ -47,11 +57,23 @@ typedef DigiVec<CbmStsDigi> StsDigiData;
**/
struct CbmDigiData {
friend class boost::serialization::access;
TofDigiData fT0;
StsDigiData fSts;
MuchDigiData fMuch;
RichDigiData fRich;
TrdDigiData fTrd;
TofDigiData fTof;
PsdDigiData fPsd;
template<class Archive>
void serialize(Archive& ar, const unsigned int /*version*/)
{
ar& fT0;
ar& fSts;
ar& fMuch;
ar& fTrd;
ar& fTof;
ar& fPsd;
ar& fRich;
}
};
......
......@@ -6,8 +6,14 @@ Set(INCLUDE_DIRECTORIES
${CBMDATA_DIR}/base
${CBMDATA_DIR}/global
${CBMDATA_DIR}/sts
${CBMDATA_DIR}/much
${CBMDATA_DIR}/rich
${CBMDATA_DIR}/tof
${CBMDATA_DIR}/psd
${CBMDATA_DIR}/trd
${CBMDATA_DIR}/mvd
${CBMDATA_DIR}/test/sts
${CMAKE_SOURCE_DIR}/external/ipc/ipc/lib/fles_ipc
${CMAKE_SOURCE_DIR}/external/ipc/ipc/lib/fles_ipc
${BASE_INCLUDE_DIRECTORIES}
${GTEST_INCLUDE_DIR}
)
......@@ -49,7 +55,7 @@ Set(CbmDigiEventSources
)
CreateGTestExeAndAddTest(_GTestCbmDigiEvent "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${CbmDigiEventSources}" "${DEPENDENCIES}" "")
# --- Test CbmDigiTimeslice
Set(CbmDigiTimesliceSources
${CBMDATA_DIR}/global/CbmDigiTimeslice.h
......@@ -57,7 +63,7 @@ Set(CbmDigiTimesliceSources
)
CreateGTestExeAndAddTest(_GTestCbmDigiTimeslice "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${CbmDigiTimesliceSources}" "${DEPENDENCIES}" "_GTestCbmDigiEvent")
# --- Test CbmVertex
Set(CbmVertexSources
${CBMDATA_DIR}/global/CbmVertex.cxx
......@@ -65,5 +71,5 @@ Set(CbmVertexSources
)
CreateGTestExeAndAddTest(_GTestCbmVertex "${INCLUDE_DIRECTORIES}" "${LINK_DIRECTORIES}"
"${CbmVertexSources}" "${DEPENDENCIES}" "_GTestCbmDigiTimeslice")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment