Skip to content
Snippets Groups Projects
Commit 56986549 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

Prepare TOF and TZD digis for switch to TZD in unpack, event build and reco

- Add usage of address field to TzdDigi
- Conversion constructor from TOF to TZD digis
- Conversion constructor from TZD to TOF digis
- Serializer and dictionary for TZD digi
- Adapt Tzd Digitizer to provide default value for new address field
parent 1b8ed150
No related branches found
No related tags found
1 merge request!1019Support for CbmTzdDigi in unpacking, event builder and TOF reco.
/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */
Authors: Pierre-Alain Loizeau, Volker Friese [committer] */
#include "CbmTzdDigi.h"
#include "CbmTofDigi.h"
CbmTzdDigi::CbmTzdDigi(const CbmTofDigi& digi)
: fAddress(digi.GetAddress())
, fTime(digi.GetTime())
, fCharge(digi.GetCharge())
{
}
CbmTzdDigi::CbmTzdDigi(const CbmTofDigi* digi)
: fAddress(digi->GetAddress())
, fTime(digi->GetTime())
, fCharge(digi->GetCharge())
{
}
/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese [committer] */
Authors: Pierre-Alain Loizeau, Volker Friese [committer] */
#ifndef CBMTZDDIGI_H
......@@ -8,8 +8,19 @@
#include "CbmDefs.h"
#ifndef NO_ROOT
#include <Rtypes.h> // for ClassDef
#endif
#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
#include <cstdint>
#ifndef CBMTOFDIGI_H
class CbmTofDigi; // For declaration of the conversion constructor without starting a cyclic dependency
#endif // CBMTOFDIGI_H
/** @class CbmTzdDigi
** @brief Data class for a signal in the t-zero detector
**
......@@ -19,11 +30,28 @@
class CbmTzdDigi {
public:
/** @brief Default Constructor
**/
CbmTzdDigi() = default;
/** @brief Constructor
** @param time Measurement time [ns]
** @param charge Measured charge]
** @param address [32b CbmAddress]
**/
CbmTzdDigi(int32_t addr, double time, float charge) : fAddress(addr), fTime(time), fCharge(charge) {};
/** @brief Constructor
** @param reference to CbmTofDigi (equivalent content)
**/
CbmTzdDigi(const CbmTofDigi& digi);
/** @brief Constructor
** @param pointer to const CbmTofDigi object (equivalent content)
**/
CbmTzdDigi(double time = -1., float charge = -1.) : fTime(time), fCharge(charge) {};
CbmTzdDigi(const CbmTofDigi* digi);
/** @brief Destructor **/
......@@ -42,28 +70,34 @@ public:
static const char* GetClassName() { return "CbmTzdDigi"; }
/** @brief Charge
** @return Charge
**/
double GetCharge() const { return fCharge; }
/** System ID (static)
** @return System identifier (EcbmModuleId)
**/
static ECbmModuleId GetSystem() { return ECbmModuleId::kT0; }
/** @brief Address
** @return Address
**/
int32_t GetAddress() const { return fAddress; }
/** @brief Time
** @return Time of measurement [ns]
**/
double GetTime() const { return fTime; }
/** @brief Set the measured charge
** @param charge Charge
/** @brief Charge
** @return Charge
**/
void SetCharge(float charge) { fCharge = charge; }
double GetCharge() const { return fCharge; }
/** @brief Set the address
** @param address [32b CbmAddress]
**/
void SetAddress(int32_t addr) { fAddress = addr; }
/** @brief Set the measurement time
......@@ -72,10 +106,30 @@ public:
void SetTime(double time) { fTime = time; }
/** @brief Set the measured charge
** @param charge Charge
**/
void SetCharge(float charge) { fCharge = charge; }
private:
int32_t fAddress = ToIntegralType<ECbmModuleId>(ECbmModuleId::kT0); ///< Unique CBM address
double fTime = -1.; ///< Time of signal in TZD [ns]
float fCharge = -1.; ///< Charge
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int /*version*/)
{
ar& fAddress;
ar& fTime;
ar& fCharge;
}
#ifndef NO_ROOT
ClassDefNV(CbmTzdDigi, 1);
#endif
};
#endif /* CBMTZDDIGI_H */
......@@ -10,6 +10,8 @@
**/
#include "CbmTofDigi.h"
#include "CbmTzdDigi.h"
#include <iomanip> // for hex, setw, setfill, fixed, setprecission
#include <sstream> // for operator<<, basic_ostream, char_trait
#include <string> // for basic_string
......@@ -34,6 +36,20 @@ CbmTofDigi::CbmTofDigi(uint32_t Sm, uint32_t Rpc, uint32_t Channel, double time,
fuAddress = CbmTofAddress::GetUniqueAddress(Sm, Rpc, Channel, Side, SmType);
}
CbmTofDigi::CbmTofDigi(const CbmTzdDigi& digi)
: fdTime(digi.GetTime())
, fdTot(digi.GetCharge())
, fuAddress(digi.GetAddress())
{
}
CbmTofDigi::CbmTofDigi(const CbmTzdDigi* digi)
: fdTime(digi->GetTime())
, fdTot(digi->GetCharge())
, fuAddress(digi->GetAddress())
{
}
CbmTofDigi::~CbmTofDigi()
{
// if ( fMatch ) delete fMatch;
......
......@@ -40,6 +40,9 @@
#include <string> // for string
//class CbmMatch;
#ifndef CBMTZDDIGI_H
class CbmTzdDigi; // For declaration of the conversion constructor without starting a cyclic dependency
#endif /* CBMTZDDIGI_H */
class CbmTofDigi {
public:
......@@ -69,6 +72,16 @@ public:
CbmTofDigi(uint32_t Sm, uint32_t Rpc, uint32_t Channel, double time, double tot, uint32_t Side = 0,
uint32_t SmType = 0);
/** @brief Constructor
** @param reference to CbmTzdDigi (equivalent content)
**/
CbmTofDigi(const CbmTzdDigi& digi);
/** @brief Constructor
** @param pointer to const CbmTzdDigi object (equivalent content)
**/
CbmTofDigi(const CbmTzdDigi* digi);
/**
** @brief Copy constructor.
**/
......
......@@ -48,7 +48,7 @@ void CbmTzdDigitize::Exec(Option_t*)
// --- Create digi and send it to DAQ
double digiTime = fCurrentEventTime + gRandom->Gaus(0., fResolution);
double charge = 1.; // Placeholder
CbmTzdDigi* digi = new CbmTzdDigi(digiTime, charge);
CbmTzdDigi* digi = new CbmTzdDigi(ToIntegralType<ECbmModuleId>(ECbmModuleId::kT0), digiTime, charge);
if (fCreateMatches) {
CbmMatch* digiMatch = new CbmMatch();
digiMatch->AddLink(1., -1, fCurrentMCEntry, fCurrentInput);
......
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