Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a template reader and a data type for sync check #897

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
2 changes: 2 additions & 0 deletions r3bdata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ${R3BROOT_SOURCE_DIR}/r3bdata/rpcData
${R3BROOT_SOURCE_DIR}/r3bdata/mwpcData
${R3BROOT_SOURCE_DIR}/r3bdata/twimData
${R3BROOT_SOURCE_DIR}/r3bdata/musliData
${R3BROOT_SOURCE_DIR}/r3bdata/synccheckData
)

include_directories(${INCLUDE_DIRECTORIES})
Expand Down Expand Up @@ -209,6 +210,7 @@ twimData/R3BTwimHitData.cxx
musliData/R3BMusliMappedData.cxx
musliData/R3BMusliCalData.cxx
musliData/R3BMusliHitData.cxx
synccheckData/R3BSyncCheckData.cxx
)

# fill list of header files from list of source files by exchanging the file extension
Expand Down
1 change: 1 addition & 0 deletions r3bdata/DataLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,6 @@
#pragma link C++ class R3BSfibCalData+;
#pragma link C++ class R3BSfibHitData+;
#pragma link C++ class R3BFrsData+;
#pragma link C++ class R3BSyncCheckData+;

#endif
44 changes: 44 additions & 0 deletions r3bdata/synccheckData/R3BSyncCheckData.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019-2023 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/

#include "R3BSyncCheckData.h"

R3BSyncCheckData::R3BSyncCheckData()
: fMaster(0)
, fMasterRef(0)
, fMusic(0)
, fRpc(0)
, fS2(0)
, fFoot1(0)
, fFoot2(0)
{
}

R3BSyncCheckData::R3BSyncCheckData(uint32_t master,
uint32_t masterref,
uint32_t music,
uint32_t rpc,
uint32_t s2,
uint32_t foot1,
uint32_t foot2)
: fMaster(master)
, fMasterRef(masterref)
, fMusic(music)
, fRpc(rpc)
, fS2(s2)
, fFoot1(foot1)
, fFoot2(foot2)
{
}

ClassImp(R3BSyncCheckData);
56 changes: 56 additions & 0 deletions r3bdata/synccheckData/R3BSyncCheckData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019-2023 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/

#ifndef R3BSyncCheckData_H
#define R3BSyncCheckData_H 1

#include "TObject.h"
#include <Rtypes.h>

class R3BSyncCheckData : public TObject
{
public:
R3BSyncCheckData();
R3BSyncCheckData(uint32_t master,
uint32_t masterref,
uint32_t music,
uint32_t rpc,
uint32_t s2,
uint32_t foot1,
uint32_t foot2);

virtual ~R3BSyncCheckData() {}

inline const uint32_t& GetMaster() const { return fMaster; }
inline const uint32_t& GetMasterRef() const { return fMasterRef; }
inline const uint32_t& GetMusic() const { return fMusic; }
inline const uint32_t& GetRpc() const { return fRpc; }
inline const uint32_t& GetS2() const { return fS2; }
inline const uint32_t& GetFoot1() const { return fFoot1; }
inline const uint32_t& GetFoot2() const { return fFoot2; }

protected:
// following the order from ext file
uint32_t fMaster;
uint32_t fMasterRef;
uint32_t fMusic;
uint32_t fRpc;
uint32_t fS2;
uint32_t fFoot1;
uint32_t fFoot2;

public:
ClassDef(R3BSyncCheckData, 1)
};

#endif /* R3BSyncCheckData_H */
4 changes: 4 additions & 0 deletions r3bsource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ${R3BROOT_SOURCE_DIR}/r3bsource/fibers
${R3BROOT_SOURCE_DIR}/r3bsource/tofd
${R3BROOT_SOURCE_DIR}/r3bsource/tofi
${R3BROOT_SOURCE_DIR}/r3bsource/rpc
${R3BROOT_SOURCE_DIR}/r3bsource/sync_check
${R3BROOT_SOURCE_DIR}/r3bbase
${R3BROOT_SOURCE_DIR}/r3bdata/beammonitorData
${R3BROOT_SOURCE_DIR}/r3bdata/califaData
Expand Down Expand Up @@ -75,6 +76,7 @@ ${R3BROOT_SOURCE_DIR}/r3bdata/twimData
${R3BROOT_SOURCE_DIR}/r3bdata/musliData
${R3BROOT_SOURCE_DIR}/r3bdata/mwpcData
${R3BROOT_SOURCE_DIR}/r3bdata/sampData
${R3BROOT_SOURCE_DIR}/r3bdata/synccheckData
)

