Project
Loading...
Searching...
No Matches
PreClusterHelper.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
17
18namespace o2
19{
20namespace mid
21{
22
24{
31 MpArea first = mMapping.stripByLocation(pc.firstStrip, pc.cathode, pc.firstLine, pc.firstColumn, pc.deId, false);
32 float firstX = first.getXmin();
33 float firstY = first.getYmin();
34 float lastX = 0., lastY = 0.;
35 if (pc.cathode == 0) {
36 int nStripsInBetween = pc.lastStrip - pc.firstStrip + 16 * (pc.lastLine - pc.firstLine);
37 lastX = first.getXmax();
38 lastY = first.getYmax() + nStripsInBetween * mMapping.getStripSize(0, 0, pc.firstColumn, pc.deId);
39 } else {
40 MpArea last = mMapping.stripByLocation(pc.lastStrip, pc.cathode, 0, pc.lastColumn, pc.deId, false);
41 lastX = last.getXmax();
42 lastY = (last.getYmax() > first.getYmax()) ? last.getYmax() : first.getYmax();
43 if (firstY > last.getYmin()) {
44 firstY = last.getYmin();
45 }
46 }
47 return MpArea{firstX, firstY, lastX, lastY};
48}
49
50MpArea PreClusterHelper::getArea(int column, const PreCluster& pc) const
51{
53 if (column > pc.lastColumn || column < pc.firstColumn) {
54 throw std::runtime_error("Required column is not in pre-cluster");
55 }
56 int firstStrip = (column > pc.firstColumn) ? 0 : pc.firstStrip;
57 int lastStrip = (column < pc.lastColumn) ? mMapping.getNStripsNBP(column, pc.deId) - 1 : pc.lastStrip;
58
59 MpArea first = mMapping.stripByLocation(firstStrip, 1, 0, column, pc.deId, false);
60 MpArea last = mMapping.stripByLocation(lastStrip, 1, 0, column, pc.deId, false);
61 return MpArea{first.getXmin(), first.getYmin(), last.getXmax(), last.getYmax()};
62}
63
64} // namespace mid
65} // namespace o2
Pre-clusters helper for MID.
int getNStripsNBP(int column, int deId) const
Definition Mapping.cxx:159
double getStripSize(int strip, int cathode, int column, int deId) const
Definition Mapping.cxx:140
MpArea stripByLocation(int strip, int cathode, int line, int column, int deId, bool warn=true) const
Definition Mapping.cxx:487
MpArea getArea(const PreCluster &pc) const
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint8_t firstLine
First line.
Definition PreCluster.h:33
uint8_t cathode
Cathode.
Definition PreCluster.h:30
uint8_t firstColumn
First column.
Definition PreCluster.h:31
uint8_t lastLine
Last line.
Definition PreCluster.h:34
uint8_t lastStrip
Last strip.
Definition PreCluster.h:36
uint8_t deId
Detection element ID.
Definition PreCluster.h:29
uint8_t lastColumn
Last column.
Definition PreCluster.h:32
uint8_t firstStrip
First strip.
Definition PreCluster.h:35