Skip to content
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
50 changes: 50 additions & 0 deletions DataFormats/simulation/include/SimulationDataFormat/TimeStamp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN 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 ALICEO2_SIM_TIMESTAMP_H
#define ALICEO2_SIM_TIMESTAMP_H

#include "Rtypes.h"

namespace o2
{
namespace dataformats
{
// A minimal TimeStamp class for simulation in the spirit of FairTimeStamp
// but without having FairLinks attached
template <typename T>
class TimeStamp
{
public:
TimeStamp() = default;
TimeStamp(T time) { mTimeStamp = time; }
T getTimeStamp() const { return mTimeStamp; }
void setTimeStamp(T t) { mTimeStamp = t; }
private:
T mTimeStamp = 0;
ClassDefNV(TimeStamp, 1);
};

template <typename T, typename E>
class TimeStampWithError : public TimeStamp<T>
{
public:
TimeStampWithError() = default;
TimeStampWithError(T t, E te) : TimeStamp<T>(t), mTimeStampError(te) {}
E getTimeStampError() const { return mTimeStampError; }
void setTimeStampError(E te) { mTimeStampError = te; }
private:
E mTimeStampError = 0;
ClassDefNV(TimeStampWithError, 1);
};
}
}

#endif /* ALICEO2_SIM_TIMESTAMP_H */
8 changes: 8 additions & 0 deletions DataFormats/simulation/src/SimulationDataLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@
#pragma link C++ class std::vector<o2::MCCompLabel>+;
#pragma link C++ class std::vector<o2::dataformats::MCTruthHeaderElement>+;

// make all sorts of dictionaries for TimeStamp
#pragma link C++ class o2::dataformats::TimeStamp<float>+;
#pragma link C++ class o2::dataformats::TimeStamp<double>+;
#pragma link C++ class o2::dataformats::TimeStamp<int>+;
#pragma link C++ class o2::dataformats::TimeStampWithError<float, float>+;
#pragma link C++ class o2::dataformats::TimeStampWithError<double, double>+;
#pragma link C++ class o2::dataformats::TimeStampWithError<int, int>+;

#endif
11 changes: 10 additions & 1 deletion DataFormats/simulation/test/testBasicHits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "SimulationDataFormat/BaseHits.h"
#include "Math/GenVector/Transform3D.h"
#include "SimulationDataFormat/BaseHits.h"
#include "SimulationDataFormat/TimeStamp.h"
#include "TFile.h"

namespace o2
Expand Down Expand Up @@ -85,4 +86,12 @@ BOOST_AUTO_TEST_CASE(BasicXYZHit_ROOTIO)
}
}

