CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
l1t::CaloStage2Nav Class Reference

#include <CaloStage2Nav.h>

Public Member Functions

 CaloStage2Nav ()
 
 CaloStage2Nav (int iEta, int iPhi)
 
 CaloStage2Nav (std::pair< int, int > pos)
 
int currIEta () const
 
int currIPhi () const
 
std::pair< int, int > currPos () const
 
std::pair< int, int > east ()
 
std::pair< int, int > move (int iEtaOffset, int iPhiOffset)
 
std::pair< int, int > north ()
 
std::pair< int, int > offsetFromCurrPos (int iEtaOffset, int iPhiOffset) const
 
void resetIEta ()
 
void resetIPhi ()
 
void resetPos ()
 
void setHomePos (int iEta, int iPhi)
 
void setHomePos (std::pair< int, int > pos)
 
std::pair< int, int > south ()
 
std::pair< int, int > west ()
 

Static Public Member Functions

static int offsetIEta (int iEta, int offset)
 
static int offsetIPhi (int iPhi, int offset)
 

Private Attributes

std::pair< int, int > currPos_
 
std::pair< int, int > homePos_
 

Detailed Description

Definition at line 24 of file CaloStage2Nav.h.

Constructor & Destructor Documentation

l1t::CaloStage2Nav::CaloStage2Nav ( )

Definition at line 3 of file CaloStage2Nav.cc.

4 {
5 
6 }
std::pair< int, int > homePos_
std::pair< int, int > currPos_
l1t::CaloStage2Nav::CaloStage2Nav ( int  iEta,
int  iPhi 
)

Definition at line 8 of file CaloStage2Nav.cc.

8  :homePos_(iEta,iPhi),currPos_(homePos_)
9 {
10 
11 }
std::pair< int, int > homePos_
std::pair< int, int > currPos_
l1t::CaloStage2Nav::CaloStage2Nav ( std::pair< int, int >  pos)
explicit

Definition at line 13 of file CaloStage2Nav.cc.

14 {
15 
16 }
std::pair< int, int > homePos_
std::pair< int, int > currPos_

Member Function Documentation

int l1t::CaloStage2Nav::currIEta ( ) const
inline

Definition at line 138 of file CaloStage2Nav.h.

References currPos().

Referenced by l1t::CaloTools::calNrTowers().

138 {return currPos().first;}
std::pair< int, int > currPos() const
int l1t::CaloStage2Nav::currIPhi ( ) const
inline

Definition at line 139 of file CaloStage2Nav.h.

References currPos().

Referenced by l1t::CaloTools::calNrTowers().

139 {return currPos().second;}
std::pair< int, int > currPos() const
std::pair<int,int> l1t::CaloStage2Nav::currPos ( ) const
inline

Definition at line 137 of file CaloStage2Nav.h.

References currPos_.

Referenced by currIEta(), and currIPhi().

137 {return currPos_;}
std::pair< int, int > currPos_
std::pair<int,int> l1t::CaloStage2Nav::east ( )
inline

Definition at line 134 of file CaloStage2Nav.h.

References move().

Referenced by l1t::CaloTools::calNrTowers().

134 {return move(1,0);}
std::pair< int, int > move(int iEtaOffset, int iPhiOffset)
std::pair< int, int > l1t::CaloStage2Nav::move ( int  iEtaOffset,
int  iPhiOffset 
)

Definition at line 26 of file CaloStage2Nav.cc.

References currPos_, offsetIEta(), and offsetIPhi().

