This class specifies which delay25 channels are delayed over the entire pixel detector and by how much. More...
#include <PixelGlobalDelay25.h>
Public Member Functions | |
unsigned int | getCyclicDelay (unsigned int offset=0) const |
unsigned int | getDelay (unsigned int offset=0) const |
unsigned int | getTTCrxDelay (unsigned int offset) const |
unsigned int | getTTCrxDelay () const |
PixelGlobalDelay25 (std::vector< std::vector< std::string > > &tab) | |
PixelGlobalDelay25 (std::string filename) | |
virtual void | setDelay (unsigned int delay) |
virtual void | writeASCII (std::string dir) const |
virtual void | writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const |
virtual void | writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const |
virtual void | writeXMLTrailer (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const |
virtual | ~PixelGlobalDelay25 () |
Private Attributes | |
unsigned int | delay_ |
This class specifies which delay25 channels are delayed over the entire pixel detector and by how much.
" "
A longer explanation will be placed here later
Definition at line 26 of file PixelGlobalDelay25.h.
PixelGlobalDelay25::PixelGlobalDelay25 | ( | std::string | filename | ) |
Definition at line 79 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, delay_, and recoMuon::in.
: PixelConfigBase(" "," "," "){ std::string mthn = "[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t\t " ; std::ifstream in(filename.c_str()); if (!in.good()){ std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl; throw std::runtime_error("Failed to open file "+filename); } else { std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl; } in >> std::hex >> delay_ >> std::dec; std::cout << __LINE__ << "]\t" << mthn << "read global delay 0x" << std::hex << delay_ << std::dec << endl; in.close(); if (delay_>=50) { std::cout << __LINE__ << "]\t" << mthn << "global delay is out of range (>= 1 Tclk)." << std::endl; std::cout << __LINE__ << "]\t" << mthn << "will not apply any global delays." << std::endl; std::cout << __LINE__ << "]\t" << mthn << "increase the delays in the TPLL if needed." << std::endl; delay_=0; } }
pos::PixelGlobalDelay25::PixelGlobalDelay25 | ( | std::vector< std::vector< std::string > > & | tab | ) |
PixelGlobalDelay25::~PixelGlobalDelay25 | ( | ) | [virtual] |
Definition at line 107 of file PixelGlobalDelay25.cc.
{}
unsigned int PixelGlobalDelay25::getCyclicDelay | ( | unsigned int | offset = 0 | ) | const |
Definition at line 126 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, delay_, and runTheMatrix::ret.
unsigned int PixelGlobalDelay25::getDelay | ( | unsigned int | offset = 0 | ) | const |
Definition at line 110 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, delay_, evf::evtn::offset(), and runTheMatrix::ret.
{ std::string mthn = "[PixelGlobalDelay25::getDelay()]\t\t\t " ; unsigned int ret=offset+delay_; if (ret > 127) { std::cout << __LINE__ << "]\t" << mthn <<"the required total delay "<<ret<<" is out of range." << endl; std::cout << __LINE__ << "]\t" << mthn <<"original setting: "<<offset<<", global delay: "<<delay_ << endl; std::cout << __LINE__ << "]\t" << mthn <<"we will keep the default delay setting..." << endl; ret=offset; } std::cout << __LINE__ << "]\t" << mthn << "getDelay("<<offset<<") returns "<<ret<<endl; return ret; }
unsigned int PixelGlobalDelay25::getTTCrxDelay | ( | ) | const |
Definition at line 167 of file PixelGlobalDelay25.cc.
{ // Computes the TTCrx delay settting required to compensate for the global Delay25 shift. // // Assumes that the current register setting in the TTCrx is 0 ns (14) // // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted // to the units of the TTCrx delay generator 103.96 ps return getTTCrxDelay(14); }
unsigned int PixelGlobalDelay25::getTTCrxDelay | ( | unsigned int | offset | ) | const |
Definition at line 135 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, delay_, m, evf::evtn::offset(), and runTheMatrix::ret.
{ // Computes the TTCrx delay settting required to compensate for the global Delay25 shift. // // 'offset' is the current register setting in the TTCrx register // // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted // to the units of the TTCrx delay generator 103.96 ps std::string mthn = "[PixelGlobalDelay25::getTTCrxDelay()]\t\t\t " ; unsigned int K=(offset/16*16+offset%16*15+30)%240; K+=(unsigned int)floor((delay_*0.499)/0.1039583 + 0.5); // add max 235 unsigned int ret; if (K>239) { std::cout << __LINE__ << "]\t" << mthn << "the required TTCrx fine delay "<<K<<" is out of range."<<endl; std::cout << __LINE__ << "]\t" << mthn << "this can happen if the register was initialized to 0"<<endl; std::cout << __LINE__ << "]\t" << mthn << "(i.e. delay of 3.1 ns) and the required delay is >21.7 ns."<<endl; std::cout << __LINE__ << "]\t" << mthn << "we will keep the current delay setting..."<<endl; ret=offset; }else{ unsigned int n=K%15; unsigned int m=((K/15)-n+14)%16; ret=16*n+m; } std::cout << __LINE__ << "]\t" << mthn << "getTTCrxDelay("<<offset<<") returns "<<ret<<endl; return ret; //return offset; }
virtual void pos::PixelGlobalDelay25::setDelay | ( | unsigned int | delay | ) | [inline, virtual] |
void PixelGlobalDelay25::writeASCII | ( | std::string | dir | ) | const [virtual] |
Implements pos::PixelConfigBase.
Definition at line 180 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, delay_, lut2db_cfg::filename, and dbtoconf::out.
{ std::string mthn = "[PixelGlobalDelay25::writeASCII()]\t\t\t " ; if (dir!="") dir+="/"; string filename=dir+"globaldelay25.dat"; ofstream out(filename.c_str()); if(!out.good()){ cout << __LINE__ << "]\t" << mthn << "Could not open file:"<<filename<<endl; assert(0); } out << "0x" << hex << delay_ << dec << endl; out.close(); }
void PixelGlobalDelay25::writeXML | ( | std::ofstream * | out, |
std::ofstream * | out1 = NULL , |
||
std::ofstream * | out2 = NULL |
||
) | const [virtual] |
Reimplemented from pos::PixelConfigBase.
Definition at line 245 of file PixelGlobalDelay25.cc.
References delay_, and asciidump::s.
{ std::stringstream s ; s << __LINE__ << "]\t[PixelGlobalDelay25::writeXML()]\t\t\t " ; std::string mthn = s.str() ; *outstream << " <DATA>" << std::endl ; *outstream << " <GLOBALDELAY25>0x" << hex << delay_ << dec << "</GLOBALDELAY25>" << std::endl ; *outstream << " </DATA>" << std::endl ; *outstream << " " << std::endl ; }
void PixelGlobalDelay25::writeXMLHeader | ( | pos::PixelConfigKey | key, |
int | version, | ||
std::string | path, | ||
std::ofstream * | out, | ||
std::ofstream * | out1 = NULL , |
||
std::ofstream * | out2 = NULL |
||
) | const [virtual] |
Reimplemented from pos::PixelConfigBase.
Definition at line 198 of file PixelGlobalDelay25.cc.
References gather_cfg::cout, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), edm::service::getTime(), and asciidump::s.
{ std::stringstream s ; s << __LINE__ << "]\t[[PixelGlobalDelay25::writeXMLHeader()]\t\t\t " ; std::string mthn = s.str() ; std::stringstream fullPath ; fullPath << path << "/Pixel_GlobalDelay25_" << PixelTimeFormatter::getmSecTime() << ".xml" ; cout << mthn << "Writing to: " << fullPath.str() << endl ; outstream->open(fullPath.str().c_str()) ; *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ; *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <!-- " << mthn << "-->" << std::endl ; *outstream << "" << std::endl ; *outstream << " <HEADER>" << std::endl ; *outstream << " <TYPE>" << std::endl ; *outstream << " <EXTENSION_TABLE_NAME>PIXEL_GLOBAL_DELAY25</EXTENSION_TABLE_NAME>" << std::endl ; *outstream << " <NAME>Pixel Global Delay25</NAME>" << std::endl ; *outstream << " </TYPE>" << std::endl ; *outstream << " <RUN>" << std::endl ; *outstream << " <RUN_TYPE>Pixel Global Delay25</RUN_TYPE>" << std::endl ; *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ; *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ; *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ; *outstream << " </RUN>" << std::endl ; *outstream << " </HEADER>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <DATA_SET>" << std::endl ; *outstream << " " << std::endl ; *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ; *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ; *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ; *outstream << " " << std::endl ; *outstream << " <PART>" << std::endl ; *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ; *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ; *outstream << " </PART>" << std::endl ; }
void PixelGlobalDelay25::writeXMLTrailer | ( | std::ofstream * | out, |
std::ofstream * | out1 = NULL , |
||
std::ofstream * | out2 = NULL |
||
) | const [virtual] |
Reimplemented from pos::PixelConfigBase.
Definition at line 259 of file PixelGlobalDelay25.cc.
References asciidump::s.
{ std::stringstream s ; s << __LINE__ << "]\t[PixelGlobalDelay25::writeASCII()]\t\t\t " ; std::string mthn = s.str() ; *outstream << " " << std::endl ; *outstream << " </DATA_SET>" << std::endl ; *outstream << "</ROOT> " << std::endl ; outstream->close() ; }
unsigned int pos::PixelGlobalDelay25::delay_ [private] |
Definition at line 59 of file PixelGlobalDelay25.h.
Referenced by getCyclicDelay(), getDelay(), getTTCrxDelay(), PixelGlobalDelay25(), setDelay(), writeASCII(), and writeXML().