/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 | Private Attributes
CalibParamAlg Class Reference

#include <CalibParamAlg.h>

Collaboration diagram for CalibParamAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CalibParamAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~CalibParamAlg ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Attributes

std::string m_readoutLocation
 Property ReadoutLocation - location in TES where the input ReadoutHeader is to be found.
std::vector< std::string > m_pmtToolNames
std::vector< std::string > m_rpcToolNames
std::vector< IPmtCalibParamTool * > m_pmtTools
std::vector< IRpcCalibParamTool * > m_rpcTools
bool m_useFloatFeePedes
std::string m_floatFeePedesSvcName
IFloatingFeePedestalSvcm_floatFeePedesSvc
TimeStamp m_beginTime
TimeStamp m_endTime

Detailed Description

Definition at line 21 of file CalibParamAlg.h.


Constructor & Destructor Documentation

CalibParamAlg::CalibParamAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 15 of file CalibParamAlg.cc.

    : GaudiAlgorithm(name,pSvcLocator)
    , m_pmtTools(0)
    , m_rpcTools(0)
{
    declareProperty("ReadoutLocation",
                    m_readoutLocation=DayaBay::ReadoutHeaderLocation::Default,
                    "Location in the TES where the input ReadoutHeader is to be found.");
    declareProperty("PmtTools",m_pmtToolNames,
                    "Names of the PMT calibration tools");
    declareProperty("RpcTools",m_rpcToolNames,
                    "Names of the RPC calibration tools");
    declareProperty("UseFloatFeePedes",m_useFloatFeePedes=false,
                    "Use FloatFeePedes or not? In case of false, it will use CalibSvc.");
    declareProperty("FloatingFeePedestalSvcName",m_floatFeePedesSvcName="FloatingFeePedestalSvc",
                    "Name of service to access floating FEE channel baselines");
}
CalibParamAlg::~CalibParamAlg ( ) [virtual]

Definition at line 33 of file CalibParamAlg.cc.

{
}

Member Function Documentation

StatusCode CalibParamAlg::initialize ( ) [virtual]

Definition at line 37 of file CalibParamAlg.cc.

{
  StatusCode sc = this->GaudiAlgorithm::initialize();
  if( sc != StatusCode::SUCCESS ) return sc;

  {  
    // Get PMT Calibration tools
    std::vector<std::string>::iterator toolIter, toolEnd=m_pmtToolNames.end();
    for(toolIter=m_pmtToolNames.begin(); toolIter != toolEnd; toolIter++){
      std::string toolName = *toolIter;
      IPmtCalibParamTool* calibTool = 0;
      try {
        calibTool = tool<IPmtCalibParamTool>(toolName);
      }
      catch(const GaudiException& exg) {
        fatal() << "Failed to get pmt calib tool: \"" << toolName << "\"" 
                << endreq;
        return StatusCode::FAILURE;
      }
      m_pmtTools.push_back(calibTool);
      info () << "Added pmt calib tool " << toolName << endreq;
    }
  }

  {
    // Get RPC Calibration tools
    std::vector<std::string>::iterator toolIter, toolEnd=m_rpcToolNames.end();
    for(toolIter=m_rpcToolNames.begin(); toolIter != toolEnd; toolIter++){
      std::string toolName = *toolIter;
      IRpcCalibParamTool* calibTool = 0;
      try {
        calibTool = tool<IRpcCalibParamTool>(toolName);
      }
      catch(const GaudiException& exg) {
        fatal() << "Failed to get rpc calib tool: \"" << toolName << "\"" 
                << endreq;
        return StatusCode::FAILURE;
      }
      m_rpcTools.push_back(calibTool);
      info () << "Added rpc calib tool " << toolName << endreq;
    }
  }

  if(m_useFloatFeePedes){
    // Get floating fee pedestal service
    m_floatFeePedesSvc = svc<IFloatingFeePedestalSvc>(m_floatFeePedesSvcName,true);
    if(!m_floatFeePedesSvc){
      error() << "Failed to access FloatingFeePedestalSvc: " << m_floatFeePedesSvcName << endreq;
      return StatusCode::FAILURE;
    }
  }

  return StatusCode::SUCCESS;
}
StatusCode CalibParamAlg::execute ( ) [virtual]

Definition at line 92 of file CalibParamAlg.cc.

