Project
Loading...
Searching...
No Matches
Digit2ElecMapper.cxx
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
13
15#include "Framework/Logger.h"
17
18namespace o2::mch::raw
19{
20// create a function that return the (DsElecId,dualSampaChannelId) of a digit
22{
23 return [det2elec](const o2::mch::Digit& digit) -> std::optional<std::pair<DsElecId, DualSampaChannelId>> {
24 auto deid = digit.getDetID();
25 auto dsid = mapping::segmentation(deid).padDualSampaId(digit.getPadID());
26 DsDetId detId{deid, dsid};
27 auto dselocopt = det2elec(DsDetId(deid, dsid));
28 if (!dselocopt.has_value()) {
29 LOGP(warning, "got no location for (de,ds)=({},{})", deid, dsid);
30 return std::nullopt;
31 }
32 DsElecId elecId = dselocopt.value();
33 auto dualSampaChannelId = mapping::segmentation(deid).padDualSampaChannel(digit.getPadID());
34 return std::make_pair(dselocopt.value(), dualSampaChannelId);
35 };
36}
37
38} // namespace o2::mch::raw
MCH digit implementation.
Definition Digit.h:31
int padDualSampaId(int dePadIndex) const
int padDualSampaChannel(int dePadIndex) const
A DsDetId is just a pair (detection element id, dual sampa id)
Definition DsDetId.h:22
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
std::function< std::optional< std::pair< DsElecId, int > >(const o2::mch::Digit &digit)> Digit2ElecMapper
std::function< std::optional< DsElecId >(DsDetId id)> Det2ElecMapper
From (deId,dsId) to (solarId,groupId,index)
Definition Mapper.h:47
Digit2ElecMapper createDigit2ElecMapper(Det2ElecMapper det2elec)