Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

CalDiagnosticTool Class Reference

Default implementation of ICalDiagnosticTool. Generate Cal Diagnostic trigger primitives from CalTrigTool, CalSignalTool output & current calibrations. More...

#include <CalDiagnosticTool.h>

Inheritance diagram for CalDiagnosticTool:

Inheritance graph
[legend]
Collaboration diagram for CalDiagnosticTool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalDiagnosticTool (const std::string &type, const std::string &name, const IInterface *parent)
 default ctor, declares jobOptions

StatusCode initialize ()
 gets needed parameters and pointers to required services

StatusCode finalize ()
virtual std::auto_ptr< LdfEvent::CalDiagnosticData > getDiagnosticData (const CalUtil::TwrNum twr, const CalUtil::LyrNum lyr)
 retrieve CalDiagnosticData object for given Tower bay and Cal layer


Private Member Functions

StatusCode calcLACBits (const CalUtil::TwrNum twr, const CalUtil::LyrNum lyr, CalUtil::CalDiagnosticWord::CalDiagLACBits &lacBits)
 calculate LAC bits for single layer

StatusCode calcTrigBits (const CalUtil::TwrNum twr, const CalUtil::LyrNum lyr, CalUtil::CalDiagnosticWord::CalDiagTrigBits &trigBits)
 calculate OR'd trigger bits for single cal diagnostic


Private Attributes

StringProperty m_precalcCalibName
 name of precalc calib tool

IPrecalcCalibToolm_precalcCalibTool
StringProperty m_calSignalToolName
ICalSignalToolm_calSignalTool
 ptr to CalSignalTool tool

StringProperty m_calTrigToolName
ICalTrigToolm_calTrigTool

Detailed Description

Default implementation of ICalDiagnosticTool. Generate Cal Diagnostic trigger primitives from CalTrigTool, CalSignalTool output & current calibrations.

Author:
Z.Fewtrell

jobOptions:

Definition at line 41 of file CalDiagnosticTool.h.


Constructor & Destructor Documentation

CalDiagnosticTool::CalDiagnosticTool const std::string &  type,
const std::string &  name,
const IInterface *  parent
 

default ctor, declares jobOptions

Definition at line 32 of file CalDiagnosticTool.cxx.

References m_calSignalToolName, m_calTrigToolName, and m_precalcCalibName.

00035   : AlgTool(type,name,parent),
00036     m_precalcCalibTool(0),
00037     m_calSignalTool(0),
00038     m_calTrigTool(0)
00039 {
00040   declareInterface<ICalDiagnosticTool>(this);
00041 
00042   declareProperty("PrecalcCalibTool", m_precalcCalibName = "PrecalcCalibTool");
00043   declareProperty("CalSignalToolName", m_calSignalToolName = "CalSignalTool");
00044   declareProperty("CalTrigToolName", m_calTrigToolName = "CalTrigTool");
00045 
00046 }


Member Function Documentation

StatusCode CalDiagnosticTool::calcLACBits const CalUtil::TwrNum  twr,
const CalUtil::LyrNum  lyr,
CalUtil::CalDiagnosticWord::CalDiagLACBits &  lacBits
[private]
 

calculate LAC bits for single layer

compare signal in CIDAC vs THOLD for each crystal face (LRG diode only)

Definition at line 117 of file CalDiagnosticTool.cxx.

References ICalSignalTool::getDiodeSignal(), IPrecalcCalibTool::getLacCIDAC(), m_calSignalTool, and m_precalcCalibTool.

Referenced by getDiagnosticData().

00119                                                                                            {
00120 
00123   for (FaceNum face; face.isValid(); face++)
00124     for (ColNum col; col.isValid(); col++) {
00125       const DiodeIdx diodeIdx(twr,lyr,col,face,LRG_DIODE);
00126 
00127       float signal;
00128       if (m_calSignalTool->getDiodeSignal(diodeIdx, signal).isFailure())
00129         return StatusCode::FAILURE;
00130 
00131       float thold;
00132       const FaceIdx faceIdx(twr,lyr,col,face);
00133       if (m_precalcCalibTool->getLacCIDAC(faceIdx, thold).isFailure())
00134         return StatusCode::FAILURE;
00135 
00136       if (signal > thold)
00137         lacBits[face][col] = true;
00138     }
00139 
00140   return StatusCode::SUCCESS;
00141 }

StatusCode CalDiagnosticTool::calcTrigBits const CalUtil::TwrNum  twr,
const CalUtil::LyrNum  lyr,
CalUtil::CalDiagnosticWord::CalDiagTrigBits &  trigBits
[private]
 

calculate OR'd trigger bits for single cal diagnostic

Definition at line 144 of file CalDiagnosticTool.cxx.

References ICalTrigTool::getTriggerBit(), and m_calTrigTool.

Referenced by getDiagnosticData().

00146                                                                                               {
00147 
00148   for (FaceNum face; face.isValid(); face++) 
00149     for (DiodeNum diode; diode.isValid(); diode++)
00150       // 'or' all xtal faces on same GCRC together
00151       for (ColNum col; col.isValid(); col++) {
00152         bool trigBit;
00153         if (m_calTrigTool->getTriggerBit(DiodeIdx(twr,lyr,col,face,diode), trigBit).isFailure())
00154           return StatusCode::FAILURE;
00155 
00156         if (trigBit) {
00157           trigBits[face][diode] = true;
00158           break; // no need to process the rest of the xtals in this row
00159         }
00160       }
00161 
00162   return StatusCode::SUCCESS;
00163 }

