Skip to content

Commit

Permalink
Merge pull request #1 from preghenella/rdev-compressor-devel
Browse files Browse the repository at this point in the history
Rdev compressor devel
  • Loading branch information
preghenella authored Feb 28, 2020
2 parents 5abb30e + 46e10dc commit 41f7c02
Show file tree
Hide file tree
Showing 35 changed files with 994 additions and 1,055 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "GlobalTrackingWorkflow/TrackTPCITSReaderSpec.h"
#include "TOFWorkflow/DigitReaderSpec.h"
#include "TOFWorkflow/TOFDigitWriterSpec.h"
#include "TOFWorkflow/RawReaderSpec.h"
#include "TOFWorkflow/ClusterReaderSpec.h"
#include "TOFWorkflow/TOFClusterizerSpec.h"
#include "TOFWorkflow/TOFClusterWriterSpec.h"
#include "TOFWorkflow/TOFMatchedWriterSpec.h"
#include "TOFWorkflow/TOFCalibWriterSpec.h"
#include "TOFWorkflow/TOFRawWriterSpec.h"
#include "TOFWorkflow/CompressedDecodingTask.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/ConfigParamSpec.h"
#include "TOFWorkflow/RecoWorkflowSpec.h"
Expand Down Expand Up @@ -52,6 +52,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
workflowOptions.push_back(ConfigParamSpec{"tof-lanes", o2::framework::VariantType::Int, 1, {"number of parallel lanes up to the matcher, TBI"}});
workflowOptions.push_back(ConfigParamSpec{"use-ccdb", o2::framework::VariantType::Bool, false, {"enable access to ccdb tof calibration objects"}});
workflowOptions.push_back(ConfigParamSpec{"use-fit", o2::framework::VariantType::Bool, false, {"enable access to fit info for calibration"}});
workflowOptions.push_back(ConfigParamSpec{"input-desc", o2::framework::VariantType::String, "CRAWDATA", {"Input specs description string"}});
}

#include "Framework/runDataProcessing.h" // the main driver
Expand Down Expand Up @@ -110,6 +111,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
if (outputType.rfind("raw") < outputType.size())
writeraw = 1;

