18 declareInterface<IeFakeTower>(
this);
22 for (
auto& allfpga : m_alltowers) {
23 delete allfpga.second;
25 for (
auto& allfpga : m_dict) {
26 delete allfpga.second;
32 ATH_CHECK( m_eFEXFPGATowerIdProviderTool.retrieve() );
34 m_inputfile = input_fileadress;
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;
39 fileStream.open(m_inputfile +
std::to_string(getFPGAnumber(efex, fpga)) + txt);
40 if (fileStream.fail()) {
43 ATH_CHECK( loaddic(getFPGAnumber(efex, fpga)) );
46 return StatusCode::SUCCESS;
51 if (eta > 5 || eta < 0) {
55 if (phi > 9 || phi < 0) {
67 if (m_dict.find(FPGAid) == m_dict.end()) {
70 int id = eta * 1000 + phi * 100 +
layer * 10 +
cell;
71 if (m_alltowers.at(FPGAid)->find(
id) == m_alltowers.at(FPGAid)->end()) {
75 return m_alltowers.at(FPGAid)->at(
id);
82 for (
auto& allfpga : m_alltowers) {
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;
89 fileStream.open(m_inputfile +
std::to_string(getFPGAnumber(efex, fpga)) + txt);
90 if (fileStream.fail()) {
93 ATH_CHECK( loadFPGA(getFPGAnumber(efex, fpga)) );
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++) {
105 StatusCode sc = m_eFEXFPGATowerIdProviderTool->getRankedTowerIDinFPGA(efex, fpga, FPGAtowerids);
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++){
111 LVL1::eTower* thistower = m_eTowerContainer->findTower(FPGAtowerids[myrow][mycol]);
119 for (
int efex{ 0 }; efex < 24; efex++) {
120 for (
int fpga{ 0 }; fpga < 4; fpga++) {
121 StatusCode sc = m_eFEXFPGATowerIdProviderTool->getRankedTowerIDinFPGA(efex, fpga, FPGAtowerids);
122 if (
sc == StatusCode::FAILURE) {
123 return StatusCode::FAILURE;
125 ATH_CHECK( changeFPGAET(FPGAtowerids, fpga, efex) );
128 return StatusCode::SUCCESS;
132 m_eTowerContainer =
input;
133 return StatusCode::SUCCESS;
138 for (
int myrow = 0; myrow<10; myrow++){
139 for (
int mycol = 0; mycol<6; mycol++){
140 LVL1::eTower* thistower = m_eTowerContainer->findTower(tmp_eTowersIDs_subset[myrow][mycol]);
143 bool nothaveFPGA = m_dict.find(getFPGAnumber(eFEXnumber, FPGAnumber)) == m_dict.end();
148 ATH_CHECK( changeTowerET(thistower, mycol, myrow, getFPGAnumber(eFEXnumber, FPGAnumber)) );
151 return StatusCode::SUCCESS;
158 inputtower->
setET(0 ,getET(FPGAid, eta, phi, 0, 0), 0);
160 inputtower->
setET(1, getET(FPGAid, eta, phi, 1, 0), 1);
161 inputtower->
setET(2, getET(FPGAid, eta, phi, 1, 1), 1);
162 inputtower->
setET(3, getET(FPGAid, eta, phi, 1, 2), 1);
163 inputtower->
setET(4, getET(FPGAid, eta, phi, 1, 3), 1);
165 inputtower->
setET(5, getET(FPGAid, eta, phi, 2, 0), 2);
166 inputtower->
setET(6, getET(FPGAid, eta, phi, 2, 1), 2);
167 inputtower->
setET(7, getET(FPGAid, eta, phi, 2, 2), 2);
168 inputtower->
setET(8, getET(FPGAid, eta, phi, 2, 3), 2);
170 inputtower->
setET(9, getET(FPGAid, eta, phi, 3, 0), 3);
172 inputtower->
setET(10, getET(FPGAid, eta, phi, 4, 0), 4);
173 return StatusCode::SUCCESS;
177 std::string txt =
".txt";
181 if (m_dict.find(FPGAid) == m_dict.end()) {
182 ATH_MSG_ERROR(
"Mapping for FPGA "<< FPGAid <<
" does not exist!");
183 return StatusCode::FAILURE;
185 std::vector<int>* Ets = loadBlock(m_inputfile +
std::to_string(FPGAid) + txt, m_numberofevents);
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 (
unsigned int i = 0;
i < Ets->size();
i++) {
194 ETmap->insert(std::make_pair((*m_dict[FPGAid])[
i], (*Ets)[
i]));
196 m_alltowers[FPGAid] = ETmap;
197 return StatusCode::SUCCESS;
203 std::string txt =
".txt";
204 std::vector<int>* dic0 = loadBlock(m_inputfile +
std::to_string(FPGAid) + txt, 0);
205 m_dict.insert(std::make_pair(FPGAid, dic0));
206 return StatusCode::SUCCESS;
211 std::string eachline;
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));
245 return iefex * 10 + ifpga;