/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
SimPmtWriter Class Reference

#include <SimPmtWriter.h>

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

List of all members.

Public Member Functions

 SimPmtWriter (const string &type, const string &name, const IInterface *parent)
virtual ~SimPmtWriter ()
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)
virtual void setSubsite (int subSite)
virtual void setIsSim (bool isSim)

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< GSimPmtSpec > * myWriter

Detailed Description

Definition at line 18 of file SimPmtWriter.h.


Constructor & Destructor Documentation

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

Definition at line 12 of file SimPmtWriter.cc.

   : GaudiTool(type, name, parent)
{
   declareInterface< ICalibWriter>(this);
}
SimPmtWriter::~SimPmtWriter ( ) [virtual]

Definition at line 20 of file SimPmtWriter.cc.

{
}

Member Function Documentation

StatusCode DBWriterAlg::initialize ( ) [virtual]

Definition at line 24 of file SimPmtWriter.cc.

{
   cout<<"SimPmtWriter initializing--------------"<<endl;
   info() << "initialize()" << endreq;

   StatusCode sc = this->GaudiTool::initialize();
   if ( sc.isFailure() ) {
      return sc;
   }

   return sc;
}
StatusCode DBWriterAlg::finalize ( ) [virtual]

Definition at line 37 of file SimPmtWriter.cc.

{
   cout<<"SimPmtWriter finalizing--------------"<<endl;
   info() << "finalize()" << endreq;

   StatusCode sc = this->GaudiTool::finalize();
   if ( sc.isFailure() ) {
      return sc;
   }

   return sc;
}
int SimPmtWriter::setRunNo ( int  runNo) [virtual]

Reimplemented from ICalibWriter.

Definition at line 50 of file SimPmtWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 56 of file SimPmtWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 62 of file SimPmtWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 68 of file SimPmtWriter.cc.

{
    mainProcess();
}
int SimPmtWriter::init ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 73 of file SimPmtWriter.cc.

{
#ifdef I_LIKE_DUPLICITY
   myWriter = new DbiWriter<SimPmtSpec>(range, aggNo, subsite, task);
#else
   TimeStamp versionDate(0, 0);
   UInt_t dbNo(0);
   const std::string logComment = "";
   const std::string tableName = "SimPmtSpec";
   myWriter = new DbiWriter<GSimPmtSpec>(range, aggNo, subsite, task, versionDate, dbNo, logComment, tableName);
#endif

   return 1;
}
int SimPmtWriter::final ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 88 of file SimPmtWriter.cc.

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

Reimplemented from CalibWriter.

Definition at line 95 of file SimPmtWriter.cc.

{
#ifdef I_LIKE_DUPLICITY
   SimPmtSpec row;
#else
#endif

   ifstream input( inputFileName.c_str() );
   if ( !input ) {
      cout << "can not open file: " << inputFileName << endl;
   }
   else {
      int pmtId = 0;
      string description;
      double gain = 0;
      double sigma = 0;
      double tOffset = 0;
      double tSpread = 0;
      double effic = 0;
      double prePuls = 0;
      double afterPuls = 0;
      double darkRate = 0;

      char buffer[512];
      input.getline( buffer, sizeof(buffer) );
      input.getline( buffer, sizeof(buffer) );

      while ( input.peek() != EOF ) {
         input.getline( buffer, sizeof(buffer) );
         istringstream(buffer) >> pmtId
                               >> description
                               >> gain
                               >> sigma
                               >> tOffset
                               >> tSpread
                               >> effic
                               >> prePuls
                               >> afterPuls
                               >> darkRate;

         cout << pmtId << "   "
              << description << "   "
              << gain << "   "
              << sigma << "   "
              << tOffset << "   "
              << tSpread << "   "
              << effic << "   "
              << prePuls << "   "
              << afterPuls << "   "
              << darkRate;

#ifdef I_LIKE_DUPLICITY
         row.SetSimPmtSpecValues(
#else
         GSimPmtSpec row(
#endif
            pmtId,
            description,
            gain,
            sigma,
            tOffset,
            tSpread,
            effic,
            prePuls,
            afterPuls,
            darkRate );

         *myWriter << row;
      }
   }

   return 1;
}
static const InterfaceID& ICalibWriter::interfaceID ( ) [inline, static, inherited]

Definition at line 24 of file ICalibWriter.h.

{ return IID_ICalibWriter; }
virtual void ICalibWriter::setSubsite ( int  subSite) [inline, virtual, inherited]

Reimplemented in CalibFeeWriter, and CalibPmtWriter.

Definition at line 29 of file ICalibWriter.h.

{}
virtual void ICalibWriter::setIsSim ( bool  isSim) [inline, virtual, inherited]

Reimplemented in CalibFeeWriter, and CalibPmtWriter.

Definition at line 30 of file ICalibWriter.h.

{}
virtual void ICalibWriter::setSiteMask ( int  siteMask) [inline, virtual, inherited]

Reimplemented in CalibFeeWriter, and CalibPmtWriter.

Definition at line 31 of file ICalibWriter.h.

{}
void CalibWriter::setSubsite ( int  subSite) [virtual, inherited]

Reimplemented in CalibFeeWriter, and CalibPmtWriter.

Definition at line 72 of file CalibWriter.cc.

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

Reimplemented in CalibFeeWriter, and CalibPmtWriter.

Definition at line 77 of file CalibWriter.cc.

{
    this->isSim = isSim;
}
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

Definition at line 40 of file SimPmtWriter.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