/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
FastTrigReadSimTool Class Reference

#include <FastTrigReadSimTool.h>

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

List of all members.

Public Member Functions

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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Detailed Description

Definition at line 19 of file FastTrigReadSimTool.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file FastTrigReadSimTool.cc.

    : GaudiTool(type,name,parent)
{
  declareInterface< IFastTrigReadSimTool >(this) ;
}
FastTrigReadSimTool::~FastTrigReadSimTool ( ) [virtual]

Definition at line 19 of file FastTrigReadSimTool.cc.

{}

Member Function Documentation

StatusCode FastTrigReadSimTool::mutate ( DayaBay::SimReadoutHeader sroHeader,
DayaBay::SimTrigHeader stHeader,
const DayaBay::ElecHeader elecHeader 
) [virtual]

Modify the event.

Check if this is from MuonProphet fast electronic simulation

Triggered!

set detector

set trigger

trigger command

Add them to header

Implements IFastTrigReadSimTool.

Definition at line 33 of file FastTrigReadSimTool.cc.

{
    SimTrigCommandHeader* trigCommandHdr = new SimTrigCommandHeader;
    SimTrigCommandCollection* tcc = new SimTrigCommandCollection;
    trigCommandHdr->addCollection( tcc );

    std::vector<SimReadout*> readouts;
    readouts.clear();

    const IHeader* iSheader = (elecHeader.inputHeaders())[0];
    const IHeader* iGheader = (iSheader->inputHeaders()) [0];
    const GenHeader* genHeader = dynamic_cast<const GenHeader*>(iGheader);
    const HepMC::GenEvent* genEvent = genHeader->event();

    HepMC::GenEvent::particle_const_iterator pci, pci_end = genEvent->particles_end();

    for( pci = genEvent->particles_begin(); pci != pci_end; ++pci )  {
      if( (*pci)->pdg_id() == 13 || (*pci)->pdg_id() == -13 )  {   // muon

        MpMuonFate fate( (*pci)->status() );    
        if( fate.getRpcTriggerStat().getCode() == MpTriggerStat::kTriggered ||
            fate.getPoolTriggerStat().getCode() == MpTriggerStat::kTriggered )  {

          /* According to current RootIO for readout, 
             for unknown detector, a Readout won't be converted to a data file.
          */
          Site::Site_t siteId = elecHeader.context().GetSite();
          DetectorId::DetectorId_t detId = DetectorId::kUnknown;
          Detector det(siteId,detId);

          Trigger::TriggerType_t type = Trigger::kUnknown;

          SimTrigCommand *tc = new SimTrigCommand(det,type,0);
          std::vector<SimTrigCommand *> vtc;
          vtc.push_back(tc);
          SimTrigCommandCollection* tcc = new SimTrigCommandCollection( trigCommandHdr, det, vtc );
          trigCommandHdr -> addCollection( tcc );

          SimReadout* pSimRO = new SimReadout;
          readouts.push_back( pSimRO );
          
          Readout* pRO = new Readout;
          pRO -> setTriggerTime( elecHeader.earliest() );
          pRO -> setDetector( det );
          pSimRO -> setReadout( pRO );
          pSimRO -> setHeader( sroHeader );
        }
      }
    }

    stHeader -> setCommandHeader( trigCommandHdr );
    trigCommandHdr -> setHeader( stHeader );
  
    sroHeader->setReadouts( readouts );

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

Definition at line 22 of file FastTrigReadSimTool.cc.

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

Definition at line 27 of file FastTrigReadSimTool.cc.

{
  return StatusCode::SUCCESS;
}
const InterfaceID & IFastTrigReadSimTool::interfaceID ( ) [static, inherited]

Retrieve interface ID.

Definition at line 8 of file IFastTrigReadSimTool.cc.

{
  return IID_IFastTrigReadSimTool;
}

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:21:42 for FastTrigReadSim by doxygen 1.7.4