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 ()
 
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_
 
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 140 of file PixelDelay25Calib.cc.

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

140  :
141  PixelCalibBase(),
142  PixelConfigBase("","",""){
143 
144  std::string mthn = "[PixelDelay25Calib::PixelDelay25Calib()]\t\t\t ";
145 
146  std::ifstream in(filename.c_str());
147 
148  if(!in.good()){
149  std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
150  assert(0);
151  }
152  else {
153  std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
154  }
155 
156  //Read initial SDa and RDa values, ranges,
157  //and grid step size from file
158 
160 
161  in >> tmp;
162 
163  assert(tmp=="Mode:");
164  in >> mode_;
165 
166  //cout << __LINE__ << "]\t" << mthn << "mode_="<<mode_<<endl;
167 
168  in >> tmp;
169 
170  assert(tmp=="Portcards:");
171  in >> tmp;
172  if(tmp=="All")
173  {
174  allPortcards_ = true;
175  } else {
176  allPortcards_ = false;
177  }
178  while (tmp!="AllModules:")
179  {
180  portcardNames_.insert(tmp);
181  in >> tmp;
182  }
183 
184  assert(tmp=="AllModules:");
185  in >> allModules_;
186 
187  in >> tmp;
188 
189  assert(tmp=="OrigSDa:");
190  in >> origSDa_;
191 
192  in >> tmp;
193 
194  assert(tmp=="OrigRDa:");
195  in >> origRDa_;
196 
197  in >> tmp;
198 
199  assert(tmp=="Range:");
200  in >> range_;
201 
202  in >> tmp;
203 
204  assert(tmp=="GridSize:");
205  in >> gridSize_;
206 
207  in >> tmp;
208  assert(tmp=="Tests:");
209  in >> numTests_;
210 
211  in >> tmp;
212  if(tmp=="Commands:") {
213  in >> commands_;
214  } else {
215  commands_=0;
216  }
217 
218  in.close();
219 
220  //Number of steps in the grid
221  gridSteps_ = range_/gridSize_;
222 
223 }
std::set< std::string > portcardNames_
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 225 of file PixelDelay25Calib.cc.

225  {
226 }

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 257 of file PixelDelay25Calib.cc.

References graphout_.

257  {
258  graphout_.close();
259  return;
260 }
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_;}
void PixelDelay25Calib::openFiles ( std::string  portcardName,
std::string  moduleName,
std::string  path = "" 
)

Definition at line 228 of file PixelDelay25Calib.cc.

References graph_, and graphout_.

228  {
229  if (path!="") path+="/";
230  graph_ = path+"graph_"+portcardName+"_"+moduleName+".dat";
231  graphout_.open(graph_.c_str());
232  return;
233 }
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
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 262 of file PixelDelay25Calib.cc.

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

Referenced by writeXMLHeader().

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

References graphout_.

247  {
248  graphout_ << tmp << endl;
249  return;
250 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void PixelDelay25Calib::writeFiles ( int  currentSDa,
int  currentRDa,
int  number 
)

Definition at line 252 of file PixelDelay25Calib.cc.

References graphout_.

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

Definition at line 235 of file PixelDelay25Calib.cc.

References graphout_.

235  {
236  graphout_ << "Portcard: " << portcardName << endl;
237  graphout_ << "Module: " << moduleName << endl;
238  graphout_ << "SDaOrigin: " << origSDa_ << endl;
239  graphout_ << "RDaOrigin: " << origRDa_ << endl;
240  graphout_ << "SDaRange: " << range_ << endl;
241  graphout_ << "RDaRange: " << range_ << endl;
242  graphout_ << "GridSize: " << gridSize_ << endl;
243  graphout_ << "Tests: " << numTests_ << endl;
244  return;
245 }
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 359 of file PixelDelay25Calib.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

362 {
363  std::string mthn = "[PixelDelay25Calib::writeXML()]\t\t\t " ;
364 
365 
366  *outstream << " " << std::endl ;
367  *outstream << " <DATA>" << std::endl ;
368  *outstream << " <CALIB_OBJ_DATA_FILE>./delay25.dat</CALIB_OBJ_DATA_FILE>" << std::endl ;
369  *outstream << " <CALIB_TYPE>delay25</CALIB_TYPE>" << std::endl ;
370  *outstream << " </DATA>" << std::endl ;
371  *outstream << " " << std::endl ;
372 }
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 310 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().

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

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

378 {
379  std::string mthn = "[PixelDelay25Calib::writeXMLTrailer()]\t\t\t " ;
380 
381  *outstream << " </DATA_SET>" << std::endl ;
382  *outstream << "</ROOT>" << std::endl ;
383 
384  outstream->close() ;
385  std::cout << __LINE__ << "]\t" << mthn << "Data written " << std::endl ;
386 
387 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool pos::PixelDelay25Calib::allModules_
private

Definition at line 69 of file PixelDelay25Calib.h.

Referenced by allModules(), and PixelDelay25Calib().

bool pos::PixelDelay25Calib::allPortcards_
private

Definition at line 69 of file PixelDelay25Calib.h.

Referenced by allPortcards(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::commands_
private

Definition at line 70 of file PixelDelay25Calib.h.

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

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

Definition at line 72 of file PixelDelay25Calib.h.

Referenced by openFiles().

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

Definition at line 71 of file PixelDelay25Calib.h.

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

int pos::PixelDelay25Calib::gridSize_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getGridSize(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::gridSteps_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getGridSteps(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::numTests_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getNumberTests(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origRDa_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getOrigRDa(), and PixelDelay25Calib().

int pos::PixelDelay25Calib::origSDa_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getOrigSDa(), and PixelDelay25Calib().

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

Definition at line 68 of file PixelDelay25Calib.h.

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

int pos::PixelDelay25Calib::range_
private

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getRange(), and PixelDelay25Calib().