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

#include <EsIdealPulseTool.h>

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

List of all members.

Public Member Functions

 EsIdealPulseTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~EsIdealPulseTool ()
virtual StatusCode generatePulses (DayaBay::SimHitCollection *, DayaBay::ElecPulseCollection *)
 This is the extension. Sub classes must provide it.
virtual StatusCode initialize ()
virtual StatusCode finalize ()

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID.

Private Attributes

std::string m_cableSvcName
ICableSvcm_cableSvc

Detailed Description

Definition at line 22 of file EsIdealPulseTool.h.


Constructor & Destructor Documentation

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

Definition at line 15 of file EsIdealPulseTool.cc.

    : GaudiTool(type,name,parent)
    , m_cableSvc(0)
{
    declareInterface< IEsPulseTool >(this) ;
    declareProperty("CableSvcName",m_cableSvcName="CableSvc",
                    "Name of service to map between detector, hardware, and electronic IDs");
}
EsIdealPulseTool::~EsIdealPulseTool ( ) [virtual]

Definition at line 26 of file EsIdealPulseTool.cc.

{}

Member Function Documentation

StatusCode EsIdealPulseTool::generatePulses ( DayaBay::SimHitCollection ,
DayaBay::ElecPulseCollection  
) [virtual]

This is the extension. Sub classes must provide it.

Implements IEsPulseTool.

Definition at line 41 of file EsIdealPulseTool.cc.

{
  debug() << "running generatePulses()" << endreq;

  const DayaBay::SimHitCollection::hit_container& htcon = hits->collection();
  DayaBay::SimHitCollection::hit_container::const_iterator hcIter, done = htcon.end();
  DayaBay::ElecPulseCollection::PulseContainer pulsecon;
  pulsecon.clear();

  // Context, ServiceMode for this data
  Context context(pulses->detector().site(), SimFlag::kMC,
                  pulses->header()->header()->timeStamp(),
                  pulses->detector().detectorId());
  int task = 0;
  ServiceMode svcMode(context, task);

  if ( msgLevel(MSG::DEBUG) ) {
      DayaBay::DetectorSensor det(htcon[0]->sensDetId());
      debug()<<"Processing hit collection in "<<det.asString()<<endreq;
  }

  for (hcIter=htcon.begin(); hcIter != done; ++hcIter) {
    DayaBay::DetectorSensor sensDetId((*hcIter)->sensDetId());
    if (sensDetId.isAD()) {
        DayaBay::AdPmtSensor pmtid((*hcIter)->sensDetId());
        if (pmtid.bogus()) {
            warning() << "generatePulses() got bogus PMT ID: " << pmtid << endreq;
        }
    }
    const DayaBay::ElecChannelId& elecChannelId = m_cableSvc->elecChannelId(
                                                                     sensDetId,
                                                                     svcMode);
    DayaBay::ElecPulse* simpulse = 0;
    if(sensDetId.detectorId() != DetectorId::kRPC){
      if ( msgLevel(MSG::VERBOSE) ){
        verbose()<<"Creating a pulse in PMT sensor "<<sensDetId<<endreq;
      }
      simpulse = new DayaBay::ElecPmtPulse();
      simpulse->setType(PulseType::kPmtHit);
    }else{
      if ( msgLevel(MSG::VERBOSE) ) {
        verbose()<<"Creating a pulse in RPC sensor "<<sensDetId<<endreq;
      }
      simpulse = new DayaBay::ElecRpcPulse();
      simpulse->setType(PulseType::kRpcHit);
    }

    // Primary vertex time (absolute, since EPOCH)
    TimeStamp vertexTime = (*hcIter)->hc()->header()->header()->timeStamp();
    // Need to subtract ElecHeader time to get pulse time wrt ElecHeader
    TimeStamp headerTime = pulses->header()->header()->timeStamp();
    // Set pulse time (nanoseconds) (used implicit conversion to double,
    // after subtraction, where the precission may be lost if the difference is too big)
    // hitTime() gives time wrt the vertex.
    simpulse->setTime((vertexTime-headerTime)*Units::second + (*hcIter)->hitTime());

    simpulse->setAmplitude(1.); //(*hcIter)->weight());
    simpulse->setAncestor((*hcIter));
    simpulse->setChannelId(elecChannelId);

    pulsecon.push_back(simpulse);
  }

  pulses->setPulses(pulsecon);
  if (msgLevel(MSG::DEBUG)) {
      debug() << "generatePusles(): " << pulsecon.size()
        << " pulses stored for detector " << pulses->detector() << endreq;
  }

  if (msgLevel(MSG::VERBOSE)) {
      verbose() << "generatePusles(): at " << pulses->header()->header()->timeStamp()
        << " pulses : \n" << (*pulses) << endreq;
  }


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

Definition at line 28 of file EsIdealPulseTool.cc.

{
  // Get Cable Service
  m_cableSvc = svc<ICableSvc>(m_cableSvcName,true);

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

Definition at line 36 of file EsIdealPulseTool.cc.

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

Retrieve interface ID.

Definition at line 8 of file IEsPulseTool.cc.

{ 
    return IID_IEsPulseTool; 
}

Member Data Documentation

std::string EsIdealPulseTool::m_cableSvcName [private]

Definition at line 40 of file EsIdealPulseTool.h.

Definition at line 43 of file EsIdealPulseTool.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:37 for ElecSim by doxygen 1.7.4