Project
Loading...
Searching...
No Matches
Mapping.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 O2_MID_MAPPING_H
17#define O2_MID_MAPPING_H
18
19#include <array>
20#include <vector>
21#include "MIDBase/MpArea.h"
22
23namespace o2
24{
25namespace mid
26{
28{
29 public:
30 Mapping();
31 virtual ~Mapping() = default;
32
34 struct MpStripIndex {
36 bool isValid() { return (column < 7 && line < 4 && strip < 16); }
37 int column;
38 int line;
39 int strip;
40 };
41
42 MpArea stripByLocation(int strip, int cathode, int line, int column, int deId, bool warn = true) const;
43 MpArea stripByLocationInBoard(int strip, int cathode, int boardId, int chamber, bool warn = true) const;
44 // MpArea stripByPosition(double xPos, double yPos, int cathode, int deId, bool warn = true) const;
45 MpStripIndex stripByPosition(double xPos, double yPos, int cathode, int deId, bool warn = true) const;
46
47 double getStripSize(int strip, int cathode, int column, int deId) const;
48 int getNStripsNBP(int column, int deId) const;
49 int getFirstColumn(int deId) const;
50 int getFirstBoardBP(int column, int deId) const;
51 int getLastBoardBP(int column, int deId) const;
52 int getBoardId(int line, int column, int deId, bool warn = true) const;
53 std::vector<MpStripIndex> getNeighbours(const Mapping::MpStripIndex& stripIndex, int cathode, int deId) const;
54 bool isValid(int deId, int column, int cathode = 0, int line = 0, int strip = 0) const;
55
56 MpStripIndex nextStrip(const MpStripIndex& stripIndex, int cathode, int deId, bool descending = false) const;
57
58 private:
60 struct MpColumn {
61 int nStripsNBP;
62 int stripPitchNBP;
63 int stripPitchBP;
64 std::vector<int> boardsBP;
65 };
66
68 struct MpDE {
69 std::array<MpColumn, 7> columns;
70 };
71
73 struct MpBoardIndex {
74 int deType;
75 int column;
76 int line;
77 };
78
79 void init();
80 void setupSegmentation(int rpcLine, int column, int nStripsNBP, int stripPitchNBP, int nBoardsBP, int firstBoardId,
81 bool isBelowBeamPipe = false);
82 void setupSegmentationLastColumn(int rpcLine, int boardId);
83 void buildDETypeLarge(int rpcLine, std::array<int, 7> boards);
84 void buildDETypeMedium(int rpcLine, std::array<int, 7> boards, bool largeNonBend);
85 void buildDETypeCut(int rpcLine, std::array<int, 7> boards, bool isBelowBeamPipe);
86 void buildDETypeShort(int rpcLine, std::array<int, 7> boards);
87 double getStripSize(int chamber, int stripPitch, int strip = 0) const;
88 double getColumnLeftPosition(int column, int chamber, int rpcLine) const;
89 double getColumnBottomPosition(int column, int chamber, int rpcLine) const;
90 double getColumnHeight(int column, int chamber, int rpcLine) const;
91 double getColumnWidth(int column, int chamber, int rpcLine) const;
92 double getStripLowEdge(int strip, int stripPitch, int line, int chamber) const;
93 double getStripLeftEdge(int strip, int stripPitch, int column, int chamber, int rpcLine) const;
94 int getColumn(double xPos, int chamber, int rpcLine) const;
95 int getLine(double yPos, const MpColumn& column, int chamber) const;
96 bool isValidColumn(int column, int rpcLine) const;
97 bool isValidLine(int line, int column, int rpcLine) const;
98 std::vector<MpStripIndex> getNeighboursBP(const MpStripIndex& stripIndex, int rpcLine) const;
99 std::vector<MpStripIndex> getNeighboursNBP(const MpStripIndex& stripIndex, int rpcLine) const;
100
101 std::array<MpDE, 9> mDetectionElements;
102 std::array<MpBoardIndex, 118> mBoardIndexes;
103};
104} // namespace mid
105} // namespace o2
106
107#endif /* O2_MID_MAPPING_H */
Mapping area for MID.
int getNStripsNBP(int column, int deId) const
Definition Mapping.cxx:159
int getBoardId(int line, int column, int deId, bool warn=true) const
Definition Mapping.cxx:202
int getFirstColumn(int deId) const
Definition Mapping.cxx:169
bool isValid(int deId, int column, int cathode=0, int line=0, int strip=0) const
Definition Mapping.cxx:361
virtual ~Mapping()=default
MpStripIndex stripByPosition(double xPos, double yPos, int cathode, int deId, bool warn=true) const
Definition Mapping.cxx:592
MpArea stripByLocationInBoard(int strip, int cathode, int boardId, int chamber, bool warn=true) const
Definition Mapping.cxx:526
int getLastBoardBP(int column, int deId) const
Definition Mapping.cxx:188
int getFirstBoardBP(int column, int deId) const
Definition Mapping.cxx:178
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
std::vector< MpStripIndex > getNeighbours(const Mapping::MpStripIndex &stripIndex, int cathode, int deId) const
Definition Mapping.cxx:227
MpStripIndex nextStrip(const MpStripIndex &stripIndex, int cathode, int deId, bool descending=false) const
Definition Mapping.cxx:323
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Indexes required to define a strip in the detection element.
Definition Mapping.h:34
int strip
Line of the local board in the column.
Definition Mapping.h:39
bool isValid()
Check if Strip is Valid.
Definition Mapping.h:36
int line
Column in the DE.
Definition Mapping.h:38