BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CreateMapTof400_BMN_12_2016.c
Go to the documentation of this file.
1
2#include "Riostream.h"
3#include "TString.h"
4
5#include <TMath.h>
6#include <fstream>
7#include <iostream>
8#include <sstream>
9#include <string>
10
11void CreateMapTof400_BMN_12_2016(std::string placementMapFile, std::string mapFile)
12{
13
14 Int_t MapR[24] = {3, 0, 9, 6, 4, 1, 10, 7, 5, 2, 11, 8, 18, 21, 12, 15, 19, 22, 13, 16, 20, 23, 14, 17};
15 Int_t MapL[24] = {20, 23, 14, 17, 19, 22, 13, 16, 18, 21, 12, 15, 5, 2, 11, 8, 4, 1, 10, 7, 3, 0, 9, 6};
16 // Int_t MapL[24] = {4, 1, 10, 7, 5, 2, 11, 8, 6, 3, 12, 9, 19, 22, 13, 16, 20, 23, 14, 17, 21, 0, 15, 18};
17 // Int_t MapR[24] = {21, 0, 15, 18, 20, 23, 14, 17, 19, 22, 13, 16, 6, 3, 12, 9, 5, 2, 11, 8, 4, 1, 10, 7};
18
19 // UInt_t crate = 0x01690454;
20 UInt_t crate = 0x06ea9711;
21 static const Int_t kNSlot = 23;
22 UInt_t slot[kNSlot] = {0.};
23 slot[1] = 0x06e9da86;
24 slot[2] = 0x06e9da91;
25 slot[3] = 0x076caef6;
26 slot[4] = 0x076cae7b;
27 slot[5] = 0x046f332f;
28 slot[6] = 0x06e9404b;
29 slot[7] = 0x06e9e4b0;
30 slot[14] = 0x046f408c;
31 slot[15] = 0x06e94033;
32 slot[16] = 0x076cae7a;
33 slot[17] = 0x07a8deb2;
34 slot[18] = 0x076cad52;
35 slot[19] = 0x076ccf62;
36 slot[20] = 0x06e940be;
37
38 fstream ff;
39
40 // 1.Placement map
41 ff.open(placementMapFile.c_str(), std::fstream::out);
42 if (ff.fail()) {
43 cerr << "Cannot open the file " << placementMapFile << endl;
44 return;
45 }
46 for (Int_t i = 0; i < kNSlot; i++)
47 if (slot[i] != 0) {
48 ff << std::hex << std::setfill('0') << std::setw(8) << crate << '\t';
49 ff << std::dec << i << '\t';
50 ff << std::hex << std::setfill('0') << std::setw(8) << slot[i] << endl;
51 }
52 ff.close();
53
54 Int_t Num = 14516;
55 cout << "Num = " << Num << endl;
56 cout << "GetSlot(Num) = " << GetSlot(Num) << " GetCon(Num) = " << GetCon(Num) << endl;
57 cout << "GetDet(Num) = " << GetDet(Num) << " GetSide(Num) = " << GetSide(Num) << endl;
58
59 // create Map for Cosmic Test Setup
60 ff.open(mapFile.c_str(), std::fstream::out);
61 if (ff.fail()) {
62 cerr << "Cannot open the file " << mapFile << endl;
63 return;
64 }
65
66 static const Int_t kNIt = 4;
67 static const Int_t kNDet = 10 + 1;
68 Int_t MapDet[kNDet][kNIt] = {
69 {1002, 1101, 1204, 2003}, {2112, 2211, 3014, 3113}, {3222, 4021, 4124, 4223},
70 {5032, 5131, 5234, 6033}, {6142, 6241, 7044, 7143}, {14052, 14151, 14254, 15053},
71 {15162, 15261, 16064, 16163}, {16272, 17071, 17174, 17273}, {18082, 18181, 18284, 19083},
72 {19192, 19291, 20094, 20193}, {7205, 20205, 7205, 20205}};
73
74 // first number - slot 1-22, second number - connector (0 - 0..23, 1 - 24..47, 2 - 48..71
75 // third - detector , fourth - side (1,2 - L, 3,4 - R)
76
77 for (Int_t det = 0; det < kNDet; det++) {
78 for (Int_t i = 0; i < kNIt; i++) {
79 for (Int_t j = 0; j < 24; j++) {
80 /*
81 cout << std::dec << "MapDet = " << MapDet[det][i] << "; Det = " << det << "; i = " << i
82 << "; j = " << j << "; slot = " << slot[GetSlot(MapDet[det][i])]
83 << "; chTDC = " << j + 24 * GetCon(MapDet[det][i]) << "; GetDet = " <<
84 GetDet(MapDet[det][i])
85 << "; GetSide = " << GetSide(MapDet[det][i]) << endl;
86 getchar();
87 */
88
89 ff << std::hex << std::setfill('0') << std::setw(8) << slot[GetSlot(MapDet[det][i])]
90 << std::setfill(' ') << '\t';
91 ff << std::dec << j + 24 * GetCon(MapDet[det][i]) << '\t';
92 ff << GetDet(MapDet[det][i]) << '\t';
93 if (GetSide(MapDet[det][i]) == 1 || GetSide(MapDet[det][i]) == 2) {
94 if (det < 5)
95 ff << 47 - (MapL[j] + (GetSide(MapDet[det][i]) - 1) * 24) << '\t';
96 else
97 ff << MapL[j] + (GetSide(MapDet[det][i]) - 1) * 24 << '\t';
98 // ff << MapL[j] + (GetSide(MapDet[det][i]) - 1)*24 << '\t';
99 ff << 'L';
100 ff << endl;
101 } else if (GetSide(MapDet[det][i]) == 3 || GetSide(MapDet[det][i]) == 4) {
102 if (det < 5)
103 ff << 47 - (MapR[j] + (GetSide(MapDet[det][i]) - 3) * 24) << '\t';
104 else
105 ff << MapR[j] + (GetSide(MapDet[det][i]) - 3) * 24 << '\t';
106 // ff << MapR[j] + (GetSide(MapDet[det][i]) - 3)*24 << '\t';
107 ff << 'R';
108 ff << endl;
109 } else {
110 ff << -1 << '\t';
111 ff << 'L';
112 ff << endl;
113 }
114 }
115 }
116 }
117}
118
120{
121 Int_t temp = static_cast<int> number / 1000.;
122 return temp;
123}
124
126{
127 Int_t temp = static_cast<int>(number - GetSlot(number) * 1000.) / 100.;
128 return temp;
129}
130
132{
133 Int_t temp = static_cast<int>(number - GetSlot(number) * 1000. - GetCon(number) * 100.) / 10.;
134 return temp;
135}
136
138{
139 Int_t temp = static_cast<int>(number - GetSlot(number) * 1000. - GetCon(number) * 100. - GetDet(number) * 10.);
140 return temp;
141}
void CreateMapTof400_BMN_12_2016(std::string placementMapFile, std::string mapFile)
Int_t GetSide(Int_t number)
Int_t GetSlot(Int_t number)
Int_t GetCon(Int_t number)
Int_t GetDet(Int_t number)
int i
Definition P4_F32vec4.h:22
int Int_t
unsigned int UInt_t