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::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 ()
 
virtual void writeASCII (std::string dir="") const
 
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
 
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
 
 ~PixelDelay25Calib ()
 
- Public Member Functions inherited from pos::PixelCalibBase
virtual std::string mode () const
 
 PixelCalibBase ()
 
virtual void writeXMLHeader (pos::PixelConfigKey &key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
 
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 145 of file PixelDelay25Calib.cc.

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

145  :
146  PixelCalibBase(),
147  PixelConfigBase("","",""){
148 
149  std::string mthn = "[PixelDelay25Calib::PixelDelay25Calib()]\t\t\t ";
150 
151  std::ifstream in(filename.c_str());
152 
153  if(!in.good()){
154  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
155  assert(0);
156  }
157  else {
158  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
159  }
160 
161  //Read initial SDa and RDa values, ranges,
162  //and grid step size from file
163 
165 
166  in >> tmp;
167 
168  assert(tmp=="Mode:");
169  in >> mode_;
170 
171  //cout << __LINE__ << "]\t" << mthn << "mode_="<<mode_<<endl;
172 
173  in >> tmp;
174 
175  assert(tmp=="Portcards:");
176  in >> tmp;
177  if(tmp=="All")
178  {
179  allPortcards_ = true;
180  } else {
181  allPortcards_ = false;
182  }
183  while (tmp!="AllModules:")
184  {
185  portcardNames_.insert(tmp);
186  in >> tmp;
187  }
188 
189  assert(tmp=="AllModules:");
190  in >> allModules_;
191 
192  in >> tmp;
193 
194  assert(tmp=="OrigSDa:");
195  in >> origSDa_;
196 
197  in >> tmp;
198 
199  assert(tmp=="OrigRDa:");
200  in >> origRDa_;
201 
202  in >> tmp;
203 
204  assert(tmp=="Range:");
205  in >> range_;
206 
207  in >> tmp;
208 
209  assert(tmp=="GridSize:");
210  in >> gridSize_;
211 
212  in >> tmp;
213  assert(tmp=="Tests:");
214  in >> numTests_;
215 
216  in >> tmp;
217  if(tmp=="Commands:") {
218  in >> commands_;
219  } else {
220  commands_=0;
221  }
222 
223  in.close();
224 
225  //Number of steps in the grid
226  gridSteps_ = range_/gridSize_;
227 
228  // Added by Dario as a temporary patch for Debbie (this will disappear in the future)
229  std::ifstream inTmp(filename.c_str());
230  calibFileContent_ = "" ;
231  while(!inTmp.eof())
232  {
233  std::string tmpString ;
234  getline (inTmp, tmpString);
235  calibFileContent_ += tmpString + "\n";
236  //cout << __LINE__ << "]\t" << "[PixelCalibConfiguration::~PixelCalibConfiguration()]\t\t" << calibFileContent_ << endl ;
237  }
238  inTmp.close() ;
239  // End of temporary patch
240 }
std::set< std::string > portcardNames_
assert(m_qm.get())
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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::PixelDelay25Calib::PixelDelay25Calib ( std::vector< std::vector< std::string > > &  )
PixelDelay25Calib::~PixelDelay25Calib ( )

Definition at line 242 of file PixelDelay25Calib.cc.

242  {
243 }

Member Function Documentation

bool pos::PixelDelay25Calib::allModules ( )
inline

Definition at line 51 of file PixelDelay25Calib.h.

References allModules_.

bool pos::PixelDelay25Calib::allPortcards ( )
inline

Definition at line 50 of file PixelDelay25Calib.h.

References allPortcards_.

void PixelDelay25Calib::closeFiles ( )

Definition at line 274 of file PixelDelay25Calib.cc.

References graphout_.

274  {
275  graphout_.close();
276  return;
277 }
int pos::PixelDelay25Calib::getCommands ( )
inline

Definition at line 58 of file PixelDelay25Calib.h.

References commands_.

int pos::PixelDelay25Calib::getGridSize ( )
inline

Definition at line 52 of file PixelDelay25Calib.h.

References gridSize_.

int pos::PixelDelay25Calib::getGridSteps ( )
inline

Definition at line 53 of file PixelDelay25Calib.h.

References gridSteps_.

int pos::PixelDelay25Calib::getNumberTests ( )
inline

Definition at line 54 of file PixelDelay25Calib.h.

References numTests_.

int pos::PixelDelay25Calib::getOrigRDa ( )
inline

Definition at line 57 of file PixelDelay25Calib.h.

References origRDa_.

int pos::PixelDelay25Calib::getOrigSDa ( )
inline

Definition at line 56 of file PixelDelay25Calib.h.

References origSDa_.

int pos::PixelDelay25Calib::getRange ( )
inline

Definition at line 55 of file PixelDelay25Calib.h.

References range_.

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

Definition at line 67 of file PixelDelay25Calib.h.

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

Definition at line 245 of file PixelDelay25Calib.cc.

References graph_, and graphout_.

245  {
246  if (path!="") path+="/";
247  graph_ = path+"graph_"+portcardName+"_"+moduleName+".dat";
248  graphout_.open(graph_.c_str());
249  return;
250 }
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
tuple path
else: Piece not in the list, fine.
std::set<std::string>& pos::PixelDelay25Calib::portcardList ( )
inline

Definition at line 49 of file PixelDelay25Calib.h.

References portcardNames_.

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

Implements pos::PixelConfigBase.

Definition at line 279 of file PixelDelay25Calib.cc.

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

Referenced by writeXMLHeader().

279  {
280 
281 
282  //FIXME this is not tested for all the use cases...
283 
284  if (dir!="") dir+="/";
285  std::string filename=dir+"delay25.dat";
286  std::ofstream out(filename.c_str());
287 
288  out << "Mode: "<<mode_<<endl;
289 
290  out << "Portcards:" <<endl;
291 
292  std::set<std::string>::const_iterator i=portcardNames_.begin();
293  while (i!=portcardNames_.end()) {
294  out << *i << endl;
295  ++i;
296  }
297 
298  out << "AllModules:" <<endl;
299  if (allModules_) {
300  out << "1" <<endl;
301  } else {
302  out << "0" <<endl;
303  }
304 
305  out << "OrigSDa:"<<endl;
306  out << origSDa_<<endl;
307 
308  out << "OrigRDa:"<<endl;
309  out << origRDa_<<endl;
310 
311  out << "Range:"<<endl;
312  out << range_<<endl;
313 
314  out << "GridSize:"<<endl;
315  out << gridSize_<<endl;
316 
317  out << "Tests:"<<endl;
318  out << numTests_<<endl;
319 
320  out << "Commands:"<<endl;
321  out << commands_<<endl;
322 
323  out.close();
324 }
int i
Definition: DBlmapReader.cc:9
std::set< std::string > portcardNames_
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
dbl *** dir
Definition: mlp_gen.cc:35
void PixelDelay25Calib::writeFiles ( std::string  tmp)

Definition at line 264 of file PixelDelay25Calib.cc.

References graphout_.

264  {
265  graphout_ << tmp << endl;
266  return;
267 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void PixelDelay25Calib::writeFiles ( int  currentSDa,
int  currentRDa,
int  number 
)

Definition at line 269 of file PixelDelay25Calib.cc.

References graphout_.

269  {
270  graphout_ << currentSDa << " " << currentRDa << " " << number << endl;
271  return;
272 }
void PixelDelay25Calib::writeSettings ( std::string  portcardName,
std::string  moduleName 
)

Definition at line 252 of file PixelDelay25Calib.cc.

References graphout_.

252  {
253  graphout_ << "Portcard: " << portcardName << endl;
254  graphout_ << "Module: " << moduleName << endl;
255  graphout_ << "SDaOrigin: " << origSDa_ << endl;
256  graphout_ << "RDaOrigin: " << origRDa_ << endl;
257  graphout_ << "SDaRange: " << range_ << endl;
258  graphout_ << "RDaRange: " << range_ << endl;
259  graphout_ << "GridSize: " << gridSize_ << endl;
260  graphout_ << "Tests: " << numTests_ << endl;
261  return;
262 }
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
void pos::PixelDelay25Calib::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const
inlinevirtual

Reimplemented from pos::PixelConfigBase.

Definition at line 33 of file PixelDelay25Calib.h.

33 {;}
void PixelDelay25Calib::writeXML ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelCalibBase.

Definition at line 376 of file PixelDelay25Calib.cc.

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

379 {
380  std::string mthn = "[PixelDelay25Calib::writeXML()]\t\t\t " ;
381 
382  std::cout << __LINE__ << "]\t" << mthn << "Writing.." << std::endl ;
383 
384  *outstream << " " << std::endl ;
385  *outstream << " <DATA>" << std::endl ;
386  *outstream << " <CALIB_OBJ_DATA_FILE>./delay25.dat</CALIB_OBJ_DATA_FILE>" << std::endl ;
387  *outstream << " <CALIB_TYPE>delay25</CALIB_TYPE>" << std::endl ;
388  *outstream << " </DATA>" << std::endl ;
389  *outstream << " " << std::endl ;
390 }
tuple cout
Definition: gather_cfg.py:121
void PixelDelay25Calib::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 327 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().

333 {
334  std::string mthn = "[PixelDelay25Calib::writeXMLHeader()]\t\t\t " ;
335  std::stringstream maskFullPath ;
336 
337  writeASCII(path) ;
338 
339  maskFullPath << path << "/PixelCalib_Test_" << PixelTimeFormatter::getmSecTime() << ".xml";
340  std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl ;
341 
342  outstream->open(maskFullPath.str().c_str()) ;
343 
344  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
345  *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
346  *outstream << "" << std::endl ;
347  *outstream << " <!-- " << mthn << "-->" << std::endl ;
348  *outstream << "" << std::endl ;
349  *outstream << " <HEADER>" << std::endl ;
350  *outstream << " <TYPE>" << std::endl ;
351  *outstream << " <EXTENSION_TABLE_NAME>PIXEL_CALIB_CLOB</EXTENSION_TABLE_NAME>" << std::endl ;
352  *outstream << " <NAME>Calibration Object Clob</NAME>" << std::endl ;
353  *outstream << " </TYPE>" << std::endl ;
354  *outstream << " <RUN>" << std::endl ;
355  *outstream << " <RUN_TYPE>delay25</RUN_TYPE>" << std::endl ;
356  *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
357  *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
358  *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
359  *outstream << " </RUN>" << std::endl ;
360  *outstream << " </HEADER>" << std::endl ;
361  *outstream << "" << std::endl ;
362  *outstream << " <DATA_SET>" << std::endl ;
363  *outstream << "" << std::endl ;
364  *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
365  *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
366  *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
367  *outstream << "" << std::endl ;
368  *outstream << " <PART>" << std::endl ;
369  *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
370  *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
371  *outstream << " </PART>" << std::endl ;
372 
373 }
static std::string getmSecTime(void)
tuple path
else: Piece not in the list, fine.
static std::string getTime(void)
std::string getComment() const
std::string getAuthor() const
virtual void writeASCII(std::string dir="") const
tuple cout
Definition: gather_cfg.py:121
void PixelDelay25Calib::writeXMLTrailer ( std::ofstream *  out,
std::ofstream *  out1 = NULL,
std::ofstream *  out2 = NULL 
) const
virtual

Reimplemented from pos::PixelCalibBase.

Definition at line 393 of file PixelDelay25Calib.cc.

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

396 {
397  std::string mthn = "[PixelDelay25Calib::writeXMLTrailer()]\t\t\t " ;
398 
399  *outstream << " </DATA_SET>" << std::endl ;
400  *outstream << "</ROOT>" << std::endl ;
401 
402  outstream->close() ;
403  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl ;
404 
405 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool pos::PixelDelay25Calib::allModules_
private

Definition at line 72 of file PixelDelay25Calib.h.

Referenced by allModules(), and PixelDelay25Calib().

bool pos::PixelDelay25Calib::allPortcards_
private

Definition at line 72 of file PixelDelay25Calib.h.

Referenced by allPortcards(), and PixelDelay25Calib().

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

Definition at line 78 of file PixelDelay25Calib.h.

Referenced by PixelDelay25Calib().

int pos::PixelDelay25Calib::commands_
private

Definition at line 73 of file PixelDelay25Calib.h.

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

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

Definition at line 75 of file PixelDelay25Calib.h.

Referenced by openFiles().

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

Definition at line 74 of file PixelDelay25Calib.h.

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

int pos::PixelDelay25Calib::gridSize_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getGridSize(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::gridSteps_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getGridSteps(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::numTests_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getNumberTests(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origRDa_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getOrigRDa(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origSDa_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getOrigSDa(), and PixelDelay25Calib().

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

Definition at line 67 of file PixelDelay25Calib.h.

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

int pos::PixelDelay25Calib::range_
private

Definition at line 73 of file PixelDelay25Calib.h.

Referenced by getRange(), and PixelDelay25Calib().