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
std::unique_ptr< TileWienerFilterWeightsStructm_weights

Friends

class TileInfoLoader

Detailed Description

Definition at line 18 of file TileWienerFilterWeights.h.

Constructor & Destructor Documentation

◆ TileWienerFilterWeights()

TileWienerFilterWeights::TileWienerFilterWeights ( )

◆ ~TileWienerFilterWeights()

TileWienerFilterWeights::~TileWienerFilterWeights ( )

Definition at line 20 of file TileWienerFilterWeights.cxx.

21{
22}

Member Function Documentation

◆ loaded()

bool TileWienerFilterWeights::loaded ( )
inline

Definition at line 29 of file TileWienerFilterWeights.h.

29{ return m_loaded; }

◆ loadWeights()

void TileWienerFilterWeights::loadWeights ( MsgStream & log)

Definition at line 24 of file TileWienerFilterWeights.cxx.

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

◆ TileWFstruct()

const TileWienerFilterWeightsStruct * TileWienerFilterWeights::TileWFstruct ( ) const
inline

Definition at line 28 of file TileWienerFilterWeights.h.

28{ return m_weights.get(); }

◆ TileInfoLoader

friend class TileInfoLoader
friend

Definition at line 20 of file TileWienerFilterWeights.h.

Member Data Documentation

◆ m_loaded

bool TileWienerFilterWeights::m_loaded
private

Definition at line 36 of file TileWienerFilterWeights.h.

◆ m_Luminosity

int TileWienerFilterWeights::m_Luminosity
private

Definition at line 34 of file TileWienerFilterWeights.h.

◆ m_NSamples_Phys

int TileWienerFilterWeights::m_NSamples_Phys = 0
private

Definition at line 35 of file TileWienerFilterWeights.h.

◆ m_weights

std::unique_ptr<TileWienerFilterWeightsStruct> TileWienerFilterWeights::m_weights
private

Definition at line 37 of file TileWienerFilterWeights.h.


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