{
  debug() << "calling execute()" << endreq; 
  // Get input header
  DayaBay::ReadoutHeader* readoutHeader = 
    get<DayaBay::ReadoutHeader>(m_readoutLocation);

  if(m_useFloatFeePedes){
    // Drop a readoutHeader for pedestal calculation
    StatusCode sc = m_floatFeePedesSvc->cumulate( readoutHeader );
    if( sc.isFailure() ) {
      return sc;
    }
  }

  TimeStamp trigTime = readoutHeader->timeStamp();
  static bool first=true;
  if(first) {
    m_beginTime = trigTime;
    first = false;
  }
  m_endTime = trigTime;
  
  DayaBay::Detector det(readoutHeader->context().GetSite(),
                        readoutHeader->context().GetDetId());
  debug() << "Got readout from " << det.detName() <<" id= "
         << det.siteDetPackedData() <<endreq;
  
  if(det.isAD() || det.isWaterShield()){
    // Loop over each PMT calibration tool
    std::vector<IPmtCalibParamTool*>::iterator toolIter, 
      toolEnd=m_pmtTools.end();
    for(toolIter=m_pmtTools.begin(); toolIter != toolEnd; toolIter++){
      IPmtCalibParamTool* calibTool = *toolIter;
      StatusCode sc = calibTool->process(*readoutHeader);
      if( sc != StatusCode::SUCCESS ) return sc;
    }
    
  }else if(det.detectorId() == DetectorId::kRPC){
    // Process RPC readout
    debug() << "Processing RPC readout" <<endreq;
    // Loop over each RPC calibration tool
    std::vector<IRpcCalibParamTool*>::iterator toolIter, 
      toolEnd=m_rpcTools.end();
    for(toolIter=m_rpcTools.begin(); toolIter != toolEnd; toolIter++){
      IRpcCalibParamTool* calibTool = *toolIter;
      StatusCode sc = calibTool->process(*readoutHeader);
      if( sc != StatusCode::SUCCESS ) return sc;
    }
    
  }else{
    error() << "Unknown detector " << det << endreq; 
    info() << "I am ignoring for now! " << endreq;//tmp
    //return StatusCode::FAILURE;//tmp !! quick fix by jpochoa, temporary! See track ticket #737
    return StatusCode::SUCCESS;//tmp
  }
  
  return StatusCode::SUCCESS;
}
StatusCode CalibParamAlg::finalize ( ) [virtual]

Definition at line 152 of file CalibParamAlg.cc.

{
  // Run calibration calculations for each tool
  {
    // Loop over each PMT calibration tool, calling calibrate()
    std::vector<IPmtCalibParamTool*>::iterator toolIter, 
      toolEnd=m_pmtTools.end();
    for(toolIter=m_pmtTools.begin(); toolIter != toolEnd; toolIter++){
      IPmtCalibParamTool* calibTool = *toolIter;
      StatusCode sc = calibTool->calibrate();
      if( sc != StatusCode::SUCCESS ) return sc;
    }
  }
  
  {
    // Loop over each RPC calibration tool, calling calibrate()
    std::vector<IRpcCalibParamTool*>::iterator toolIter, 
      toolEnd=m_rpcTools.end();
    for(toolIter=m_rpcTools.begin(); toolIter != toolEnd; toolIter++){
      IRpcCalibParamTool* calibTool = *toolIter;
      StatusCode sc = calibTool->calibrate();
      if( sc != StatusCode::SUCCESS ) return sc;
    }
  }

  info()<<"First trigger time: "<<m_beginTime.GetSec()<<" sec "<<m_beginTime.GetNanoSec()<<" nanoSec"<<endreq;
  info()<<"Last trigger time:  "<<m_endTime.GetSec()<<" sec "<<m_endTime.GetNanoSec()<<" nanoSec"<<endreq;

  return this->GaudiAlgorithm::finalize();
}

Member Data Documentation

std::string CalibParamAlg::m_readoutLocation [private]

Property ReadoutLocation - location in TES where the input ReadoutHeader is to be found.

Default is DayaBay::ReadoutHeader::Default

Definition at line 39 of file CalibParamAlg.h.

std::vector<std::string> CalibParamAlg::m_pmtToolNames [private]

Definition at line 42 of file CalibParamAlg.h.

std::vector<std::string> CalibParamAlg::m_rpcToolNames [private]

Definition at line 44 of file CalibParamAlg.h.

Definition at line 47 of file CalibParamAlg.h.

Definition at line 49 of file CalibParamAlg.h.

Definition at line 52 of file CalibParamAlg.h.

Definition at line 54 of file CalibParamAlg.h.

Definition at line 57 of file CalibParamAlg.h.

Definition at line 60 of file CalibParamAlg.h.

Definition at line 61 of file CalibParamAlg.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:04:27 for CalibParam by doxygen 1.7.4