28 std::string mthn =
"]\t[PixelTrimAllPixels::PixelTrimAllPixels()]\t\t " ;
29 std::stringstream currentRocName;
30 std::map<std::string , int > colM;
31 std::vector<std::string > colNames;
44 colNames.push_back(
"CONFIG_KEY" );
45 colNames.push_back(
"KEY_TYPE" );
46 colNames.push_back(
"KEY_ALIAS" );
47 colNames.push_back(
"VERSION" );
48 colNames.push_back(
"KIND_OF_COND");
49 colNames.push_back(
"ROC_NAME" );
50 colNames.push_back(
"TRIM_BITS" );
53 for(
unsigned int c = 0 ;
c < tableMat[0].size() ;
c++)
55 for(
unsigned int n=0;
n<colNames.size();
n++)
57 if(tableMat[0][
c] == colNames[
n])
59 colM[colNames[
n]] =
c;
64 for(
unsigned int n=0;
n<colNames.size();
n++)
66 if(colM.find(colNames[
n]) == colM.end())
68 std::cerr << __LINE__ << mthn <<
"Couldn't find in the database the column with name " << colNames[
n] << std::endl;
77 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++)
91 if (filename[filename.size()-1]==
't'){
93 std::ifstream
in(filename.c_str());
95 if (!
in.good())
throw std::runtime_error(
"Failed to open file "+filename);
111 assert( s1 ==
"ROC:" );
132 std::ifstream
in(filename.c_str(),std::ios::binary);
133 if (!
in.good())
throw std::runtime_error(
"Failed to open file "+filename);
142 for(
int i=0;
i< nchar;
i++){
172 if (
in.eof())
continue;
175 for(
int i=0;
i< nchar;
i++){
226 std::vector<unsigned char> trimAndMasks(4160);
231 for (
unsigned int row=0;row<80;row++){
233 if (maskbits.
mask(
col,row)!=0) tmp|=0x80;
234 trimAndMasks[
col*80+row]=
tmp;
254 std::ofstream
out(filename.c_str(),std::ios::binary);
266 if (dir!=
"") dir+=
"/";
271 std::ofstream
out(filename.c_str());
283 std::ofstream *outstream,
284 std::ofstream *out1stream,
285 std::ofstream *out2stream)
const 287 std::string mthn =
"[PixelTrimAllPixels::writeXMLHeader()]\t\t\t " ;
288 std::stringstream maskFullPath ;
291 std::cout << mthn <<
"Writing to: " << maskFullPath.str() << std::endl ;
293 outstream->open(maskFullPath.str().c_str()) ;
295 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
296 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
297 *outstream <<
"" << std::endl ;
298 *outstream <<
" <HEADER>" << std::endl ;
299 *outstream <<
" <TYPE>" << std::endl ;
300 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_TRIMS</EXTENSION_TABLE_NAME>" << std::endl ;
301 *outstream <<
" <NAME>ROC Trim Bits</NAME>" << std::endl ;
302 *outstream <<
" </TYPE>" << std::endl ;
303 *outstream <<
" <RUN>" << std::endl ;
304 *outstream <<
" <RUN_TYPE>ROC Trim Bits</RUN_TYPE>" << std::endl ;
305 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
307 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
308 *outstream <<
" </RUN>" << std::endl ;
309 *outstream <<
" </HEADER>" << std::endl ;
310 *outstream <<
"" << std::endl ;
311 *outstream <<
" <DATA_SET>" << std::endl ;
312 *outstream <<
"" << std::endl ;
313 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
314 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
315 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
316 *outstream <<
"" << std::endl ;
317 *outstream <<
" <PART>" << std::endl ;
318 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
319 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
320 *outstream <<
" </PART>" << std::endl ;
321 *outstream <<
"" << std::endl ;
327 std::ofstream *out1stream,
328 std::ofstream *out2stream)
const 330 std::string mthn =
"[PixelTrimAllPixels::writeXML()]\t\t\t " ;
339 std::ofstream *out1stream,
340 std::ofstream *out2stream )
const 342 std::string mthn =
"[PixelTrimAllPixels::writeXMLTrailer()]\t\t\t " ;
344 *outstream <<
" </DATA_SET>" << std::endl ;
345 *outstream <<
"</ROOT>" << std::endl ;
348 std::cout << mthn <<
"Data written " << std::endl ;
unsigned int mfec() const
void writeBinary(std::string filename) const override
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
int read(PixelROCName rocid, std::string in)
#define base64_decode(in, inlen, out, outlen)
void writeASCII(std::string filename) const override
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
unsigned int portaddress() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
virtual const PixelROCMaskBits & getMaskBits(int ROCId) const =0
int readBinary(PixelROCName rocid, std::ifstream &in)
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
unsigned int rocid() const
unsigned int mfecchannel() const
virtual int roctrimload(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, const std::vector< unsigned char > &allPixels)=0
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
std::string getComment() const
unsigned int hubaddress() const
Store mfec, mfecchannel etc.
std::string getAuthor() const
std::vector< PixelROCTrimBits > trimbits_
PixelROCTrimBits getTrimBits(int ROCId) const override
This is the documentation about PixelMaskBase...
PixelTrimAllPixels(std::string filename)
std::string modulename() const
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, const PixelMaskBase &pixelMask) const override
This is the documentation about PixelNameTranslation...
std::vector< std::vector< double > > tmp
unsigned int mask(unsigned int col, unsigned int row) const