CMS 3D CMS Logo

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

List of all members.

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::vector< std::vector< std::string > > &)
 PixelDelay25Calib (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)
virtual void writeXML (std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) 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, 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 ()

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_

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_, and tmp.

                                                       : 
  PixelCalibBase(),
  PixelConfigBase("","",""){

  std::string mthn = "[PixelDelay25Calib::PixelDelay25Calib()]\t\t\t    ";
  
  std::ifstream in(filename.c_str());
  
  if(!in.good()){
    std::cout << __LINE__ << "]\t" << mthn << "Could not open: " << filename << std::endl;
    assert(0);
  }
  else {
    std::cout << __LINE__ << "]\t" << mthn << "Opened: " << filename << std::endl;
  }

  //Read initial SDa and RDa values, ranges,
  //and grid step size from file
  
  std::string tmp;

  in >> tmp;

  assert(tmp=="Mode:");
  in >> mode_;

  //cout << __LINE__ << "]\t" << mthn  << "mode_="<<mode_<<endl;

  in >> tmp;

  assert(tmp=="Portcards:");
  in >> tmp;
  if(tmp=="All")
    {
      allPortcards_ = true;
    } else {
      allPortcards_ = false;
    }
  while (tmp!="AllModules:")
    {
      portcardNames_.insert(tmp);
      in >> tmp;
    }

  assert(tmp=="AllModules:");
  in >> allModules_;

  in >> tmp;

  assert(tmp=="OrigSDa:");
  in >> origSDa_;

  in >> tmp;

  assert(tmp=="OrigRDa:");
  in >> origRDa_;

  in >> tmp;

  assert(tmp=="Range:");
  in >> range_;

  in >> tmp;

  assert(tmp=="GridSize:");
  in >> gridSize_;

  in >> tmp;
  assert(tmp=="Tests:");
  in >> numTests_;

  in >> tmp;
  if(tmp=="Commands:") {
    in >> commands_;
  } else {
    commands_=0;
  }

  in.close();

  //Number of steps in the grid
  gridSteps_ = range_/gridSize_;

}
pos::PixelDelay25Calib::PixelDelay25Calib ( std::vector< std::vector< std::string > > &  )
PixelDelay25Calib::~PixelDelay25Calib ( )

Definition at line 225 of file PixelDelay25Calib.cc.

                                      {
}

Member Function Documentation

bool pos::PixelDelay25Calib::allModules ( ) [inline]

Definition at line 51 of file PixelDelay25Calib.h.

References allModules_.

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

Definition at line 50 of file PixelDelay25Calib.h.

References allPortcards_.

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

Definition at line 257 of file PixelDelay25Calib.cc.

References graphout_.

                                   {
  graphout_.close();
  return;
}
int pos::PixelDelay25Calib::getCommands ( ) [inline]

Definition at line 58 of file PixelDelay25Calib.h.

References commands_.

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

Definition at line 52 of file PixelDelay25Calib.h.

References gridSize_.

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

Definition at line 53 of file PixelDelay25Calib.h.

References gridSteps_.

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

Definition at line 54 of file PixelDelay25Calib.h.

References numTests_.

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

Definition at line 57 of file PixelDelay25Calib.h.

References origRDa_.

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

Definition at line 56 of file PixelDelay25Calib.h.

References origSDa_.

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

Definition at line 55 of file PixelDelay25Calib.h.

References range_.

