23 std::string mthn =
"[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t " ;
24 vector<string>
ins = tableMat[0];
25 map<string , int > colM;
26 vector<string> colNames;
42 colNames.push_back(
"CONFIG_KEY" ) ;
43 colNames.push_back(
"KEY_TYPE" ) ;
44 colNames.push_back(
"KEY_ALIAS_ID" ) ;
45 colNames.push_back(
"KEY_ALIAS" ) ;
46 colNames.push_back(
"VERSION" ) ;
47 colNames.push_back(
"KIND_OF_COND" ) ;
48 colNames.push_back(
"GLOBALDELAY25") ;
49 for(
unsigned int c = 0 ;
c < ins.size() ;
c++)
51 for(
unsigned int n=0;
n<colNames.size();
n++)
53 if(tableMat[0][
c] == colNames[
n]){
54 colM[colNames[
n]] =
c;
59 for(
unsigned int n=0;
n<colNames.size();
n++)
61 if(colM.find(colNames[
n]) == colM.end())
63 std::cerr <<
"[PixelGlobalDelay25::PixelGlobalDelay25()]\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
67 sscanf(tableMat[1][colM[
"GLOBALDELAY25"]].c_str(),
"%x",&delay_);
68 std::cout << __LINE__ <<
"]\t" << mthn <<
"[DB] read global delay 0x" << std::hex << delay_ <<
std::dec << endl;
71 std::cout << __LINE__ <<
"]\t" << mthn <<
"global delay is out of range (>= 1 Tclk)." << std::endl;
72 std::cout << __LINE__ <<
"]\t" << mthn <<
"will not apply any global delays." << std::endl;
73 std::cout << __LINE__ <<
"]\t" << mthn <<
"increase the delays in the TPLL if needed." << std::endl;
82 std::string mthn =
"[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t\t " ;
83 std::ifstream
in(filename.c_str());
86 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
87 throw std::runtime_error(
"Failed to open file "+filename);
90 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename << std::endl;
94 std::cout << __LINE__ <<
"]\t" << mthn <<
"read global delay 0x" << std::hex <<
delay_ << std::dec << endl;
99 std::cout << __LINE__ <<
"]\t" << mthn <<
"global delay is out of range (>= 1 Tclk)." << std::endl;
100 std::cout << __LINE__ <<
"]\t" << mthn <<
"will not apply any global delays." << std::endl;
101 std::cout << __LINE__ <<
"]\t" << mthn <<
"increase the delays in the TPLL if needed." << std::endl;
111 std::string mthn =
"[PixelGlobalDelay25::getDelay()]\t\t\t " ;
114 std::cout << __LINE__ <<
"]\t" << mthn <<
"the required total delay "<<ret<<
" is out of range." << endl;
115 std::cout << __LINE__ <<
"]\t" << mthn <<
"original setting: "<<offset<<
", global delay: "<<delay_ << endl;
116 std::cout << __LINE__ <<
"]\t" << mthn <<
"we will keep the default delay setting..." << endl;
121 std::cout << __LINE__ <<
"]\t" << mthn <<
"getDelay("<<offset<<
") returns "<<ret<<endl;
127 std::string mthn =
"[PixelGlobalDelay25::getCyclicDelay()]\t\t\t " ;
129 if (ret > 120) ret-=50;
130 std::cout<< __LINE__ <<
"]\t" << mthn <<
"getCyclicDelay("<<offset<<
") returns "<<ret<<endl;
143 std::string mthn =
"[PixelGlobalDelay25::getTTCrxDelay()]\t\t\t " ;
144 unsigned int K=(offset/16*16+offset%16*15+30)%240;
145 K+=(
unsigned int)floor((
delay_*0.499)/0.1039583 + 0.5);
150 std::cout << __LINE__ <<
"]\t" << mthn <<
"the required TTCrx fine delay "<<K<<
" is out of range."<<endl;
151 std::cout << __LINE__ <<
"]\t" << mthn <<
"this can happen if the register was initialized to 0"<<endl;
152 std::cout << __LINE__ <<
"]\t" << mthn <<
"(i.e. delay of 3.1 ns) and the required delay is >21.7 ns."<<endl;
153 std::cout << __LINE__ <<
"]\t" << mthn <<
"we will keep the current delay setting..."<<endl;
157 unsigned int m=((K/15)-n+14)%16;
161 std::cout << __LINE__ <<
"]\t" << mthn <<
"getTTCrxDelay("<<offset<<
") returns "<<ret<<endl;
182 std::string mthn =
"[PixelGlobalDelay25::writeASCII()]\t\t\t " ;
183 if (dir!=
"") dir+=
"/";
184 string filename=dir+
"globaldelay25.dat";
186 ofstream
out(filename.c_str());
188 cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file:"<<filename<<endl;
201 std::ofstream *outstream,
202 std::ofstream *out1stream,
203 std::ofstream *out2stream)
const
205 std::stringstream
s ; s << __LINE__ <<
"]\t[[PixelGlobalDelay25::writeXMLHeader()]\t\t\t " ;
209 cout << mthn <<
"Writing to: " << fullPath.str() << endl ;
211 outstream->open(fullPath.str().c_str()) ;
213 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
214 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
215 *outstream <<
"" << std::endl ;
216 *outstream <<
" <!-- " << mthn <<
"-->" << std::endl ;
217 *outstream <<
"" << std::endl ;
218 *outstream <<
" <HEADER>" << std::endl ;
219 *outstream <<
" <TYPE>" << std::endl ;
220 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_GLOBAL_DELAY25</EXTENSION_TABLE_NAME>" << std::endl ;
221 *outstream <<
" <NAME>Pixel Global Delay25</NAME>" << std::endl ;
222 *outstream <<
" </TYPE>" << std::endl ;
223 *outstream <<
" <RUN>" << std::endl ;
224 *outstream <<
" <RUN_TYPE>Pixel Global Delay25</RUN_TYPE>" << std::endl ;
225 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
227 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
228 *outstream <<
" </RUN>" << std::endl ;
229 *outstream <<
" </HEADER>" << std::endl ;
230 *outstream <<
"" << std::endl ;
231 *outstream <<
" <DATA_SET>" << std::endl ;
232 *outstream <<
" " << std::endl ;
233 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
234 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
235 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
236 *outstream <<
" " << std::endl ;
237 *outstream <<
" <PART>" << std::endl ;
238 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
239 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
240 *outstream <<
" </PART>" << std::endl ;
246 std::ofstream *out1stream,
247 std::ofstream *out2stream)
const
249 std::stringstream
s ; s << __LINE__ <<
"]\t[PixelGlobalDelay25::writeXML()]\t\t\t " ;
252 *outstream <<
" <DATA>" << std::endl ;
253 *outstream <<
" <GLOBALDELAY25>0x" << hex <<
delay_ <<
dec <<
"</GLOBALDELAY25>" << std::endl ;
254 *outstream <<
" </DATA>" << std::endl ;
255 *outstream <<
" " << std::endl ;
260 std::ofstream *out1stream,
261 std::ofstream *out2stream)
const
263 std::stringstream
s ; s << __LINE__ <<
"]\t[PixelGlobalDelay25::writeASCII()]\t\t\t " ;
266 *outstream <<
" " << std::endl ;
267 *outstream <<
" </DATA_SET>" << std::endl ;
268 *outstream <<
"</ROOT> " << std::endl ;
This file contains the base class for "pixel configuration data" management.
virtual ~PixelGlobalDelay25()
unsigned int getCyclicDelay(unsigned int offset=0) const
virtual void writeXML(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
tuple path
else: Piece not in the list, fine.
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
PixelGlobalDelay25(std::string filename)
std::string getComment() const
std::string getAuthor() const
unsigned int offset(bool)
virtual void writeASCII(std::string dir) const
unsigned int getDelay(unsigned int offset=0) const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
unsigned int getTTCrxDelay() const
This class specifies which delay25 channels are delayed over the entire pixel detector and by how muc...