bool dgtinput = 0;
if (inputType == "digits") {
dgtinput = 1;
}
bool clusterinput = 0;
if (inputType == "clusters") {
clusterinput = 1;
Expand All @@ -135,7 +140,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
if (clusterinput) {
LOG(INFO) << "Insert TOF Cluster Reader";
specs.emplace_back(o2::tof::getClusterReaderSpec(useMC));
} else if (!rawinput) {
} else if (dgtinput) {
// TOF clusterizer
LOG(INFO) << "Insert TOF Digit reader from file";
specs.emplace_back(o2::tof::getDigitReaderSpec(useMC));
Expand All @@ -144,9 +149,10 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
LOG(INFO) << "Insert TOF Raw writer";
specs.emplace_back(o2::tof::getTOFRawWriterSpec());
}
} else {
LOG(INFO) << "Insert TOF Raw Reader";
specs.emplace_back(o2::tof::getRawReaderSpec());
} else if (rawinput) {
LOG(INFO) << "Insert TOF Compressed Raw Decoder";
auto inputDesc = cfgc.options().get<std::string>("input-desc");
specs.emplace_back(o2::tof::getCompressedDecodingSpec(inputDesc));
useMC = 0;

if (writedigit) {
Expand Down
2 changes: 1 addition & 1 deletion Detectors/TOF/base/include/TOFBase/Strip.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Strip

/// Empties the point container
/// @param option unused
void clear();
void clear() { mDigits.clear(); }

/// Change the chip index
/// @param index New chip index
Expand Down
5 changes: 4 additions & 1 deletion Detectors/TOF/base/include/TOFBase/WindowFiller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ class WindowFiller

void initObj();

void reset();

Int_t getCurrentReadoutWindow() const { return mReadoutWindowCurrent; }
void setCurrentReadoutWindow(Double_t value) { mReadoutWindowCurrent = value; }
void setEventTime(double value) { mEventTime = value; }
void setEventTime(double value) { mEventTime = value - mTF * o2::constants::lhc::LHCOrbitNS * 256; }

std::vector<Digit>* getDigitPerTimeFrame() { return &mDigitsPerTimeFrame; }
std::vector<ReadoutWindowData>* getReadoutWindowData() { return &mReadoutWindowData; }
Expand All @@ -45,6 +47,7 @@ class WindowFiller

protected:
// info TOF timewindow
Int_t mTF = 0;
Int_t mReadoutWindowCurrent = 0;
Int_t mFirstOrbit = 0;
Int_t mFirstBunch = 0;
Expand Down
22 changes: 22 additions & 0 deletions Detectors/TOF/base/src/WindowFiller.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ void WindowFiller::initObj()
}
}
//______________________________________________________________________
void WindowFiller::reset()
{
mIcurrentReadoutWindow = 0;
mReadoutWindowCurrent = 0;

for (Int_t i = 0; i < MAXWINDOWS; i++) {
for (Int_t j = 0; j < Geo::NSTRIPS; j++) {
mStrips[i][j].clear();
}
}
mFutureDigits.clear();

mStripsCurrent = &(mStrips[0]);
mStripsNext[0] = &(mStrips[1]);

mDigitsPerTimeFrame.clear();
mReadoutWindowData.clear();

mFirstOrbit = 0;
mFirstBunch = 0;
}
//______________________________________________________________________
void WindowFiller::fillDigitsInStrip(std::vector<Strip>* strips, int channel, int tdc, int tot, int nbc, UInt_t istrip, Int_t triggerorbit, Int_t triggerbunch)
{
(*strips)[istrip].addDigit(channel, tdc, tot * Geo::NTOTBIN_PER_NS, nbc, 0, triggerorbit, triggerbunch);
Expand Down
15 changes: 8 additions & 7 deletions Detectors/TOF/compression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@

o2_add_library(TOFCompression
SOURCES src/Compressor.cxx
src/RawReaderTask.cxx
src/CompressorTask.cxx
src/CompressedWriterTask.cxx
src/CompressedInspectorTask.cxx
PUBLIC_LINK_LIBRARIES O2::TOFBase O2::Framework O2::Headers O2::DataFormatsTOF
O2::DetectorsRaw
)

o2_target_root_dictionary(TOFCompression
HEADERS include/TOFCompression/RawDataFrame.h
)

o2_add_executable(compressor
COMPONENT_NAME tof
SOURCES src/tof-compressor.cxx
PUBLIC_LINK_LIBRARIES O2::TOFCompression
)

o2_add_executable(compressed-inspector
COMPONENT_NAME tof
SOURCES src/tof-compressed-inspector.cxx
PUBLIC_LINK_LIBRARIES O2::TOFWorkflowUtils
)


This file was deleted.

22 changes: 3 additions & 19 deletions Detectors/TOF/compression/include/TOFCompression/Compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Compressor

public:
Compressor() = default;
~Compressor();
~Compressor() = default;

inline bool run()
{
Expand All @@ -43,16 +43,11 @@ class Compressor
return false;
};

bool init();
bool open(const std::string inFileName, const std::string outFileName);
bool close();
inline bool read() { return decoderRead(); };
inline void rewind()
{
decoderRewind();
encoderRewind();
};
inline bool write() { return encoderWrite(); };

void checkSummary();
void resetCounters();
Expand All @@ -79,10 +74,6 @@ class Compressor

/** decoder private functions and data members **/

bool decoderInit();
bool decoderOpen(const std::string name);
bool decoderRead();
bool decoderClose();
bool decoderParanoid();
inline void decoderRewind() { mDecoderPointer = reinterpret_cast<uint32_t*>(mDecoderBuffer); };
inline void decoderNext()
Expand All @@ -97,9 +88,7 @@ class Compressor

std::ifstream mDecoderFile;
char* mDecoderBuffer = nullptr;
bool mOwnDecoderBuffer = false;
long mDecoderBufferSize = 8192;
// long mDecoderBufferSize = 1048576;
long mDecoderBufferSize;
uint32_t* mDecoderPointer = nullptr;
uint32_t* mDecoderPointerMax = nullptr;
uint32_t* mDecoderPointerNext = nullptr;
Expand All @@ -114,18 +103,13 @@ class Compressor

/** encoder private functions and data members **/

bool encoderInit();
bool encoderOpen(const std::string name);
bool encoderWrite();
bool encoderClose();
void encoderSpider(int itrm);
inline void encoderRewind() { mEncoderPointer = reinterpret_cast<uint32_t*>(mEncoderBuffer); };
inline void encoderNext() { mEncoderPointer++; };

std::ofstream mEncoderFile;
char* mEncoderBuffer = nullptr;
bool mOwnEncoderBuffer = false;
long mEncoderBufferSize = 1048576;
long mEncoderBufferSize;
uint32_t* mEncoderPointer = nullptr;
uint32_t* mEncoderPointerMax = nullptr;
uint32_t* mEncoderPointerStart = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "Framework/Task.h"
#include "Framework/DataProcessorSpec.h"
#include "TOFCompression/Compressor.h"
#include "TOFCompression/RawDataFrame.h"
#include <fstream>

using namespace o2::framework;
Expand All @@ -37,12 +36,8 @@ class CompressorTask : public Task
void init(InitContext& ic) final;
void run(ProcessingContext& pc) final;

static DataProcessorSpec getSpec();

private:
Compressor mCompressor;
int mTicks = 0;
RawDataFrame mDataFrame;
};

} // namespace tof
Expand Down
64 changes: 0 additions & 64 deletions Detectors/TOF/compression/include/TOFCompression/RawDataFrame.h

This file was deleted.

50 changes: 0 additions & 50 deletions Detectors/TOF/compression/include/TOFCompression/RawReaderTask.h

This file was deleted.

Loading

0 comments on commit 41f7c02

Please sign in to comment.