Project
Loading...
Searching...
No Matches
MpArea.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
16#include "MIDBase/MpArea.h"
17
18namespace o2
19{
20namespace mid
21{
22//______________________________________________________________________________
23MpArea::MpArea(double x1, double y1, double x2, double y2) : mPositions()
24{
26 mPositions[0] = (x1 < x2) ? x1 : x2;
27 mPositions[2] = (x1 < x2) ? x2 : x1;
28 mPositions[1] = (y1 < y2) ? y1 : y2;
29 mPositions[3] = (y1 < y2) ? y2 : y1;
30}
31
32//______________________________________________________________________________
33double MpArea::getCenterX() const
34{
36 return 0.5 * (getXmax() + getXmin());
37}
38
39//______________________________________________________________________________
40double MpArea::getCenterY() const
41{
43 return 0.5 * (getYmax() + getYmin());
44}
45
46//______________________________________________________________________________
48{
50 return 0.5 * (getXmax() - getXmin());
51}
52
53//______________________________________________________________________________
55{
57 return 0.5 * (getYmax() - getYmin());
58}
59
60//______________________________________________________________________________
61bool MpArea::isValid() const
62{
64 for (int icoor = 0; icoor < 2; ++icoor) {
65 if (mPositions[icoor] == mPositions[icoor + 2]) {
66 return false;
67 }
68 }
69 return true;
70}
71
72} // namespace mid
73} // namespace o2
Mapping area for MID.
bool isValid() const
Definition MpArea.cxx:61
double getXmax() const
Get x max.
Definition MpArea.h:49
double getHalfSizeX() const
Definition MpArea.cxx:47
double getCenterY() const
Definition MpArea.cxx:40
double getYmin() const
Get y min.
Definition MpArea.h:51
double getHalfSizeY() const
Definition MpArea.cxx:54
double getYmax() const
Get y max.
Definition MpArea.h:53
double getCenterX() const
Definition MpArea.cxx:33
double getXmin() const
Get x min.
Definition MpArea.h:47
MpArea(double x1=0., double y1=0., double x2=0., double y2=0.)
Definition MpArea.cxx:23
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition glcorearb.h:5034
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...