BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
add_GEM_mapping.C
Go to the documentation of this file.
1// macro for adding parameter value (if parameter exist - you could check existing parameters by
2// 'UniParameter::PrintAll()' function)
3void ReadAndPut(TString fName, vector<UniValue*>& pValues);
4
5void AssignMapStructure(vector<UniValue*>& pArray, unsigned int ser, int ch_l, int ch_h, int gemId, int st, int hz)
6{
7 GemMapValue* pValue = new GemMapValue;
8 pValue->serial = ser;
9 pValue->id = gemId;
10 pValue->station = st;
11 pValue->hotZone = hz;
12 pValue->channel_low = ch_l;
13 pValue->channel_high = ch_h;
14
15 pArray.push_back(pValue);
16}
17
19{
20 bool return_error = false;
21
22 vector<UniValue*> pValues;
23
24 TString path = TString(getenv("VMCWORKDIR")) + TString("/input/");
25 ReadAndPut(path + TString("GEM_map_run7.txt"), pValues);
26
27 UniDetectorParameter* pDetectorParameter =
28 UniDetectorParameter::CreateDetectorParameter("GEM", "GEM_global_mapping", 7, 1, 7, 10000, pValues);
29 if (pDetectorParameter == nullptr)
30 return_error = true;
31
32 // clean memory after work
33 for (int i = 0; i < pValues.size(); i++)
34 delete pValues[i];
35 if (pDetectorParameter)
36 delete pDetectorParameter;
37
38 if (return_error)
39 cout << "\nMacro finished with errors" << endl;
40 else
41 cout << "\nMacro finished successfully" << endl;
42}
43
44void ReadAndPut(TString fName, vector<UniValue*>& pValues)
45{
46 UInt_t ser = 0;
47 Int_t ch_l = 0;
48 Int_t ch_h = 0;
49 Int_t gem_id = 0;
50 Int_t stat = 0;
51 Int_t mod = 0;
52 string dummy;
53
54 ifstream inFile(fName.Data());
55 if (!inFile.is_open())
56 cout << "Error opening map-file (" << fName << ")!" << endl;
57 getline(inFile, dummy); // comment line in input file
58 getline(inFile, dummy); // comment line in input file
59 getline(inFile, dummy); // comment line in input file
60 getline(inFile, dummy); // comment line in input file
61 getline(inFile, dummy); // comment line in input file
62
63 while (inFile >> std::hex >> ser >> std::dec >> ch_l >> ch_h >> gem_id >> stat >> mod) {
64 printf("%X\t%d\t%d\t%d\t%d\t%d\n", ser, ch_l, ch_h, gem_id, stat, mod);
65 AssignMapStructure(pValues, ser, ch_l, ch_h, gem_id, stat, mod);
66 }
67}
int i
Definition P4_F32vec4.h:22
int Int_t
unsigned int UInt_t
void AssignMapStructure(vector< UniValue * > &pArray, unsigned int ser, int ch_l, int ch_h, int gemId, int st, int hz)
void add_GEM_mapping()
void ReadAndPut(TString fName, vector< UniValue * > &pValues)
const char * Data() const
static UniDetectorParameter * CreateDetectorParameter(TString detector_name, int parameter_id, int start_period, int start_run, int end_period, int end_run, int value_key, unsigned char *parameter_value, Long_t size_parameter_value, TDatime *expiry_date)
add new detector parameter to the database