ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1TGC::TGCTileMuCoincidenceLUT Class Reference

This class stores the LUT for Tile-Muon coincidence of the Run-3 L1Muon Endcap trigger. More...

#include <TGCTileMuCoincidenceLUT.h>

Collaboration diagram for LVL1TGC::TGCTileMuCoincidenceLUT:

Public Types

enum  TileMuMask {
  TM_NA = 0 , TM_D6_L = 1 , TM_D6_H = 5 , TM_D56_L = 3 ,
  TM_D56_H = 7
}
enum  { N_Input_TileMuModule =4 }

Public Member Functions

 TGCTileMuCoincidenceLUT (LVL1TGCTrigger::TGCArguments *, const SG::ReadCondHandleKey< TGCTriggerData > &readCondKey, const std::string &version="NA")
virtual ~TGCTileMuCoincidenceLUT ()
 TGCTileMuCoincidenceLUT (const TGCTileMuCoincidenceLUT &right)=default
TGCTileMuCoincidenceLUToperator= (const TGCTileMuCoincidenceLUT &right)=delete
uint16_t getAddr (int16_t side, int16_t sec, int16_t ssc) const
int getFlagPT (const int pt, const int16_t ssc, const int16_t sec, const int16_t side) const
int getFlagROI (const int roi, const int16_t ssc, const int16_t sec, const int16_t side) const
int getTrigMask (const int module, const int16_t ssc, const int16_t sec, const int16_t side) const
const std::string & getVersion () const
bool readMap ()
LVL1TGCTrigger::TGCArgumentstgcArgs ()
const LVL1TGCTrigger::TGCArgumentstgcArgs () const

Private Attributes

std::unordered_map< uint16_t, uint8_t > m_flagpt
std::unordered_map< uint16_t, uint8_t > m_flagroi
std::unordered_map< uint16_t, uint16_t > m_trigbit
std::string m_verName
LVL1TGCTrigger::TGCArgumentsm_tgcArgs
const SG::ReadCondHandleKey< TGCTriggerData > & m_readCondKey

Detailed Description

This class stores the LUT for Tile-Muon coincidence of the Run-3 L1Muon Endcap trigger.

The contents are read from the Condition database, and are kept in the XXXX object. When the coincidence map is read from the text file, the contents is kept in member variables of this class. Note that the structure is temporary same as Run-2's one.

Contents of Run-3 Tile-Muon LUT

consists of three look-up tables a) Applied pT in SSC (m_flagpt) std::unordered_map<ADDR, PTMASK> where ADDR | 12 bits | uint16_t | side, trigger sector, and SSC PTMASK | 3 bits | uint8_t | bit mask for applied pT for SSC

b)Applied RoI in SSC (m_flagroi) std::unordered_map<ADDR, ROIMASK> where ADDR | 12 bits | uint16_t | side, trigger sector, and SSC ROIMASK | 8 bits | uint8_t | bit mask for applied RoI in SSC

c) Trigger bit for each input (m_trigbit) std::unordered_map<ADDR, TRIGBIT> where TRIGBIT is: | Module D (Tile=3) || Module C (Tile=2) || Module B (Tile=1) || Module A (Tile=0) | | 15 | 14 | 13 | 12 || 11 | 10 | 9 | 8 || 7 | 6 | 5 | 4 || 3 | 2 | 1 | 0 | | 0 | LH | D56| D6 || 0 | LH | D56| D6 || 0 | LH | D56 | D6 || 0 | LH | D56 | D6 | for each Module: [1:0] hit with cell information: D6=0x1, D56=0x3 [2] Low/High threshold: 1 = H, 0=L e.g.) 0x7 = D5+D6 energy exceeds the high threshold

for ADDR, | 11 |10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| |side| Trig. Sector | SSC | where side = 0x0 (A-side), 0x1 (C-side). trig. sector = 0x(0...2f) SSC = 0x(0...12)

Definition at line 61 of file TGCTileMuCoincidenceLUT.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
N_Input_TileMuModule 

Definition at line 89 of file TGCTileMuCoincidenceLUT.h.

◆ TileMuMask

Constructor & Destructor Documentation

