Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | 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:

Inheritance graph
[legend]
Collaboration diagram for CalFailureModeSvc:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { TOWER, TOWERAFEE, TOWERCONTROL }

Public Member Functions

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

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

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

const InterfaceID & type () const
 return the service type


Static Public Member Functions

const InterfaceID & interfaceID ()

Protected Member Functions

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

bool matchTowerAfee (idents::CalXtalId id, idents::CalXtalId::XtalFace face)
 look for crystal in list of dead AFEE boards

bool matchTowerController (idents::CalXtalId id, idents::CalXtalId::XtalFace face)
 look for crystal in list of dead controllers

void processTowerList ()
 process the input list of towers

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

void processTowerControllerList ()
 process the input list of tower/cable controller pairs


Private Attributes

StringArrayProperty m_towerListProperty
 List of towers from jobOptions.

StringArrayProperty m_towerAfeeListProperty
 List of towers,layers from jobOptions.

StringArrayProperty m_towerControllerListProperty
 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_towerAfeeList
 map of towers/layers to fail

std::map< int, std::vector<
int > > 
m_towerControllerList
 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 21 of file CalFailureModeSvc.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TOWER 
TOWERAFEE 
TOWERCONTROL 

Definition at line 33 of file CalFailureModeSvc.h.


Constructor & Destructor Documentation

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

Definition at line 28 of file CalFailureModeSvc.cxx.

References m_towerAfeeListProperty, m_towerControllerListProperty, and m_towerListProperty.

00028                                                                            : Service(name,svc)
00029 {
00030   // Purpose and Method: Constructor - Declares and sets default properties
00031   //                     
00032   // Inputs: service name and locator 
00033   //         
00034   // Outputs: None
00035   // Dependencies: None
00036   // Restrictions and Caveats:  None
00037     
00038         
00039   // declare the properties
00040         
00041         
00042   declareProperty("towerList", m_towerListProperty);
00043   declareProperty("towerAfeeList", m_towerAfeeListProperty);
00044   declareProperty("towerControllerList", m_towerControllerListProperty);
00045 }


Member Function Documentation

StatusCode CalFailureModeSvc::finalize  ) 
 

Definition at line 97 of file CalFailureModeSvc.cxx.

00097 {return StatusCode::SUCCESS;}

int CalFailureModeSvc::getFailureConditions  )  [inline, virtual]
 

get the list of enabled failure mode conditions

Implements ICalFailureModeSvc.

Definition at line 31 of file CalFailureModeSvc.h.

References m_failureModes.

00031 {return m_failureModes;};

StatusCode CalFailureModeSvc::initialize  ) 
 

Definition at line 63 of file CalFailureModeSvc.cxx.

References m_failureModes, processTowerAfeeList(), processTowerControllerList(), and processTowerList().

00064 {
00065   // Purpose and Method: Initialize the lists of dead units
00066   //                     
00067   // Inputs: None        
00068   // Outputs: None
00069   // Dependencies: None
00070   // Restrictions and Caveats:  None
00071     
00072         
00073   StatusCode  status = StatusCode::SUCCESS;
00074         
00075   // Open the message log
00076   MsgStream msglog(msgSvc(), name());   
00077   msglog << MSG::INFO << "initialize" << endreq;
00078     
00079         
00080   // Call super-class
00081   Service::initialize ();
00082         
00083   // Bind all of the properties for this service
00084   if ( (status = setProperties()).isFailure() ) {
00085     msglog << MSG::ERROR << "Failed to set properties" << endreq;
00086   }
00087         
00088   m_failureModes = 0;
00089   processTowerList();
00090   processTowerAfeeList();
00091   processTowerControllerList();
00092         
00093   return StatusCode::SUCCESS;
00094 }

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

Reimplemented from ICalFailureModeSvc.

Definition at line 41 of file CalFailureModeSvc.h.

References ICalFailureModeSvc::interfaceID().

00041                                           {
00042     return ICalFailureModeSvc::interfaceID(); 
00043   }

bool CalFailureModeSvc::matchChannel idents::CalXtalId  id,
idents::CalXtalId::XtalFace  face
[virtual]
 

look for crystal in list of dead towers

Implements ICalFailureModeSvc.

Definition at line 277 of file CalFailureModeSvc.cxx.

References matchTower(), matchTowerAfee(), and matchTowerController().

00277                                                                                      {
00278         
00279   // Purpose and Method: look for the given id in the (tower,layer) list
00280   //                     
00281         
00282         
00283   if (matchTower(id)) return true;
00284   if (matchTowerAfee(id,face)) return true;
00285   if (matchTowerController(id,face)) return true;
00286         
00287   return false;
00288         
00289 }

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

look for crystal in list of dead towers

Implements ICalFailureModeSvc.

Definition at line 192 of file CalFailureModeSvc.cxx.

References m_towerList.

Referenced by matchChannel().

