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

#include <SimHists.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string m_location
 Property: Location - TES path to the SimHits.
std::string m_filepath
 Property: FilePath - path to use when registering histograms.
ITHistSvc * m_hsvc
TH1I * m_nHitCollections
TH2F * m_nHitByDetector

Detailed Description

Definition at line 19 of file SimHists.h.


Constructor & Destructor Documentation

SimHists::SimHists ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)
SimHists::~SimHists ( ) [virtual]

Definition at line 71 of file SimHists.cc.

{
}

Member Function Documentation

StatusCode SimHists::initialize ( ) [virtual]

Definition at line 75 of file SimHists.cc.

{
    this->GaudiAlgorithm::initialize();

    // Get the histogram service
    if ( service("THistSvc", m_hsvc).isFailure()) {
        error() << " No THistSvc available." << endreq;
        return StatusCode::FAILURE;
    } 

    m_nHitCollections = new TH1I("nHitCollections","Number of Hit Collections",15,0,15);
    if (m_hsvc->regHist(m_filepath+"nHitCollections",m_nHitCollections).isFailure()) {
        error() << "Could not register " << m_filepath+"nHitCollections" << endreq;
        delete m_nHitCollections; m_nHitCollections = 0;
        return StatusCode::FAILURE;
    }

    m_nHitByDetector = new TH2F("nHitByDetector","Number of hits in each detector",
                                15,0,15,1000,0,1000);
    if (m_hsvc->regHist(m_filepath+"nHitByDetector",m_nHitByDetector).isFailure()) {
        error() << "Could not register " << m_filepath+"nHitByDetector" << endreq;
        delete m_nHitByDetector; m_nHitByDetector = 0;
        return StatusCode::FAILURE;
    }
    // FIXME: label bins by detector name

    return StatusCode::SUCCESS;
}
StatusCode SimHists::execute ( ) [virtual]

Definition at line 104 of file SimHists.cc.

{
    DayaBay::SimHeader* shead = get<DayaBay::SimHeader>(m_location);
    const DayaBay::SimHitHeader* shith = shead->hits();
    const DayaBay::SimHitHeader::hc_map& hcmap = shith->hitCollection();

    m_nHitCollections->Fill(hcmap.size());
    
    DayaBay::SimHitHeader::hc_map::const_iterator it, done = hcmap.end();
    for (it=hcmap.begin(); it != done; ++it) {
        DayaBay::Detector det(it->first);
        pair<int,string> bin = detector_bins[det.siteDetPackedData()];

        info () << "Got hit collection from " << det.detName() 
                << " in bin " << bin.first << endreq;

        size_t siz = it->second->collection().size();
        m_nHitByDetector->Fill(bin.first + 0.5,siz);
    }

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

Definition at line 127 of file SimHists.cc.

{

    return this->GaudiAlgorithm::finalize();
}

Member Data Documentation

std::string SimHists::m_location [private]

Property: Location - TES path to the SimHits.

Defaults to DayaBay::SimHeaderLocation::Default

Definition at line 35 of file SimHists.h.

std::string SimHists::m_filepath [private]

Property: FilePath - path to use when registering histograms.

Must end in "/". Default "/file1/gen/"

Definition at line 39 of file SimHists.h.

ITHistSvc* SimHists::m_hsvc [private]

Definition at line 44 of file SimHists.h.

TH1I* SimHists::m_nHitCollections [private]

Definition at line 47 of file SimHists.h.

TH2F* SimHists::m_nHitByDetector [private]

Definition at line 48 of file SimHists.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:19:50 for SimHistsExample by doxygen 1.7.4