ATLAS Offline Software
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 
29 static const double M_2PI = 2*M_PI;
30 
31 RegSelRoI::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
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 
77 std::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 
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
RegSelRoI::m_invaMin
double m_invaMin
Definition: RegSelRoI.h:108
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
operator<<
std::ostream & operator<<(std::ostream &s, const RegSelRoI &r)
Definition: RegSelRoI.cxx:77
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
RegSelRoI::m_aMin
double m_aMin
Definition: RegSelRoI.h:109
RegSelRoI::m_invaMax
double m_invaMax
Definition: RegSelRoI.h:108
RegSelRoI::m_split
bool m_split
Definition: RegSelRoI.h:111
RegSelRoI::m_phiMin
double m_phiMin
Definition: RegSelRoI.h:106
RegSelRoI::m_aMax
double m_aMax
Definition: RegSelRoI.h:109
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
RegSelRoI
Definition: RegSelRoI.h:32
RegSelRoI::m_phiMax
double m_phiMax
Definition: RegSelRoI.h:106
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
M_2PI
#define M_2PI
Definition: CaloGpuGeneral_fnc.cxx:8
RegSelRoI::m_etaMin
double m_etaMin
Definition: RegSelRoI.h:107
RegSelRoI.h
RegSelRoI::RegSelRoI
RegSelRoI()
Definition: RegSelRoI.h:51
RegSelRoI::m_etaMax
double m_etaMax
Definition: RegSelRoI.h:107