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

#include <NeutronCap.h>

Collaboration diagram for NeutronCap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NeutronCap (const std::string &name, ISvcLocator *svcloc)
 Constructor has to be in this form.
virtual ~NeutronCap ()
StatusCode initialize ()
 Three mandatory member functions of any algorithm.
StatusCode execute ()
StatusCode finalize ()

Private Attributes

IJobInfoSvcm_jobInfoSvc
double m_lowe_gd
double m_highe_gd
double m_lowe_h
double m_highe_h

Detailed Description

Definition at line 12 of file NeutronCap.h.


Constructor & Destructor Documentation

NeutronCap::NeutronCap ( const std::string &  name,
ISvcLocator *  svcloc 
)

Constructor has to be in this form.

Definition at line 12 of file NeutronCap.cc.

: GaudiAlgorithm(name, svcloc)
{
  declareProperty("LowE_Gd", m_lowe_gd=5.,
                  "The lower energy/MeV cut for neutron captures on Gd.");
  declareProperty("HighE_Gd", m_highe_gd=10.,
                  "The upper energy/MeV cut for neutron captures on Gd.");
  declareProperty("LowE_H", m_lowe_h=1.,
                  "The lower energy/MeV cut for neutron captures on H.");
  declareProperty("HighE_H", m_highe_h=3.5,
                  "The upper energy/MeV cut for neutron captures on H.");
}
NeutronCap::~NeutronCap ( ) [virtual]

Definition at line 25 of file NeutronCap.cc.

{
}

Member Function Documentation

StatusCode NeutronCap::initialize ( )

Three mandatory member functions of any algorithm.

Definition at line 29 of file NeutronCap.cc.

{
  debug() << "initialize()" << endreq;


  m_jobInfoSvc = svc<IJobInfoSvc>("JobInfoSvc",true);
  if(!m_jobInfoSvc) {
    error() << "Failed to initialize JobInfoSvc" << endreq;
    return StatusCode::FAILURE;
  }

  return StatusCode::SUCCESS;
}
StatusCode NeutronCap::execute ( )

Definition at line 43 of file NeutronCap.cc.

{
  debug() << "execute() ______________________________ start" << endreq;

  // Get ReadoutHeader from TES
  ReadoutHeader* roh = get<ReadoutHeader>("/Event/Readout/ReadoutHeader");
  
  // Make a new Header as a tag
  HeaderObject *header = new HeaderObject();
  // Use inputHeaders to record the ReadoutHeader which is connected to this tag
  vector<const IHeader*> inputHeaders;
  inputHeaders.push_back(roh);
  header->setInputHeaders(inputHeaders);
  // Copy from the ReadoutHeader
  header->setExecNumber(roh->execNumber());
  header->setContext(roh->context());
  header->setEarliest(roh->earliest());
  header->setLatest(roh->latest());
  // Get job id
  const DayaBay::JobId &m_currentJobId = m_jobInfoSvc->currentJobInfo()->jobId();
  header->setJobId(m_currentJobId);
  
  // Make different tag according to the detector's id
  DetectorId::DetectorId_t detectorId = roh->context().GetDetId();
  if(detectorId == DetectorId::kAD1 || detectorId == DetectorId::kAD2
     || detectorId == DetectorId::kAD3 || detectorId == DetectorId::kAD4
     ) {

    if(!exist<HeaderObject>("/Event/Rec/AdSimple")) {
      error() << "Failed to find AdSimple header." << endreq;
      return StatusCode::FAILURE;
    } else {
      RecHeader* rh = get<RecHeader>("/Event/Rec/AdSimple");
      RecTrigger& recTrigger = rh->recTrigger();
      double recEnergy = recTrigger.energy();

      // Register to TES, this is how a tag works
      if (recEnergy > m_lowe_gd && recEnergy < m_highe_gd)
        put(header,"/Event/Tag/Physics/NeutronGd");
      else if (recEnergy > m_lowe_h && recEnergy < m_highe_h)
        put(header,"/Event/Tag/Physics/NeutronH");
      else {
        debug() << "This readout has a non-neutron energy:" << recEnergy << endreq;
        delete header;
      }
    }
  } else {
    debug() << "Not an AD readout" << endreq;
    delete header;
  }

  debug() << "execute() ______________________________ end" << endreq;
  return StatusCode::SUCCESS;
}
StatusCode NeutronCap::finalize ( )

Definition at line 98 of file NeutronCap.cc.

{
  debug() << "finalize()" << endreq;

  return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 25 of file NeutronCap.h.

double NeutronCap::m_lowe_gd [private]

Definition at line 28 of file NeutronCap.h.

double NeutronCap::m_highe_gd [private]

Definition at line 29 of file NeutronCap.h.

double NeutronCap::m_lowe_h [private]

Definition at line 30 of file NeutronCap.h.

double NeutronCap::m_highe_h [private]

Definition at line 31 of file NeutronCap.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:01:54 for NeutronCapTagging by doxygen 1.7.4