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;
32 cout <<
"DTMapGenerator: Output Map: " << outputMapName <<
" ROS Type: " << rosType << endl;
35 ifstream existingChannels(
"/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/existing_channels.txt");
37 set<DTWireId> wireMap;
41 while (getline(existingChannels, lineMap)) {
42 if (lineMap.empty() || lineMap[0] ==
'#')
46 int wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx;
47 linestr >> wheelEx >> sectorEx >> stationEx >> slEx >> layerEx >> wireEx;
48 DTWireId wireIdEx(wheelEx, stationEx, sectorEx, slEx, layerEx, wireEx);
49 wireMap.insert(wireIdEx);
51 cout <<
"Map size: " << wireMap.size() << endl;
54 ifstream skeletonMap(inputMapName.c_str());
57 ofstream outputMap(outputMapName.c_str());
61 while (getline(skeletonMap,
line)) {
68 cout <<
"DDU: " << ddu << endl
69 <<
"ROS: " << ros << endl
70 <<
"Connected to chamber in Wh: " <<
wheel <<
" St: " <<
station <<
" Sec: " << sector << endl;
77 nameTmp <<
"/afs/cern.ch/cms/Physics/muon/CMSSW/DT/channelsMaps/templates/MB" <<
station <<
"_" << sector <<
".map";
79 ifstream chamberMap(
fileName.c_str());
81 string lineChamberMap;
82 while (getline(chamberMap, lineChamberMap)) {
83 if (lineChamberMap.empty() || lineChamberMap[0] ==
'#')
85 stringstream chamberMapStr;
86 chamberMapStr << lineChamberMap;
88 int rob, tdc, tdcChannel, sl, layer, wire;
89 int unusedRos, unusedChamberCode;
91 chamberMapStr >> unusedRos >> rob >> tdc >> tdcChannel >> unusedChamberCode >> sl >> layer >> wire;
94 if (!checkWireExist(wireMap,
wheel,
station, sector, sl, layer, wire))
97 if (rob > previousROB) {
100 }
else if (rob < previousROB) {
101 cout <<
"Error: ROB number is not uniformly increasing!" << endl;
109 outRob = robCounter + 6;
112 outRob = robCounter + 12;
113 else if (robCounter == 3)
115 else if (robCounter > 3)
116 outRob = robCounter + 11;
119 if (robCounter == 3) {
122 outRob = robCounter + 18;
123 }
else if (sector == 10) {
124 if (robCounter == 3) {
126 }
else if (robCounter == 0) {
129 outRob = robCounter + 21;
131 }
else if (sector == 4) {
132 if (robCounter == 3 || robCounter == 4) {
135 outRob = robCounter + 18;
136 }
else if (sector == 13) {
137 if (robCounter == 3 || robCounter == 4) {
139 }
else if (robCounter == 0) {
142 outRob = robCounter + 21;
144 }
else if (sector == 11 || sector == 9) {
145 outRob = robCounter + 18;
146 if (robCounter == 3) {
152 outRob = robCounter + 18;
158 outputMap << ddu <<
" " << ros <<
" " << outRob <<
" " << tdc <<
" " << tdcChannel <<
" " <<
wheel <<
" " 159 <<
station <<
" " << sector <<
" " << sl <<
" " << layer <<
" " << wire << endl;
165 const set<DTWireId>& wireMap,
int wheel,
int station,
int sector,
int sl,
int layer,
int wire) {
167 if (wireMap.find(wireId) == wireMap.end()) {
168 cout <<
"Skipping channel: Wh: " <<
wheel <<
", st: " <<
station <<
", sec: " << sector <<
", sl: " << sl
169 <<
", lay: " << layer <<
", wire: " << wire << endl;
DTMapGenerator(const edm::ParameterSet &pset)
Constructor.
bool checkWireExist(const std::set< DTWireId > &wireMap, int wheel, int station, int sector, int sl, int layer, int wire)