CMS 3D CMS Logo

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

This class manages data and files used in the Delay25 calibration. More...

#include <PixelDelay25Calib.h>

Inheritance diagram for pos::PixelDelay25Calib:
pos::PixelCalibBase pos::PixelConfigBase

Public Member Functions

bool allModules ()
 
bool allPortcards ()
 
void closeFiles ()
 
int getCommands ()
 
int getGridSize ()
 
int getGridSteps ()
 
int getNumberTests ()
 
int getOrigRDa ()
 
int getOrigSDa ()
 
int getRange ()
 
std::string getStreamedContent (void) const
 
void openFiles (std::string portcardName, std::string moduleName, std::string path="")
 
 PixelDelay25Calib (std::string)
 
 PixelDelay25Calib (std::vector< std::vector< std::string > > &)
 
std::set< std::string > & portcardList ()
 
void writeASCII (std::string dir="") const override
 
void writeFiles (std::string tmp)
 
void writeFiles (int currentSDa, int currentRDa, int number)
 
void writeSettings (std::string portcardName, std::string moduleName)
 
void writeXML (pos::PixelConfigKey key, int version, std::string path) 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
 
 ~PixelDelay25Calib () override
 
- Public Member Functions inherited from pos::PixelCalibBase
virtual std::string mode () const
 
 PixelCalibBase ()
 
virtual ~PixelCalibBase ()
 
