20 std::string mthn =
"[PixelPortcardMap::PixelPortcardMap()]\t\t\t ";
21 std::vector<std::string>
ins = tableMat[0];
22 std::map<std::string, int> colM;
23 std::vector<std::string> colNames;
37 colNames.push_back(
"CONFIG_KEY");
38 colNames.push_back(
"KEY_TYPE");
39 colNames.push_back(
"KEY_ALIAS");
40 colNames.push_back(
"VERSION");
41 colNames.push_back(
"KIND_OF_COND");
42 colNames.push_back(
"PORT_CARD");
43 colNames.push_back(
"PANEL_NAME");
44 colNames.push_back(
"TBM_MODE");
45 colNames.push_back(
"AOH_CHAN");
57 for (
unsigned int c = 0;
c <
ins.size();
c++) {
58 for (
unsigned int n = 0;
n < colNames.size();
n++) {
59 if (tableMat[0][
c] == colNames[
n]) {
60 colM[colNames[
n]] =
c;
83 for (
unsigned int r = 1; r < tableMat.size(); r++) {
85 portcardname = tableMat[r][colM[
"PORT_CARD"]];
86 modulename = tableMat[r][colM[
"PANEL_NAME"]];
87 aohstring = tableMat[r][colM[
"AOH_CHAN"]];
88 tbmChannel = tableMat[r][colM[
"TBM_MODE"]];
96 aoh = (((
unsigned int)atoi(aohstring.c_str())));
99 if (
module.modulename() != modulename) {
100 std::cout << __LINE__ <<
"]\t" << mthn <<
"Modulename: " << modulename << std::endl;
101 std::cout << __LINE__ <<
"]\t" << mthn <<
"Parsed to : " <<
module.modulename() << std::endl;
104 if (tbmChannel.empty()) {
108 std::pair<std::string, int> portcardAndAOH(portcardname, aoh);
109 map_[channel] = portcardAndAOH;
116 std::string mthn =
"[PixelPortcardMap::PixelPortcardMap()]\t\t\t ";
120 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " <<
filename << std::endl;
121 throw std::runtime_error(
"Failed to open file " +
filename);
123 std::cout << __LINE__ <<
"]\t" << mthn <<
"Reading from: " <<
filename << std::endl;
141 in >> portcardname >> modulename >> aoh_string;
142 if (aoh_string ==
"A" ||
145 TBMChannel = aoh_string;
148 aoh = atoi(aoh_string.c_str());
152 if (
module.modulename() != modulename) {
153 std::cout << __LINE__ <<
"]\t" << mthn <<
"Modulename: " << modulename << std::endl;
154 std::cout << __LINE__ <<
"]\t" << mthn <<
"Parsed to : " <<
module.modulename() << std::endl;
159 std::pair<std::string, int> portcardAndAOH(portcardname, aoh);
160 map_[channel] = portcardAndAOH;
181 std::string mthn =
"[PixelPortcardMap::writeASCII()]\t\t\t\t ";
188 cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file: " <<
filename << endl;
192 out <<
"# Portcard Module AOH channel" << endl;
193 std::map<PixelChannel, std::pair<std::string, int> >::const_iterator
i =
map_.begin();
194 for (;
i !=
map_.end(); ++
i) {
195 out <<
i->second.first <<
" " <<
i->first.module() <<
" " <<
i->first.TBMChannel() <<
" " 196 <<
i->second.second << endl;
202 std::set<std::pair<std::string, int> > returnThis;
206 map_itr !=
map_.end();
208 if (map_itr->first.modulename() == aModule.
modulename()) {
209 returnThis.insert(map_itr->second);
219 map_itr !=
map_.end();
221 if (map_itr->first.modulename() ==
moduleName) {
222 portcardName = map_itr->second.first;
230 std::set<std::string> returnThis;
231 const std::set<std::pair<std::string, int> > portCardAndAOHs =
PortCardAndAOHs(aModule);
232 for (std::set<std::pair<std::string, int> >::const_iterator portCardAndAOHs_itr = portCardAndAOHs.begin();
233 portCardAndAOHs_itr != portCardAndAOHs.end();
234 ++portCardAndAOHs_itr) {
235 returnThis.insert((*portCardAndAOHs_itr).first);
251 std::map<PixelChannel, std::pair<std::string, int> >::const_iterator
found =
map_.find(aChannel);
253 std::pair<std::string, int> returnThis(
"none", 0);
256 return found->second;
261 std::set<PixelModuleName> returnThis;
265 map_itr !=
map_.end();
267 if (map_itr->second.first == portCardName) {
268 returnThis.insert(map_itr->first.module());
276 std::set<std::string> returnThis;
278 if (detconfig !=
nullptr) {
282 std::set<std::string> moduleNames;
285 moduleNames.insert(
it->modulename());
289 map_itr !=
map_.end();
291 if (moduleNames.find(map_itr->first.modulename()) != moduleNames.end()) {
292 returnThis.insert(map_itr->second.first);
298 map_itr !=
map_.end();
300 returnThis.insert(map_itr->second.first);
310 std::ofstream *outstream,
311 std::ofstream *out1stream,
312 std::ofstream *out2stream)
const {
313 std::string mthn =
"[PixelPortcardMap::writeXMLHeader()]\t\t\t ";
316 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " <<
fullPath.str() << std::endl;
318 outstream->open(
fullPath.str().c_str());
320 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
321 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
322 *outstream <<
" <HEADER>" << std::endl;
323 *outstream <<
" <TYPE>" << std::endl;
324 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_PORTCARD_MAP</EXTENSION_TABLE_NAME>" << std::endl;
325 *outstream <<
" <NAME>Pixel Port Card Map</NAME>" << std::endl;
326 *outstream <<
" </TYPE>" << std::endl;
327 *outstream <<
" <RUN>" << std::endl;
328 *outstream <<
" <RUN_TYPE>Pixel Port Card Map</RUN_TYPE>" << std::endl;
329 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
332 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
333 *outstream <<
" </RUN>" << std::endl;
334 *outstream <<
" </HEADER>" << std::endl;
335 *outstream <<
"" << std::endl;
336 *outstream <<
" <DATA_SET>" << std::endl;
337 *outstream <<
" <PART>" << std::endl;
338 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
339 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
340 *outstream <<
" </PART>" << std::endl;
341 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
342 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
343 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
348 std::string mthn =
"[PixelPortcardMap::writeXML()]\t\t\t ";
350 std::map<PixelChannel, std::pair<std::string, int> >::const_iterator
i =
map_.begin();
351 for (;
i !=
map_.end(); ++
i) {
352 *outstream <<
" <DATA>" << std::endl;
353 *outstream <<
" <PORT_CARD>" <<
i->second.first <<
"</PORT_CARD>" << std::endl;
354 *outstream <<
" <PANEL_NAME>" <<
i->first.module() <<
"</PANEL_NAME>" << std::endl;
355 *outstream <<
" <TBM_MODE>" <<
i->first.TBMChannel() <<
"</TBM_MODE>" << std::endl;
356 *outstream <<
" <AOH_CHAN>" <<
i->second.second <<
"</AOH_CHAN>" << std::endl;
357 *outstream <<
" </DATA>" << std::endl;
363 std::ofstream *out1stream,
364 std::ofstream *out2stream)
const {
365 std::string mthn =
"[PixelPortcardMap::writeXMLTrailer()]\t\t\t ";
367 *outstream <<
" </DATA_SET>" << std::endl;
368 *outstream <<
"</ROOT> " << std::endl;
This file contains the base class for "pixel configuration data" management.
Simple class to hold either "A" or "B" for the TBM channel.
This class provides the mapping between portcards and the modules controlled by the card...
std::string getComment() const
void writeASCII(std::string dir) const override
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
PixelPortcardMap(std::string filename)
const std::vector< PixelModuleName > & getModuleList() const
~PixelPortcardMap() override
This is the documentation about PixelDetectorConfig...
std::string modulename() const
key
prepare the HTCondor submission files and eventually submit them
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
std::set< PixelModuleName > modules(std::string portCardName) const
const std::set< std::string > portcards(const PixelModuleName &aModule) const
const std::set< std::pair< std::string, int > > PortCardAndAOHs(const PixelModuleName &aModule) const
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
std::string getAuthor() const
const std::pair< std::string, int > PortCardAndAOH(const PixelModuleName &aModule, const std::string &TBMChannel) const
bool getName(std::string moduleName, std::string &portcardName)
std::map< PixelChannel, std::pair< std::string, int > > map_