26 std::string mthn =
"]\t[PixelTrimAllPixels::PixelTrimAllPixels()]\t\t ";
27 std::stringstream currentRocName;
28 std::map<std::string, int> colM;
29 std::vector<std::string> colNames;
42 colNames.push_back(
"CONFIG_KEY");
43 colNames.push_back(
"KEY_TYPE");
44 colNames.push_back(
"KEY_ALIAS");
45 colNames.push_back(
"VERSION");
46 colNames.push_back(
"KIND_OF_COND");
47 colNames.push_back(
"ROC_NAME");
48 colNames.push_back(
"TRIM_BITS");
50 for (
unsigned int c = 0;
c < tableMat[0].size();
c++) {
51 for (
unsigned int n = 0;
n < colNames.size();
n++) {
52 if (tableMat[0][
c] == colNames[
n]) {
53 colM[colNames[
n]] =
c;
58 for (
unsigned int n = 0;
n < colNames.size();
n++) {
59 if (colM.find(colNames[
n]) == colM.end()) {
60 std::cerr << __LINE__ << mthn <<
"Couldn't find in the database the column with name " << colNames[
n]
70 for (
unsigned int r = 1;
r < tableMat.size();
r++)
85 throw std::runtime_error(
"Failed to open file " +
filename);
117 std::ifstream
in(
filename.c_str(), std::ios::binary);
119 throw std::runtime_error(
"Failed to open file " +
filename);
128 for (
int i = 0;
i < nchar;
i++) {
147 tmp.readBinary(rocid,
in);
159 for (
int i = 0;
i < nchar;
i++) {
194 std::vector<unsigned char> trimAndMasks(4160);
198 for (
unsigned int col = 0;
col < 52;
col++) {
199 for (
unsigned int row = 0; row < 80; row++) {
201 if (maskbits.
mask(
col, row) != 0)
203 trimAndMasks[
col * 80 + row] =
tmp;
221 std::ofstream
out(
filename.c_str(), std::ios::binary);
244 std::ofstream *outstream,
245 std::ofstream *out1stream,
246 std::ofstream *out2stream)
const {
247 std::string mthn =
"[PixelTrimAllPixels::writeXMLHeader()]\t\t\t ";
248 std::stringstream maskFullPath;
251 std::cout << mthn <<
"Writing to: " << maskFullPath.str() << std::endl;
253 outstream->open(maskFullPath.str().c_str());
255 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
256 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
257 *outstream <<
"" << std::endl;
258 *outstream <<
" <HEADER>" << std::endl;
259 *outstream <<
" <TYPE>" << std::endl;
260 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_TRIMS</EXTENSION_TABLE_NAME>" << std::endl;
261 *outstream <<
" <NAME>ROC Trim Bits</NAME>" << std::endl;
262 *outstream <<
" </TYPE>" << std::endl;
263 *outstream <<
" <RUN>" << std::endl;
264 *outstream <<
" <RUN_TYPE>ROC Trim Bits</RUN_TYPE>" << std::endl;
265 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
267 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
268 *outstream <<
" </RUN>" << std::endl;
269 *outstream <<
" </HEADER>" << std::endl;
270 *outstream <<
"" << std::endl;
271 *outstream <<
" <DATA_SET>" << std::endl;
272 *outstream <<
"" << std::endl;
273 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
274 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
275 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
276 *outstream <<
"" << std::endl;
277 *outstream <<
" <PART>" << std::endl;
278 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
279 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
280 *outstream <<
" </PART>" << std::endl;
281 *outstream <<
"" << std::endl;
286 std::ofstream *out1stream,
287 std::ofstream *out2stream)
const {
288 std::string mthn =
"[PixelTrimAllPixels::writeXML()]\t\t\t ";
297 std::ofstream *out1stream,
298 std::ofstream *out2stream)
const {
299 std::string mthn =
"[PixelTrimAllPixels::writeXMLTrailer()]\t\t\t ";
301 *outstream <<
" </DATA_SET>" << std::endl;
302 *outstream <<
"</ROOT>" << std::endl;
305 std::cout << mthn <<
"Data written " << std::endl;
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
void writeASCII(std::string filename) const override
unsigned int mfec() const
#define base64_decode(in, inlen, out, outlen)
std::string getComment() const
unsigned int portaddress() const
virtual int roctrimload(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, const std::vector< unsigned char > &allPixels)=0
virtual const PixelROCMaskBits & getMaskBits(int ROCId) const =0
Store mfec, mfecchannel etc.
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
unsigned int mfecchannel() const
std::vector< PixelROCTrimBits > trimbits_
unsigned int rocid() const
This is the documentation about PixelMaskBase...
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, const PixelMaskBase &pixelMask) const override
PixelTrimAllPixels(std::string filename)
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
This is the documentation about PixelNameTranslation...
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
PixelROCTrimBits getTrimBits(int ROCId) const override
std::string getAuthor() const
void writeBinary(std::string filename) const override
unsigned int hubaddress() const
unsigned int mask(unsigned int col, unsigned int row) const