◆ TGCTileMuCoincidenceLUT() [1/2]

LVL1TGC::TGCTileMuCoincidenceLUT::TGCTileMuCoincidenceLUT ( LVL1TGCTrigger::TGCArguments * tgcargs,
const SG::ReadCondHandleKey< TGCTriggerData > & readCondKey,
const std::string & version = "NA" )

Definition at line 14 of file TGCTileMuCoincidenceLUT.cxx.

17 : m_verName(version),
18 m_tgcArgs(tgcargs),
19 m_readCondKey(readCondKey)
20{
21 if (!tgcArgs()->TILE_MU()) return;
22 if (tgcArgs()->USE_CONDDB()) return;
23
24 MsgStream log(Athena::getMessageSvc(), "LVL1TGC::TGCTileMuCoincidenceLUT");
25
26 // read Inner Coincidence Map
27 if (this->readMap()) {
28 log << MSG::INFO
29 << " TGC TileMu CW version of " << m_verName << " is selected " << endmsg;
30 } else {
31 log << MSG::INFO
32 << " NOT use TileMu " << endmsg;
33 m_flagpt.clear();
34 m_flagroi.clear();
35 m_trigbit.clear();
36 }
37}
#define endmsg
LVL1TGCTrigger::TGCArguments * m_tgcArgs
std::unordered_map< uint16_t, uint8_t > m_flagroi
std::unordered_map< uint16_t, uint16_t > m_trigbit
const SG::ReadCondHandleKey< TGCTriggerData > & m_readCondKey
std::unordered_map< uint16_t, uint8_t > m_flagpt
LVL1TGCTrigger::TGCArguments * tgcArgs()
IMessageSvc * getMessageSvc(bool quiet=false)

◆ ~TGCTileMuCoincidenceLUT()

LVL1TGC::TGCTileMuCoincidenceLUT::~TGCTileMuCoincidenceLUT ( )
virtual

Definition at line 40 of file TGCTileMuCoincidenceLUT.cxx.

41{
42}

◆ TGCTileMuCoincidenceLUT() [2/2]

LVL1TGC::TGCTileMuCoincidenceLUT::TGCTileMuCoincidenceLUT ( const TGCTileMuCoincidenceLUT & right)
default

Member Function Documentation

◆ getAddr()

uint16_t LVL1TGC::TGCTileMuCoincidenceLUT::getAddr ( int16_t side,
int16_t sec,
int16_t ssc ) const

Definition at line 190 of file TGCTileMuCoincidenceLUT.cxx.

191{
195}
static constexpr uint8_t SECTOR_MASK
Mask for trigger sector for the (EIFI/TILE) ADDR.
static constexpr uint8_t SIDE_MASK
Mask for extracting the side from the GLOBALADDR.
static constexpr uint8_t ADDR_SIDE_SHIFT
Bit position of the side bit in the (EIFI/TILE) ADDR.
static constexpr uint8_t SSC_MASK
Mask for SSC for the (EIFI/TILE) ADDR.
static constexpr uint8_t ADDR_SECTOR_SHIFT
Bit position of the trigger sector bit in the (EIFI/TILE) ADDR.

◆ getFlagPT()

int LVL1TGC::TGCTileMuCoincidenceLUT::getFlagPT ( const int pt,
const int16_t ssc,
const int16_t sec,
const int16_t side ) const

Definition at line 150 of file TGCTileMuCoincidenceLUT.cxx.

154{
155 if ((pt<=0)||(pt>TGCTriggerData::N_PT_THRESH)) return -1;
156
157 uint8_t ptmask = 0x0;
158 if (tgcArgs()->USE_CONDDB()) {
159 SG::ReadCondHandle<TGCTriggerData> readHandle{m_readCondKey};
160 const TGCTriggerData* readCdo{*readHandle};
161 ptmask = readCdo->getFlagPtTile(ssc, sec, side);
162 } else {
163 uint16_t addr = this->getAddr(side, sec, ssc);
164 std::unordered_map<uint16_t, uint8_t>::const_iterator it = m_flagpt.find(addr);
165 if(it != m_flagpt.end()) ptmask = it->second;
166 }
167 return (ptmask>>(pt-1)) & 0x1; /* only 1st bit needed (0x1) */
168}
uint16_t getAddr(int16_t side, int16_t sec, int16_t ssc) const
unsigned char getFlagPtTile(int ssc, int sectorId, int side) const
setWord1 uint16_t

