#include <SimHists.h>
Inheritance diagram for SimHists:
Public Member Functions | |
SimHists (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~SimHists () |
virtual StatusCode | initialize () |
virtual StatusCode | execute () |
virtual StatusCode | finalize () |
virtual StatusCode | sysExecute () |
void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
void | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
bool | registerContext () const |
INTupleSvc * | evtColSvc () const |
IAlgContextSvc * | contextSvc () const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | sysStart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysBeginRun () |
virtual StatusCode | sysEndRun () |
virtual const std::string & | name () const |
virtual const std::string & | version () const |
virtual StatusCode | configure () |
virtual StatusCode | terminate () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual bool | isExecuted () const |
virtual void | setExecuted (bool state) |
virtual void | resetExecuted () |
virtual StatusCode | beginRun () |
virtual StatusCode | endRun () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual bool | isEnabled () const |
virtual bool | filterPassed () const |
virtual void | setFilterPassed (bool state) |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
void | setOutputLevel (int level) |
IAuditorSvc * | auditorSvc () const |
IChronoStatSvc * | chronoSvc () const |
IChronoStatSvc * | chronoStatService () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | detDataService () const |
IConversionSvc * | detCnvSvc () const |
IConversionSvc * | detDataCnvService () const |
IDataProviderSvc * | eventSvc () const |
IDataProviderSvc * | evtSvc () const |
IDataProviderSvc * | eventDataService () const |
IConversionSvc * | eventCnvSvc () const |
IConversionSvc * | eventDataCnvService () const |
IHistogramSvc * | histoSvc () const |
IHistogramSvc * | histogramDataService () const |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () const |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | ntupleService () const |
IRndmGenSvc * | randSvc () const |
IToolSvc * | toolSvc () const |
IExceptionSvc * | exceptionSvc () const |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
std::vector< Algorithm * > * | subAlgorithms () const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
unsigned long | addRef () |
StatusCode | queryInterface (const InterfaceID &riid, void **) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
bool | isInitialized () const |
bool | isFinalized () const |
int | outputLevel () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
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 |
Definition at line 19 of file SimHists.h.
SimHists::SimHists | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 30 of file SimHists.cc.
00031 : GaudiAlgorithm(name,pSvcLocator) 00032 , m_hsvc(0) 00033 , m_nHitCollections(0) 00034 , m_nHitByDetector(0) 00035 { 00036 declareProperty("Location",m_location=DayaBay::SimHeaderLocation::Default, 00037 "Location in the TES to get HepMCEvents"); 00038 declareProperty("FilePath",m_filepath="/file1/sim/", 00039 "File path with with to register histograms."); 00040 00041 if (!detector_bins.size()) { 00042 DayaBay::Detector dets[] = { 00043 DayaBay::Detector(Site::kDayaBay,DetectorId::kAD1), 00044 DayaBay::Detector(Site::kDayaBay,DetectorId::kAD2), 00045 DayaBay::Detector(Site::kDayaBay,DetectorId::kOWS), 00046 DayaBay::Detector(Site::kDayaBay,DetectorId::kIWS), 00047 DayaBay::Detector(Site::kDayaBay,DetectorId::kRPC), 00048 DayaBay::Detector(Site::kLingAo,DetectorId::kAD1), 00049 DayaBay::Detector(Site::kLingAo,DetectorId::kAD2), 00050 DayaBay::Detector(Site::kLingAo,DetectorId::kOWS), 00051 DayaBay::Detector(Site::kLingAo,DetectorId::kIWS), 00052 DayaBay::Detector(Site::kLingAo,DetectorId::kRPC), 00053 DayaBay::Detector(Site::kFar,DetectorId::kAD1), 00054 DayaBay::Detector(Site::kFar,DetectorId::kAD2), 00055 DayaBay::Detector(Site::kFar,DetectorId::kAD3), 00056 DayaBay::Detector(Site::kFar,DetectorId::kAD4), 00057 DayaBay::Detector(Site::kFar,DetectorId::kOWS), 00058 DayaBay::Detector(Site::kFar,DetectorId::kIWS), 00059 DayaBay::Detector(Site::kFar,DetectorId::kRPC), 00060 DayaBay::Detector(), 00061 }; 00062 00063 detector_bins[0] = pair<int,string>(0,"unknown"); 00064 for (int ind=0; dets[ind].site(); ++ind) { 00065 detector_bins[dets[ind].siteDetPackedData()] 00066 = pair<int,string>(ind+1,dets[ind].detName()); 00067 } 00068 } 00069 }
SimHists::~SimHists | ( | ) | [virtual] |
StatusCode SimHists::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 75 of file SimHists.cc.
00076 { 00077 this->GaudiAlgorithm::initialize(); 00078 00079 // Get the histogram service 00080 if ( service("THistSvc", m_hsvc).isFailure()) { 00081 error() << " No THistSvc available." << endreq; 00082 return StatusCode::FAILURE; 00083 } 00084 00085 m_nHitCollections = new TH1I("nHitCollections","Number of Hit Collections",15,0,15); 00086 if (m_hsvc->regHist(m_filepath+"nHitCollections",m_nHitCollections).isFailure()) { 00087 error() << "Could not register " << m_filepath+"nHitCollections" << endreq; 00088 delete m_nHitCollections; m_nHitCollections = 0; 00089 return StatusCode::FAILURE; 00090 } 00091 00092 m_nHitByDetector = new TH2F("nHitByDetector","Number of hits in each detector", 00093 15,0,15,1000,0,1000); 00094 if (m_hsvc->regHist(m_filepath+"nHitByDetector",m_nHitByDetector).isFailure()) { 00095 error() << "Could not register " << m_filepath+"nHitByDetector" << endreq; 00096 delete m_nHitByDetector; m_nHitByDetector = 0; 00097 return StatusCode::FAILURE; 00098 } 00099 // FIXME: label bins by detector name 00100 00101 return StatusCode::SUCCESS; 00102 }
StatusCode SimHists::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 104 of file SimHists.cc.
00105 { 00106 DayaBay::SimHeader* shead = get<DayaBay::SimHeader>(m_location); 00107 const DayaBay::SimHitHeader* shith = shead->hits(); 00108 const DayaBay::SimHitHeader::hc_map& hcmap = shith->hitCollection(); 00109 00110 m_nHitCollections->Fill(hcmap.size()); 00111 00112 DayaBay::SimHitHeader::hc_map::const_iterator it, done = hcmap.end(); 00113 for (it=hcmap.begin(); it != done; ++it) { 00114 DayaBay::Detector det(it->first); 00115 pair<int,string> bin = detector_bins[det.siteDetPackedData()]; 00116 00117 info () << "Got hit collection from " << det.detName() 00118 << " in bin " << bin.first << endreq; 00119 00120 size_t siz = it->second->collection().size(); 00121 m_nHitByDetector->Fill(bin.first + 0.5,siz); 00122 } 00123 00124 return StatusCode::SUCCESS; 00125 }
StatusCode SimHists::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 127 of file SimHists.cc.
00128 { 00129 00130 return this->GaudiAlgorithm::finalize(); 00131 }
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.