ATLAS Offline Software
Loading...
Searching...
No Matches
TileWienerFilterWeights Class Reference

#include <TileWienerFilterWeights.h>

Collaboration diagram for TileWienerFilterWeights:

Public Member Functions

 TileWienerFilterWeights ()
 ~TileWienerFilterWeights ()
void loadWeights (MsgStream &log)
const TileWienerFilterWeightsStructTileWFstruct () const
bool loaded ()

Private Attributes

int m_Luminosity
int m_NSamples_Phys = 0
bool m_loaded
TileWienerFilterWeightsStructm_weights

Friends

class TileInfoLoader

Detailed Description

Definition at line 17 of file TileWienerFilterWeights.h.

Constructor & Destructor Documentation

◆ TileWienerFilterWeights()

TileWienerFilterWeights::TileWienerFilterWeights ( )

Definition at line 14 of file TileWienerFilterWeights.cxx.

15 : m_Luminosity(40)
16 , m_loaded(false)
17 , m_weights(nullptr)
18{
19}
TileWienerFilterWeightsStruct * m_weights

◆ ~TileWienerFilterWeights()

TileWienerFilterWeights::~TileWienerFilterWeights ( )

Definition at line 21 of file TileWienerFilterWeights.cxx.

22{
23 if (m_weights) delete m_weights;
24}

Member Function Documentation

◆ loaded()

bool TileWienerFilterWeights::loaded ( )
inline

Definition at line 28 of file TileWienerFilterWeights.h.

28{ return m_loaded; }

◆ loadWeights()

void TileWienerFilterWeights::loadWeights ( MsgStream & log)

Definition at line 26 of file TileWienerFilterWeights.cxx.

27{
28 log<<MSG::DEBUG<<"TileWienerFilterWeights::loadWeights"<<endmsg;
29
30 m_weights = new TileWienerFilterWeightsStruct;
31 memset(m_weights,0,sizeof(TileWienerFilterWeightsStruct));
32
33 // set luminosity
34 m_weights->luminosity = m_Luminosity;
35 log<<MSG::DEBUG<<" Luminosity="<<m_Luminosity<<endmsg;
36
38 // GENERAL WEIGHTS
39 std::string file_name_gn = "wiener_General_mu"+std::to_string(m_Luminosity)+".dat";
40 std::string file_path_gn = PathResolver::find_file(file_name_gn, "DATAPATH");
41 std::ifstream file_gn(file_path_gn.c_str());
42 std::string line_gn;
43
44 if (file_gn.is_open()) {
45 log<<MSG::DEBUG<<file_name_gn<<" opened"<<endmsg;
46
47 int partition, channel;
48
49 while (std::getline(file_gn, line_gn)) {
50 // skip empty or comment lines
51 if (line_gn.empty() || line_gn[0] == '#') continue;
52
53 // read values
54 std::istringstream iss(line_gn);
55 iss>>partition;
56 iss>>channel;
57 if (partition > -1 && partition < 4 && channel > -1 && channel < 48) {
58 for (int i=0; i<8; i++) {
59 iss>>m_weights->generalWeights[partition][channel][i];
60 }
61 }
62 }
63
64 file_gn.close();
65 } else {
66 log<<MSG::FATAL<<file_name_gn<<" not found"<<endmsg;
67 return;
68 }
70
72 // OPTIMAL WEIGHTS
73 std::string file_name_op = "wiener_Optimal_mu"+std::to_string(m_Luminosity)+".dat";
74 std::string file_path_op = PathResolver::find_file(file_name_op, "DATAPATH");
75 std::ifstream file_op(file_path_op.c_str());
76 std::string line_op;
77
78 if (file_op.is_open()) {
79 log<<MSG::DEBUG<<file_name_op<<" opened"<<endmsg;
80
81 int bcidIndex = 0;
82
83 while (std::getline(file_op, line_op)) {
84 // skip empty or comment lines
85 if (line_op.empty() || line_op[0] == '#') continue;
86
87 // read values
88 std::istringstream iss(line_op);
89 for (int i=0; i<8; i++) {
90 iss>>m_weights->optimalWeights[bcidIndex][i];
91 }
92 bcidIndex++;
93 }
94
95 file_op.close();
96 } else {
97 log<<MSG::FATAL<<file_name_op<<" not found"<<endmsg;
98 return;
99 }
101
102 m_loaded = true;
103 log<<MSG::DEBUG<<" WienerFilter Weights loaded"<<endmsg;
104}
#define endmsg
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)

◆ TileWFstruct()

const TileWienerFilterWeightsStruct * TileWienerFilterWeights::TileWFstruct ( ) const
inline

Definition at line 27 of file TileWienerFilterWeights.h.

27{ return m_weights; }

◆ TileInfoLoader

friend class TileInfoLoader
friend

Definition at line 19 of file TileWienerFilterWeights.h.

Member Data Documentation

◆ m_loaded

bool TileWienerFilterWeights::m_loaded
private

Definition at line 35 of file TileWienerFilterWeights.h.

◆ m_Luminosity

int TileWienerFilterWeights::m_Luminosity
private

Definition at line 33 of file TileWienerFilterWeights.h.

◆ m_NSamples_Phys

int TileWienerFilterWeights::m_NSamples_Phys = 0
private

Definition at line 34 of file TileWienerFilterWeights.h.

◆ m_weights

TileWienerFilterWeightsStruct* TileWienerFilterWeights::m_weights
private

Definition at line 36 of file TileWienerFilterWeights.h.


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