Referenced by east(), north(), offsetIEta(), south(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and west().

27 {
28  currPos_.first=offsetIEta(currPos_.first,iEtaOffset);
29  currPos_.second=offsetIPhi(currPos_.second,iPhiOffset);
30  return currPos_;
31 }
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:44
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:33
std::pair< int, int > currPos_
std::pair<int,int> l1t::CaloStage2Nav::north ( )
inline

Definition at line 132 of file CaloStage2Nav.h.

References move().

Referenced by l1t::CaloTools::calNrTowers().

132 {return move(0,1);}
std::pair< int, int > move(int iEtaOffset, int iPhiOffset)
std::pair< int, int > l1t::CaloStage2Nav::offsetFromCurrPos ( int  iEtaOffset,
int  iPhiOffset 
) const

Definition at line 18 of file CaloStage2Nav.cc.

References currPos_, offsetIEta(), and offsetIPhi().

Referenced by offsetIEta().

19 {
20  std::pair<int,int> offsetPos;
21  offsetPos.first = offsetIEta(currPos_.first,iEtaOffset);
22  offsetPos.second = offsetIPhi(currPos_.second,iPhiOffset);
23  return offsetPos;
24 }
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:44
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:33
std::pair< int, int > currPos_
static int l1t::CaloStage2Nav::offsetIEta ( int  iEta,
int  offset 
)
inlinestatic

Definition at line 44 of file CaloStage2Nav.h.

References funct::abs(), ALCARECOTkAlBeamHalo_cff::etaMax, l1t::CaloTools::kHFBegin, l1t::CaloTools::kHFEnd, move(), PFRecoTauDiscriminationByIsolation_cfi::offset, and offsetFromCurrPos().

Referenced by l1t::CaloTools::calHwEtSum(), l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::clustering(), l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::filtering(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::is3x3Maximum(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::makeSecClusters(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), move(), offsetFromCurrPos(), l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(), and l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::refining().

45 {
46 
48  int etaBoundaryHF = CaloTools::kHFBegin;
49 
50  if(iEta==0) return 0;//0 is not a valid position
51  if(abs(iEta)>etaMax) return 0;//beyond +/-41 is not a valid position
52  if(abs(iEta)==etaBoundaryHF) return 0;//+/-29 is not a valid position
53 
54  if(iEta>etaBoundaryHF)
55  {
56  int iEta_tmp = iEta;
57 
58  if(offset<0)
59  {
60  if(iEta_tmp+offset<=etaBoundaryHF) iEta_tmp--;
61  if(iEta_tmp+offset<=0) iEta_tmp--;
62  if(iEta_tmp+offset<=-etaBoundaryHF) iEta_tmp--;
63  if(iEta_tmp+offset<=-etaMax) return -etaMax;
64  return iEta_tmp+offset;
65  }
66  if(offset>=0)
67  {
68  if(iEta_tmp+offset>=etaMax) return etaMax;
69  return iEta_tmp+offset;
70  }
71  }
72  else if(iEta>0)
73  {
74  int iEta_tmp = iEta;
75 
76  if(offset<0)
77  {
78  if(iEta_tmp+offset<=0) iEta_tmp--;
79  if(iEta_tmp+offset<=-etaBoundaryHF) iEta_tmp--;
80  if(iEta_tmp+offset<=-etaMax) return -etaMax;
81  return iEta_tmp+offset;
82  }
83  if(offset>=0)
84  {
85  if(iEta_tmp+offset>=etaBoundaryHF) iEta_tmp++;
86  if(iEta_tmp+offset>=etaMax) return etaMax;
87  else return iEta_tmp+offset;
88  }
89  }
90  else if(iEta>-etaBoundaryHF)
91  {
92  int iEta_tmp = iEta;
93 
94  if(offset<0)
95  {
96  if(iEta_tmp+offset<=-etaBoundaryHF) iEta_tmp--;
97  if(iEta_tmp+offset<=-etaMax) return -etaMax;
98  return iEta_tmp+offset;
99  }
100  if(offset>=0)
101  {
102  if(iEta_tmp+offset>=0) iEta_tmp++;
103  if(iEta_tmp+offset>=etaBoundaryHF) iEta_tmp++;
104  if(iEta_tmp+offset>=etaMax) return etaMax;
105  return iEta_tmp+offset;
106  }
107  }
108  else
109  {
110  int iEta_tmp = iEta;
111 
112  if(offset<0)
113  {
114  if(iEta_tmp+offset<=-etaMax) return -etaMax;
115  return iEta_tmp+offset;
116  }
117  if(offset>=0)
118  {
119  if(iEta_tmp+offset>=-etaBoundaryHF) iEta_tmp++;
120  if(iEta_tmp+offset>=0) iEta_tmp++;
121  if(iEta_tmp+offset>=etaBoundaryHF) iEta_tmp++;
122  if(iEta_tmp+offset>=etaMax) return etaMax;
123  return iEta_tmp+offset;
124  }
125  }
126  return 0;
127  }
static const int kHFBegin
Definition: CaloTools.h:40
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int l1t::CaloStage2Nav::offsetIPhi ( int  iPhi,
int  offset 
)
inlinestatic

Definition at line 33 of file CaloStage2Nav.h.

References PFRecoTauDiscriminationByIsolation_cfi::offset.

Referenced by l1t::CaloTools::calHwEtSum(), l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::clustering(), l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::filtering(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::is3x3Maximum(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::makeSecClusters(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), move(), offsetFromCurrPos(), l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(), and l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::refining().

33  {
34  if(iPhi==0) return 0; //some debate here on whether I should accept 0 and just cast it to 72, I've decided that it is less confusing for 0,0 (the invalid position) to not move eta or phi rather than allowing phi to move
35  else {
36  iPhi+=offset;
37  while(iPhi<=0) iPhi+=72;
38  while(iPhi>72) iPhi-=72;
39  return iPhi;
40  }
41  }
void l1t::CaloStage2Nav::resetIEta ( )
inline

Definition at line 142 of file CaloStage2Nav.h.

References currPos_, and homePos_.

142 {currPos_.first=homePos_.first;}
std::pair< int, int > homePos_
std::pair< int, int > currPos_
void l1t::CaloStage2Nav::resetIPhi ( )
inline

Definition at line 143 of file CaloStage2Nav.h.

References currPos_, and homePos_.

Referenced by l1t::CaloTools::calNrTowers().

143 {currPos_.second=homePos_.second;}
std::pair< int, int > homePos_
std::pair< int, int > currPos_
void l1t::CaloStage2Nav::resetPos ( )
inline

Definition at line 141 of file CaloStage2Nav.h.

References currPos_, and homePos_.

std::pair< int, int > homePos_
std::pair< int, int > currPos_
void l1t::CaloStage2Nav::setHomePos ( int  iEta,
int  iPhi 
)
inline

Definition at line 144 of file CaloStage2Nav.h.

References homePos_.

144 {homePos_.first=iEta;homePos_.second=iPhi;}
std::pair< int, int > homePos_
void l1t::CaloStage2Nav::setHomePos ( std::pair< int, int >  pos)
inline

Definition at line 145 of file CaloStage2Nav.h.

References setHomePos().

Referenced by setHomePos().

145 {setHomePos(pos.first,pos.second);}
void setHomePos(int iEta, int iPhi)
std::pair<int,int> l1t::CaloStage2Nav::south ( )
inline

Definition at line 133 of file CaloStage2Nav.h.

References move().

133 {return move(0,-1);}
std::pair< int, int > move(int iEtaOffset, int iPhiOffset)
std::pair<int,int> l1t::CaloStage2Nav::west ( )
inline

Definition at line 135 of file CaloStage2Nav.h.

References move().

135 {return move(-1,0);}
std::pair< int, int > move(int iEtaOffset, int iPhiOffset)

Member Data Documentation

std::pair<int,int> l1t::CaloStage2Nav::currPos_
private

Definition at line 149 of file CaloStage2Nav.h.

Referenced by currPos(), move(), offsetFromCurrPos(), resetIEta(), resetIPhi(), and resetPos().

std::pair<int,int> l1t::CaloStage2Nav::homePos_
private

Definition at line 148 of file CaloStage2Nav.h.

Referenced by resetIEta(), resetIPhi(), resetPos(), and setHomePos().