ATLAS Offline Software
Loading...
Searching...
No Matches
RegSelRoI.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6/**************************************************************************
7 **
8 ** File: RegSelRoI.cxx
9 **
10 ** Description:
11 **
12 **
13 **
14 ** Author: M.Sutton
15 **
16 ** Created: Thu Feb 15 00:19:57 GMT 2007
17 ** Modified:
18 **
19 **
20 **
21 **************************************************************************/
22
23#include "RegSelLUT/RegSelRoI.h"
24
25#include <cmath>
26
27#include <iostream>
28
29static const double M_2PI = 2*M_PI;
30
31RegSelRoI::RegSelRoI(double zMin, double zMax,
32 double phiMin, double phiMax,
33 double etaMin, double etaMax)
34 : m_zMin(zMin), m_zMax(zMax),
35 m_phiMin(phiMin), m_phiMax(phiMax),
36 m_etaMin(etaMin), m_etaMax(etaMax),
37 m_split(false)
38{
39 // calculate and store inverses
40 m_invaMin = std::tan(2*atan(exp(-m_etaMin)));
41 m_invaMax = std::tan(2*atan(exp(-m_etaMax)));
42 m_aMin = 1/m_invaMin;
43 m_aMax = 1/m_invaMax;
44
45 // just check explicitly, in case either range individually
46 // is set to pi
47 if ( m_phiMin==float(-M_PI) ) m_phiMin=-M_PI;
48 if ( m_phiMax==float( M_PI) ) m_phiMax= M_PI;
49
50 // AAARGH!!!! Check that the roi is in the correct range
51 double deltaphi = m_phiMax-m_phiMin;
52
53 if ( m_phiMax<m_phiMin ) deltaphi+=M_2PI;
54
56 if ( std::fabs(deltaphi-M_2PI)>1e-6 ) {
57 if ( m_phiMin> M_PI ) m_phiMin -= M_2PI;
58 if ( m_phiMin<-M_PI ) m_phiMin += M_2PI;
59
60 if ( m_phiMax> M_PI ) m_phiMax -= M_2PI;
61 if ( m_phiMax<-M_PI ) m_phiMax += M_2PI;
62 }
63 else {
66 m_phiMin = -M_PI;
67 m_phiMax = M_PI;
68 }
69
71
72}
73
74
75
76
77std::ostream& operator<<(std::ostream& s, const RegSelRoI& r) {
78 return s << "[ roi: z=" << int(1000*r.getzMin())*0.001 << " - " << int(1000*r.getzMax())*0.001
79 << "\tphi=" << (r.getphiMin()<0 ? " " : "" ) << int(1000*r.getphiMin())*0.001 << " - " << int(1000*r.getphiMax())*0.001
80 << "\t( " << int(10*180*r.getphiMin()/M_PI)*0.1 << " - " << int(10*180*r.getphiMax()/M_PI)*0.1 << " )"
81 << "\teta=" << int(1000*r.getetaMin())*0.001 << " - " << int(1000*r.getetaMax())*0.001
82 << " ]";
83}
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#define M_PI
#define M_2PI
std::ostream & operator<<(std::ostream &s, const RegSelRoI &r)
Definition RegSelRoI.cxx:77
double m_etaMin
Definition RegSelRoI.h:92
double m_aMin
Definition RegSelRoI.h:94
double m_zMax
Definition RegSelRoI.h:90
double m_phiMax
Definition RegSelRoI.h:91
double m_aMax
Definition RegSelRoI.h:94
double m_invaMax
Definition RegSelRoI.h:93
double m_invaMin
Definition RegSelRoI.h:93
bool m_split
Definition RegSelRoI.h:96
double m_zMin
Definition RegSelRoI.h:90
double m_etaMax
Definition RegSelRoI.h:92
double m_phiMin
Definition RegSelRoI.h:91
int r
Definition globals.cxx:22