Project
Loading...
Searching...
No Matches
Helpers.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16#ifndef ALICEO2_DATAFORMATSTPC_HELPERS_H
17#define ALICEO2_DATAFORMATSTPC_HELPERS_H
18
19#include <memory>
20#include <cstring> // for memset
22
23namespace o2
24{
25class MCCompLabel;
26namespace dataformats
27{
28template <class T>
30}
31} // namespace o2
32
33namespace o2
34{
35namespace tpc
36{
37template <unsigned int size>
39{
40 // We cannot use a union because that prevents ROOT streaming, so we just block 8 kb and reinterpret_cast to
41 // ClusterHardwareContainer
42 public:
43 ClusterHardwareContainer* getContainer() { return (reinterpret_cast<ClusterHardwareContainer*>(mFixSize)); }
44 ClusterHardwareContainer const* getContainer() const { return (reinterpret_cast<ClusterHardwareContainer const*>(mFixSize)); }
45 constexpr int getMaxNumberOfClusters()
46 {
47 static_assert(sizeof(*this) == sizeof(mFixSize));
48 return ((sizeof(mFixSize) - sizeof(ClusterHardwareContainer)) / sizeof(ClusterHardware));
49 }
51
52 private:
53 uint8_t mFixSize[size];
54
55 static_assert(size <= 8192, "Size must be below 8 kb");
56 static_assert(size >= sizeof(ClusterHardwareContainer), "Size must be at least sizeof(ClusterHardwareContainer)");
57};
59
61 char data[8192];
62};
63
64} // namespace tpc
65} // namespace o2
66
67#endif
Class of a TPC cluster as produced by the hardware cluster finder (needs a postprocessing step to con...
ClusterHardwareContainer const * getContainer() const
Definition Helpers.h:44
ClusterHardwareContainer * getContainer()
Definition Helpers.h:43
GLsizeiptr size
Definition glcorearb.h:659
GLboolean * data
Definition glcorearb.h:298
ClusterHardwareContainerFixedSize< 8192 > ClusterHardwareContainer8kb
Definition Helpers.h:58
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...