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

#include <TsFilterTool.h>

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

List of all members.

Public Member Functions

 TsFilterTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TsFilterTool ()
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 Attributes

unsigned int m_recoveryCycles
bool m_active

Detailed Description

Definition at line 28 of file TsFilterTool.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file TsFilterTool.cc.

    : GaudiTool(type,name,parent)
{
  declareInterface< ITsTriggerTool >(this) ;
  declareProperty("RecoveryTime",m_recoveryCycles=24,
                  "Number of nhit (80MHz) clock cycles for trigger dead time");
  declareProperty("ApplyFilter",m_active=false,
                  "If set to true the tool will filter trigger commands.");
}
TsFilterTool::~TsFilterTool ( ) [virtual]

Definition at line 26 of file TsFilterTool.cc.

{}

Member Function Documentation

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

Modify the event.

Implements ITsTriggerTool.

Definition at line 40 of file TsFilterTool.cc.

{     
  if ( !m_active ){
      debug() << "TsFilterTool is not active, so doing nothing" << endreq;
      return StatusCode::SUCCESS;
  }
  
  debug() << "running mutate()" << endreq;
  const DayaBay::SimTrigCommandHeader *tch = trigHeader->commandHeader();
  const DayaBay::SimTrigCommandHeader::detCollMap trigCollMap 
                                                          = tch->collections();
  DayaBay::SimTrigCommandHeader::detCollMap::const_iterator trigIt;  
  //Loop over All trigger Collections
  for(trigIt  = trigCollMap.begin(); trigIt != trigCollMap.end(); ++trigIt)
  {
    DayaBay::Detector det(trigIt->first);
    debug() << "found " << (trigIt->second)->commands().size()
              << " commands for " << det.detName() << endreq;

    DayaBay::SimTrigCommandCollection *triggerColl = 
               const_cast<DayaBay::SimTrigCommandCollection*>(trigIt->second);

    // sort the trigger commands by clock cycle
    triggerColl->sort();

    DayaBay::SimTrigCommandCollection::CommandContainer& detTriggers = 
        const_cast<DayaBay::SimTrigCommandCollection::CommandContainer&>(triggerColl->commands());

    DayaBay::SimTrigCommandCollection::CommandContainer::iterator tcIt;
    // Loop over all triggers in each collection
    int prevCycle=-1;
    for(tcIt=detTriggers.begin();tcIt!=detTriggers.end();/*in loop*/){
         verbose() << "Trigger: " << **tcIt << endreq;
         int thiscycle = (*tcIt)->clockCycle();
         if(thiscycle == prevCycle){// combined triggers at same clock cycle
             verbose() << "Combining trigger with the previous one" 
                       << **tcIt << endreq;
             
             // combine the triggers
             DayaBay::Trigger::TriggerType_t type = (*tcIt)->type();
             tcIt = detTriggers.erase(tcIt); // returns next element
             --tcIt; // go back to previous one.
             int newtype = (int) (type | (*tcIt)->type()); // update its type
             (*tcIt)->setType( (DayaBay::Trigger::TriggerType_t) newtype );
             ++tcIt; // go to command for next pass through for loop
             
         }else if ((unsigned int) (thiscycle-prevCycle) < m_recoveryCycles ){
         
             // remove triggers within "recovery time"
             verbose() << "Removing trigger that occured during recovery window " 
                       << **tcIt << endreq;
             tcIt = detTriggers.erase(tcIt); // returns next element
         
         }else{ // leave this one as it is
         
             prevCycle=thiscycle;
             ++tcIt;
         }
    }
    verbose() << "Done Filtering. " << *triggerColl << endreq;
  }

  return StatusCode::SUCCESS;                               
}
StatusCode TsFilterTool::initialize ( ) [virtual]

Definition at line 28 of file TsFilterTool.cc.

{
  debug() << "Initializing TsFilterTool" << endreq;
  return StatusCode::SUCCESS;
}
StatusCode TsFilterTool::finalize ( ) [virtual]

Definition at line 34 of file TsFilterTool.cc.

{
  debug() << "Finalizing TsFilterTool" << endreq;
  return StatusCode::SUCCESS;
}
const InterfaceID & ITsTriggerTool::interfaceID ( ) [static, inherited]

Retrieve interface ID.

Definition at line 8 of file ITsTriggerTool.cc.

{ 
    return IID_ITsTriggerTool; 
}

Member Data Documentation

unsigned int TsFilterTool::m_recoveryCycles [private]

Definition at line 44 of file TsFilterTool.h.

bool TsFilterTool::m_active [private]

Definition at line 45 of file TsFilterTool.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