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

#include <TESDemoUse.h>

List of all members.

Public Member Functions

 TESDemoUse (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Attributes

StringProperty m_positronPath
StringProperty m_neutronPath
StringProperty m_antiNeutrinoPath
FloatProperty m_window
IDataProviderSvc * p_archiveSvc

Detailed Description

Definition at line 10 of file TESDemoUse.h.


Constructor & Destructor Documentation

TESDemoUse::TESDemoUse ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 14 of file TESDemoUse.cpp.

                                                   :
  GaudiAlgorithm(name,
                 pSvcLocator)
{
   declareProperty("PositronPath",
                   m_positronPath="/Event/TESDemo/Positron",
                   "Path from which to retrieve the Positron candidates");
   declareProperty("NeutronPath",
                   m_neutronPath="/Event/TESDemo/Neutron",
                   "Path from which to retrieve the Neutron candidates");
   declareProperty("AntiNeutrinoPath",
                   m_antiNeutrinoPath="/Event/TESDemo/Anti-Neutrino",
                   "Path, in the TES, into which the Anti-Neutrinos are stored");
   declareProperty("TimeWindow",
                   m_window=0.00005,
                   "The maximum time between Neutron and Positrion");
}

Member Function Documentation

StatusCode TESDemoUse::initialize ( )

Definition at line 33 of file TESDemoUse.cpp.

                                  {

   info() << "in initialize" 
          << endreq;
   info() << m_positronPath 
          << endreq;
   info() << m_neutronPath 
          << endreq;
   info() << m_antiNeutrinoPath 
          << endreq;

   StatusCode status = service("EventDataArchiveSvc",
                               p_archiveSvc);
   if (status.isFailure()) {
     Error("Service [EventDataArchiveSvc] not found",
           status);
   }

   return StatusCode::SUCCESS;

}
StatusCode TESDemoUse::execute ( )

Definition at line 55 of file TESDemoUse.cpp.

                               {

  SmartDataPtr<TESDemoNeutron>  neutron(eventSvc(),
                                        m_neutronPath.value());
  if (0 == neutron) {
    return Print("No Neutron in this readout");
  }

  SmartDataPtr<DybArchiveList>  positrons(p_archiveSvc,
                                          m_positronPath.value());
  if (0 == positrons) {
    return Print("No Positrons have been found so far");
  }

  if (positrons->empty()) {
    return Print("No Positrons are currently available");
  }

  TESDemoAntiNeutrino::Container* antiNeutrinos = 0;
  bool searching = true;
  DybArchiveList::const_iterator finished = positrons->end();
  DybArchiveList::const_iterator iter = positrons->begin();
  while (searching &&
         finished != iter ) {
    
    TESDemoPositron* positron = dynamic_cast<TESDemoPositron*>(*iter);
    if (0 == positron) {
      return Error("Positron archive does not contain correct type");
    }

    double deltaTime = neutron->timeStamp().GetSeconds()
      -  positron->timeStamp().GetSeconds();
    if (m_window.value() < deltaTime) {
      searching = false;
    } else {
      TESDemoAntiNeutrino* antiNeutrino =
        new TESDemoAntiNeutrino(positron,
                                neutron);

      if (0 == antiNeutrinos) {
        antiNeutrinos = new TESDemoAntiNeutrino::Container();
      }
      antiNeutrinos->add(antiNeutrino);
      
      int positronId = positron->readout()->identifier();
      int neutronId = neutron->readout()->identifier();
      info() << "Stored one anti-neutrino built from readouts "
             << positronId
             << " and "
             << neutronId
             << endreq;
    }
    iter++;
  }

  if (0 == antiNeutrinos) {
    info() << "No Anti-Neutrino candidates found"
           << endreq;
    return StatusCode::SUCCESS;
  } else {
    info() << "Time span of anti-neutrinos is:" << endreq;
    info() << "    From: " << antiNeutrinos->earliest() << endreq;
    info() << "      To: " << antiNeutrinos->latest() << endreq;

    if (eventSvc()->registerObject(m_antiNeutrinoPath.value(),
                                   antiNeutrinos).isFailure()) {
      return Error("Failed to store anti-neutrinos in Event Store");
    }
  }

  return StatusCode::SUCCESS;
}
StatusCode TESDemoUse::finalize ( )

Definition at line 128 of file TESDemoUse.cpp.

                                {

  info() << "in finalize"
         << endreq;

  if (0 != p_archiveSvc) {
    p_archiveSvc->release();
  }

  return StatusCode::SUCCESS;

}

Member Data Documentation

StringProperty TESDemoUse::m_positronPath [private]

Definition at line 23 of file TESDemoUse.h.

StringProperty TESDemoUse::m_neutronPath [private]

Definition at line 24 of file TESDemoUse.h.

StringProperty TESDemoUse::m_antiNeutrinoPath [private]

Definition at line 25 of file TESDemoUse.h.

FloatProperty TESDemoUse::m_window [private]

Definition at line 27 of file TESDemoUse.h.

IDataProviderSvc* TESDemoUse::p_archiveSvc [private]

Definition at line 29 of file TESDemoUse.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:09:00 for TESDemo by doxygen 1.7.4