- 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 (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

bool allModules_
 
bool allPortcards_
 
std::string calibFileContent_
 
int commands_
 
std::string graph_
 
std::ofstream graphout_
 
int gridSize_
 
int gridSteps_
 
int numTests_
 
int origRDa_
 
int origSDa_
 
std::set< std::string > portcardNames_
 
int range_
 

Additional Inherited Members

- Protected Attributes inherited from pos::PixelCalibBase
std::string mode_
 

Detailed Description

This class manages data and files used in the Delay25 calibration.

" "

Definition at line 24 of file PixelDelay25Calib.h.

Constructor & Destructor Documentation

PixelDelay25Calib::PixelDelay25Calib ( std::string  filename)

Definition at line 134 of file PixelDelay25Calib.cc.

References allModules_, allPortcards_, cms::cuda::assert(), calibFileContent_, commands_, gather_cfg::cout, gridSize_, gridSteps_, recoMuon::in, pos::PixelCalibBase::mode_, numTests_, origRDa_, origSDa_, portcardNames_, range_, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

134  : PixelCalibBase(), PixelConfigBase("", "", "") {
135  std::string mthn = "[PixelDelay25Calib::PixelDelay25Calib()]\t\t\t ";
136 
137  std::ifstream in(filename.c_str());
138 
139  if (!in.good()) {
140  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
141  assert(0);
142  } else {
143  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
144  }
145 
146  //Read initial SDa and RDa values, ranges,
147  //and grid step size from file
148 
150 
151  in >> tmp;
152 
153  assert(tmp == "Mode:");
154  in >> mode_;
155 
156  //cout << __LINE__ << "]\t" << mthn << "mode_="<<mode_<<endl;
157 
158  in >> tmp;
159 
160  assert(tmp == "Portcards:");
161  in >> tmp;
162  if (tmp == "All") {
163  allPortcards_ = true;
164  } else {
165  allPortcards_ = false;
166  }
167  while (tmp != "AllModules:") {
168  portcardNames_.insert(tmp);
169  in >> tmp;
170  }
171 
172  assert(tmp == "AllModules:");
173  in >> allModules_;
174 
175  in >> tmp;
176 
177  assert(tmp == "OrigSDa:");
178  in >> origSDa_;
179 
180  in >> tmp;
181 
182  assert(tmp == "OrigRDa:");
183  in >> origRDa_;
184 
185  in >> tmp;
186 
187  assert(tmp == "Range:");
188  in >> range_;
189 
190  in >> tmp;
191 
192  assert(tmp == "GridSize:");
193  in >> gridSize_;
194 
195  in >> tmp;
196  assert(tmp == "Tests:");
197  in >> numTests_;
198 
199  in >> tmp;
200  if (tmp == "Commands:") {
201  in >> commands_;
202  } else {
203  commands_ = 0;
204  }
205 
206  in.close();
207 
208  //Number of steps in the grid
209  gridSteps_ = range_ / gridSize_;
210 
211  // Added by Dario as a temporary patch for Debbie (this will disappear in the future)
212  std::ifstream inTmp(filename.c_str());
213  calibFileContent_ = "";
214  while (!inTmp.eof()) {
215  std::string tmpString;
216  getline(inTmp, tmpString);
217  calibFileContent_ += tmpString + "\n";
218  //cout << __LINE__ << "]\t" << "[PixelCalibConfiguration::~PixelCalibConfiguration()]\t\t" << calibFileContent_ << endl ;
219  }
220  inTmp.close();
221  // End of temporary patch
222 }
std::set< std::string > portcardNames_
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
tmp
align.sh
Definition: createJobs.py:716
PixelConfigBase(std::string description, std::string creator, std::string date)
pos::PixelDelay25Calib::PixelDelay25Calib ( std::vector< std::vector< std::string > > &  )
PixelDelay25Calib::~PixelDelay25Calib ( )
override

Definition at line 224 of file PixelDelay25Calib.cc.

224 {}

Member Function Documentation

bool pos::PixelDelay25Calib::allModules ( )
inline

Definition at line 45 of file PixelDelay25Calib.h.

References allModules_.

45 { return allModules_; }
bool pos::PixelDelay25Calib::allPortcards ( )
inline

Definition at line 44 of file PixelDelay25Calib.h.

References allPortcards_.

44 { return allPortcards_; }
void PixelDelay25Calib::closeFiles ( )

Definition at line 256 of file PixelDelay25Calib.cc.

References graphout_.

256  {
257  graphout_.close();
258  return;
259 }
int pos::PixelDelay25Calib::getCommands ( )
inline

Definition at line 52 of file PixelDelay25Calib.h.

References commands_.

52 { return commands_; }
int pos::PixelDelay25Calib::getGridSize ( )
inline

Definition at line 46 of file PixelDelay25Calib.h.

References gridSize_.

46 { return gridSize_; }
int pos::PixelDelay25Calib::getGridSteps ( )
inline

Definition at line 47 of file PixelDelay25Calib.h.

References gridSteps_.

47 { return gridSteps_; }
int pos::PixelDelay25Calib::getNumberTests ( )
inline

Definition at line 48 of file PixelDelay25Calib.h.

References numTests_.

48 { return numTests_; }
int pos::PixelDelay25Calib::getOrigRDa ( )
inline

Definition at line 51 of file PixelDelay25Calib.h.

References origRDa_.

51 { return origRDa_; }
int pos::PixelDelay25Calib::getOrigSDa ( )
inline

Definition at line 50 of file PixelDelay25Calib.h.

References origSDa_.

50 { return origSDa_; }
int pos::PixelDelay25Calib::getRange ( )
inline

Definition at line 49 of file PixelDelay25Calib.h.

References range_.

49 { return range_; }
std::string pos::PixelDelay25Calib::getStreamedContent ( void  ) const
inline

Definition at line 60 of file PixelDelay25Calib.h.

60 { return calibFileContent_; };
void PixelDelay25Calib::openFiles ( std::string  portcardName,
std::string  moduleName,
std::string  path = "" 
)

Definition at line 226 of file PixelDelay25Calib.cc.

References graph_, and graphout_.

226  {
227  if (!path.empty())
228  path += "/";
229  graph_ = path + "graph_" + portcardName + "_" + moduleName + ".dat";
230  graphout_.open(graph_.c_str());
231  return;
232 }
std::set<std::string>& pos::PixelDelay25Calib::portcardList ( )
inline

Definition at line 43 of file PixelDelay25Calib.h.

References portcardNames_.

43 { return portcardNames_; }
std::set< std::string > portcardNames_
void PixelDelay25Calib::writeASCII ( std::string  dir = "") const
overridevirtual

Implements pos::PixelConfigBase.

Definition at line 261 of file PixelDelay25Calib.cc.

References commands_, lut2db_cfg::filename, mps_fire::i, submitPVResolutionJobs::out, portcardNames_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by writeXMLHeader().

261  {
262  //FIXME this is not tested for all the use cases...
263 
264  if (!dir.empty())
265  dir += "/";
266  std::string filename = dir + "delay25.dat";
267  std::ofstream out(filename.c_str());
268 
269  out << "Mode: " << mode_ << endl;
270 
271  out << "Portcards:" << endl;
272 
273  std::set<std::string>::const_iterator i = portcardNames_.begin();
274  while (i != portcardNames_.end()) {
275  out << *i << endl;
276  ++i;
277  }
278 
279  out << "AllModules:" << endl;
280  if (allModules_) {
281  out << "1" << endl;
282  } else {
283  out << "0" << endl;
284  }
285 
286  out << "OrigSDa:" << endl;
287  out << origSDa_ << endl;
288 
289  out << "OrigRDa:" << endl;
290  out << origRDa_ << endl;
291 
292  out << "Range:" << endl;
293  out << range_ << endl;
294 
295  out << "GridSize:" << endl;
296  out << gridSize_ << endl;
297 
298  out << "Tests:" << endl;
299  out << numTests_ << endl;
300 
301  out << "Commands:" << endl;
302  out << commands_ << endl;
303 
304  out.close();
305 }
std::set< std::string > portcardNames_
tuple filename
Definition: lut2db_cfg.py:20
void PixelDelay25Calib::writeFiles ( std::string  tmp)

Definition at line 246 of file PixelDelay25Calib.cc.

References graphout_.

246  {
247  graphout_ << tmp << endl;
248  return;
249 }
tmp
align.sh
Definition: createJobs.py:716
void PixelDelay25Calib::writeFiles ( int  currentSDa,
int  currentRDa,
int  number 
)

Definition at line 251 of file PixelDelay25Calib.cc.

References graphout_.

251  {
252  graphout_ << currentSDa << " " << currentRDa << " " << number << endl;
253  return;
254 }
void PixelDelay25Calib::writeSettings ( std::string  portcardName,
std::string  moduleName 
)

Definition at line 234 of file PixelDelay25Calib.cc.

References graphout_.

234  {
235  graphout_ << "Portcard: " << portcardName << endl;
236  graphout_ << "Module: " << moduleName << endl;
237  graphout_ << "SDaOrigin: " << origSDa_ << endl;
238  graphout_ << "RDaOrigin: " << origRDa_ << endl;
239  graphout_ << "SDaRange: " << range_ << endl;
240  graphout_ << "RDaRange: " << range_ << endl;
241  graphout_ << "GridSize: " << gridSize_ << endl;
242  graphout_ << "Tests: " << numTests_ << endl;
243  return;
244 }
void pos::PixelDelay25Calib::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlineoverridevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 31 of file PixelDelay25Calib.h.

31 { ; }
void PixelDelay25Calib::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelCalibBase.

Definition at line 355 of file PixelDelay25Calib.cc.

References gather_cfg::cout, and AlCaHLTBitMon_QueryRunRegistry::string.

355  {
356  std::string mthn = "[PixelDelay25Calib::writeXML()]\t\t\t ";
357 
358  std::cout << __LINE__ << "]\t" << mthn << "Writing.." << std::endl;
359 
360  *outstream << " " << std::endl;
361  *outstream << " <DATA>" << std::endl;
362  *outstream << " <CALIB_OBJ_DATA_FILE>./delay25.dat</CALIB_OBJ_DATA_FILE>" << std::endl;
363  *outstream << " <CALIB_TYPE>delay25</CALIB_TYPE>" << std::endl;
364  *outstream << " </DATA>" << std::endl;
365  *outstream << " " << std::endl;
366 }
tuple cout
Definition: gather_cfg.py:144
void PixelDelay25Calib::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelCalibBase.

Definition at line 308 of file PixelDelay25Calib.cc.

References gather_cfg::cout, pos::PixelConfigBase::getAuthor(), pos::PixelConfigBase::getComment(), pos::PixelTimeFormatter::getmSecTime(), pos::PixelTimeFormatter::getTime(), AlCaHLTBitMon_QueryRunRegistry::string, and writeASCII().

313  {
314  std::string mthn = "[PixelDelay25Calib::writeXMLHeader()]\t\t\t ";
315  std::stringstream maskFullPath;
316 
317  writeASCII(path);
318 
319  maskFullPath << path << "/PixelCalib_Test_" << PixelTimeFormatter::getmSecTime() << ".xml";
320  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl;
321 
322  outstream->open(maskFullPath.str().c_str());
323 
324  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
325  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
326  *outstream << "" << std::endl;
327  *outstream << " <!-- " << mthn << "-->" << std::endl;
328  *outstream << "" << std::endl;
329  *outstream << " <HEADER>" << std::endl;
330  *outstream << " <TYPE>" << std::endl;
331  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_CALIB_CLOB</EXTENSION_TABLE_NAME>" << std::endl;
332  *outstream << " <NAME>Calibration Object Clob</NAME>" << std::endl;
333  *outstream << " </TYPE>" << std::endl;
334  *outstream << " <RUN>" << std::endl;
335  *outstream << " <RUN_TYPE>delay25</RUN_TYPE>" << std::endl;
336  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
337  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl;
338  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl;
339  *outstream << " </RUN>" << std::endl;
340  *outstream << " </HEADER>" << std::endl;
341  *outstream << "" << std::endl;
342  *outstream << " <DATA_SET>" << std::endl;
343  *outstream << "" << std::endl;
344  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl;
345  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl;
346  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl;
347  *outstream << "" << std::endl;
348  *outstream << " <PART>" << std::endl;
349  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
350  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
351  *outstream << " </PART>" << std::endl;
352 }
static std::string getmSecTime(void)
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
void writeASCII(std::string dir="") const override
tuple cout
Definition: gather_cfg.py:144
void PixelDelay25Calib::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = nullptr,
std::ofstream *  out2 = nullptr 
) const
overridevirtual

