ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::CoordToHardware Class Reference

returns the trigger hardware components associated with a given Coordinate More...

#include <CoordToHardware.h>

Collaboration diagram for LVL1::CoordToHardware:

Public Types

enum  SubDet_ID { PPr =0x71 , CP =0x72 , JEP =0x73 }

Public Member Functions

 CoordToHardware ()
 ~CoordToHardware ()
unsigned int jepCrate (const Coordinate &Coord)
 returns ID of JEP Crate that covers this coordinate
unsigned int cpCrate (const Coordinate &coord)
 returns crate ID covering that coord.
unsigned int cpRoIROD (const Coordinate &coord)
 returns Module ID of CP RoI ROD
unsigned int jepModule (const Coordinate &coord)
 returns ID of JEP module (i.e.
unsigned int cpModule (const Coordinate &coord)
 return ID of CP module.
unsigned int cpModuleFPGA (const Coordinate &coord)
 returns ID [0-7] of the CP FPGA.
unsigned int cpModuleLocalRoI (const Coordinate &coord)
 returns local RoI coordinate within FPGA
unsigned int cpCoordinateWord (const Coordinate &coord)
 return CP (Cluster Processing) hardware coordinate word for this coordinate.
unsigned int jepCoordinateWord (const Coordinate &coord)
 return JEP (Jet Energy Processing) hardware coordinate word for this coordinate.
unsigned int jepLocalCoordinate (const Coordinate &coord)
 returns the roi's local coord, in the form of a 5b word.
unsigned int cpCrateOverlap (const Coordinate &coord)
 returns crate ID covering that overlap coord.
unsigned int cpModuleOverlap (const Coordinate &coord)
 return ID of CP module for overlap coord
unsigned int jepCrateOverlap (const Coordinate &coord)
 returns ID of JEP Crate that covers this overlap coordinate
unsigned int jepModuleOverlap (const Coordinate &coord)
 returns ID of JEP module (i.e.

Private Member Functions

void fillRoILocalMap ()
 No descriptions.
unsigned int phiQuadrant (const double phi) const
 returns the quadrant number associated with the phi coordinate,
bool cpCoordIsValid (const Coordinate &coord) const
 returns false if Coord is outside permitted region
double cpPhiOverlap (const Coordinate &coord) const
 returns a phi in core area for overlap CPM towers
double jepPhiOverlap (const Coordinate &coord) const
 returns a phi in core area for overlap jet elements

Private Attributes

double m_cpmEtaWidth
 eta width of CP modules (CPMs)
double m_cpmEtaMax
 extreme value of eta, covered by CPMs.
double m_cpFPGAPhiWidth
 phi width of CP FPGAs
double m_cpEtaMax
 contains the maximum permissable eta for CP system.
unsigned int m_roiLocalMap [2][4]
 width of JEMs
bool m_debug

Static Private Attributes

static const unsigned int m_error =999
 returned value in the case of an invalid Coordinate error

Detailed Description

returns the trigger hardware components associated with a given Coordinate

Author
E.Moyse
Todo
this should probably be a static class.

Definition at line 37 of file CoordToHardware.h.

Member Enumeration Documentation

◆ SubDet_ID

Enumerator
PPr 
CP 
JEP 

Definition at line 86 of file CoordToHardware.h.

Constructor & Destructor Documentation

◆ CoordToHardware()

LVL1::CoordToHardware::CoordToHardware ( )

Definition at line 20 of file CoordToHardware.cxx.

20 :
21 m_cpmEtaWidth(0.4), m_cpmEtaMax(2.8),
22 m_cpFPGAPhiWidth(M_PI/16.0), m_cpEtaMax(2.5), m_debug(false)
23{
25}
#define M_PI
double m_cpmEtaWidth
eta width of CP modules (CPMs)
void fillRoILocalMap()
No descriptions.
double m_cpEtaMax
contains the maximum permissable eta for CP system.
double m_cpFPGAPhiWidth
phi width of CP FPGAs
double m_cpmEtaMax
extreme value of eta, covered by CPMs.

◆ ~CoordToHardware()

LVL1::CoordToHardware::~CoordToHardware ( )

Definition at line 27 of file CoordToHardware.cxx.

27 {
28}

Member Function Documentation

◆ cpCoordinateWord()

unsigned int LVL1::CoordToHardware::cpCoordinateWord ( const Coordinate & coord)

return CP (Cluster Processing) hardware coordinate word for this coordinate.

This word is formed as follows: -3 bits: RoI local coordinates with FPGA [0-7] -3 bits: CP FPGA position within CPM (Cluster Processing module) [0-7] -4 bits: CPM position within crate [1-14] -2 bits: CP crate number [0-3]

This word is formed as follows: -3 bits: RoI local coordinates within FPGA [0-7] -3 bits: CP FPGA position within CPM (Cluster Processing module) [0-7] -4 bits: CPM position within crate [1-14] -2 bits: CP crate number [0-3]

Definition at line 174 of file CoordToHardware.cxx.

174 {
175 unsigned int crate =cpCrate(coord);
176 unsigned int cpm=cpModule(coord);
177 unsigned int fpga=cpModuleFPGA(coord);
178 unsigned int lc=cpModuleLocalRoI(coord);
179
180 unsigned int word=0;
181 if ((crate==m_error)||(cpm==m_error)||(fpga==m_error)||(lc==m_error)){
182 std::cerr << "CPCoordinateWord ERROR: "<< std::endl;
183 }else{
184 word= crate; // put 2 bit crate number
185 word = (word<<4) + cpm; // followed by 4 bit CPM number
186 word = (word<<3) + fpga; // 3 bit FPGA number
187 word = (word<<3) + lc; //2 bit local coord
188 }
189 if (m_debug) std::cout << " Coords set to ("<<coord.phi()<<", "<<coord.eta()<<") giving : "<<word
190 << " from crate "<<crate
191 << " CPM "<<cpm<<" fpga : "<<fpga<<" LC : "<<lc<< std::endl;
192 return word;
193}
double coord
Type of coordination system.
unsigned int cpModuleFPGA(const Coordinate &coord)
returns ID [0-7] of the CP FPGA.
unsigned int cpModule(const Coordinate &coord)
return ID of CP module.
unsigned int cpModuleLocalRoI(const Coordinate &coord)
returns local RoI coordinate within FPGA
static const unsigned int m_error
returned value in the case of an invalid Coordinate error
unsigned int cpCrate(const Coordinate &coord)
returns crate ID covering that coord.

◆ cpCoordIsValid()

bool LVL1::CoordToHardware::cpCoordIsValid ( const Coordinate & coord) const
private

returns false if Coord is outside permitted region

Definition at line 128 of file CoordToHardware.cxx.

128 {
129 double eta= coord.eta();
130 if ( (eta>=-m_cpEtaMax) && (eta <=m_cpEtaMax) ) return true;
131 std::cerr << "CoordToHardware::cpCoordIsValid: Coordinate outside permitted range of eta = "
132 <<-m_cpEtaMax<<" to "<<m_cpEtaMax<<std::endl;
133 return false;
134}
Scalar eta() const
pseudorapidity method

◆ cpCrate()

unsigned int LVL1::CoordToHardware::cpCrate ( const Coordinate & coord)

returns crate ID covering that coord.

Definition at line 39 of file CoordToHardware.cxx.

39 {
40
41 return ( phiQuadrant(coord.phi()) );
42}
unsigned int phiQuadrant(const double phi) const
returns the quadrant number associated with the phi coordinate,

◆ cpCrateOverlap()

unsigned int LVL1::CoordToHardware::cpCrateOverlap ( const Coordinate & coord)

returns crate ID covering that overlap coord.

Definition at line 205 of file CoordToHardware.cxx.

205 {
206
207 const double phi = cpPhiOverlap(coord);
208 return (phi == coord.phi()) ? m_error
209 : cpCrate(Coordinate(phi, coord.eta()));
210}
Scalar phi() const
phi method
double cpPhiOverlap(const Coordinate &coord) const
returns a phi in core area for overlap CPM towers

◆ cpModule()

unsigned int LVL1::CoordToHardware::cpModule ( const Coordinate & coord)

return ID of CP module.

return ID of CP module

According to the LVL1-LVL2 interface document: CPMs are numbered 1-14, with CPM1 covering eta=-2.6 to -2.2 and so on. This is implemented here.

Definition at line 52 of file CoordToHardware.cxx.

52 {
53 if ( cpCoordIsValid(coord) ) {
54 // CPM1 is at -2.6 to -2.4 (here set it to -2.8)
55 // CPM8 is at 0.0 to 0.4
56 double eta=coord.eta();
57 unsigned int cpm = static_cast<unsigned int>( (eta+m_cpmEtaMax)/m_cpmEtaWidth )+1;
58 return cpm;
59 }
60 return m_error;
61}
bool cpCoordIsValid(const Coordinate &coord) const
returns false if Coord is outside permitted region

◆ cpModuleFPGA()

unsigned int LVL1::CoordToHardware::cpModuleFPGA ( const Coordinate & coord)

returns ID [0-7] of the CP FPGA.

The FPGAs cover a region of 0.2 in phi and 0.4 in eta. FPGA 0 starts at phi=0 within its CPM.

Definition at line 74 of file CoordToHardware.cxx.

74 {
75 if ( cpCoordIsValid(coord) ) {
76 double phi=coord.phi();
77 // should be 32 FPGAs in 2*PI
78 double temp = phi/m_cpFPGAPhiWidth;
79 // so temp mod 8 returns FPGA #
80 return ( (static_cast<unsigned int>(temp))%8);
81 }
82 // not a valid coord
83 return m_error;
84}

◆ cpModuleLocalRoI()

unsigned int LVL1::CoordToHardware::cpModuleLocalRoI ( const Coordinate & coord)

returns local RoI coordinate within FPGA

Definition at line 104 of file CoordToHardware.cxx.

104 {
105 if ( cpCoordIsValid(coord) ) {
106 double phi=coord.phi();
107 double eta=coord.eta();
108 // should be 32 FPGAs in 2*PI, and there are 2 local RoI locations in phi per FPGA
109 // so "temp" ranges from 0-63
110 unsigned int temp = static_cast<unsigned int>( (phi/m_cpFPGAPhiWidth)*2);
111 // so this (below) gives us the integer phi coordinate WITHIN the FPGA
112 unsigned int iLocalPhi= temp%2;
113 // There are 14 CPMs, each with 8 FPGAs that each span it completely in eta
114 // (i.e. one eta position for FPGAs in CPM) and there are 4 local RoI
115 // locations in eta per FPGA
116
117 temp=static_cast<unsigned int>( (eta+2.8)/0.1 );
118
119 //temp = static_cast<unsigned int>( (eta+(m_cpmEtaMax+m_cpmEtaWidth)/m_cpmEtaWidth ) * 4);
120 unsigned int iLocalEta = temp%4;
121 return m_roiLocalMap[iLocalPhi][iLocalEta];
122 }
123 // invalid coord
124 return m_error;
125}
unsigned int m_roiLocalMap[2][4]
width of JEMs

◆ cpModuleOverlap()

unsigned int LVL1::CoordToHardware::cpModuleOverlap ( const Coordinate & coord)

return ID of CP module for overlap coord

Definition at line 213 of file CoordToHardware.cxx.

213 {
214
215 const double phi = cpPhiOverlap(coord);
216 return (phi == coord.phi()) ? m_error
217 : cpModule(Coordinate(phi, coord.eta()));
218}

◆ cpPhiOverlap()

double LVL1::CoordToHardware::cpPhiOverlap ( const Coordinate & coord) const
private

returns a phi in core area for overlap CPM towers

Definition at line 237 of file CoordToHardware.cxx.

237 {
238
239 double phi = coord.phi();
240 const double twoPi = 2.*M_PI;
241 const double piByTwo = M_PI/2.;
242 const double twoPhiBins = M_PI/16.;
243 const double phiLoc = std::fmod(phi, piByTwo);
244 if (phiLoc < twoPhiBins) {
245 phi -= twoPhiBins;
246 if (phi < 0.) phi += twoPi;
247 } else if (phiLoc > piByTwo - twoPhiBins) {
248 phi += twoPhiBins;
249 if (phi >= twoPi) phi -= twoPi;
250 }
251 return phi;
252}

◆ cpRoIROD()

unsigned int LVL1::CoordToHardware::cpRoIROD ( const Coordinate & coord)

returns Module ID of CP RoI ROD

Todo
check that this is still correct - it seems sensible but hasn't be formally defined

Definition at line 47 of file CoordToHardware.cxx.

47 {
48 return ( phiQuadrant(coord.phi()) );
49}

◆ fillRoILocalMap()

void LVL1::CoordToHardware::fillRoILocalMap ( )
private

No descriptions.

fill m_roiLocalMap so that it looks like this:

 2 3 6 7
 0 1 4 5

(as usual, phi increases up and eta increases right)

Definition at line 91 of file CoordToHardware.cxx.

91 {
92
93 m_roiLocalMap[0][0]=0;
94 m_roiLocalMap[0][1]=1;
95 m_roiLocalMap[0][2]=4;
96 m_roiLocalMap[0][3]=5;
97 m_roiLocalMap[1][0]=2;
98 m_roiLocalMap[1][1]=3;
99 m_roiLocalMap[1][2]=6;
100 m_roiLocalMap[1][3]=7;
101}

◆ jepCoordinateWord()

unsigned int LVL1::CoordToHardware::jepCoordinateWord ( const Coordinate & coord)

return JEP (Jet Energy Processing) hardware coordinate word for this coordinate.

This word is formed as follows: -4 bits: RoI local coordinates with FPGA [0-15] -4 bits: JEM number [0-15] -2 bits: JEP crate number [0-2]

This word is formed as follows: -5 bits: RoI local coordinates within FPGA [0-31] -4 bits: JEM number [0-15] -1 bits: JEP crate number [0-1]

Definition at line 140 of file CoordToHardware.cxx.

140 {
141 unsigned int crate =jepCrate(coord);
142 unsigned int jem=jepModule(coord);
143 unsigned int PJ=jepLocalCoordinate(coord);
144
145 unsigned int word=0;
146 if ((crate==m_error)||(jem==m_error)||(PJ==m_error)){
147 std::cerr << "CPCoordinateWord ERROR: "<< std::endl;
148 }else{
149 word = crate; // put 1 bit crate number
150 word = (word<<4) + jem; // followed by 4 bit JEM number
151 word = (word<<5) + PJ; // JP
152 }
153 if (m_debug) std::cout << " Coords set to ("<<coord.phi()<<", "<<coord.eta()<<") giving : "<<word
154 << " from crate "<<crate
155 << " JEM "<<jem<<" PJ : "<<PJ<< std::endl;
156 return word;
157}
unsigned int jepModule(const Coordinate &coord)
returns ID of JEP module (i.e.
unsigned int jepLocalCoordinate(const Coordinate &coord)
returns the roi's local coord, in the form of a 5b word.
unsigned int jepCrate(const Coordinate &Coord)
returns ID of JEP Crate that covers this coordinate

◆ jepCrate()

unsigned int LVL1::CoordToHardware::jepCrate ( const Coordinate & Coord)

returns ID of JEP Crate that covers this coordinate

returns ID of JEP Crate that covers this coordinate.

(quadrants 0+2, 1+3)

Definition at line 32 of file CoordToHardware.cxx.

32 {
33 unsigned int quad=phiQuadrant( Coord.phi() );
34 return (quad%2);
35}

◆ jepCrateOverlap()

unsigned int LVL1::CoordToHardware::jepCrateOverlap ( const Coordinate & coord)

returns ID of JEP Crate that covers this overlap coordinate

Definition at line 221 of file CoordToHardware.cxx.

221 {
222
223 const double phi = jepPhiOverlap(coord);
224 return (phi == coord.phi()) ? m_error
225 : jepCrate(Coordinate(phi, coord.eta()));
226}
double jepPhiOverlap(const Coordinate &coord) const
returns a phi in core area for overlap jet elements

◆ jepLocalCoordinate()

unsigned int LVL1::CoordToHardware::jepLocalCoordinate ( const Coordinate & coord)

returns the roi's local coord, in the form of a 5b word.

This is based on fig 16 of JEM spec.

  • 3 bits: phi row
  • 2 bits: eta col

Definition at line 195 of file CoordToHardware.cxx.

195 {
196 JetEnergyModuleKey jemKey;
197 unsigned int row=jemKey.row(coord);
198 unsigned int col=jemKey.col(coord);
199 unsigned int frame = 4*(col>>1) + (row>>1);
200 unsigned int rl = 2*(row%2) + (col%2);
201 return (frame<<2)+rl;
202}
row
Appending html table to final .html summary file.

◆ jepModule()

unsigned int LVL1::CoordToHardware::jepModule ( const Coordinate & coord)

returns ID of JEP module (i.e.

JEM) There are 16 JEMS per crate, and 8 JEMS per quadrant. The central 6 JEMS cover the barrel, JEMs 0,7,8 & 15 extend over the FCAL as well. (each crate contains JEMS for opposite quadrants, so one crate might have JEMs 0-7 in quadrant 0 and JEMs 8-15 in quadrant 2)

Todo
IMPLEMENT

JEM) There are 16 JEMS per crate, and 8 JEMS per quadrant. The central 6 JEMS cover the barrel, JEMs 0,7,8 & 15 extend over the FCAL as well. (each crate contains JEMS for opposite quadrants, so one crate might have JEMs 0-7 in quadrant 0 and JEMs 8-15 in quadrant 2)

Definition at line 67 of file CoordToHardware.cxx.

67 {
68 JetEnergyModuleKey jemKey;
69 return static_cast<unsigned int>(jemKey.jem(coord));
70}

◆ jepModuleOverlap()

unsigned int LVL1::CoordToHardware::jepModuleOverlap ( const Coordinate & coord)

returns ID of JEP module (i.e.

JEM) for overlap coord

Definition at line 229 of file CoordToHardware.cxx.

229 {
230
231 const double phi = jepPhiOverlap(coord);
232 return (phi == coord.phi()) ? m_error
233 : jepModule(Coordinate(phi, coord.eta()));
234}

◆ jepPhiOverlap()

double LVL1::CoordToHardware::jepPhiOverlap ( const Coordinate & coord) const
private

returns a phi in core area for overlap jet elements

Definition at line 255 of file CoordToHardware.cxx.

255 {
256
257 double phi = coord.phi();
258 const double eta = coord.eta();
259 const bool fcal = eta < -3.2 || eta > 3.2;
260 const double twoPi = 2.*M_PI;
261 const double piByTwo = M_PI/2.;
262 const double twoPhiBins = M_PI/8.;
263 const double onePhiBin = (fcal) ? twoPhiBins : twoPhiBins/2.;
264 const double phiLoc = std::fmod(phi, piByTwo);
265 if (phiLoc < twoPhiBins) {
266 phi -= twoPhiBins;
267 if (phi < 0.) phi += twoPi;
268 } else if (phiLoc > piByTwo - onePhiBin) {
269 phi += onePhiBin;
270 if (phi >= twoPi) phi -= twoPi;
271 }
272 return phi;
273}

◆ phiQuadrant()

unsigned int LVL1::CoordToHardware::phiQuadrant ( const double phi) const
private

returns the quadrant number associated with the phi coordinate,

returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 270-360 = 3

  • 0 - 90 = 0
  • 90 -180 = 1
  • 180-270 = 2
  • 270-360 = 3

Definition at line 164 of file CoordToHardware.cxx.

164 {
165 double temp = phi/(M_PI/2);
166 return static_cast<unsigned int>(temp);
167}

Member Data Documentation

◆ m_cpEtaMax

double LVL1::CoordToHardware::m_cpEtaMax
private

contains the maximum permissable eta for CP system.

Expected to be 2.5

Definition at line 113 of file CoordToHardware.h.

◆ m_cpFPGAPhiWidth

double LVL1::CoordToHardware::m_cpFPGAPhiWidth
private

phi width of CP FPGAs

Definition at line 111 of file CoordToHardware.h.

◆ m_cpmEtaMax

double LVL1::CoordToHardware::m_cpmEtaMax
private

extreme value of eta, covered by CPMs.

This is expected to be 2.8, and it is assumed that the range is symmetric

Definition at line 109 of file CoordToHardware.h.

◆ m_cpmEtaWidth

double LVL1::CoordToHardware::m_cpmEtaWidth
private

eta width of CP modules (CPMs)

Definition at line 107 of file CoordToHardware.h.

◆ m_debug

bool LVL1::CoordToHardware::m_debug
private

Definition at line 120 of file CoordToHardware.h.

◆ m_error

const unsigned int LVL1::CoordToHardware::m_error =999
staticprivate

returned value in the case of an invalid Coordinate error

Definition at line 119 of file CoordToHardware.h.

◆ m_roiLocalMap

unsigned int LVL1::CoordToHardware::m_roiLocalMap[2][4]
private

width of JEMs

contains RoI local coordinate mapping (phi,eta)

Definition at line 117 of file CoordToHardware.h.


The documentation for this class was generated from the following files: