ATLAS Offline Software
eFexTower_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // EDM includes(s):
7 
8 // Local include(s):
10 
11 namespace xAOD{
12 
13  AUXSTORE_OBJECT_SETTER_AND_GETTER( eFexTower_v1 , std::vector<uint16_t> , et_count , setEt_count )
14  AUXSTORE_OBJECT_MOVE( eFexTower_v1 , std::vector<uint16_t> , et_count , setEt_count )
15  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, float , eta , setEta )
16  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, float , phi , setPhi )
17  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, uint8_t , module , setModule )
18  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, uint8_t , fpga , setFpga )
19  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, uint32_t , em_status , setEm_status )
20  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexTower_v1, uint32_t , had_status , setHad_status )
21 
22 
23  uint32_t eFexTower_v1::eFEXtowerID() const {
24  // Calculate ID by hand from coordinate
25  float eta = this->eta(); float phi = this->phi();
26  int posneg = (eta >= 0 ? 1 : -1);
27  int towereta = std::abs(eta+0.025)/0.1;
28  if (phi < 0) phi += 2*M_PI;
29  int towerphi = int(32*(phi+0.025)/M_PI);
30  unsigned int tower_id = towerphi + 64*towereta;
31 
32  if (towereta < 14) {
33  tower_id += (posneg > 0 ? 200000 : 100000);
34  }
35  else if (towereta == 14) {
36  tower_id += (posneg > 0 ? 400000 : 300000);
37  }
38  else {
39  tower_id += (posneg > 0 ? 600000 : 500000);
40  }
41 
42  return tower_id;
43  }
44 
45 
47  void eFexTower_v1::initialize(const float Eta,const float Phi)
48  {
49  setEta( Eta );
50  setPhi( Phi );
51  }
52 
53  void eFexTower_v1::initialize(const float Eta,const float Phi,
54  const std::vector<uint16_t>& Et_count,
55  const uint8_t Module,
56  const uint8_t Fpga,
57  const uint32_t Em_status,
58  const uint32_t Had_status)
59  {
60  setEta( Eta );
61  setPhi( Phi );
62  setEt_count( Et_count );
63  setModule( Module );
64  setFpga( Fpga );
65  setEm_status( Em_status );
66  setHad_status( Had_status );
67  }
68 
69  int32_t eFexTower_v1::id() const {
70  int etaIndex = int( (eta()+0.025)*10 ) + (((eta()+0.025)<0) ? -1 : 1); // runs from -25 to 25 (excluding 0)
71  int phiIndex = int( (phi()+0.025)*32./ROOT::Math::Pi() ) + ((phi()+0.025)<0 ? 63 : 0); // runs from 0 to 63
72  int modIndex = ( module()>23 ) ? 99 : module(); // module runs from 0 to 23 or otherwise takes value 99
73  int fpgaIndex = ( fpga() > 3 ) ? 9 : fpga(); //from runs from 0 to 3 or otherwise takes value 9
74  return (std::abs(etaIndex)*100000 + phiIndex*1000 + modIndex*10 +fpgaIndex)*(etaIndex<0 ? -1 : 1);
75  }
76 
77  bool eFexTower_v1::disconnectedCount(size_t idx) const {
78  if(idx>11) return true;
79  int mod = eFexTower_v1::module();
80  double eta = eFexTower_v1::eta() + 0.025;
81  double phi = eFexTower_v1::phi() + 0.025;
82 
83  if ( std::abs(eta)>1.8 && idx==0 ) return true; // no PS beyond 1.8
84  if ( std::abs(eta)>2.4 && idx>0 && idx<5 ) return idx!=4; // only the 'last' l1 is connected
85 
86  if (mod>23) return false; // all emulated towers are connected
87 
88  // extremities of the real modules are disconnected
89  // em inputs at most extreme phi of module are all disconnected
90  // as well as the last two in eta of each module (modules centered at eta = -1.6,0,1.6 ... extent in em inputs is +/- 1.0 (1.1 ish for the A/C modules) )
91  // exception is the eta=+/-2.45 inputs at the extreme of efex environment, which are present in the most extreme phi still.
92  // meaning |eta|>2.4 is all connected
93 
94  double module_central_eta = 1.6*(mod%3-1);
95 
96  if( std::abs(eta)<2.4 &&
97  idx!=11 &&
98  (std::abs(std::remainder(phi - (M_PI/32)*(8*(mod/3) + 6 - (mod>11)*64),2*M_PI)) > 5.*M_PI/32 || std::abs( module_central_eta - (eta) ) > 1.0 )
99  ) {
100  return true;
101  }
102 
103  // finally, we also treat any input tower that is too far away from the centre of the module it is feeding as 'disconnected'
104  // it shouldn't be in use by any algorithm at least
105  double fpga_central_eta = module_central_eta + 0.4*(int(fpga())-2) + 0.2;
106  if ( std::abs(fpga_central_eta - eta) > 0.3 ) return true;
107 
108  return false;
109  };
110 
111 } // namespace xAOD
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33
xAOD::eFexTower_v1
Class describing input data of a LVL1 eFEX.
Definition: eFexTower_v1.h:22
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::eFexTower_v1::module
uint8_t module() const
setter for the above
eFexTower_v1.h
AUXSTORE_OBJECT_MOVE
#define AUXSTORE_OBJECT_MOVE(CL, TYPE, NAME, SETTER)
Macro creating a move accessor for complex auxiliary properties.
Definition: AuxStoreAccessorMacros.h:101
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
Phi
@ Phi
Definition: RPCdef.h:8
xAOD::eFexTower_v1::phi
float phi() const
setter for the above
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
xAOD::eFexTower_v1::eta
float eta() const
The pseudorapidity ( )
python.PyAthena.module
module
Definition: PyAthena.py:131
xAOD::eFexTower_v1::setModule
void setModule(uint8_t)
getter for the module number [0-23] inclusive
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
xAOD::eFexTower_v1::disconnectedCount
bool disconnectedCount(size_t idx) const
setter for the above
Definition: eFexTower_v1.cxx:77
xAOD::eFexTower_v1::initialize
void initialize(const float Eta, const float Phi)
getter for the etower simulation ID
Definition: eFexTower_v1.cxx:47
xAOD::eFexTower_v1::fpga
uint8_t fpga() const
setter for the above
xAOD::eFexTower_v1::setPhi
void setPhi(float)
getter for the global phi value (float)
xAOD::eFexTower_v1::setEm_status
void setEm_status(uint32_t)
getter for the electromagnetic status bit
remainder
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
list of entries in a vector that are not in another
Definition: compareFlatTrees.cxx:44
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
xAOD::eFexTower_v1::setFpga
void setFpga(uint8_t)
getter for the fpga number [0-3] inclusive
xAOD::eFexTower_v1::setHad_status
void setHad_status(uint32_t)
getter for hadronic status bit
xAOD::eFexTower_v1::id
int32_t id() const
setter for the above
Definition: eFexTower_v1.cxx:69
Eta
@ Eta
Definition: RPCdef.h:8
xAOD::eFexTower_v1::setEt_count
void setEt_count(const std::vector< uint16_t > &)
getter for the 11 energy counts
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27
xAOD::eFexTower_v1::setEta
void setEta(float)
getter for the global eta value (float)