From 6463a47e896977bbcaa7ac82fc741ea3bc0b0850 Mon Sep 17 00:00:00 2001
From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de>
Date: Fri, 26 Apr 2024 09:18:40 +0000
Subject: [PATCH] online: Add compat/RTypes.h header for compatability with
 root macros.

---
 algo/base/compat/RTypes.h      | 18 ++++++++++++++++++
 algo/detectors/trd/Cluster2D.h | 11 ++++-------
 algo/detectors/trd/DigiRec.h   | 14 +++++---------
 3 files changed, 27 insertions(+), 16 deletions(-)
 create mode 100644 algo/base/compat/RTypes.h

diff --git a/algo/base/compat/RTypes.h b/algo/base/compat/RTypes.h
new file mode 100644
index 0000000000..5c575f4f94
--- /dev/null
+++ b/algo/base/compat/RTypes.h
@@ -0,0 +1,18 @@
+/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Felix Weiglhofer [committer] */
+#pragma once
+
+/**
+ * @file RTypes.h
+ * @brief Compatibility header for basic ROOT macros.
+**/
+
+#if __has_include(<Rtypes.h>)
+#include <Rtypes.h>
+#else
+#define BIT(n) (1ULL << (n))
+#define SETBIT(n, i) ((n) |= BIT(i))
+#define CLRBIT(n, i) ((n) &= ~BIT(i))
+#define TESTBIT(n, i) ((bool) (((n) &BIT(i)) != 0))
+#endif
diff --git a/algo/detectors/trd/Cluster2D.h b/algo/detectors/trd/Cluster2D.h
index b2b362e350..bd3f4cf293 100644
--- a/algo/detectors/trd/Cluster2D.h
+++ b/algo/detectors/trd/Cluster2D.h
@@ -4,14 +4,11 @@
 
 #pragma once
 
+#include "compat/RTypes.h"
+
 #include <cstdint>
 #include <vector>  // for vector
 
-#define BIT(n) (1ULL << (n))
-#define SETBIT(n, i) ((n) |= BIT(i))
-#define CLRBIT(n, i) ((n) &= ~BIT(i))
-#define TESTBIT(n, i) ((bool) (((n) &BIT(i)) != 0))
-
 class CbmTrdDigi;
 
 namespace cbm::algo::trd
@@ -58,7 +55,7 @@ namespace cbm::algo::trd
     /**
 	 * \brief Add digi to cluster.
 	 * \param[in] index Digi index in TClonesArray.
-	 * \param[in] digi pointer to digi 
+	 * \param[in] digi pointer to digi
 	 */
     void AddDigiIdxPair(int32_t index, const CbmTrdDigi* digi)
     {
@@ -116,7 +113,7 @@ namespace cbm::algo::trd
 
     /** \brief Append digi to cluster
    * \param[in] idx index of digi in TClonesArray
-   * \param[in] digi pointer to digi 
+   * \param[in] digi pointer to digi
    * \param[in] chT RO channel for digi (tilt pairing for FASP) default 0xffff (SPADIC)
    * \param[in] chR RO channel for rect pairing (only for FASP)
    * \param[in] dt update start time of cluster if current digi is prompt
diff --git a/algo/detectors/trd/DigiRec.h b/algo/detectors/trd/DigiRec.h
index 86e7136920..a6ef0cfe5f 100644
--- a/algo/detectors/trd/DigiRec.h
+++ b/algo/detectors/trd/DigiRec.h
@@ -5,21 +5,17 @@
 #pragma once
 
 #include "CbmTrdDigi.h"
-
-#define BIT(n) (1ULL << (n))
-#define SETBIT(n, i) ((n) |= BIT(i))
-#define CLRBIT(n, i) ((n) &= ~BIT(i))
-#define TESTBIT(n, i) ((bool) (((n) &BIT(i)) != 0))
+#include "compat/RTypes.h"
 
 /** @class DigiRec
- ** @brief Extend the TRD(2D) digi class to incorporate FEE calibration. 
+ ** @brief Extend the TRD(2D) digi class to incorporate FEE calibration.
  ** @author Alexandru Bercucic <abercuci@niham.nipne.ro>
  ** @since 01.10.2021
  ** @date 01.10.2021
  **
  ** The digi class contains the information as it is produced by the FEE (ASIC/GETS)
  ** The variation from channel to channel is captured by running the pulser on anode wires
- ** using various signal values, frequencies, etc. The calibrated baselines, gains, jitter, 
+ ** using various signal values, frequencies, etc. The calibrated baselines, gains, jitter,
  ** etc. are transported via the parameter files and are applied to the data within the digRec
  ** class which is in the end used to calculate the TRD hit parameters.
  **/
@@ -48,12 +44,12 @@ namespace cbm::algo::trd
     /** \brief Return calibrated rect time [ns]*/
     double GetRectTime() const { return GetTime(1); }
     /** \brief Return calibrated signal
-   * \param[in] typ tilt [0], rect [1] 
+   * \param[in] typ tilt [0], rect [1]
    * \param[out] on flag signal exists
    */
     double GetCharge(int typ, bool& on) const;
     /** \brief Return calibrated time
-   * \param[in] typ tilt [0], rect [1] 
+   * \param[in] typ tilt [0], rect [1]
   */
     double GetTime(int typ) const;
     bool HasRectOvf() const { return TESTBIT(fStatus, 1); }
-- 
GitLab