{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_.

                                                                                              {
  if (path!="") path+="/";
  graph_ = path+"graph_"+portcardName+"_"+moduleName+".dat";
  graphout_.open(graph_.c_str());
  return;
}
std::set<std::string>& pos::PixelDelay25Calib::portcardList ( ) [inline]

Definition at line 49 of file PixelDelay25Calib.h.

References portcardNames_.

{return 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, and portcardNames_.

Referenced by writeXMLHeader().

                                                      {


  //FIXME this is not tested for all the use cases...

  if (dir!="") dir+="/";
  std::string filename=dir+"delay25.dat";
  std::ofstream out(filename.c_str());

  out << "Mode: "<<mode_<<endl;
  
  out << "Portcards:" <<endl;

  std::set<std::string>::const_iterator i=portcardNames_.begin();
  while (i!=portcardNames_.end()) {
    out << *i << endl;
    ++i;
  }

  out << "AllModules:" <<endl;
  if (allModules_) {
    out << "1" <<endl;
  } else {
    out << "0" <<endl;
  }

  out << "OrigSDa:"<<endl;
  out << origSDa_<<endl;
  
  out << "OrigRDa:"<<endl;
  out << origRDa_<<endl;
  
  out << "Range:"<<endl;
  out << range_<<endl;
  
  out << "GridSize:"<<endl;
  out << gridSize_<<endl;
  
  out << "Tests:"<<endl;
  out << numTests_<<endl;

  out << "Commands:"<<endl;
  out << commands_<<endl;
  
  out.close();
}
void PixelDelay25Calib::writeFiles ( int  currentSDa,
int  currentRDa,
int  number 
)

Definition at line 252 of file PixelDelay25Calib.cc.

References graphout_.

                                                                               {
  graphout_ << currentSDa << " " << currentRDa << " " << number << endl;
  return;
}
void PixelDelay25Calib::writeFiles ( std::string  tmp)

Definition at line 247 of file PixelDelay25Calib.cc.

References graphout_.

                                                  {
  graphout_ << tmp << endl;
  return;
}
void PixelDelay25Calib::writeSettings ( std::string  portcardName,
std::string  moduleName 
)

Definition at line 235 of file PixelDelay25Calib.cc.

References graphout_.

                                                                                  {
  graphout_ << "Portcard: " << portcardName << endl;
  graphout_ << "Module: " << moduleName << endl;
  graphout_ << "SDaOrigin: " << origSDa_ << endl;
  graphout_ << "RDaOrigin: " << origRDa_ << endl;
  graphout_ << "SDaRange: " << range_ << endl;
  graphout_ << "RDaRange: " << range_ << endl;
  graphout_ << "GridSize: " << gridSize_ << endl;
  graphout_ << "Tests: " << numTests_ << endl;
  return;
}
void pos::PixelDelay25Calib::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 33 of file PixelDelay25Calib.h.

{;}
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.

{
  std::string mthn = "[PixelDelay25Calib::writeXML()]\t\t\t    " ;
  

  *outstream << " "                                                                                       << std::endl ;
  *outstream << "  <DATA>"                                                                                << std::endl ;
  *outstream << "   <CALIB_OBJ_DATA_FILE>./delay25.dat</CALIB_OBJ_DATA_FILE>"                             << std::endl ;
  *outstream << "   <CALIB_TYPE>delay25</CALIB_TYPE>"                                                     << std::endl ;
  *outstream << "  </DATA>"                                                                               << std::endl ;
  *outstream << " "                                                                                       << std::endl ;
}
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(), edm::service::getTime(), and writeASCII().

{
  std::string mthn = "[PixelDelay25Calib::writeXMLHeader()]\t\t\t    " ;
  std::stringstream maskFullPath ;

  writeASCII(path) ;

  maskFullPath << path << "/PixelCalib_Test_" << PixelTimeFormatter::getmSecTime() << ".xml";
  std::cout  << __LINE__ << "]\t" << mthn << "Writing to: " << maskFullPath.str() << std::endl ;

  outstream->open(maskFullPath.str().c_str()) ;
  
  *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>"                                 << std::endl ;
  *outstream << "<ROOT xmlns:xsi='https://www.w3.org/2001/XMLSchema-instance'>"                            << std::endl ;
  *outstream << ""                                                                                        << std::endl ; 
  *outstream << " <!-- " << mthn << "-->"                                                                 << std::endl ; 
  *outstream << ""                                                                                        << std::endl ; 
  *outstream << " <HEADER>"                                                                               << std::endl ; 
  *outstream << "  <TYPE>"                                                                                << std::endl ; 
  *outstream << "   <EXTENSION_TABLE_NAME>PIXEL_CALIB_CLOB</EXTENSION_TABLE_NAME>"                        << std::endl ; 
  *outstream << "   <NAME>Calibration Object Clob</NAME>"                                                 << std::endl ; 
  *outstream << "  </TYPE>"                                                                               << std::endl ; 
  *outstream << "  <RUN>"                                                                                 << std::endl ; 
  *outstream << "   <RUN_TYPE>delay25</RUN_TYPE>"                                                         << std::endl ; 
  *outstream << "   <RUN_NUMBER>1</RUN_NUMBER>"                                                           << std::endl ; 
  *outstream << "   <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>"   << std::endl ; 
  *outstream << "   <LOCATION>CERN P5</LOCATION>"                                                         << std::endl ; 
  *outstream << "  </RUN>"                                                                                << std::endl ; 
  *outstream << " </HEADER>"                                                                              << std::endl ; 
  *outstream << ""                                                                                        << std::endl ; 
  *outstream << " <DATA_SET>"                                                                             << std::endl ;
  *outstream << ""                                                                                        << std::endl ;
  *outstream << "  <VERSION>"             << version      << "</VERSION>"                                 << std::endl ;
  *outstream << "  <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>"                     << std::endl ;
  *outstream << "  <CREATED_BY_USER>"     << getAuthor()  << "</CREATED_BY_USER>"                         << std::endl ;
  *outstream << ""                                                                                        << std::endl ;
  *outstream << "  <PART>"                                                                                << std::endl ;
  *outstream << "   <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>"                                              << std::endl ;      
  *outstream << "   <KIND_OF_PART>Detector ROOT</KIND_OF_PART>"                                           << std::endl ;         
  *outstream << "  </PART>"                                                                               << std::endl ;

}
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.

{
  std::string mthn = "[PixelDelay25Calib::writeXMLTrailer()]\t\t\t    " ;
  
  *outstream << " </DATA_SET>"                                                                            << std::endl ;
  *outstream << "</ROOT>"                                                                                 << std::endl ;
  
  outstream->close() ;
  std::cout  << __LINE__ << "]\t" << mthn << "Data written "                                              << std::endl ;

}

Member Data Documentation

Definition at line 69 of file PixelDelay25Calib.h.

Referenced by allModules(), and PixelDelay25Calib().

Definition at line 69 of file PixelDelay25Calib.h.

Referenced by allPortcards(), and PixelDelay25Calib().

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().

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getGridSize(), and PixelDelay25Calib().

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getGridSteps(), and PixelDelay25Calib().

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getNumberTests(), and PixelDelay25Calib().

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getOrigRDa(), and PixelDelay25Calib().

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().

Definition at line 70 of file PixelDelay25Calib.h.

Referenced by getRange(), and PixelDelay25Calib().