File indexing completed on 2024-04-06 12:02:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CondTools/DT/test/validate/DTROMapValidateHandler.h"
0014
0015
0016
0017
0018 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0019
0020
0021
0022
0023 #include <iostream>
0024 #include <fstream>
0025 #include <sstream>
0026
0027
0028
0029
0030
0031
0032
0033
0034 DTROMapValidateHandler::DTROMapValidateHandler(const edm::ParameterSet& ps)
0035 : dataVersion(ps.getParameter<std::string>("version")),
0036 dataFileName(ps.getParameter<std::string>("outFile")),
0037 elogFileName(ps.getParameter<std::string>("logFile")) {
0038 std::ofstream logFile(elogFileName.c_str());
0039 }
0040
0041
0042
0043
0044 DTROMapValidateHandler::~DTROMapValidateHandler() {}
0045
0046
0047
0048
0049 void DTROMapValidateHandler::getNewObjects() {
0050 std::string dRosTag(dataVersion);
0051 std::string dRobTag(dataVersion);
0052 dRosTag += "_ROS";
0053 dRobTag += "_ROB";
0054 DTReadOutMapping* ro = new DTReadOutMapping(dRosTag, dRobTag);
0055
0056
0057
0058
0059 int status = 0;
0060
0061 std::ofstream outFile(dataFileName.c_str());
0062 std::ofstream logFile(elogFileName.c_str(), std::ios_base::app);
0063 int whe;
0064 int sta;
0065 int sec;
0066 int qua;
0067 int lay;
0068 int cel;
0069 int ddu;
0070 int ros;
0071 int rob;
0072 int tdc;
0073 int cha;
0074 int ckwhe;
0075 int cksta;
0076 int cksec;
0077 int ckqua;
0078 int cklay;
0079 int ckcel;
0080 int ckddu;
0081 int ckros;
0082 int ckrob;
0083 int cktdc;
0084 int ckcha;
0085
0086 whe = 3;
0087 while (--whe >= -2) {
0088 ddu = whe + 773;
0089 sta = 5;
0090 while (--sta) {
0091
0092
0093 sec = 13;
0094 while (--sec) {
0095 ros = sec;
0096 qua = 4;
0097 while (--qua) {
0098 rob = ((sta - 1) * 6) + qua;
0099 if ((sta == 4) && (qua == 2))
0100 continue;
0101 lay = 5;
0102 while (--lay) {
0103 cel = 20;
0104 while (--cel) {
0105 cha = ((cel - 1) * 4) + lay;
0106 tdc = 0;
0107 while (cha > 31) {
0108 cha -= 32;
0109 tdc++;
0110 }
0111 status = ro->insertReadOutGeometryLink(ddu, ros, rob, tdc, cha, whe, sta, sec, qua, lay, cel);
0112 outFile << ddu << " " << ros << " " << rob << " " << tdc << " " << cha << " " << whe << " " << sta << " "
0113 << sec << " " << qua << " " << lay << " " << cel << std::endl;
0114 if (status)
0115 logFile << "ERROR while setting chan-cell map " << ddu << " " << ros << " " << rob << " " << tdc << " "
0116 << cha << " -> " << whe << " " << sta << " " << sec << " " << qua << " " << lay << " " << cel
0117 << " , status = " << status << std::endl;
0118 status = ro->readOutToGeometry(ddu, ros, rob, tdc, cha, ckwhe, cksta, cksec, ckqua, cklay, ckcel);
0119 if (status)
0120 logFile << "ERROR while checking chan->cell map " << ddu << " " << ros << " " << rob << " " << tdc
0121 << " " << cha << " -> " << whe << " " << sta << " " << sec << " " << qua << " " << lay << " "
0122 << cel << " , status = " << status << std::endl;
0123 if ((ckwhe != whe) || (cksta != sta) || (cksec != sec) || (ckqua != qua) || (cklay != lay) ||
0124 (ckcel != cel))
0125 logFile << "MISMATCH WHEN WRITING chan->cell " << ddu << " " << ros << " " << rob << " " << tdc << " "
0126 << cha << " : " << whe << " " << sta << " " << sec << " " << qua << " " << lay << " " << cel
0127 << " -> " << ckwhe << " " << cksta << " " << cksec << " " << ckqua << " " << cklay << " "
0128 << ckcel << std::endl;
0129 status = ro->geometryToReadOut(whe, sta, sec, qua, lay, cel, ckddu, ckros, ckrob, cktdc, ckcha);
0130 if (status)
0131 logFile << "ERROR while checking cell->chan map " << whe << " " << sta << " " << sec << " " << qua
0132 << " " << lay << " " << cel << " -> " << ddu << " " << ros << " " << rob << " " << tdc << " "
0133 << cha << " , status = " << status << std::endl;
0134 if ((ckddu != ddu) || (ckros != ros) || (ckrob != rob) || (cktdc != tdc) || (ckcha != cha))
0135 logFile << "MISMATCH WHEN WRITING cell->chan " << whe << " " << sta << " " << sec << " " << qua << " "
0136 << lay << " " << cel << " : " << ddu << " " << ros << " " << rob << " " << tdc << " " << cha
0137 << " -> " << ckddu << " " << ckros << " " << ckrob << " " << cktdc << " " << ckcha << std::endl;
0138 }
0139 }
0140 }
0141 }
0142 }
0143 }
0144
0145 cond::Time_t snc = 1;
0146 m_to_transfer.push_back(std::make_pair(ro, snc));
0147
0148 return;
0149 }
0150
0151 std::string DTROMapValidateHandler::id() const { return dataVersion; }