/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
CalibPmtWriter Class Reference

#include <CalibPmtWriter.h>

Inheritance diagram for CalibPmtWriter:
Inheritance graph
[legend]
Collaboration diagram for CalibPmtWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CalibPmtWriter (const string &type, const string &name, const IInterface *parent)
virtual ~CalibPmtWriter ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
int setRunNo (int)
int setFileName (string)
int setTimeWindow (int)
int run ()
virtual void setSubsite (int subSite)
virtual void setIsSim (bool isSim)
virtual void setSiteMask (int siteMask)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

int mainProcess ()

Protected Attributes

int runNumber
int timeWindow
string inputFileName
ContextRange range
Int_t aggNo
Dbi::SubSite subsite
Dbi::Task task
TimeStamp startTime
TimeStamp endTime
bool isSim
int siteMask

Private Member Functions

virtual int init ()
virtual int final ()
int fillRow ()

Private Attributes

DbiWriter< GCalibPmtSpec > * myWriter

Detailed Description

Definition at line 25 of file CalibPmtWriter.h.


Constructor & Destructor Documentation

CalibPmtWriter::CalibPmtWriter ( const string &  type,
const string &  name,
const IInterface *  parent 
)

Definition at line 27 of file CalibPmtWriter.cc.

              :GaudiTool(type, name, parent)
{
    declareInterface< ICalibWriter >(this);
    //aggNo = -1;
    //subsite = 0;
    //task = 0;
    //m_daqRunInfoSvcName = "DaqRunInfoSvc";
}
CalibPmtWriter::~CalibPmtWriter ( ) [virtual]

Definition at line 39 of file CalibPmtWriter.cc.

                               {
//    delete myWriter;
}

Member Function Documentation

StatusCode CalibPmtWriter::initialize ( ) [virtual]

Definition at line 43 of file CalibPmtWriter.cc.

                                     {
  cout<<"CalibPmtWriter initialzing--------------"<<endl;
  info()<< "initialize()"<< endreq;
  StatusCode sc = this->GaudiTool::initialize();
  if(sc != StatusCode::SUCCESS) return sc;

  //Get the DaqRunInfo Service
  //m_daqRunInfoSvc = svc<IDaqRunInfoSvc>("DaqRunInfoSvc", true);
  //if(!m_daqRunInfoSvc)
  //{
  //  error()<< "No DaqRunInfoSvc available."<< endreq;
  //  return StatusCode::FAILURE;
  //} 
  return StatusCode::SUCCESS;
}
StatusCode CalibPmtWriter::finalize ( ) [virtual]

Definition at line 59 of file CalibPmtWriter.cc.

                                   {
    cout<<"CalibPmtWriter finalizing--------------"<<endl;
    StatusCode sc = this->GaudiTool::finalize();
    if(sc != StatusCode::SUCCESS) return sc;
    return StatusCode::SUCCESS;
}
int CalibPmtWriter::setRunNo ( int  runNo) [virtual]

Reimplemented from ICalibWriter.

Definition at line 66 of file CalibPmtWriter.cc.

                                     { 
    runNumber = runNo;
    return 1;
} 
int CalibPmtWriter::setFileName ( string  fileName) [virtual]

Reimplemented from ICalibWriter.

Definition at line 71 of file CalibPmtWriter.cc.

                                              {
    inputFileName = fileName; 
    return 1;
} 
int CalibPmtWriter::setTimeWindow ( int  time) [virtual]

Reimplemented from ICalibWriter.

Definition at line 76 of file CalibPmtWriter.cc.

                                         {
    timeWindow = time; 
    return 1;
} 
int CalibPmtWriter::run ( ) [virtual]

Reimplemented from ICalibWriter.

Definition at line 134 of file CalibPmtWriter.cc.

{
    mainProcess();
}
void CalibPmtWriter::setSubsite ( int  subSite) [virtual]

Reimplemented from CalibWriter.

Definition at line 81 of file CalibPmtWriter.cc.

{
    this->subsite = subSite;
}
void CalibPmtWriter::setIsSim ( bool  isSim) [virtual]

Reimplemented from CalibWriter.

Definition at line 86 of file CalibPmtWriter.cc.

{
    this->isSim = isSim;
}
void CalibPmtWriter::setSiteMask ( int  siteMask) [virtual]

Reimplemented from ICalibWriter.

Definition at line 91 of file CalibPmtWriter.cc.

{
    this->siteMask = siteMask;
}
int CalibPmtWriter::init ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 113 of file CalibPmtWriter.cc.

