CMS 3D CMS Logo

pos::PixelGlobalDelay25 Class Reference
["Configuration Objects"]

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

#include <CalibFormats/SiPixelObjects/interface/PixelGlobalDelay25.h>

Inheritance diagram for pos::PixelGlobalDelay25:

pos::PixelConfigBase

List of all members.

Public Member Functions

unsigned int getDelay (unsigned int offset=0) const
unsigned int getTTCrxDelay (unsigned int offset=0) const
 PixelGlobalDelay25 (std::string filename)
virtual void writeASCII (std::string dir) const
virtual void writeXML (std::ofstream *out) const
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
virtual void writeXMLTrailer (std::ofstream *out) const
virtual ~PixelGlobalDelay25 ()

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 18 of file PixelGlobalDelay25.cc.

References GenMuonPlsPt100GeV_cfg::cout, delay_, lat::endl(), and in.

00018                                                         :
00019     PixelConfigBase(" "," "," "){
00020 
00021     std::ifstream in(filename.c_str());
00022 
00023     if (!in.good()){
00024         std::cout << "Could not open:"<<filename<<std::endl;
00025         assert(0);
00026     }
00027     else {
00028         std::cout << "Opened:"<<filename<<std::endl;
00029     }
00030 
00031     in >> std::hex >> delay_ >> std::dec;
00032     std::cout << "PixelGlobalDelay25:: read global delay 0x" << std::hex << delay_ << std::dec << endl;  
00033 
00034     in.close();
00035 
00036     if (delay_>=50) {
00037       std::cout << "PixelGlobalDelay25:: global delay is out of range (>= 1 Tclk)."<< std::endl;
00038       std::cout << "PixelGlobalDelay25:: will not apply any global delays."<<std::endl;
00039       std::cout << "PixelGlobalDelay25:: increase the delays in the TPLL if needed."<<std::endl;
00040       delay_=0;
00041     }
00042 }

PixelGlobalDelay25::~PixelGlobalDelay25 (  )  [virtual]

Definition at line 45 of file PixelGlobalDelay25.cc.

00045 {}


Member Function Documentation

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

Definition at line 48 of file PixelGlobalDelay25.cc.

References GenMuonPlsPt100GeV_cfg::cout, delay_, and lat::endl().

00048                                                                   {
00049   unsigned int ret=offset+delay_;
00050   if (ret > 127) {
00051     std::cout<<"PixelGlobalDelay25:: the required Delay25 delay "<<ret<<" is out of range."<<endl;
00052     std::cout<<"PixelGlobalDelay25:: this can happen if the operating point is chosen to be"<<endl;
00053     std::cout<<"PixelGlobalDelay25:: over 78; i.e. more than 7 ns delay."<<endl;    
00054     std::cout<<"PixelGlobalDelay25:: we will keep the current delay setting..."<<endl;
00055     ret=offset;
00056   }
00057 
00058   std::cout<<"PixelGlobalDelay25::getDelay("<<offset<<") returns "<<ret<<endl;
00059   return ret;
00060 }

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

Definition at line 63 of file PixelGlobalDelay25.cc.

References GenMuonPlsPt100GeV_cfg::cout, delay_, lat::endl(), K, m, and n.

00063                                                                        {
00064   // Computes the TTCrx delay settting required to compensate for the global Delay25 shift.
00065   //
00066   // 'offset' is the current register setting in the TTCrx.
00067   //
00068   // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted
00069   // to the units of the TTCrx delay generator 103.96 ps
00070 
00071   unsigned int K=(offset/16*16+offset%16*15+30)%240;
00072   K+=floor((delay_*0.499)/0.1039583 + 0.5); // add max 235
00073 
00074   unsigned int ret;
00075   if (K>239) {
00076     std::cout<<"PixelGlobalDelay25:: the required TTCrx fine delay "<<K<<" is out of range."<<endl;
00077     std::cout<<"PixelGlobalDelay25:: this can happen if the register was initialized to 0"<<endl;
00078     std::cout<<"PixelGlobalDelay25:: (i.e. delay of 3.1 ns) and the required delay is >21.7 ns."<<endl;    
00079     std::cout<<"PixelGlobalDelay25:: we will keep the current delay setting..."<<endl;
00080     ret=offset;
00081   }else{
00082     unsigned int n=K%15;
00083     unsigned int m=((K/15)-n+14)%16;
00084     ret=16*n+m;
00085   }
00086   
00087   std::cout<<"PixelGlobalDelay25::getTTCrxDelay("<<offset<<") returns "<<ret<<endl;
00088   return ret;
00089   //return offset;
00090 }

void PixelGlobalDelay25::writeASCII ( std::string  dir  )  const [virtual]

Implements pos::PixelConfigBase.

Definition at line 93 of file PixelGlobalDelay25.cc.

References GenMuonPlsPt100GeV_cfg::cout, delay_, lat::endl(), EgammaValidation_cff::filename, and out.

00093                                                        {
00094 
00095   if (dir!="") dir+="/";
00096   string filename=dir+"globaldelay25.dat";
00097 
00098   ofstream out(filename.c_str());
00099   if(!out.good()){
00100     cout << "Could not open file:"<<filename<<endl;
00101     assert(0);
00102   }
00103 
00104   out << "0x" << hex << delay_ << dec << endl;
00105 
00106   out.close();
00107 }

virtual void pos::PixelGlobalDelay25::writeXML ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 38 of file PixelGlobalDelay25.h.

00038 {;}

void pos::PixelGlobalDelay25::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 36 of file PixelGlobalDelay25.h.

00036 {;}

virtual void pos::PixelGlobalDelay25::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 37 of file PixelGlobalDelay25.h.

00037 {;}

virtual void pos::PixelGlobalDelay25::writeXMLTrailer ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 39 of file PixelGlobalDelay25.h.

00039 {;}


Member Data Documentation

unsigned int pos::PixelGlobalDelay25::delay_ [private]

Definition at line 42 of file PixelGlobalDelay25.h.

Referenced by getDelay(), getTTCrxDelay(), PixelGlobalDelay25(), and writeASCII().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:34 2009 for CMSSW by  doxygen 1.5.4