Reimplemented from pos::PixelCalibBase.

Definition at line 369 of file PixelDelay25Calib.cc.

References gather_cfg::cout, and AlCaHLTBitMon_QueryRunRegistry::string.

371  {
372  std::string mthn = "[PixelDelay25Calib::writeXMLTrailer()]\t\t\t ";
373 
374  *outstream << " </DATA_SET>" << std::endl;
375  *outstream << "</ROOT>" << std::endl;
376 
377  outstream->close();
378  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl;
379 }
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

bool pos::PixelDelay25Calib::allModules_
private

Definition at line 64 of file PixelDelay25Calib.h.

Referenced by allModules(), and PixelDelay25Calib().

bool pos::PixelDelay25Calib::allPortcards_
private

Definition at line 64 of file PixelDelay25Calib.h.

Referenced by allPortcards(), and PixelDelay25Calib().

std::string pos::PixelDelay25Calib::calibFileContent_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by PixelDelay25Calib().

int pos::PixelDelay25Calib::commands_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getCommands(), PixelDelay25Calib(), and writeASCII().

std::string pos::PixelDelay25Calib::graph_
private

Definition at line 67 of file PixelDelay25Calib.h.

Referenced by openFiles().

std::ofstream pos::PixelDelay25Calib::graphout_
private

Definition at line 66 of file PixelDelay25Calib.h.

Referenced by closeFiles(), openFiles(), writeFiles(), and writeSettings().

int pos::PixelDelay25Calib::gridSize_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getGridSize(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::gridSteps_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getGridSteps(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::numTests_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getNumberTests(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origRDa_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getOrigRDa(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origSDa_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getOrigSDa(), and PixelDelay25Calib().

std::set<std::string> pos::PixelDelay25Calib::portcardNames_
private

Definition at line 60 of file PixelDelay25Calib.h.

Referenced by PixelDelay25Calib(), portcardList(), and writeASCII().

int pos::PixelDelay25Calib::range_
private

Definition at line 65 of file PixelDelay25Calib.h.

Referenced by getRange(), and PixelDelay25Calib().