BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
add_DCH_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*>& pValues1, vector<UniValue*>& pValues2);
4
5void AssignMapStructure(vector<UniValue*>& pArray, int pl, int gr, unsigned int cr, int sl, int ch_l, int ch_h)
6{
7 DchMapValue* pValue = new DchMapValue;
8 pValue->plane = pl;
9 pValue->group = gr;
10 pValue->crate = cr;
11 pValue->slot = sl;
12 pValue->channel_low = ch_l;
13 pValue->channel_high = ch_h;
14
15 pArray.push_back(pValue);
16}
17
19{
20 Bool_t return_error = kFALSE;
21
22 vector<UniValue*> pValues1;
23 vector<UniValue*> pValues2;
24 TString path = TString(getenv("VMCWORKDIR")) + TString("/input/");
25 ReadAndPut(path + TString("DCH_map_Run7.txt"), pValues1, pValues2);
26
27 UniDetectorParameter::CreateDetectorParameter("DCH1", "DCH_mapping", 7, 1, 7, 10000, pValues1);
28 UniDetectorParameter::CreateDetectorParameter("DCH2", "DCH_mapping", 7, 1, 7, 10000, pValues2);
29
30 for (int i = 0; i < pValues1.size(); i++)
31 delete pValues1[i];
32 for (int i = 0; i < pValues2.size(); i++)
33 delete pValues2[i];
34
35 if (return_error)
36 cout << "\nMacro finished with errors" << endl;
37 else
38 cout << "\nMacro finished successfully" << endl;
39}
40
41void ReadAndPut(TString fName, vector<UniValue*>& pValues1, vector<UniValue*>& pValues2)
42{
43 UInt_t ser = 0;
44 Int_t ch_l = 0;
45 Int_t ch_h = 0;
46 Int_t slot = 0;
47 Int_t group = 0;
48 TString name;
49 Int_t planeId;
50
51 TString planes[16];
52 planes[0] = "VA_1";
53 planes[1] = "VB_1";
54 planes[2] = "UA_1";
55 planes[3] = "UB_1";
56 planes[4] = "YA_1";
57 planes[5] = "YB_1";
58 planes[6] = "XA_1";
59 planes[7] = "XB_1";
60 planes[8] = "VA_2";
61 planes[9] = "VB_2";
62 planes[10] = "UA_2";
63 planes[11] = "UB_2";
64 planes[12] = "YA_2";
65 planes[13] = "YB_2";
66 planes[14] = "XA_2";
67 planes[15] = "XB_2";
68
69 TString dummy;
70
71 ifstream inFile(fName.Data());
72 if (!inFile.is_open())
73 cout << "Error opening map-file (" << fName << ")!" << endl;
74 inFile >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy;
75 inFile >> dummy;
76 while (inFile >> name >> group >> std::hex >> ser >> std::dec >> slot >> ch_l >> ch_h) {
77 Int_t j = 0;
78 for (j = 0; j < 16; ++j)
79 if (name == planes[j])
80 break;
81 planeId = j;
82 printf("%s\t%d\t%d\t0x%x\t%d\t%d\t%d\n", name.Data(), planeId, group, ser, slot, ch_l, ch_h);
83 if (planeId / 8 == 0)
84 AssignMapStructure(pValues1, planeId, group, ser, slot, ch_l, ch_h);
85 else
86 AssignMapStructure(pValues2, planeId, group, ser, slot, ch_l, ch_h);
87 }
88}
int i
Definition P4_F32vec4.h:22
bool Bool_t
int Int_t
unsigned int UInt_t
constexpr Bool_t kFALSE
void ReadAndPut(TString fName, vector< UniValue * > &pValues1, vector< UniValue * > &pValues2)
void AssignMapStructure(vector< UniValue * > &pArray, int pl, int gr, unsigned int cr, int sl, int ch_l, int ch_h)
void add_DCH_mapping()
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