00192                                                      {
00193         
00194   // Purpose and Method: check whether given id is in any of the identified lists
00195         
00196   //                     
00197         
00198     
00199         
00200   if (m_towerList.size() == 0) return false;
00201         
00202   int tower = id.getTower();
00203         
00204   // Search to see if this event id is among the list of ids we want to pause on
00205         
00206   std::vector<int>::iterator loc = std::find(m_towerList.begin(), 
00207                                              m_towerList.end(), tower);
00208   return (loc != m_towerList.end());
00209 }

bool CalFailureModeSvc::matchTowerAfee idents::CalXtalId  id,
idents::CalXtalId::XtalFace  face
[protected, virtual]
 

look for crystal in list of dead AFEE boards

Implements ICalFailureModeSvc.

Definition at line 213 of file CalFailureModeSvc.cxx.

References m_towerAfeeList.

Referenced by matchChannel().

00213                                                                                        {
00214         
00215   // Purpose and Method: look for the given id in the tower list
00216   //                     
00217         
00218         
00219   if (m_towerAfeeList.size() == 0) return false;
00220         
00221   int tower = id.getTower();
00222   int afee = 2*face + (!id.isX());
00223         
00224   std::vector<int> &afeeList = m_towerAfeeList[tower];
00225         
00226   // Search to see if this (tower,AFEE) is among the list
00227         
00228   std::vector<int>::iterator loc = std::find(afeeList.begin(), 
00229                                              afeeList.end(), afee);
00230         
00231   return (loc != afeeList.end());
00232         
00233 }

bool CalFailureModeSvc::matchTowerController idents::CalXtalId  id,
idents::CalXtalId::XtalFace  face
[protected]
 

look for crystal in list of dead controllers

Definition at line 235 of file CalFailureModeSvc.cxx.

References m_towerControllerList.

Referenced by matchChannel().

00235                                                                                              {
00236         
00237   // Purpose and Method: look for the given id in the tower/controller list
00238   //                     
00239         
00240         
00241   if (m_towerControllerList.size() == 0) return false;
00242         
00243   int tower = id.getTower();
00244   int layer = id.getLayer();
00245 
00246   // primary controller has same numbering as AFEE; secondary is opposite
00247   int controller1 = 2*face + (!id.isX());
00248   int controller2 = (controller1+2)%4;
00249 
00250   // x+ controller takes out all + side and layers 0,1 on neg side
00251   // y+ controller takes out all + side and layers 2,3 on neg side
00252   bool offController2P = (face == idents::CalXtalId::POS) && (
00253                                                               (id.isX() && layer < 4) 
00254                                                               || ( !id.isX() && layer > 2));
00255   bool offController2N = (face == idents::CalXtalId::NEG) && (
00256                                                               (id.isX() && layer > 3) 
00257                                                               || ( !id.isX() && layer < 5));
00258 
00259   std::vector<int> &controllerList = m_towerControllerList[tower];
00260   if (controllerList.size() == 0) return false;
00261     
00262   // Search to see if this (tower,controller) is among the list
00263         
00264   std::vector<int>::iterator loc1 = std::find(controllerList.begin(), 
00265                                               controllerList.end(), 
00266                                               controller1);                
00267   std::vector<int>::iterator loc2 = controllerList.end();
00268   if (offController2P || offController2N) loc2 = std::find(controllerList.begin(), 
00269                                                            controllerList.end(), controller2);                
00270         
00271   return (loc1 != controllerList.end() || loc2 != controllerList.end());
00272         
00273 }

void CalFailureModeSvc::processTowerAfeeList  )  [protected, virtual]
 

process the input list of tower/layer pairs

Implements ICalFailureModeSvc.

Definition at line 100 of file CalFailureModeSvc.cxx.

References m_failureModes, m_towerAfeeList, m_towerAfeeListProperty, and TOWERAFEE.

Referenced by initialize().

00100                                              {
00101   // Purpose and Method: process the jobOptions input lists of (tower,layer) pairs
00102   //                     
00103         
00104   MsgStream msglog(msgSvc(), name());
00105         
00106   const std::vector<std::string>& theTowers = m_towerAfeeListProperty.value( );
00107   if (theTowers.size() == 0) return;
00108         
00109   m_failureModes = m_failureModes || 1 << TOWERAFEE;
00110         
00111   msglog << MSG::INFO << "Towers and AFEEs to kill " << endreq;
00112         
00113         
00114   std::vector<std::string>::const_iterator it;
00115   std::vector<std::string>::const_iterator itend = theTowers.end( );
00116         
00117   for (it = theTowers.begin(); it != itend; it++) {
00118     int len = (*it).size();
00119     int delimPos = (*it).find_first_of('_');
00120     int tower = atoi((*it).substr(0, delimPos).c_str());
00121     int layer = atoi((*it).substr(delimPos+1, len-delimPos-1).c_str());
00122                 
00123     msglog << MSG::INFO << "Tower " << tower << " AFEE " << layer << endreq;
00124                 
00125     std::vector<int>& curList = m_towerAfeeList[tower];
00126     curList.push_back(layer);                
00127   }
00128 }

