CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
pos::PixelGlobalDelay25 Class Reference

This class specifies which delay25 channels are delayed over the entire pixel detector and by how much. More...

#include <PixelGlobalDelay25.h>

Inheritance diagram for pos::PixelGlobalDelay25:
pos::PixelConfigBase

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::string filename)
 
 PixelGlobalDelay25 (std::vector< std::vector< std::string > > &tab)
 
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 ()
 
- Public Member Functions inherited from pos::PixelConfigBase
std::string creator ()
 
std::string date ()
 
std::string description ()
 
std::string getAuthor () const
 
std::string getComment () const
 
 PixelConfigBase (std::string description, std::string creator, std::string date)
 
void setAuthor (std::string author)
 
void setComment (std::string comment)
 
virtual void writeXML (pos::PixelConfigKey key, int version, std::string path) const
 
virtual void writeXML (std::ofstream *out) const
 
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
 
virtual void writeXMLTrailer (std::ofstream *out) const
 
virtual ~PixelConfigBase ()
 

Private Attributes

unsigned int delay_
 

Detailed Description

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.

Constructor & Destructor Documentation

PixelGlobalDelay25::PixelGlobalDelay25 ( std::string  filename)

Definition at line 79 of file PixelGlobalDelay25.cc.

References gather_cfg::cout, delay_, and recoMuon::in.

79  :
80  PixelConfigBase(" "," "," "){
81 
82  std::string mthn = "[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t\t " ;
83  std::ifstream in(filename.c_str());
84 
85  if (!in.good()){
86  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
87  throw std::runtime_error("Failed to open file "+filename);
88  }
89  else {
90  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
91  }
92 
93  in >> std::hex >> delay_ >> std::dec;
94  std::cout << __LINE__ << "]\t" << mthn << "read global delay 0x" << std::hex << delay_ << std::dec << endl;
95 
96  in.close();
97 
98  if (delay_>=50) {
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;
102  delay_=0;
103  }
104 }
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
PixelConfigBase(std::string description, std::string creator, std::string date)
pos::PixelGlobalDelay25::PixelGlobalDelay25 ( std::vector< std::vector< std::string > > &  tab)
PixelGlobalDelay25::~PixelGlobalDelay25 ( )
virtual

Definition at line 107 of file PixelGlobalDelay25.cc.

107 {}

Member Function Documentation

unsigned int PixelGlobalDelay25::getCyclicDelay ( unsigned int  offset = 0) const

Definition at line 126 of file PixelGlobalDelay25.cc.

References gather_cfg::cout, delay_, and run_regression::ret.

126  {
127  std::string mthn = "[PixelGlobalDelay25::getCyclicDelay()]\t\t\t " ;
128  unsigned int ret=offset+delay_;
129  if (ret > 120) ret-=50;
130  std::cout<< __LINE__ << "]\t" << mthn << "getCyclicDelay("<<offset<<") returns "<<ret<<endl;
131  return ret;
132 }
unsigned int offset(bool)
tuple cout
Definition: gather_cfg.py:121
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 run_regression::ret.

110  {
111  std::string mthn = "[PixelGlobalDelay25::getDelay()]\t\t\t " ;
112  unsigned int ret=offset+delay_;
113  if (ret > 127) {
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;
117 
118  ret=offset;
119  }
120 
121  std::cout << __LINE__ << "]\t" << mthn << "getDelay("<<offset<<") returns "<<ret<<endl;
122  return ret;
123 }
unsigned int offset(bool)
tuple cout
Definition: gather_cfg.py:121
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 run_regression::ret.

135  {
136  // Computes the TTCrx delay settting required to compensate for the global Delay25 shift.
137  //
138  // 'offset' is the current register setting in the TTCrx register
139  //
140  // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted
141  // to the units of the TTCrx delay generator 103.96 ps
142 
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); // add max 235
146 
147 
148  unsigned int ret;
149  if (K>239) {
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;
154  ret=offset;
155  }else{
156  unsigned int n=K%15;
157  unsigned int m=((K/15)-n+14)%16;
158  ret=16*n+m;
159  }
160 
161  std::cout << __LINE__ << "]\t" << mthn << "getTTCrxDelay("<<offset<<") returns "<<ret<<endl;
162  return ret;
163  //return offset;
164 }
unsigned int offset(bool)
tuple cout
Definition: gather_cfg.py:121
unsigned int PixelGlobalDelay25::getTTCrxDelay ( ) const

Definition at line 167 of file PixelGlobalDelay25.cc.

167  {
168  // Computes the TTCrx delay settting required to compensate for the global Delay25 shift.
169  //
170  // Assumes that the current register setting in the TTCrx is 0 ns (14)
171  //
172  // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted
173  // to the units of the TTCrx delay generator 103.96 ps
174 
175  return getTTCrxDelay(14);
176 }
unsigned int getTTCrxDelay() const
virtual void pos::PixelGlobalDelay25::setDelay ( unsigned int  delay)
inlinevirtual

Definition at line 39 of file PixelGlobalDelay25.h.

References delay_.

39 {delay_ = delay ;}
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.

180  {
181 
182  std::string mthn = "[PixelGlobalDelay25::writeASCII()]\t\t\t " ;
183  if (dir!="") dir+="/";
184  string filename=dir+"globaldelay25.dat";
185 
186  ofstream out(filename.c_str());
187  if(!out.good()){
188  cout << __LINE__ << "]\t" << mthn << "Could not open file:"<<filename<<endl;
189  assert(0);
190  }
191 
192  out << "0x" << hex << delay_ << dec << endl;
193 
194  out.close();
195 }
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
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 alignCSCRings::s.

248 {
249  std::stringstream s ; s << __LINE__ << "]\t[PixelGlobalDelay25::writeXML()]\t\t\t " ;
250  std::string mthn = s.str() ;
251 
252  *outstream << " <DATA>" << std::endl ;
253  *outstream << " <GLOBALDELAY25>0x" << hex << delay_ << dec << "</GLOBALDELAY25>" << std::endl ;
254  *outstream << " </DATA>" << std::endl ;
255  *outstream << " " << std::endl ;
256 }
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(), pos::PixelTimeFormatter::getTime(), and alignCSCRings::s.

204 {
205  std::stringstream s ; s << __LINE__ << "]\t[[PixelGlobalDelay25::writeXMLHeader()]\t\t\t " ;
206  std::string mthn = s.str() ;
207  std::stringstream fullPath ;
208  fullPath << path << "/Pixel_GlobalDelay25_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
209  cout << mthn << "Writing to: " << fullPath.str() << endl ;
210 
211  outstream->open(fullPath.str().c_str()) ;
212 
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 ;
226  *outstream << " <RUN_BEGIN_TIMESTAMP>" << pos::PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << 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 ;
241 
242 }
static std::string getmSecTime(void)
list path
Definition: scaleCards.py:51
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
tuple cout
Definition: gather_cfg.py:121
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 alignCSCRings::s.

262 {
263  std::stringstream s ; s << __LINE__ << "]\t[PixelGlobalDelay25::writeASCII()]\t\t\t " ;
264  std::string mthn = s.str() ;
265 
266  *outstream << " " << std::endl ;
267  *outstream << " </DATA_SET>" << std::endl ;
268  *outstream << "</ROOT> " << std::endl ;
269 
270  outstream->close() ;
271 }

Member Data Documentation

unsigned int pos::PixelGlobalDelay25::delay_
private