/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 | Private Member Functions | Private Attributes
TsExternalTriggerTool Class Reference

#include <TsExternalTriggerTool.h>

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

List of all members.

Public Member Functions

 TsExternalTriggerTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TsExternalTriggerTool ()
virtual StatusCode mutate (DayaBay::SimTrigHeader *trigHeader, const DayaBay::ElecHeader &elecHeader)
 Modify the event.
virtual StatusCode initialize ()
virtual StatusCode finalize ()

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Private Member Functions

DayaBay::Trigger::TriggerType_t getTriggerType (DayaBay::Detector det)

Private Attributes

std::vector< std::string > m_detectorsToProcess
int m_triggerOffset
double m_frequency
bool m_autoSet

Detailed Description

Definition at line 28 of file TsExternalTriggerTool.h.


Constructor & Destructor Documentation

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

Definition at line 13 of file TsExternalTriggerTool.cc.

    : GaudiTool(type,name,parent)
{
  declareInterface< ITsTriggerTool >(this) ;
  // for now add all but RPC's as default.
  m_detectorsToProcess.push_back("DayaBayAD1");
  m_detectorsToProcess.push_back("DayaBayAD2");
  m_detectorsToProcess.push_back("DayaBayIWS");
  m_detectorsToProcess.push_back("DayaBayOWS");
  m_detectorsToProcess.push_back("LingAoAD1");
  m_detectorsToProcess.push_back("LingAoAD2");
  m_detectorsToProcess.push_back("LingAoIWS");
  m_detectorsToProcess.push_back("LingAoOWS"); 
  m_detectorsToProcess.push_back("FarAD1");
  m_detectorsToProcess.push_back("FarAD2");
  m_detectorsToProcess.push_back("FarAD3");
  m_detectorsToProcess.push_back("FarAD4");
  m_detectorsToProcess.push_back("FarIWS");
  m_detectorsToProcess.push_back("FarOWS");
  
  declareProperty("DetectorsToProcess",m_detectorsToProcess,
                  "List of detectors to process with this tool");
  declareProperty("TriggerOffset",m_triggerOffset=24,
                  "Adjustable trigger offset for external triggering, in trigger clock cycles");
  declareProperty("Frequency",m_frequency=1.0*CLHEP::hertz,
                  "Frequency of external triggering");
  declareProperty("AutoSet",m_autoSet=true,
                  "Auto-set the external triggering based on electronics simulation input");
}
TsExternalTriggerTool::~TsExternalTriggerTool ( ) [virtual]

Definition at line 45 of file TsExternalTriggerTool.cc.

{}

Member Function Documentation

StatusCode TsExternalTriggerTool::mutate ( DayaBay::SimTrigHeader trigHeader,
const DayaBay::ElecHeader elecHeader 
) [virtual]

Modify the event.

Implements ITsTriggerTool.

Definition at line 57 of file TsExternalTriggerTool.cc.

{     
  debug() << "running mutate()" << endreq;
  DayaBay::SimTrigCommandHeader* trigCH 
     = const_cast<DayaBay::SimTrigCommandHeader*>(trigHeader->commandHeader());
  
  const DayaBay::ElecCrateHeader* crateHeader = elecHeader.crateHeader();
  DayaBay::ElecCrateHeader::CrateMap cmap = crateHeader->crates();
  DayaBay::ElecCrateHeader::CrateMap::iterator detIterator;
  
  std::vector<std::string>::iterator it;
  debug() << "processing " << m_detectorsToProcess.size() 
          << " detectors." << endreq;
  
  // loop over detectors 
  for(it = m_detectorsToProcess.begin(); 
      it != m_detectorsToProcess.end(); 
      ++it){
    short int detId =  DayaBay::Detector::siteDetPackedFromString(*it);
    DayaBay::Detector det(detId);
    debug() << "Processing " << *it << " which is " << det << endreq;
    
    // create and add a triggerCollection for this detector
    DayaBay::SimTrigCommandCollection *tcc 
      = new DayaBay::SimTrigCommandCollection();
    tcc->setHeader(trigCH);
    tcc->setDetector(det);
    trigCH->addCollection(tcc);
    detIterator = cmap.find(det);
    if(detIterator != cmap.end()){
      // A crate was found for this detector
      debug() << "A crate was found for " << det 
              << " processing..." << endreq;

      int i = 0;
      if(m_autoSet){
        i = 0;
      }else{
        // FIXME: implement non-auto external triggering
        error() << "Non-auto external triggering not yet implemented." 
                << endreq;
      }
      
      DayaBay::Trigger::TriggerType_t type = getTriggerType(det);
      i += m_triggerOffset;
      DayaBay::SimTrigCommand *tc = new DayaBay::SimTrigCommand(det,type,i,0,0,0);
      trigCH->addCommand(tc);
      debug() << "Adding Trigger at cycle\t" <<  i
              << " With type " << type <<  endreq;
    }// end if crate exists
  }
  return StatusCode::SUCCESS;                               
}
StatusCode TsExternalTriggerTool::initialize ( ) [virtual]

Definition at line 47 of file TsExternalTriggerTool.cc.

{
  return StatusCode::SUCCESS;
}
StatusCode TsExternalTriggerTool::finalize ( ) [virtual]

Definition at line 52 of file TsExternalTriggerTool.cc.

{
  return StatusCode::SUCCESS;
}
DayaBay::Trigger::TriggerType_t TsExternalTriggerTool::getTriggerType ( DayaBay::Detector  det) [private]

Definition at line 112 of file TsExternalTriggerTool.cc.

const InterfaceID & ITsTriggerTool::interfaceID ( ) [static, inherited]

Retrieve interface ID.

Definition at line 8 of file ITsTriggerTool.cc.

{ 
    return IID_ITsTriggerTool; 
}

Member Data Documentation

std::vector<std::string> TsExternalTriggerTool::m_detectorsToProcess [private]

Definition at line 44 of file TsExternalTriggerTool.h.

Definition at line 45 of file TsExternalTriggerTool.h.

Definition at line 46 of file TsExternalTriggerTool.h.

Definition at line 47 of file TsExternalTriggerTool.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:16:52 for TrigSim by doxygen 1.7.4