void CalFailureModeSvc::processTowerControllerList  )  [protected]
 

process the input list of tower/cable controller pairs

Definition at line 130 of file CalFailureModeSvc.cxx.

References m_failureModes, m_towerControllerList, m_towerControllerListProperty, and TOWERCONTROL.

Referenced by initialize().

00130                                                    {
00131   // Purpose and Method: process the jobOptions input lists of (tower,layer) pairs
00132   //                     
00133         
00134   MsgStream msglog(msgSvc(), name());
00135         
00136   const std::vector<std::string>& theTowers = m_towerControllerListProperty.value( );
00137   if (theTowers.size() == 0) return;
00138         
00139   m_failureModes = m_failureModes || 1 << TOWERCONTROL;
00140         
00141   msglog << MSG::INFO << "Towers and Controllers to kill " << endreq;
00142         
00143         
00144   std::vector<std::string>::const_iterator it;
00145   std::vector<std::string>::const_iterator itend = theTowers.end( );
00146         
00147   for (it = theTowers.begin(); it != itend; it++) {
00148     int len = (*it).size();
00149     int delimPos = (*it).find_first_of('_');
00150     int tower = atoi((*it).substr(0, delimPos).c_str());
00151     int layer = atoi((*it).substr(delimPos+1, len-delimPos-1).c_str());
00152                 
00153     msglog << MSG::INFO << "Tower " << tower << " Controller " << layer << endreq;
00154                 
00155     std::vector<int>& curList = m_towerControllerList[tower];
00156     curList.push_back(layer);                
00157   }
00158 }

void CalFailureModeSvc::processTowerList  )  [protected, virtual]
 

process the input list of towers

Implements ICalFailureModeSvc.

Definition at line 162 of file CalFailureModeSvc.cxx.

References m_failureModes, m_towerList, m_towerListProperty, and TOWER.

Referenced by initialize().

00162                                          {
00163         
00164   // Purpose and Method: process the jobOptions input lists of towers
00165   //                     
00166         
00167         
00168   MsgStream msglog(msgSvc(), name());
00169         
00170   const std::vector<std::string>& theTowers = m_towerListProperty.value( );
00171         
00172   if (theTowers.size() == 0) return;
00173         
00174   msglog << MSG::INFO << "Towers to kill " << endreq;
00175         
00176   m_failureModes = m_failureModes || 1 << TOWER;
00177         
00178   std::vector<std::string>::const_iterator it;
00179   std::vector<std::string>::const_iterator itend = theTowers.end( );
00180         
00181   for (it = theTowers.begin(); it != itend; it++) {
00182     int tower = atoi((*it).c_str());
00183                 
00184     msglog << MSG::INFO << "Tower " << tower << endreq;
00185                 
00186     m_towerList.push_back(tower);
00187   }
00188 }

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

queryInterface - for implementing a Service this is necessary

Definition at line 49 of file CalFailureModeSvc.cxx.

00049                                                                                     {
00050         
00051         
00052     if (IID_ICalFailureModeSvc == riid) {
00053         *ppvIF = dynamic_cast<ICalFailureModeSvc*> (this);
00054         return StatusCode::SUCCESS;
00055     }
00056     else {
00057         return Service::queryInterface (riid, ppvIF);
00058     }
00059 }

const InterfaceID& CalFailureModeSvc::type  )  const [inline]
 

return the service type

Definition at line 46 of file CalFailureModeSvc.h.

00046                                       {
00047       return IID_ICalFailureModeSvc;
00048     }


Member Data Documentation

int CalFailureModeSvc::m_failureModes [private]
 

bitmap of failure modes

Definition at line 82 of file CalFailureModeSvc.h.

Referenced by getFailureConditions(), initialize(), processTowerAfeeList(), processTowerControllerList(), and processTowerList().

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

map of towers/layers to fail

Definition at line 88 of file CalFailureModeSvc.h.

Referenced by matchTowerAfee(), and processTowerAfeeList().

StringArrayProperty CalFailureModeSvc::m_towerAfeeListProperty [private]
 

List of towers,layers from jobOptions.

Definition at line 76 of file CalFailureModeSvc.h.

Referenced by CalFailureModeSvc(), and processTowerAfeeList().

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

map of towers/layers to fail

Definition at line 91 of file CalFailureModeSvc.h.

Referenced by matchTowerController(), and processTowerControllerList().

StringArrayProperty CalFailureModeSvc::m_towerControllerListProperty [private]
 

List of towers,layers from jobOptions.

Definition at line 79 of file CalFailureModeSvc.h.

Referenced by CalFailureModeSvc(), and processTowerControllerList().

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

vector of towers to fail

Definition at line 85 of file CalFailureModeSvc.h.

Referenced by matchTower(), and processTowerList().

StringArrayProperty CalFailureModeSvc::m_towerListProperty [private]
 

List of towers from jobOptions.

Definition at line 73 of file CalFailureModeSvc.h.

Referenced by CalFailureModeSvc(), and processTowerList().


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 13:29:51 2008 by doxygen 1.3.3