17#ifndef O2_MCH_MAPPING_CATHODESEGMENTATION_H
18#define O2_MCH_MAPPING_CATHODESEGMENTATION_H
70 mDetElemId{detElemId},
74 throw std::runtime_error(
"no mch mapping implementaion found : did you forget to link with an actual implementation library (e.g. O2MCHMappingImpl4) ? ");
78 throw std::runtime_error(
"Can not create segmentation for DE " +
std::to_string(detElemId) +
79 (mIsBendingPlane ?
" Bending" :
" NonBending"));
81 std::vector<int> dpid;
84 auto fn =
static_cast<decltype(&addDualSampaId)
>(
data);
98 return mDetElemId == rhs.mDetElemId && mIsBendingPlane == rhs.mIsBendingPlane;
108 swap(
a.mDualSampaIds,
b.mDualSampaIds);
109 swap(
a.mDetElemId,
b.mDetElemId);
110 swap(
a.mIsBendingPlane,
b.mIsBendingPlane);
111 swap(
a.mNofPads,
b.mNofPads);
116 mDetElemId =
seg.mDetElemId;
117 mIsBendingPlane =
seg.mIsBendingPlane;
119 mDualSampaIds =
seg.mDualSampaIds;
120 mNofPads =
seg.mNofPads;
156 if (dualSampaChannel < 0 || dualSampaChannel > 63) {
157 throw std::out_of_range(
"dualSampaChannel should be between 0 and 63");
183 int dualSampaId(
int dualSampaIndex)
const {
return mDualSampaIds[dualSampaIndex]; }
194 template <
typename CALLABLE>
197 template <
typename CALLABLE>
198 void forEachPadInArea(
double xmin,
double ymin,
double xmax,
double ymax, CALLABLE&&
func)
const;
200 template <
typename CALLABLE>
203 template <
typename CALLABLE>
208 std::vector<int> mDualSampaIds;
210 bool mIsBendingPlane;
214template <
typename CALLABLE>
217 auto callback = [](
void*
data,
int catPadIndex) {
218 auto fn =
static_cast<decltype(&
func)
>(
data);
224template <
typename CALLABLE>
227 auto callback = [](
void*
data,
int catPadIndex) {
228 auto fn =
static_cast<decltype(&
func)
>(
data);
234template <
typename CALLABLE>
242template <
typename CALLABLE>
245 auto callback = [](
void*
data,
int puid) {
246 auto fn =
static_cast<decltype(&
func)
>(
data);
255 auto fn =
static_cast<decltype(&
func)
>(
data);
262template <
typename CALLABLE>
265 auto callback = [](
void*
data,
int detElemId) {
266 auto fn =
static_cast<decltype(&
func)
>(
data);
273template <
typename CALLABLE>
276 auto callback = [](
void*
data,
int detElemId) {
277 auto fn =
static_cast<decltype(&
func)
>(
data);
293 <<
"X " << std::setw(7) << std::setprecision(2) <<
padPositionX(catPadIndex)
294 <<
"Y " << std::setw(7) << std::setprecision(2) <<
padPositionY(catPadIndex)
295 <<
"SX " << std::setw(7) << std::setprecision(2) <<
padSizeX(catPadIndex)
296 <<
"SY " << std::setw(7) << std::setprecision(2) <<
padSizeY(catPadIndex);
o2::mch::mapping::CathodeSegmentation seg
O2MCHMAPPINGIMPL3_EXPORT double mchCathodeSegmentationPadPositionY(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL3_EXPORT double mchCathodeSegmentationPadSizeY(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL3_EXPORT int mchCathodeSegmentationPadDualSampaId(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL3_EXPORT int mchCathodeSegmentationIsPadValid(MchCathodeSegmentationHandle segHandle, int catPadIndex)
Return > 0 if catPadIndex is a valid one or <= 1 if not.
O2MCHMAPPINGIMPL3_EXPORT int mchCathodeSegmentationFindPadByPosition(MchCathodeSegmentationHandle segHandle, double x, double y)
Find the pad at position (x,y) (in cm).
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForEachNeighbouringPad(MchCathodeSegmentationHandle segHandle, int catPadIndex, MchPadHandler handler, void *userData)
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForEachPadInArea(MchCathodeSegmentationHandle segHandle, double xmin, double ymin, double xmax, double ymax, MchPadHandler handler, void *clientData)
O2MCHMAPPINGIMPL3_EXPORT double mchCathodeSegmentationPadSizeX(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL3_EXPORT int mchCathodeSegmentationFindPadByFEE(MchCathodeSegmentationHandle segHandle, int dualSampaId, int dualSampaChannel)
Find the pad connected to the given channel of the given dual sampa.
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForEachDualSampa(MchCathodeSegmentationHandle segHandle, MchDualSampaHandler handler, void *clientData)
O2MCHMAPPINGIMPL3_EXPORT double mchCathodeSegmentationPadPositionX(MchCathodeSegmentationHandle segHandle, int catPadIndex)
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForOneDetectionElementOfEachSegmentationType(MchDetectionElementHandler handler, void *clientData)
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForEachDetectionElement(MchDetectionElementHandler handler, void *clientData)
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationDestruct(MchCathodeSegmentationHandle sh)
Delete a segmentation handle.
O2MCHMAPPINGIMPL3_EXPORT void mchCathodeSegmentationForEachPadInDualSampa(MchCathodeSegmentationHandle segHandle, int dualSampaId, MchPadHandler handler, void *clientData)
O2MCHMAPPINGIMPL3_EXPORT MchCathodeSegmentationHandle mchCathodeSegmentationConstruct(int detElemId, bool isBendingPlane)
Create a handle to a segmentation for a given plane of a detection element.
O2MCHMAPPINGIMPL3_EXPORT int mchCathodeSegmentationPadDualSampaChannel(MchCathodeSegmentationHandle segHandle, int catPadIndex)
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
A CathodeSegmentation lets you find pads on a given plane (cathode) of a detection element and then i...
int dualSampaId(int dualSampaIndex) const
void forEachPad(CALLABLE &&func) const
CathodeSegmentation(const CathodeSegmentation &seg)
double padSizeY(int catPadIndex) const
double padSizeX(int catPadIndex) const
void forEachPadInDualSampa(int dualSampaId, CALLABLE &&func) const
std::string padAsString(int catPadIndex) const
CathodeSegmentation(int detElemId, bool isBendingPlane)
This ctor throws if detElemId is invalid.
bool operator!=(const CathodeSegmentation &rhs) const
int nofDualSampas() const
int padDualSampaChannel(int catPadIndex) const
int padDualSampaId(int catPadIndex) const
void forEachDualSampa(std::function< void(int dualSampaId)> func) const
Loop over dual sampas of this detection element.
void forEachPadInArea(double xmin, double ymin, double xmax, double ymax, CALLABLE &&func) const
int findPadByPosition(double x, double y) const
double padPositionY(int catPadIndex) const
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
double padPositionX(int catPadIndex) const
CathodeSegmentation & operator=(CathodeSegmentation seg)
bool isBendingPlane() const
void forEachNeighbouringPad(int catPadIndex, CALLABLE &&func) const
bool isValid(int catPadIndex) const
Not every integer is a valid catPadIndex. This method will tell if catPadIndex is a valid one.
bool operator==(const CathodeSegmentation &rhs) const
friend void swap(CathodeSegmentation &a, CathodeSegmentation &b)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
constexpr std::array< std::string_view, BasicOp::Conditional+1 > mapping
a map between BasicOp and tokens in string expressions
void forOneDetectionElementOfEachSegmentationType(CALLABLE &&func)
void forEachDetectionElement(CALLABLE &&func)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)