{
#ifdef I_LIKE_DUPLICITY 
   myWriter = new DbiWriter<CalibPmtSpec>(range,aggNo,subsite,task);
#else
   TimeStamp versionDate(0,0) ;
   UInt_t dbNo(0) ;
   const std::string logComment = "" ;
   const std::string tableName = "CalibPmtSpec" ;
   myWriter = new DbiWriter<GCalibPmtSpec>(range,aggNo,subsite,task, versionDate, dbNo, logComment, tableName );
#endif
   return 1;
}
int CalibPmtWriter::final ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 127 of file CalibPmtWriter.cc.

{     
    cout<<"close DB"<<endl;
    myWriter->Close();
    return 1;
}
int CalibPmtWriter::fillRow ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 139 of file CalibPmtWriter.cc.

                           { 
#ifdef I_LIKE_DUPLICITY 
    CalibPmtSpec row;
#else
#endif
    ifstream input;
    input.open(inputFileName.c_str());
    if(!input){
      cout<<"can not open file : "<<inputFileName<<endl;
      return 0;
    }else{
      int pmtID = 0;
      string description;
      int status = 0;
      double speHigh = 0;
      double sigmaSpe = 0;
      double speLow = 0;
      double timeOffset = 0;
      double timeSpread = 0;
      double efficiency = 0;
      double prePulse = 0;
      double afterPulse = 0;
      double darkRate = 0;
      char buffer[500];
      input.getline(buffer, sizeof(buffer));
      input.getline(buffer, sizeof(buffer));
      while(input.peek()!=EOF)
      {
        input.getline(buffer, sizeof(buffer));
        istringstream(buffer)>>pmtID
                             >>description
                             >>status
                             >>speHigh
                             >>sigmaSpe
                             >>speLow
                             >>timeOffset
                             >>timeSpread
                             >>efficiency 
                             >>prePulse 
                             >>afterPulse
                             >>darkRate ;

        cout<<pmtID<<"   "
            <<description<<"   "
            <<status<<"   "
            <<speHigh<<"   "
            <<sigmaSpe<<"   "
            <<speLow<<"   "
            <<timeOffset<<"   "
            <<timeSpread<<"   "
            <<efficiency<<"   "
            <<prePulse<<"   "
            <<afterPulse<<"   "
            <<darkRate<<endl;

#ifdef I_LIKE_DUPLICITY 
         row.SetCalibPmtSpecValues(
#else
         GCalibPmtSpec row(
#endif
                                   pmtID,
                                   description,
                                   status,
                                   speHigh,                             
                                   sigmaSpe,
                                   speLow,
                                   timeOffset,
                                   timeSpread,
                                   efficiency,
                                   prePulse,
                                   afterPulse,
                                   darkRate);
         //writeToDB();
         *myWriter << row;
      }
    }
    return 1;
} 
static const InterfaceID& ICalibWriter::interfaceID ( ) [inline, static, inherited]

Definition at line 24 of file ICalibWriter.h.

{ return IID_ICalibWriter; }
int CalibWriter::mainProcess ( ) [protected, inherited]

Definition at line 88 of file CalibWriter.cc.

{ 
   cout<<"CalibWriter runing--------------"<<endl;
   if( 0 == setContextRange() ) 
   {
     cout<<"can not set ContextRange"<<endl;
     return 0;
   }
   if( 0 == init() ) 
   {
     cout<<"can not initial"<<endl;
      return 0;
   }
   if( 0 == fillRow() )
   {
     cout<<"can not fill row"<<endl;
    return 0;
   }
   if( 0 == final() )
   {
     cout<<"can not finalize"<<endl;
     return 0;
   }
   return 1;

}

Member Data Documentation

DbiWriter<GCalibPmtSpec>* CalibPmtWriter::myWriter [private]

Definition at line 58 of file CalibPmtWriter.h.

int CalibWriter::runNumber [protected, inherited]

Definition at line 32 of file CalibWriter.h.

int CalibWriter::timeWindow [protected, inherited]

Definition at line 33 of file CalibWriter.h.

string CalibWriter::inputFileName [protected, inherited]

Definition at line 34 of file CalibWriter.h.

ContextRange CalibWriter::range [protected, inherited]

Definition at line 35 of file CalibWriter.h.

Int_t CalibWriter::aggNo [protected, inherited]

Definition at line 36 of file CalibWriter.h.

Dbi::SubSite CalibWriter::subsite [protected, inherited]

Definition at line 37 of file CalibWriter.h.

Dbi::Task CalibWriter::task [protected, inherited]

Definition at line 38 of file CalibWriter.h.

TimeStamp CalibWriter::startTime [protected, inherited]

Definition at line 39 of file CalibWriter.h.

TimeStamp CalibWriter::endTime [protected, inherited]

Definition at line 40 of file CalibWriter.h.

bool CalibWriter::isSim [protected, inherited]

Definition at line 41 of file CalibWriter.h.

int CalibWriter::siteMask [protected, inherited]

Definition at line 42 of file CalibWriter.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:02:34 for DBWriter by doxygen 1.7.4