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

CalFailureModeSvc Class Reference

Service to store and compare to a list of desired failure modes in the CAL. More...

#include <CalFailureModeSvc.h>

Inheritance diagram for CalFailureModeSvc:

ICalFailureModeSvc List of all members.

Public Types

enum  { TOWER, TOWERLAYER }

Public Methods

 CalFailureModeSvc (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
int getFailureConditions ()
 get the list of enabled failure mode conditions

bool matchChannel (idents::CalXtalId id)
 look for crystal in list of dead towers

StatusCode queryInterface (const IID &riid, void **ppvUnknown)
 queryInterface - for implementing a Service this is necessary

const IID & type () const
 return the service type


Static Public Methods

const InterfaceID & interfaceID ()

Protected Methods

bool matchTower (idents::CalXtalId id)
 look for crystal in list of dead towers

bool matchTowerLayer (idents::CalXtalId id)
 look for crystal in list of dead layers

void processTowerList ()
 process the input list of towers

void processTowerLayerList ()
 process the input list of tower/layer pairs


Private Attributes

StringArrayProperty m_towerListProperty
 List of towers from jobOptions.

StringArrayProperty m_towerLayerListProperty
 List of towers,layers from jobOptions.

int m_failureModes
 bitmap of failure modes

std::vector< int > m_towerList
 vector of towers to fail

std::map< int, std::vector<
int > > 
m_towerLayerList
 map of towers/layers to fail


Detailed Description

Service to store and compare to a list of desired failure modes in the CAL.

Author: R.Dubois

Definition at line 17 of file CalFailureModeSvc.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TOWER 
TOWERLAYER 

Definition at line 30 of file CalFailureModeSvc.h.

00030 {TOWER, TOWERLAYER};


Constructor & Destructor Documentation

CalFailureModeSvc::CalFailureModeSvc const std::string &    name,
ISvcLocator *    pSvcLocator
 

Definition at line 21 of file CalFailureModeSvc.cxx.

References m_towerLayerListProperty, and m_towerListProperty.

00021                                                                            : Service(name,svc)
00022 {
00023     // Purpose and Method: Constructor - Declares and sets default properties
00024     //                     
00025     // Inputs: service name and locator 
00026     //         
00027     // Outputs: None
00028     // Dependencies: None
00029     // Restrictions and Caveats:  None
00030     
00031     // declare the properties
00032 
00033     declareProperty("towerList", m_towerListProperty);
00034     declareProperty("towerLayerList", m_towerLayerListProperty);
00035 }


Member Function Documentation

StatusCode CalFailureModeSvc::execute  
 

StatusCode CalFailureModeSvc::finalize  
 

Definition at line 82 of file CalFailureModeSvc.cxx.

00082 {return StatusCode::SUCCESS;}

int CalFailureModeSvc::getFailureConditions   [inline, virtual]
 

get the list of enabled failure mode conditions

Implements ICalFailureModeSvc.

Definition at line 28 of file CalFailureModeSvc.h.

References m_failureModes.

00028 {return m_failureModes;};

StatusCode CalFailureModeSvc::initialize  
 

Definition at line 52 of file CalFailureModeSvc.cxx.

References m_failureModes, processTowerLayerList(), and processTowerList().

00053 {
00054     // Purpose and Method: Initialize the lists of dead units
00055     //                     
00056     // Inputs: None        
00057     // Outputs: None
00058     // Dependencies: None
00059     // Restrictions and Caveats:  None
00060     
00061     StatusCode  status = StatusCode::SUCCESS;
00062     
00063     // Open the message log
00064     MsgStream log( msgSvc(), name() );
00065     
00066     // Call super-class
00067     Service::initialize ();
00068     
00069     // Bind all of the properties for this service
00070     if ( (status = setProperties()).isFailure() ) {
00071         log << MSG::ERROR << "Failed to set properties" << endreq;
00072     }
00073     
00074     
00075     m_failureModes = 0;
00076     processTowerList();
00077     processTowerLayerList();
00078     
00079     return StatusCode::SUCCESS;
00080 }

const InterfaceID& CalFailureModeSvc::interfaceID   [inline, static]
 

Reimplemented from ICalFailureModeSvc.

Definition at line 38 of file CalFailureModeSvc.h.

References ICalFailureModeSvc::interfaceID().

00038                                             {
00039         return ICalFailureModeSvc::interfaceID(); 
00040     }

bool CalFailureModeSvc::matchChannel idents::CalXtalId    id [virtual]
 

look for crystal in list of dead towers

Implements ICalFailureModeSvc.

Definition at line 164 of file CalFailureModeSvc.cxx.

References matchTower(), and matchTowerLayer().

00164                                                        {
00165     // Purpose and Method: look for the given id in the (tower,layer) list
00166     //                     
00167      
00168     if (matchTower(id)) return true;
00169     if (matchTowerLayer(id)) return true;
00170     
00171     return false;
00172 }

bool CalFailureModeSvc::matchTower idents::CalXtalId    id [protected, virtual]
 

look for crystal in list of dead towers

Implements ICalFailureModeSvc.

Definition at line 133 of file CalFailureModeSvc.cxx.

References m_towerList.

Referenced by matchChannel().

00133                                                      {
00134     // Purpose and Method: check whether given id is in any of the identified lists
00135     //                     
00136     
00137     if (m_towerList.size() == 0) return false;
00138 
00139     int tower = id.getTower();
00140     
00141     // Search to see if this event id is among the list of ids we want to pause on
00142     int *loc = std::find(m_towerList.begin(), m_towerList.end(), tower);                
00143 
00144     return (loc != m_towerList.end());
00145 }

bool CalFailureModeSvc::matchTowerLayer idents::CalXtalId    id [protected, virtual]
 

look for crystal in list of dead layers

Implements ICalFailureModeSvc.

Definition at line 147 of file CalFailureModeSvc.cxx.

References m_towerLayerList.

Referenced by matchChannel().

00147                                                           {
00148     // Purpose and Method: look for the given id in the tower list
00149     //                     
00150     
00151     if (m_towerLayerList.size() == 0) return false;
00152 
00153     int tower = id.getTower();
00154     int layer = id.getLayer();
00155     
00156     std::vector<int> &layerList = m_towerLayerList[tower];
00157     
00158     // Search to see if this (tower,layer) is among the list
00159     int *loc = std::find(layerList.begin(), layerList.end(), layer);                
00160     
00161     return (loc != layerList.end());
00162 }

void CalFailureModeSvc::processTowerLayerList   [protected, virtual]
 

process the input list of tower/layer pairs

Implements ICalFailureModeSvc.

Definition at line 84 of file CalFailureModeSvc.cxx.

References m_failureModes, m_towerLayerList, m_towerLayerListProperty, and TOWER.

Referenced by initialize().

00084                                               {
00085     // Purpose and Method: process the jobOptions input lists of (tower,layer) pairs
00086     //                     
00087     
00088     MsgStream log(msgSvc(), name());
00089     
00090     const std::vector<std::string>& theTowers = m_towerLayerListProperty.value( );
00091     if (theTowers.size() == 0) return;
00092 
00093     m_failureModes = m_failureModes || 1 << TOWER;
00094 
00095     log << MSG::DEBUG << "Towers and Layers to kill " << endreq;
00096 
00097     std::vector<std::string>::const_iterator it;
00098     std::vector<std::string>::const_iterator itend = theTowers.end( );
00099     for (it = theTowers.begin(); it != itend; it++) {
00100         int len = (*it).size();
00101         int delimPos = (*it).find_first_of('_');
00102         int tower = atoi((*it).substr(0, delimPos).c_str());
00103         int layer = atoi((*it).substr(delimPos+1, len-delimPos-1).c_str());
00104         log << MSG::DEBUG << "Tower " << tower << " Layer " << layer << endreq;
00105         std::vector<int>& curList = m_towerLayerList[tower];
00106         curList.push_back(layer);                
00107     }
00108 }

void CalFailureModeSvc::processTowerList   [protected, virtual]
 

process the input list of towers

Implements ICalFailureModeSvc.

Definition at line 110 of file CalFailureModeSvc.cxx.

References m_failureModes, m_towerList, m_towerListProperty, and TOWERLAYER.

Referenced by initialize().

00110                                          {
00111      // Purpose and Method: process the jobOptions input lists of towers
00112     //                     
00113    
00114     MsgStream log(msgSvc(), name());
00115     
00116     const std::vector<std::string>& theTowers = m_towerListProperty.value( );
00117 
00118     if (theTowers.size() == 0) return;
00119 
00120     log << MSG::DEBUG << "Towers to kill " << endreq;
00121 
00122     m_failureModes = m_failureModes || 1 << TOWERLAYER;
00123 
00124     std::vector<std::string>::const_iterator it;
00125     std::vector<std::string>::const_iterator itend = theTowers.end( );
00126     for (it = theTowers.begin(); it != itend; it++) {
00127         int tower = atoi((*it).c_str());
00128         log << MSG::DEBUG << "Tower " << tower << endreq;
00129         m_towerList.push_back(tower);
00130     }
00131 }

StatusCode CalFailureModeSvc::queryInterface const IID &    riid,
void **    ppvUnknown
 

queryInterface - for implementing a Service this is necessary

Definition at line 37 of file CalFailureModeSvc.cxx.

00038 {
00039     if (IID_ICalFailureModeSvc == riid) {
00040         *ppvIF = dynamic_cast<ICalFailureModeSvc*> (this);
00041         return StatusCode::SUCCESS;
00042     }
00043     else {
00044         return Service::queryInterface (riid, ppvIF);
00045     }
00046 }

const IID & CalFailureModeSvc::type   const
 

return the service type

Definition at line 48 of file CalFailureModeSvc.cxx.

00048                                            {
00049     return IID_ICalFailureModeSvc;
00050 }


Member Data Documentation

int CalFailureModeSvc::m_failureModes [private]
 

bitmap of failure modes

Definition at line 68 of file CalFailureModeSvc.h.

Referenced by getFailureConditions(), initialize(), processTowerLayerList(), and processTowerList().

std::map<int,std::vector<int> > CalFailureModeSvc::m_towerLayerList [private]
 

map of towers/layers to fail

Definition at line 74 of file CalFailureModeSvc.h.

Referenced by matchTowerLayer(), and processTowerLayerList().

StringArrayProperty CalFailureModeSvc::m_towerLayerListProperty [private]
 

List of towers,layers from jobOptions.

Definition at line 65 of file CalFailureModeSvc.h.

Referenced by CalFailureModeSvc(), and processTowerLayerList().

std::vector<int> CalFailureModeSvc::m_towerList [private]
 

vector of towers to fail

Definition at line 71 of file CalFailureModeSvc.h.

Referenced by matchTower(), and processTowerList().

StringArrayProperty CalFailureModeSvc::m_towerListProperty [private]
 

List of towers from jobOptions.

Definition at line 62 of file CalFailureModeSvc.h.

Referenced by CalFailureModeSvc(), and processTowerList().


The documentation for this class was generated from the following files:
Generated on Tue Oct 29 08:24:27 2002 for CalUtil by doxygen1.2.16