Project
Loading...
Searching...
No Matches
HV.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
12#include "HV.h"
13
20
21namespace o2::mch::dcs
22{
23
25{
26 double xmean = 0.0;
27 int n = 0;
28 for (auto ch = 0; ch < 64; ++ch) {
29 auto pad = seg.findPadByFEE(dsId, ch);
30 if (seg.isValid(pad)) {
31 double x = seg.padPositionX(pad);
32 n++;
33 xmean += x;
34 }
35 }
36 return xmean / n;
37}
38
39std::set<DsIndex> hvAliasToDsIndices(std::string_view alias)
40{
41 const auto chamber = aliasToChamber(alias);
42 bool slat = isSlat(chamber);
43 int deId = aliasToDetElemId(alias).value();
44 std::set<DsIndex> indices;
45 for (DsIndex dsIndex = 0; dsIndex < o2::mch::NumberOfDualSampas; ++dsIndex) {
46 const auto& dd = getDsDetId(dsIndex);
47 if (dd.deId() != deId) {
48 continue;
49 }
50 if (slat) {
51 indices.emplace(dsIndex);
52 } else {
53 const auto& seg = o2::mch::mapping::segmentation(deId);
54 auto xref = 10 * findXmean(seg, dd.dsId());
55 int sector{-1};
56 double x0, x1, x2, x3;
57 if (dd.deId() < 300) {
58 x0 = -10,
59 x1 = 291.65;
60 x2 = 585.65;
61 x3 = 879.65;
62
63 } else {
64 x0 = -140;
65 x1 = 283.75;
66 x2 = 606.25;
67 x3 = 1158.75;
68 }
69 if (xref < x0) {
70 throw std::invalid_argument("x<x0");
71 }
72 if (xref < x1) {
73 sector = 0;
74 } else if (xref < x2) {
75 sector = 1;
76 } else if (xref < x3) {
77 sector = 2;
78 }
79 const auto number = aliasToNumber(alias);
80 if (sector == number % 10) {
81 indices.emplace(dsIndex);
82 }
83 }
84 }
85 return indices;
86}
87
88} // namespace o2::mch::dcs
o2::mch::mapping::CathodeSegmentation seg
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
int findPadByFEE(int dualSampaId, int dualSampaChannel) const
double padPositionX(int catPadIndex) const
bool isValid(int catPadIndex) const
Not every integer is a valid catPadIndex. This method will tell if catPadIndex is a valid one.
A Segmentation lets you find pads of a detection element and then inspect those pads.
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLsizei GLenum const void * indices
Definition glcorearb.h:400
GLuint GLfloat x0
Definition glcorearb.h:5034
Chamber aliasToChamber(std::string_view alias)
Definition Chamber.cxx:100
std::set< DsIndex > hvAliasToDsIndices(std::string_view alias)
Definition HV.cxx:39
std::optional< Chamber > chamber(int chamberId)
Definition Chamber.cxx:17
int aliasToNumber(std::string_view dcsAlias)
Definition Number.cxx:30
bool isSlat(Chamber chamber)
Definition Chamber.cxx:53
double findXmean(const o2::mch::mapping::Segmentation &seg, int dsId)
Definition HV.cxx:24
std::optional< int > aliasToDetElemId(std::string_view dcsAlias)
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
uint16_t DsIndex
Definition DsIndex.h:26
constexpr uint16_t NumberOfDualSampas
Definition DsIndex.h:28
o2::mch::raw::DsDetId getDsDetId(DsIndex dsIndex)
Definition DsIndex.cxx:90