18 declareInterface<eFakeTower>(
this);
23 delete allfpga.second;
25 for (
auto& allfpga :
m_dict) {
26 delete allfpga.second;
35 std::string txt =
".txt";
36 for (
int efex{ 0 }; efex < 24; efex++) {
37 for (
int fpga{ 0 }; fpga < 4; fpga++) {
38 std::fstream fileStream;
40 if (fileStream.fail()) {
46 return StatusCode::SUCCESS;
59 if (layer > 4 || layer < 0) {
63 if (cell > 3 || cell < 0) {
70 int id =
eta * 1000 +
phi * 100 + layer * 10 + cell;
83 delete allfpga.second;
85 std::string txt =
".txt";
86 for (
int efex{ 0 }; efex < 24; efex++) {
87 for (
int fpga{ 0 }; fpga < 4; fpga++) {
88 std::fstream fileStream;
90 if (fileStream.fail()) {
96 return StatusCode::SUCCESS;
100 int FPGAtowerids[10][6];
103 for (
int efex{ 0 }; efex < 24; efex++) {
104 for (
int fpga{ 0 }; fpga < 4; fpga++) {
106 if (
sc == StatusCode::FAILURE) {
107 return StatusCode::FAILURE;
109 for (
int myrow = 0; myrow<10; myrow++){
110 for (
int mycol = 0; mycol<6; mycol++){
119 for (
int efex{ 0 }; efex < 24; efex++) {
120 for (
int fpga{ 0 }; fpga < 4; fpga++) {
122 if (
sc == StatusCode::FAILURE) {
123 return StatusCode::FAILURE;
128 return StatusCode::SUCCESS;
133 return StatusCode::SUCCESS;
138 for (
int myrow = 0; myrow<10; myrow++){
139 for (
int mycol = 0; mycol<6; mycol++){
151 return StatusCode::SUCCESS;
173 return StatusCode::SUCCESS;
177 std::string txt =
".txt";
182 ATH_MSG_ERROR(
"Mapping for FPGA "<< FPGAid <<
" does not exist!");
183 return StatusCode::FAILURE;
188 if (Ets->size() != (*
m_dict[FPGAid]).size()) {
190 return StatusCode::FAILURE;
192 std::unordered_map<int, unsigned int>* ETmap =
new std::unordered_map<int, unsigned int>;
193 for (
size_t i{};
const auto &thisEt : *Ets){
194 ETmap->emplace((*
m_dict[FPGAid])[i++], thisEt);
197 return StatusCode::SUCCESS;
203 std::string txt =
".txt";
205 m_dict.insert(std::make_pair(FPGAid, dic0));
206 return StatusCode::SUCCESS;
211 std::string eachline;
212 std::ifstream myfile(inputfile);
213 std::vector<int>* output =
new std::vector<int>;
214 if (myfile.is_open()) {
216 while (std::getline(myfile, eachline)) {
218 if (eachline.length() < 3) {
221 if (nblock < eventnumber) {
224 else if (nblock > eventnumber) {
227 std::string temvalue;
228 std::stringstream
ss(eachline);
229 while (
ss >> temvalue) {
231 if (eventnumber == 0) {
232 output->push_back(std::stoi(temvalue));
235 output->push_back(
et);
245 return iefex * 10 + ifpga;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
static int expand(unsigned int code)
Uncompress data.
std::string m_inputfile
path to the input directory
ToolHandle< eFEXFPGATowerIdProvider > m_eFEXFPGATowerIdProviderTool
tool needed for tower-FPGA mapping
std::unordered_map< int, std::unordered_map< int, unsigned int > * > m_alltowers
map of all supercell ETs of FPGAs m_alltowers[FPGAid] = (supercell id,ET) supercell id = eta * 1000 +...
virtual StatusCode loadnext()
Load the test vector of the next event.
StatusCode changeFPGAET(int tmp_eTowersIDs_subset[][6], int FPGAnumber, int eFEXnumber)
Replace the Et in an FOGA by the ones in the test vector.
StatusCode changeTowerET(LVL1::eTower *inputtower, int eta, int phi, int FPGAid) const
Replace the Et in a tower by the ones in the test vector.
virtual StatusCode seteTowers(eTowerContainer *)
Define the eTowerContainer object for which the Et will be replaced.
eTowerContainer * m_eTowerContainer
StatusCode loaddic(int)
load index of Et
std::unordered_map< int, std::vector< int > * > m_dict
map for mapping infomation. m_dict[FPGAid] = [ list of supercell id in order ]
eFakeTower(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
int getFPGAnumber(int iefex, int ifpga) const
determine the index of an FPGA
std::vector< int > * loadBlock(const std::string &, int) const
Load the Et or index in a block.
virtual StatusCode init(const std::string &)
initiate with the path to the test vector directory
int m_numberofevents
number of events
StatusCode loadFPGA(int)
load the Et in an FPGA
virtual StatusCode execute()
replace the Tower Et with the ones stored in the test vector.
virtual int getET(int FPGAid, int eta, int phi, int layer, int cell) const
obtain the Et of a tower slot
The eTower class is an interface object for eFEX trigger algorithms The purposes are twofold:
void clearET()
Clear supercell ET values.
void setET(int cell, float et, int layer, bool ignoreDisable=false)
Load Et of the test vector.
Extra patterns decribing particle interation process.