◆ getFlagROI()

int LVL1TGC::TGCTileMuCoincidenceLUT::getFlagROI ( const int roi,
const int16_t ssc,
const int16_t sec,
const int16_t side ) const

Definition at line 170 of file TGCTileMuCoincidenceLUT.cxx.

174{
175 if ((roi<0)||(roi>=TGCTriggerData::N_ROI_IN_SSC)) return -1;
176
177 uint8_t roimask = 0x0;
178 if (tgcArgs()->USE_CONDDB()) {
179 SG::ReadCondHandle<TGCTriggerData> readHandle{m_readCondKey};
180 const TGCTriggerData* readCdo{*readHandle};
181 roimask = readCdo->getFlagRoiTile(ssc, sec, side);
182 } else {
183 uint16_t addr = this->getAddr(side, sec, ssc);
184 std::unordered_map<uint16_t, uint8_t>::const_iterator it = m_flagroi.find(addr);
185 if(it != m_flagroi.end()) roimask = it->second;
186 }
187 return (roimask >> roi) & 0x1; /* only 1st bit needed (0x1) */
188}
uint8_t getFlagRoiTile(int ssc, int sectorId, int side) const

◆ getTrigMask()

int LVL1TGC::TGCTileMuCoincidenceLUT::getTrigMask ( const int module,
const int16_t ssc,
const int16_t sec,
const int16_t side ) const

Definition at line 129 of file TGCTileMuCoincidenceLUT.cxx.

133{
134 if ((module<0)||(module>=TGCTriggerData::N_TILE_INPUT)) return TM_NA;
135
136 uint16_t mask = 0x0;
137 if (tgcArgs()->USE_CONDDB()) {
138 SG::ReadCondHandle<TGCTriggerData> readHandle{m_readCondKey};
139 const TGCTriggerData* readCdo{*readHandle};
140 mask = readCdo->getTrigMaskTile(ssc, sec, side);
141 } else {
142 uint16_t addr = this->getAddr(side, sec, ssc);
143 std::unordered_map<uint16_t, uint16_t>::const_iterator it = m_trigbit.find(addr);
144 if(it != m_trigbit.end()) mask = it->second;
145 }
146
147 return mask>>(module*4) & 0x7;
148}
unsigned short getTrigMaskTile(int ssc, int sectorId, int side) const

◆ getVersion()

const std::string & LVL1TGC::TGCTileMuCoincidenceLUT::getVersion ( ) const
inline

Definition at line 78 of file TGCTileMuCoincidenceLUT.h.

78{ return m_verName; }

◆ operator=()

TGCTileMuCoincidenceLUT & LVL1TGC::TGCTileMuCoincidenceLUT::operator= ( const TGCTileMuCoincidenceLUT & right)
delete

◆ readMap()

bool LVL1TGC::TGCTileMuCoincidenceLUT::readMap ( )

Definition at line 44 of file TGCTileMuCoincidenceLUT.cxx.

