CMS 3D CMS Logo

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 () const
 
unsigned int getTTCrxDelay (unsigned int offset) const
 
 PixelGlobalDelay25 (std::string filename)
 
 PixelGlobalDelay25 (std::vector< std::vector< std::string > > &tab)
 
virtual void setDelay (unsigned int delay)
 
void writeASCII (std::string dir) const override
 
void writeXML (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
void writeXMLTrailer (std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
 
 ~PixelGlobalDelay25 () override
 
- 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() [1/2]

PixelGlobalDelay25::PixelGlobalDelay25 ( std::string  filename)

Definition at line 73 of file PixelGlobalDelay25.cc.

73  : PixelConfigBase(" ", " ", " ") {
74  std::string mthn = "[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t\t ";
75  std::ifstream in(filename.c_str());
76 
77  if (!in.good()) {
78  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
79  throw std::runtime_error("Failed to open file " + filename);
80  } else {
81  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
82  }
83 
84  in >> std::hex >> delay_ >> std::dec;
85  std::cout << __LINE__ << "]\t" << mthn << "read global delay 0x" << std::hex << delay_ << std::dec << endl;
86 
87  in.close();
88 
89  if (delay_ >= 50) {
90  std::cout << __LINE__ << "]\t" << mthn << "global delay is out of range (>= 1 Tclk)." << std::endl;
91  std::cout << __LINE__ << "]\t" << mthn << "will not apply any global delays." << std::endl;
92  std::cout << __LINE__ << "]\t" << mthn << "increase the delays in the TPLL if needed." << std::endl;
93  delay_ = 0;
94  }
95 }

References gather_cfg::cout, TauDecayModes::dec, delay_, corrVsCorr::filename, recoMuon::in, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ PixelGlobalDelay25() [2/2]

pos::PixelGlobalDelay25::PixelGlobalDelay25 ( std::vector< std::vector< std::string > > &  tab)

◆ ~PixelGlobalDelay25()

PixelGlobalDelay25::~PixelGlobalDelay25 ( )
override

Definition at line 97 of file PixelGlobalDelay25.cc.

97 {}

Member Function Documentation

◆ getCyclicDelay()

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

Definition at line 114 of file PixelGlobalDelay25.cc.

114  {
115  std::string mthn = "[PixelGlobalDelay25::getCyclicDelay()]\t\t\t ";
116  unsigned int ret = offset + delay_;
117  if (ret > 120)
118  ret -= 50;
119  std::cout << __LINE__ << "]\t" << mthn << "getCyclicDelay(" << offset << ") returns " << ret << endl;
120  return ret;
121 }

References gather_cfg::cout, delay_, hltrates_dqm_sourceclient-live_cfg::offset, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ getDelay()

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

Definition at line 99 of file PixelGlobalDelay25.cc.

99  {
100  std::string mthn = "[PixelGlobalDelay25::getDelay()]\t\t\t ";
101  unsigned int ret = offset + delay_;
102  if (ret > 127) {
103  std::cout << __LINE__ << "]\t" << mthn << "the required total delay " << ret << " is out of range." << endl;
104  std::cout << __LINE__ << "]\t" << mthn << "original setting: " << offset << ", global delay: " << delay_ << endl;
105  std::cout << __LINE__ << "]\t" << mthn << "we will keep the default delay setting..." << endl;
106 
107  ret = offset;
108  }
109 
110  std::cout << __LINE__ << "]\t" << mthn << "getDelay(" << offset << ") returns " << ret << endl;
111  return ret;
112 }

References gather_cfg::cout, delay_, hltrates_dqm_sourceclient-live_cfg::offset, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ getTTCrxDelay() [1/2]

unsigned int PixelGlobalDelay25::getTTCrxDelay ( ) const

Definition at line 153 of file PixelGlobalDelay25.cc.

153  {
154  // Computes the TTCrx delay settting required to compensate for the global Delay25 shift.
155  //
156  // Assumes that the current register setting in the TTCrx is 0 ns (14)
157  //
158  // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted
159  // to the units of the TTCrx delay generator 103.96 ps
160 
161  return getTTCrxDelay(14);
162 }

◆ getTTCrxDelay() [2/2]

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

Definition at line 123 of file PixelGlobalDelay25.cc.

123  {
124  // Computes the TTCrx delay settting required to compensate for the global Delay25 shift.
125  //
126  // 'offset' is the current register setting in the TTCrx register
127  //
128  // The unit of delay_ is 0.499 ns (Delay25 granularity) that needs to be converted
129  // to the units of the TTCrx delay generator 103.96 ps
130 
131  std::string mthn = "[PixelGlobalDelay25::getTTCrxDelay()]\t\t\t ";
132  unsigned int K = (offset / 16 * 16 + offset % 16 * 15 + 30) % 240;
133  K += (unsigned int)floor((delay_ * 0.499) / 0.1039583 + 0.5); // add max 235
134 
135  unsigned int ret;
136  if (K > 239) {
137  std::cout << __LINE__ << "]\t" << mthn << "the required TTCrx fine delay " << K << " is out of range." << endl;
138  std::cout << __LINE__ << "]\t" << mthn << "this can happen if the register was initialized to 0" << endl;
139  std::cout << __LINE__ << "]\t" << mthn << "(i.e. delay of 3.1 ns) and the required delay is >21.7 ns." << endl;
140  std::cout << __LINE__ << "]\t" << mthn << "we will keep the current delay setting..." << endl;
141  ret = offset;
142  } else {
143  unsigned int n = K % 15;
144  unsigned int m = ((K / 15) - n + 14) % 16;
145  ret = 16 * n + m;
146  }
147 
148  std::cout << __LINE__ << "]\t" << mthn << "getTTCrxDelay(" << offset << ") returns " << ret << endl;
149  return ret;
150  //return offset;
151 }

References gather_cfg::cout, delay_, createfilelist::int, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, hltrates_dqm_sourceclient-live_cfg::offset, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ setDelay()

virtual void pos::PixelGlobalDelay25::setDelay ( unsigned int  delay)
inlinevirtual

Definition at line 37 of file PixelGlobalDelay25.h.

37 { delay_ = delay; }

References phase2TrackerDigitizer_cfi::delay, and delay_.

◆ writeASCII()

void PixelGlobalDelay25::writeASCII ( std::string  dir) const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 164 of file PixelGlobalDelay25.cc.

164  {
165  std::string mthn = "[PixelGlobalDelay25::writeASCII()]\t\t\t ";
166  if (!dir.empty())
167  dir += "/";
168  string filename = dir + "globaldelay25.dat";
169 
170  ofstream out(filename.c_str());
171  if (!out.good()) {
172  cout << __LINE__ << "]\t" << mthn << "Could not open file:" << filename << endl;
173  assert(0);
174  }
175 
176  out << "0x" << hex << delay_ << dec << endl;
177 
178  out.close();
179 }

References cms::cuda::assert(), gather_cfg::cout, TauDecayModes::dec, delay_, DeadROC_duringRun::dir, corrVsCorr::filename, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ writeXML()

void pos::PixelGlobalDelay25::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

◆ writeXMLHeader()

void PixelGlobalDelay25::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

◆ writeXMLTrailer()

void pos::PixelGlobalDelay25::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelConfigBase.

Member Data Documentation

◆ delay_

unsigned int pos::PixelGlobalDelay25::delay_
private
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
pos::PixelGlobalDelay25::getTTCrxDelay
unsigned int getTTCrxDelay() const
Definition: PixelGlobalDelay25.cc:153
pos::PixelGlobalDelay25::delay_
unsigned int delay_
Definition: PixelGlobalDelay25.h:53
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelConfigBase::PixelConfigBase
PixelConfigBase(std::string description, std::string creator, std::string date)
Definition: PixelConfigBase.cc:15
recoMuon::in
Definition: RecoMuonEnumerators.h:6
createfilelist.int
int
Definition: createfilelist.py:10
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
phase2TrackerDigitizer_cfi.delay
delay
Definition: phase2TrackerDigitizer_cfi.py:49
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23