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

#include <FeeCableMapWriter.h>

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

List of all members.

Public Member Functions

 FeeCableMapWriter (const string &type, const string &name, const IInterface *parent)
virtual ~FeeCableMapWriter ()
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 ()
int setContextRange ()

Private Attributes

DbiWriter< GFeeCableMap > * myWriter

Detailed Description

Definition at line 25 of file FeeCableMapWriter.h.


Constructor & Destructor Documentation

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

Definition at line 27 of file FeeCableMapWriter.cc.

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

Definition at line 39 of file FeeCableMapWriter.cc.

                                     {
//    delete myWriter;
}

Member Function Documentation

StatusCode FeeCableMapWriter::initialize ( ) [virtual]

Definition at line 43 of file FeeCableMapWriter.cc.

                                        {
  cout<<"FeeCableMapWriter 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 FeeCableMapWriter::finalize ( ) [virtual]

Definition at line 59 of file FeeCableMapWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 66 of file FeeCableMapWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 71 of file FeeCableMapWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 76 of file FeeCableMapWriter.cc.

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

Reimplemented from ICalibWriter.

Definition at line 119 of file FeeCableMapWriter.cc.

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

Reimplemented from CalibWriter.

Definition at line 98 of file FeeCableMapWriter.cc.

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

Reimplemented from CalibWriter.

Definition at line 112 of file FeeCableMapWriter.cc.

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

Reimplemented from CalibWriter.

Definition at line 124 of file FeeCableMapWriter.cc.

                              { 
#ifdef I_LIKE_DUPLICITY
    FeeCableMap row;
#else
#endif
    ifstream input;
    input.open(inputFileName.c_str());
    if(!input){
      cout<<"can not open file : "<<inputFileName<<endl;
      return 0;
    }else{
          int feeChannelId = 0;
          string channelDesc;
          int feeHardwareId = 0;
          string chanHrdwDesc;
          int sensorId = 0;
          string sensorDesc;
          int pmtHardwareId = 0;
          string pmtHrdwDesc;

        char buffer[500];
//      input.getline(buffer, sizeof(buffer));
//      input.getline(buffer, sizeof(buffer));
      while(input.peek()!=EOF)
      {
        input.getline(buffer, sizeof(buffer));
        istringstream(buffer)>>feeChannelId
                             >>channelDesc
                             >>feeHardwareId
                             >>chanHrdwDesc
                             >>sensorId
                             >>sensorDesc
                             >>pmtHardwareId
                             >>pmtHrdwDesc;

cout<< feeChannelId<<"   "
    << channelDesc<<"   "
    << feeHardwareId<<"   "
    << chanHrdwDesc<<"   "
    << sensorId<<"   "
    << sensorDesc<<"   "
    << pmtHardwareId<<"   "
    << pmtHrdwDesc;


#ifdef I_LIKE_DUPLICITY
row.SetFeeCableMapValues(
#else
  GFeeCableMap row( 
#endif
feeChannelId,
channelDesc,
feeHardwareId,
chanHrdwDesc,
sensorId,
sensorDesc,
pmtHardwareId,
pmtHrdwDesc
              );
         //writeToDB();
         *myWriter << row;
      }
    }
    return 1;
} 
int FeeCableMapWriter::setContextRange ( ) [private, virtual]

Reimplemented from CalibWriter.

Definition at line 190 of file FeeCableMapWriter.cc.

                                      {
    ifstream input;
    input.open("/publicfs/dyb/user/anfp/DBIW/DBWriter/share/feeCableMap.conf");
     if(!input){
      cout<<"can not open file : "<<"/publicfs/dyb/user/anfp/DBIW/DBWriter/share/feeCableMap.conf"<<endl;
      return 0;
    }else{
      int Syear;
      int Smonth;
      int Sday;
      int Shour;
      int Smin;
      int Ssec;

      int Eyear;
      int Emonth;
      int Eday;
      int Ehour;
      int Emin;
      int Esec;

      int sitemask;
      int simmask;

      input>> Syear
           >> Smonth
           >> Sday
           >> Shour
           >> Smin
           >> Ssec;

      input>> Eyear
           >> Emonth
           >> Eday
           >> Ehour
           >> Emin
           >> Esec;

      input>> sitemask
           >> simmask;



//    startTime.Set(Syear, Smonth, Sday, Shour, Smin, Ssec,0,0,0);///
TimeStamp Tstart(Syear, Smonth, Sday, Shour, Smin, Ssec,0,1,0);
//TimeStamp Tstart(2010, 4, 1, 0, 0, 0,0,0,0);
    startTime = Tstart;

TimeStamp Tend(Eyear, Emonth, Eday, Ehour, Emin, Esec,0,1,0);
//    TimeStamp Tend(2020, 12, 22, 0, 0, 0,0,0,0);
    endTime = Tend;

//    endTime.Set(Eyear, Emonth, Eday, Ehour, Emin, Esec,0,0,0);///
    ContextRange Cr(sitemask, simmask, startTime, endTime);
// ContextRange Cr(32, 1, startTime, endTime);///
    range = Cr;
}

}
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

DbiWriter<GFeeCableMap>* FeeCableMapWriter::myWriter [private]

Definition at line 45 of file FeeCableMapWriter.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