set(LINK_DIRECTORIES
Expand Down Expand Up @@ -145,6 +147,7 @@ set(SRCS
./twim/R3BTwimReader.cxx
./musli/R3BMusliReader.cxx
./mwpc/R3BMwpcReader.cxx
./sync_check/R3BSyncCheckReader.cxx
)

Set(STRUCT_HEADERS
Expand Down Expand Up @@ -212,6 +215,7 @@ Set(STRUCT_HEADERS
./trloii/ext_h101_samplosms.h
./pdc/ext_h101_pdc.h
./rpc/ext_h101_rpc.h
./sync_check/ext_h101_sync_check.h
)

# fill list of header files from list of source files
Expand Down
2 changes: 2 additions & 0 deletions r3bsource/SourceLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#pragma link C++ class R3BTwimReader+;
#pragma link C++ class R3BMusliReader+;
#pragma link C++ class R3BMwpcReader+;
#pragma link C++ class R3BSyncCheckReader+;


#pragma link C++ class EXT_STR_h101_unpack_t;
Expand Down Expand Up @@ -138,5 +139,6 @@
#pragma link C++ class EXT_STR_h101_PDC_onion_t;
#pragma link C++ class EXT_STR_h101_LOS_t;
#pragma link C++ class EXT_STR_h101_RPC_t;
#pragma link C++ class EXT_STR_h101_SYNC_CHECK_t;

#endif
78 changes: 78 additions & 0 deletions r3bsource/sync_check/R3BSyncCheckReader.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019-2023 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/

#include "FairLogger.h"
#include "FairRootManager.h"

#include "R3BEventHeader.h"
#include "R3BLogger.h"
#include "R3BSyncCheckData.h"
#include "R3BSyncCheckReader.h"
#include "TClonesArray.h"

extern "C"
{
#include "ext_data_client.h"
#include "ext_h101_sync_check.h"
}

R3BSyncCheckReader::R3BSyncCheckReader(EXT_STR_h101_SYNC_CHECK* data, size_t offset)
: R3BReader("R3BSyncCheckReader")
, fNEvent(1)
, fData(data)
, fOffset(offset)
, fArray(new TClonesArray("R3BSyncCheckData"))
{
}

R3BSyncCheckReader::~R3BSyncCheckReader()
{
if (fArray)
{
delete fArray;
}
}

Bool_t R3BSyncCheckReader::Init(ext_data_struct_info* a_struct_info)
{
Int_t ok;
R3BLOG(info, "");
EXT_STR_h101_SYNC_CHECK_ITEMS_INFO(ok, *a_struct_info, fOffset, EXT_STR_h101_SYNC_CHECK, 0);
if (!ok)
{
R3BLOG(fatal, "Failed to setup structure information");
return kFALSE;
}
// Register output array in tree
FairRootManager::Instance()->Register("SyncCheckData", "SyncCheck", fArray, kTRUE);
Reset();
memset(fData, 0, sizeof *fData);
return kTRUE;
}

Bool_t R3BSyncCheckReader::R3BRead()
{
new ((*fArray)[fArray->GetEntriesFast()]) R3BSyncCheckData(fData->SYNC_CHECK_MASTER,
fData->SYNC_CHECK_MASTERRR,
fData->SYNC_CHECK_MUSIC,
fData->SYNC_CHECK_RPC,
fData->SYNC_CHECK_STWO,
fData->SYNC_CHECK_FT1V,
fData->SYNC_CHECK_FT2V);
fNEvent++;
return kTRUE;
}

void R3BSyncCheckReader::Reset() { fArray->Clear(); }

ClassImp(R3BSyncCheckReader);
56 changes: 56 additions & 0 deletions r3bsource/sync_check/R3BSyncCheckReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/******************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2019-2023 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/

#ifndef R3BSyncCheckReader_H
#define R3BSyncCheckReader_H 1

#include "R3BReader.h"
#include <Rtypes.h>

struct EXT_STR_h101_SYNC_CHECK_t;
typedef struct EXT_STR_h101_SYNC_CHECK_t EXT_STR_h101_SYNC_CHECK;
class ext_data_struct_info;
class TClonesArray;

class R3BSyncCheckReader : public R3BReader
{
public:
// Standard constructor
R3BSyncCheckReader(EXT_STR_h101_SYNC_CHECK*, size_t);

// Destructor
virtual ~R3BSyncCheckReader();

// Setup structure information
virtual Bool_t Init(ext_data_struct_info*) override;

// Read data from full event structure
virtual Bool_t R3BRead() override;

// Reset
virtual void Reset() override;

private:
// An event counter
UInt_t fNEvent;
// Reader specific data structure from ucesb
EXT_STR_h101_SYNC_CHECK* fData;
// Offset of detector specific data in full data structure
size_t fOffset;
// Output array
TClonesArray* fArray;

public:
ClassDefOverride(R3BSyncCheckReader, 0);
};
#endif // R3BSyncCheckReader_H
Loading