20 outputMapName =
pset.getUntrackedParameter<
string>(
"outputFileName",
"output.map");
22 inputMapName =
pset.getUntrackedParameter<
string>(
"inputFileName",
"basemap.txt");
24 rosType =
pset.getUntrackedParameter<
int>(
"rosType", 25);
25 if (rosType != 8 && rosType != 25) {
26 cout <<
"[DTMapGenerator]: wrong ros type (8 for commissioning, 25 otherwise)" << endl;
34 cout <<
"DTMapGenerator: Output Map: " << outputMapName <<
" ROS Type: " << rosType << endl;
37 ifstream existingChannels(
"/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/existing_channels.txt");
39 set<DTWireId> wireMap;
43 while (getline(existingChannels, lineMap)) {
44 if (lineMap.empty() || lineMap[0] ==
'#')
48 int wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx;
49 linestr >> wheelEx >> sectorEx >> stationEx >> slEx >> layerEx >> wireEx;
50 DTWireId wireIdEx(wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx);
51 wireMap.insert(wireIdEx);
53 cout <<
"Map size: " << wireMap.size() << endl;
56 ifstream skeletonMap(inputMapName.c_str());
59 ofstream outputMap(outputMapName.c_str());
63 while (getline(skeletonMap,
line)) {
70 cout <<
"DDU: " << ddu << endl
71 <<
"ROS: " << ros << endl
72 <<
"Connected to chamber in Wh: " <<
wheel <<
" St: " <<
station <<
" Sec: " << sector << endl;
79 nameTmp <<
"/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/templates/MB" <<
station <<
"_" << sector <<
".map";
81 ifstream chamberMap(
fileName.c_str());
83 string lineChamberMap;
84 while (getline(chamberMap, lineChamberMap)) {
85 if (lineChamberMap.empty() || lineChamberMap[0] ==
'#')
87 stringstream chamberMapStr;
88 chamberMapStr << lineChamberMap;
90 int rob, tdc, tdcChannel, sl, layer, wire;
91 int unusedRos, unusedChamberCode;
93 chamberMapStr >> unusedRos >> rob >> tdc >> tdcChannel >> unusedChamberCode >> sl >> layer >> wire;
96 if (!checkWireExist(wireMap,
wheel,
station, sector, sl, layer, wire))
99 if (rob > previousROB) {
102 }
else if (rob < previousROB) {
103 cout <<
"Error: ROB number is not uniformly increasing!" << endl;
111 outRob = robCounter + 6;
114 outRob = robCounter + 12;
115 else if (robCounter == 3)
117 else if (robCounter > 3)
118 outRob = robCounter + 11;
121 if (robCounter == 3) {
124 outRob = robCounter + 18;
125 }
else if (sector == 10) {
126 if (robCounter == 3) {
128 }
else if (robCounter == 0) {
131 outRob = robCounter + 21;
135 if (robCounter == 3 || robCounter == 4) {
138 outRob = robCounter + 18;
139 }
else if (sector == 13) {
140 if (robCounter == 3 || robCounter == 4) {
142 }
else if (robCounter == 0) {
145 outRob = robCounter + 21;
147 }
else if (sector == 11 || sector == 9) {
148 outRob = robCounter + 18;
149 if (robCounter == 3) {
155 outRob = robCounter + 18;
161 outputMap << ddu <<
" " << ros <<
" " << outRob <<
" " << tdc <<
" " << tdcChannel <<
" " <<
wheel <<
" "
162 <<
station <<
" " << sector <<
" " << sl <<
" " << layer <<
" " << wire << endl;
168 const set<DTWireId>& wireMap,
int wheel,
int station,
int sector,
int sl,
int layer,
int wire) {
170 if (wireMap.find(wireId) == wireMap.end()) {
171 cout <<
"Skipping channel: Wh: " <<
wheel <<
", st: " <<
station <<
", sec: " << sector <<
", sl: " << sl
172 <<
", lay: " << layer <<
", wire: " << wire << endl;