// basic TimeStamp tests
BOOST_AUTO_TEST_CASE(TimeStamp)
{
o2::dataformats::TimeStampWithError<float, float> aTimeStamp(10., 0.1);
BOOST_CHECK_CLOSE(aTimeStamp.getTimeStampError(), 0.1, 1E-4);
BOOST_CHECK_CLOSE(aTimeStamp.getTimeStamp(), 10, 1E-4);
}

} // end namespace AliceO2
2 changes: 0 additions & 2 deletions Detectors/ITSMFT/ITS/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ set(SRCS
src/V3Layer.cxx
src/Detector.cxx
src/DigitizerTask.cxx
src/DigitWriteoutBuffer.cxx
)
set(HEADERS
include/${MODULE_NAME}/Detector.h
include/${MODULE_NAME}/DigitWriteoutBuffer.h
include/${MODULE_NAME}/DigitizerTask.h
include/${MODULE_NAME}/V1Layer.h
include/${MODULE_NAME}/V3Layer.h
Expand Down

This file was deleted.

77 changes: 0 additions & 77 deletions Detectors/ITSMFT/ITS/simulation/src/DigitWriteoutBuffer.cxx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma link C++ class o2::ITS::V3Layer+;
#pragma link C++ class o2::ITS::Detector+;
#pragma link C++ class o2::Base::DetImpl<o2::ITS::Detector>+;
#pragma link C++ class o2::ITS::DigitWriteoutBuffer+;
#pragma link C++ class o2::ITS::DigitizerTask+;

#endif
61 changes: 8 additions & 53 deletions Detectors/ITSMFT/common/base/include/ITSMFTBase/Digit.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,9 @@
#ifndef ALICEO2_ITSMFT_DIGIT_H
#define ALICEO2_ITSMFT_DIGIT_H

#ifndef __CLING__

#include <boost/serialization/base_object.hpp> // for base_object

#endif

#include "Rtypes.h" // for Double_t, ULong_t, etc
#include "SimulationDataFormat/MCCompLabel.h"
#include "FairTimeStamp.h" // for FairTimeStamp
#include "Rtypes.h" // for Double_t, ULong_t, etc

namespace boost
{
namespace serialization
{
class access;
}
}
#include "SimulationDataFormat/TimeStamp.h"

namespace o2
{
Expand All @@ -39,7 +25,9 @@ namespace ITSMFT
/// \class Digit
/// \brief Digit class for the ITS
///
class Digit : public FairTimeStamp

using DigitBase = o2::dataformats::TimeStamp<double>;
class Digit : public DigitBase
{
using Label = o2::MCCompLabel;

Expand All @@ -58,7 +46,7 @@ class Digit : public FairTimeStamp
Digit(UShort_t chipindex, UInt_t frame, UShort_t row, UShort_t col, Float_t charge, Double_t timestamp);

/// Destructor
~Digit() override;
~Digit();

/// Addition operator
/// Adds the charge of 2 digits
Expand Down Expand Up @@ -144,18 +132,6 @@ class Digit : public FairTimeStamp
return static_cast<UInt_t>(key>>(8*(sizeof(UInt_t)+ROFrameOverFlowBits)));
}

bool equal(FairTimeStamp* other) override
{
Digit* mydigi = dynamic_cast<Digit*>(other);
if (mydigi) {
if (mChipIndex == mydigi->getChipIndex() && mCol == mydigi->getColumn() &&
mRow == mydigi->getRow() && getROFrame() == mydigi->getROFrame()) {
return true;
}
}
return false;
}

/// Test if the current digit is lower than the other
/// Comparison is done based on the chip index and pixel index. Two
/// options are possible for true:
Expand All @@ -164,7 +140,6 @@ class Digit : public FairTimeStamp
/// @param other The digit to compare with
/// @return True if this digit has a lower total index, false otherwise
//
using FairTimeStamp::operator<; // to avoid hiding
virtual bool operator<(const Digit& other) const
{
/* if (mChipIndex < other.mChipIndex || */
Expand All @@ -190,27 +165,7 @@ class Digit : public FairTimeStamp
return output;
}

/// Serialization method of the Digit using boost serialization
/// @param ar Archive where digit is appended
/// @param version Unused
template <class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<FairTimeStamp>(*this);
ar& mChipIndex;
ar& mRow;
ar& mCol;
ar& mCharge;
ar& mROFrame;
ar& mLabels;
}

private:
#ifndef __CLING__

friend class boost::serialization::access;

#endif
UShort_t mChipIndex = 0; ///< Chip index
UShort_t mRow = 0; ///< Pixel index in X
UShort_t mCol = 0; ///< Pixel index in Z
Expand All @@ -221,8 +176,8 @@ class Digit : public FairTimeStamp
static constexpr int ROFrameOverFlowBits = 3; ///< max bits occupied by ROFrame overflow record
static constexpr UInt_t ROFrameOverFlowMask = (0x1<<ROFrameOverFlowBits)-1; //< mask for ROFrame overflow record
static constexpr UInt_t ROFrameMask = ~ROFrameOverFlowMask; //< mask for ROFrame record
ClassDefOverride(Digit, 3);

ClassDefNV(Digit, 3);
};
}
}
Expand Down
7 changes: 4 additions & 3 deletions Detectors/ITSMFT/common/base/src/Digit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
/// \brief Implementation of the ITSMFT digit

#include "ITSMFTBase/Digit.h"
#include <iostream>

ClassImp(o2::ITSMFT::Digit)

using namespace o2::ITSMFT;

Digit::Digit(UShort_t chipindex, UInt_t frame, UShort_t row, UShort_t col, Float_t charge, Double_t time)
: FairTimeStamp(time), mChipIndex(chipindex), mRow(row), mCol(col), mCharge(charge), mROFrame(0)
: DigitBase(time), mChipIndex(chipindex), mRow(row), mCol(col), mCharge(charge), mROFrame(0)
{
setROFrame(frame);
}
Expand Down Expand Up @@ -52,8 +53,8 @@ const Digit Digit::operator+(const Digit& other)

std::ostream& Digit::print(std::ostream& output) const
{
output << "ITSMFTDigit chip [" << mChipIndex << "] R:" << mRow << " C:" << mCol << " Q: "
<< mCharge << "ROFrame " << getROFrame() << "(" << getNOverflowFrames() << ") time " << fTimeStamp;
output << "ITSMFTDigit chip [" << mChipIndex << "] R:" << mRow << " C:" << mCol << " Q: " << mCharge << "ROFrame "
<< getROFrame() << "(" << getNOverflowFrames() << ") time " << getTimeStamp();
for (int i=0;i<maxLabels;i++) {
if ( mLabels[i].isEmpty() ) break;
output << " Lb" << i << ' ' << mLabels[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef ALICEO2_ITSMFT_CLUSTER_H
#define ALICEO2_ITSMFT_CLUSTER_H

//#include "FairTimeStamp.h" // for FairTimeStamp
#include "DetectorsBase/BaseCluster.h"

// uncomment this to have cluster topology stored
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Bool_t DigitPixelReader::getNextChipData(PixelReader::ChipPixelData &chipData)
}
chipData.chipID = mLastDigit->getChipIndex();
chipData.roFrame = mLastDigit->getROFrame();
chipData.timeStamp = mLastDigit->GetTimeStamp(); // time difference within the same TFrame does not matter, take 1st one
chipData.timeStamp =
mLastDigit->getTimeStamp(); // time difference within the same TFrame does not matter, take 1st one
chipData.pixels.emplace_back(mLastDigit);
mLastDigit = nullptr;

Expand Down
Loading