45{
46 MsgStream log(Athena::getMessageSvc(), "LVL1TGC::TGCTileMuCoincidenceLUT");
47
48 // select right database according to a set of thresholds
49 std::string dbname="";
50 dbname = "TileMuCoincidenceMap." + m_verName + "._12.db";
51
52 //-----
53
54 std::string fullName;
55 fullName = PathResolver::FindCalibDirectory("dev")+"/TrigT1TGC/TILE/"+dbname;
56 bool isFound =( fullName.length() > 0 );
57 if( !isFound) {
58 log << MSG::WARNING
59 << " Could not found " << dbname << endmsg;
60 return false ;
61 }
62
63 std::ifstream file(fullName.c_str(),std::ios::in);
64
65 static constexpr unsigned int BufferSize = 256;
66 char buf[BufferSize];
67
68 while (file.getline(buf, BufferSize)) {
69
70 int16_t sideId = -1;
71 int16_t sectorId = -1;
72 int16_t sscId = -1;
73
74 std::istringstream header(buf);
75 std::string tag;
76 header >> tag;
77 if(tag == "#") {
78 header >> sideId >> sectorId >> sscId;
79 }
80
81 // check Id
82 if(sideId < 0 || sideId>=TGCTriggerData::N_SIDE ||
83 sectorId < 0 || sectorId>=TGCTriggerData::N_ENDCAP_SECTOR ||
84 sscId < 0 || sscId>=TGCTriggerData::N_ENDCAP_SSC ) {
85 log << MSG::WARNING
86 << " illegal parameter in database header : " << header.str()
87 << " in file " << dbname
88 << endmsg;
89 file.close();
90 return false;
91 }
92
93 uint16_t addr = this->getAddr(sideId, sectorId, sscId);
94
95 uint8_t flagpt = 0;
96 for (size_t pt = 0; pt < TGCTriggerData::N_PT_THRESH; pt++){
97 uint8_t use;
98 header >> use;
99 flagpt |= (use&0x1)<<pt;
100 }
101 m_flagpt[addr] = flagpt;
102
103 uint8_t roi = 0;
104 for (size_t pos=0; pos< TGCTriggerData::N_ROI_IN_SSC; pos++){
105 uint8_t use;
106 header >> use;
107 roi |= (use&0x1)<<pos;
108 }
109 m_flagroi[addr] = roi;
110
111 // get trigger word
112 file.getline(buf,BufferSize);
113 std::istringstream cont(buf);
114 uint16_t trigbit = 0x0;
115 for(size_t pos=0; pos < TGCTriggerData::N_TILE_INPUT; pos++){
116 uint16_t word;
117 cont >> word;
118 trigbit |= (word & 0xf)<<(pos*4);
119 }
120 m_trigbit[addr] = trigbit;
121
122 }
123 file.close();
124
125 return true;
126}
static std::string FindCalibDirectory(const std::string &logical_file_name)
setScaleOne setStatusOne setSaturated int16_t
TFile * file

◆ tgcArgs() [1/2]

LVL1TGCTrigger::TGCArguments * LVL1TGC::TGCTileMuCoincidenceLUT::tgcArgs ( )
inline

Definition at line 91 of file TGCTileMuCoincidenceLUT.h.

91{ return m_tgcArgs; }

◆ tgcArgs() [2/2]

const LVL1TGCTrigger::TGCArguments * LVL1TGC::TGCTileMuCoincidenceLUT::tgcArgs ( ) const
inline

Definition at line 92 of file TGCTileMuCoincidenceLUT.h.

92{ return m_tgcArgs; }

Member Data Documentation

◆ m_flagpt

std::unordered_map<uint16_t, uint8_t> LVL1TGC::TGCTileMuCoincidenceLUT::m_flagpt
private

Definition at line 95 of file TGCTileMuCoincidenceLUT.h.

◆ m_flagroi

std::unordered_map<uint16_t, uint8_t> LVL1TGC::TGCTileMuCoincidenceLUT::m_flagroi
private

Definition at line 96 of file TGCTileMuCoincidenceLUT.h.

◆ m_readCondKey

const SG::ReadCondHandleKey<TGCTriggerData>& LVL1TGC::TGCTileMuCoincidenceLUT::m_readCondKey
private

Definition at line 101 of file TGCTileMuCoincidenceLUT.h.

◆ m_tgcArgs

LVL1TGCTrigger::TGCArguments* LVL1TGC::TGCTileMuCoincidenceLUT::m_tgcArgs
private

Definition at line 100 of file TGCTileMuCoincidenceLUT.h.

◆ m_trigbit

std::unordered_map<uint16_t, uint16_t> LVL1TGC::TGCTileMuCoincidenceLUT::m_trigbit
private

Definition at line 97 of file TGCTileMuCoincidenceLUT.h.

◆ m_verName

std::string LVL1TGC::TGCTileMuCoincidenceLUT::m_verName
private

Definition at line 99 of file TGCTileMuCoincidenceLUT.h.


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