ATLAS Offline Software
Loading...
Searching...
No Matches
PtBarrelLUT.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#include "PtBarrelLUT.h"
6
7#include<fstream>
8
10
11// --------------------------------------------------------------------------------
12// --------------------------------------------------------------------------------
13
15 const std::string& name,
16 const IInterface* parent):
17 AthAlgTool(type, name, parent)
18{
19}
20
21// --------------------------------------------------------------------------------
22// --------------------------------------------------------------------------------
23
24StatusCode TrigL2MuonSA::PtBarrelLUT::readLUT(const std::string& lut_fileName,
25 const std::string& lutSP_fileName)
26{
27 int charge,chamber;
28 float A0,A1,etamin,etamax,phimin,phimax;
29 std::ifstream file;
30
31 for (int i_saddress=0; i_saddress<4; i_saddress++) {
32 for(int i_charge=0; i_charge<2; i_charge++) {
33 for(int i_eta=0; i_eta<60; i_eta++) {
34 for(int i_phi=0; i_phi<60; i_phi++) {
35 for(int i_parms=0; i_parms<2; i_parms++) {
36 m_lut.table[i_saddress][i_charge][i_eta][i_phi][i_parms] = 0.;
37 }
38 }
39 }
40 }
41 }
42
43 for(int i_innerR=0; i_innerR<2; i_innerR++) {
44 for(int i_charge=0; i_charge<2; i_charge++) {
45 for(int i_eta=0; i_eta<30; i_eta++) {
46 for(int i_phi=0; i_phi<30; i_phi++) {
47 for(int i_parms=0; i_parms<2; i_parms++) {
48 m_lutSP.table_LargeSP[i_innerR][i_charge][i_eta][i_phi][i_parms] = 0;
49 }
50 }
51 }
52 }
53 }
54
55 file.open(lut_fileName.c_str());
56 if(!file) {
57 ATH_MSG_INFO("Failed to open barrel LUT file");
58 return StatusCode::FAILURE;
59 }
60
61 for(int nlut=0;nlut<8;++nlut) {
62 file >> charge >> chamber;
63 file >> etamin >> etamax >> phimin >> phimax
64 >> m_lut.NbinEta[chamber] >> m_lut.NbinPhi[chamber];
65 m_lut.EtaMin[chamber] = etamin;
66 m_lut.EtaMax[chamber] = etamax;
67 m_lut.PhiMin[chamber] = phimin;
68 m_lut.PhiMax[chamber] = phimax;
69 m_lut.PhiStep[chamber] = (phimax-phimin)/m_lut.NbinPhi[chamber];
70 m_lut.EtaStep[chamber] = (etamax-etamin)/m_lut.NbinEta[chamber];
71
72 for(int i=0;i<m_lut.NbinEta[chamber];i++) {
73 for(int j=0;j<m_lut.NbinPhi[chamber];j++) {
74
75 file >> A1 >> A0;
76
77 m_lut.table[chamber][charge][i][j][0] = A1;
78 m_lut.table[chamber][charge][i][j][1] = A0;
79 }
80 }
81 }
82
83 file.close();
84
85 std::ifstream fileSP;
86 fileSP.open(lutSP_fileName.c_str());
87 if(!fileSP) {
88 ATH_MSG_INFO("Failed to open barrel LUT file");
89 return StatusCode::FAILURE;
90 }
91
92 int ieta, iphi, iqeta, iR;
93 while( !fileSP.eof() ){
94 fileSP >> iqeta >> iR >> ieta >> iphi >> A1 >> A0;
95 m_lutSP.table_LargeSP[iqeta][iR][ieta][iphi][0] = A1;
96 m_lutSP.table_LargeSP[iqeta][iR][ieta][iphi][1] = A0;
97 }
98
99 return StatusCode::SUCCESS;
100}
101
102// --------------------------------------------------------------------------------
103// --------------------------------------------------------------------------------
104
#define ATH_MSG_INFO(x)
double charge(const T &p)
Definition AtlasPID.h:997
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
PtBarrelLUT(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode readLUT(const std::string &lut_fileName, const std::string &lutSP_fileName)
TFile * file