Skip to content

calo decoder dev #38

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

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions artdaq-core-mu2e/Data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ TimeStamp.cc
Mu2eEventHeader.cc
DTCDataDecoder.cc
CalorimeterDataDecoder.cc
CaloTestDataDecoder.cc
CRVDataDecoder.cc
TrackerDataDecoder.cc
LIBRARIES PUBLIC
Expand Down
47 changes: 47 additions & 0 deletions artdaq-core-mu2e/Data/CaloTestDataDecoder.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "artdaq-core-mu2e/Data/CaloTestDataDecoder.hh"

namespace mu2e {

CaloTestDataDecoder::CaloTestDataDecoder(DTCLib::DTC_SubEvent const& evt)
: DTCDataDecoder(evt)
{
if (block_count() > 0)
{
auto dataPtr = dataAtBlockIndex(0);
auto hdr = dataPtr->GetHeader();
if (hdr->GetSubsystem() != DTCLib::DTC_Subsystem_Calorimeter || hdr->GetVersion() > 1)
{
TLOG(TLVL_ERROR) << "CaloTestDataDecoder CONSTRUCTOR: First block has unexpected type/version " << hdr->GetSubsystem() << "/" << static_cast<int>(hdr->GetVersion()) << " (expected " << static_cast<int>(DTCLib::DTC_Subsystem_Calorimeter) << "/[0,1])";
}
}
}

CaloTestDataDecoder::CaloTestDataDecoder(std::vector<uint8_t> data)
: DTCDataDecoder(data)
{
if (block_count() > 0)
{
auto dataPtr = dataAtBlockIndex(0);
auto hdr = dataPtr->GetHeader();
if (hdr->GetSubsystem() != DTCLib::DTC_Subsystem_Calorimeter || hdr->GetVersion() > 1)
{
TLOG(TLVL_ERROR) << "CaloTestDataDecoder CONSTRUCTOR: First block has unexpected type/version " << hdr->GetSubsystem() << "/" << static_cast<int>(hdr->GetVersion()) << " (expected " << static_cast<int>(DTCLib::DTC_Subsystem_Calorimeter) << "/[0,1])";
}
}
}

std::vector<std::pair<mu2e::CaloTestDataDecoder::CaloTestHitDataPacket, std::vector<uint16_t>>>* mu2e::CaloTestDataDecoder::GetCalorimeterHitData(size_t blockIndex) const
{
std::vector<std::pair<mu2e::CaloTestDataDecoder::CaloTestHitDataPacket, std::vector<uint16_t>>> *output = new std::vector<std::pair<mu2e::CaloTestDataDecoder::CaloTestHitDataPacket, std::vector<uint16_t>>>();
//TODO
return output;
}

std::vector<std::pair<mu2e::CaloTestDataDecoder::CaloTestHitDataPacket, uint16_t>> mu2e::CaloTestDataDecoder::GetCalorimeterHitsForTrigger(size_t blockIndex) const
{
std::vector<std::pair<mu2e::CaloTestDataDecoder::CaloTestHitDataPacket,uint16_t>> output;
//TODO
return output;
}

} // namespace mu2e
41 changes: 41 additions & 0 deletions artdaq-core-mu2e/Data/CaloTestDataDecoder.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef ARTDAQ_CORE_MU2E_DATA_CaloTestDataDecoder_HH
#define ARTDAQ_CORE_MU2E_DATA_CaloTestDataDecoder_HH

#include "artdaq-core-mu2e/Data/DTCDataDecoder.hh"


namespace mu2e {
class CaloTestDataDecoder : public DTCDataDecoder
{
public:

CaloTestDataDecoder() : DTCDataDecoder() {}

CaloTestDataDecoder(std::vector<uint8_t> data);

explicit CaloTestDataDecoder(DTCLib::DTC_SubEvent const& f);

struct CaloTestHitDataPacket
{
uint16_t HitTest0;
CaloTestHitDataPacket()
: HitTest0(0) {}
};


struct CaloTestFooterPacket
{
uint16_t TestFooter;

CaloTestFooterPacket ()
: TestFooter(0) {}

};

std::vector<std::pair<CaloTestHitDataPacket, std::vector<uint16_t>>>* GetCalorimeterHitData(size_t blockIndex) const;
std::unique_ptr<CaloTestFooterPacket> GetCalorimeterFooter(size_t blockIndex) const;
std::vector<std::pair<CaloTestHitDataPacket, uint16_t>> GetCalorimeterHitsForTrigger(size_t blockIndex) const;

};
} // namespace mu2e
#endif
Loading