StatusCode CalDiagnosticTool::finalize  )  [inline]
 

Definition at line 54 of file CalDiagnosticTool.h.

00054 {return StatusCode::SUCCESS;}

auto_ptr< LdfEvent::CalDiagnosticData > CalDiagnosticTool::getDiagnosticData const CalUtil::TwrNum  twr,
const CalUtil::LyrNum  lyr
[virtual]
 

retrieve CalDiagnosticData object for given Tower bay and Cal layer

Returns:
Null pointer on error.
create new CalDiagnosticData object for each call, fill bits from information in CalTrigTool, CalSignalTool & PrecalcCalib

Implements ICalDiagnosticTool.

Definition at line 92 of file CalDiagnosticTool.cxx.

References calcLACBits(), and calcTrigBits().

00093                                                                                                     {
00095   auto_ptr<LdfEvent::CalDiagnosticData> calDiagData;
00096 
00098   CalDiagnosticWord::CalDiagTrigBits trigBits;
00099   if (calcTrigBits(twr, lyr, trigBits).isFailure())
00100     return calDiagData; 
00101 
00103   CalDiagnosticWord::CalDiagLACBits lacBits;
00104   if (calcLACBits(twr, lyr, lacBits).isFailure())
00105     return calDiagData; 
00106 
00107   CalUtil::CalDiagnosticWord diagWord(trigBits, lacBits);
00108 
00110   calDiagData.reset(new LdfEvent::CalDiagnosticData(diagWord.getDatum(), twr.val(), lyr.val()));
00111 
00112   return calDiagData;
00113 }

StatusCode CalDiagnosticTool::initialize  ) 
 

gets needed parameters and pointers to required services

Definition at line 48 of file CalDiagnosticTool.cxx.

References m_calSignalTool, m_calSignalToolName, m_calTrigTool, m_calTrigToolName, m_precalcCalibName, and m_precalcCalibTool.

00048                                          {
00049   MsgStream msglog(msgSvc(), name());   
00050   msglog << MSG::INFO << "initialize" << endreq;
00051 
00052   StatusCode sc;
00053 
00054   //-- jobOptions --//
00055   if ((sc = setProperties()).isFailure()) {
00056     msglog << MSG::ERROR << "Failed to set properties" << endreq;
00057     return sc;
00058   }
00059 
00060   // this tool may also be shared by other tools, global ownership
00061   sc = toolSvc()->retrieveTool("PrecalcCalibTool", 
00062                                m_precalcCalibName, 
00063                                m_precalcCalibTool,
00064                                0); // shared
00065   if (sc.isFailure() ) {
00066     msglog << MSG::ERROR << "  Unable to create " << m_precalcCalibName << endreq;
00067     return sc;
00068   }
00069 
00070   sc = toolSvc()->retrieveTool("CalSignalTool",
00071                                m_calSignalToolName,
00072                                m_calSignalTool,
00073                                0); // intended to be shared
00074   if (sc.isFailure() ) {
00075     msglog << MSG::ERROR << "  can't create " << m_calSignalToolName << endreq;
00076     return sc;
00077   }
00078 
00079   sc = toolSvc()->retrieveTool("CalTrigTool",
00080                                m_calTrigToolName,
00081                                m_calTrigTool,
00082                                0); // intended to be shared
00083   if (sc.isFailure() ) {
00084     msglog << MSG::ERROR << "  can't create " << m_calTrigToolName << endreq;
00085     return sc;
00086   }
00087 
00088   return StatusCode::SUCCESS;
00089 }


Member Data Documentation

ICalSignalTool* CalDiagnosticTool::m_calSignalTool [private]
 

ptr to CalSignalTool tool

Definition at line 83 of file CalDiagnosticTool.h.

Referenced by calcLACBits(), and initialize().

StringProperty CalDiagnosticTool::m_calSignalToolName [private]
 

Definition at line 81 of file CalDiagnosticTool.h.

Referenced by CalDiagnosticTool(), and initialize().

ICalTrigTool* CalDiagnosticTool::m_calTrigTool [private]
 

Definition at line 86 of file CalDiagnosticTool.h.

Referenced by calcTrigBits(), and initialize().

StringProperty CalDiagnosticTool::m_calTrigToolName [private]
 

Definition at line 85 of file CalDiagnosticTool.h.

Referenced by CalDiagnosticTool(), and initialize().

StringProperty CalDiagnosticTool::m_precalcCalibName [private]
 

name of precalc calib tool

Definition at line 76 of file CalDiagnosticTool.h.

Referenced by CalDiagnosticTool(), and initialize().

IPrecalcCalibTool* CalDiagnosticTool::m_precalcCalibTool [private]
 

Definition at line 78 of file CalDiagnosticTool.h.

Referenced by calcLACBits(), and initialize().


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 20:29:23 2008 by doxygen 1.3.3