#include <GenHists.h>
Inheritance diagram for GenHists:
Public Member Functions | |
GenHists (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~GenHists () |
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 Member Functions | |
StatusCode | BookVertices () |
Private Attributes | |
std::string | m_location |
Property: Location - TES path to the generated kinematics. | |
std::string | m_volume |
Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations. | |
std::string | m_filepath |
Property: FilePath - path to use when registering histograms. | |
double | m_maxEnergy |
Property MaxEnergy - max value for energy histogram. | |
double | m_energyUnits |
Property EnergyUnits - units for energy. | |
ITHistSvc * | m_hsvc |
IGeometryInfo * | m_geo |
TH1I * | m_nKineParts |
TH1F * | m_kineEnergy |
TH1F * | m_vtxTime |
TH2F * | m_xy |
TH2F * | m_yz |
TH2F * | m_xz |
Definition at line 25 of file GenHists.h.
GenHists::GenHists | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 33 of file GenHists.cc.
00034 : GaudiAlgorithm(name,pSvcLocator) 00035 , m_hsvc(0) 00036 , m_nKineParts(0) 00037 , m_kineEnergy(0) 00038 , m_xy(0), m_yz(0), m_xz(0) 00039 { 00040 declareProperty("Location",m_location=DayaBay::GenHeaderLocation::Default, 00041 "Location in the TES to get GenHeader"); 00042 declareProperty("Volume",m_volume="", 00043 "TDS path of volume used to generated vertices"); 00044 declareProperty("FilePath",m_filepath="/file1/gen/", 00045 "File path with with to register histograms."); 00046 declareProperty("MaxEnergy",m_maxEnergy = 10*CLHEP::MeV, 00047 "Maximum energy for plot bounds."); 00048 declareProperty("EnergyUnits",m_energyUnits = CLHEP::MeV, 00049 "Energy units for plot bounds."); 00050 }
GenHists::~GenHists | ( | ) | [virtual] |
StatusCode GenHists::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 78 of file GenHists.cc.
00079 { 00080 this->GaudiAlgorithm::initialize(); 00081 00082 // Get the histogram service 00083 if ( service("THistSvc", m_hsvc).isFailure()) { 00084 error() << " No THistSvc available." << endreq; 00085 return StatusCode::FAILURE; 00086 } 00087 00088 // Book some histograms, using CPP macro to help reduce typing 00089 00090 REG1D(TH1I,m_nKineParts,"nKineParts","Total number of primaries",10,0,10); 00091 REG1D(TH1F,m_kineEnergy,"kineEnergy","Particle Energy (MeV)",100,0,m_maxEnergy); 00092 REG1D(TH1F,m_vtxTime,"kineVtxTime","Times of vertices (seconds)",1500,0,15*60); 00093 return this->BookVertices(); 00094 }
StatusCode GenHists::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 142 of file GenHists.cc.
00143 { 00144 DayaBay::GenHeader* header = get<DayaBay::GenHeader>(m_location); 00145 00146 HepMC::GenEvent* genevt = header->event(); 00147 if (!genevt) { 00148 warning() << "No event, giving up" << endreq; 00149 // we don't return failure as it is not fatal. 00150 return StatusCode::SUCCESS; 00151 } 00152 00153 HepMC::GenVertex* genvtx = genevt->signal_process_vertex(); 00154 m_nKineParts->Fill(genvtx->particles_out_size()); 00155 00156 HepMC::GenVertex::particles_out_const_iterator 00157 it = genvtx->particles_out_const_begin(), 00158 done = genvtx->particles_out_const_end(); 00159 00160 double energy=0; 00161 for (; it != done; ++it) { 00162 HepMC::GenParticle* part = *it; 00163 HepMC::FourVector momentum = part->momentum(); 00164 energy += momentum.e(); 00165 m_kineEnergy->Fill(momentum.e()/m_energyUnits); 00166 } 00167 00168 HepMC::FourVector r4 = genvtx->position(); 00169 00170 Gaudi::XYZPoint gp(r4.x(),r4.y(),r4.z()); 00171 Gaudi::XYZPoint lp = m_geo->toLocal(gp); 00172 00173 m_vtxTime->Fill(r4.t()/CLHEP::second); 00174 m_xy->Fill(lp.x()/CLHEP::meter,lp.y()/CLHEP::meter); 00175 m_yz->Fill(lp.y()/CLHEP::meter,lp.z()/CLHEP::meter); 00176 m_xz->Fill(lp.x()/CLHEP::meter,lp.z()/CLHEP::meter); 00177 00178 return StatusCode::SUCCESS; 00179 }
StatusCode GenHists::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 181 of file GenHists.cc.
00182 { 00183 00184 return this->GaudiAlgorithm::finalize(); 00185 }
StatusCode GenHists::BookVertices | ( | ) | [private] |
Definition at line 96 of file GenHists.cc.
00097 { 00098 // Get volume of generation to get bounds later 00099 DetectorElement* detelem=0; 00100 if ("" == m_volume) { 00101 warning() << "No Volume property set, guessing at volume bounds." << endreq; 00102 } 00103 if (!existDet<DetectorElement>(m_volume)) { 00104 warning() << "Failed to get detector element " << m_volume 00105 << ", will guess at volume bounds" << endreq; 00106 } 00107 else { 00108 detelem = getDet<DetectorElement>(m_volume); 00109 } 00110 00111 double minx = -25*CLHEP::meter, maxx = +25*CLHEP::meter; 00112 double miny = -25*CLHEP::meter, maxy = +25*CLHEP::meter; 00113 double minz = -25*CLHEP::meter, maxz = +25*CLHEP::meter; 00114 if (detelem) { 00115 m_geo = detelem->geometry(); 00116 const ILVolume* lvol = m_geo->lvolume(); 00117 if (!lvol) { 00118 error() << "Could not get logical volume for: \"" << m_volume << "\"" << endreq; 00119 return StatusCode::FAILURE; 00120 } 00121 00122 const SolidBase* solid = dynamic_cast<const SolidBase*>(lvol->solid()); 00123 minx = solid->xMin(); maxx = solid->xMax(); 00124 miny = solid->yMin(); maxy = solid->yMax(); 00125 minz = solid->zMin(); maxz = solid->zMax(); 00126 info () << "Volume bounded by: " 00127 << "X: [" << minx/CLHEP::meter << " " << maxx/CLHEP::meter << "], " 00128 << "Y: [" << miny/CLHEP::meter << " " << maxy/CLHEP::meter << "], " 00129 << "Z: [" << minz/CLHEP::meter << " " << maxz/CLHEP::meter << "]" 00130 << endreq; 00131 } 00132 REG2D(TH2F,m_xy,"kineVertexXY","Primary Vertices, X-Y", 00133 100,minx/CLHEP::meter,maxx/CLHEP::meter,100,miny/CLHEP::meter,maxy/CLHEP::meter); 00134 REG2D(TH2F,m_yz,"kineVertexYZ","Primary Vertices, Y-Z", 00135 100,miny/CLHEP::meter,maxy/CLHEP::meter,100,minz/CLHEP::meter,maxz/CLHEP::meter); 00136 REG2D(TH2F,m_xz,"kineVertexXZ","Primary Vertices, Z-X", 00137 100,minx/CLHEP::meter,maxx/CLHEP::meter,100,minz/CLHEP::meter,maxz/CLHEP::meter); 00138 00139 return StatusCode::SUCCESS; 00140 }
std::string GenHists::m_location [private] |
Property: Location - TES path to the generated kinematics.
Defaults to DayaBay::HepMCEventLocation::Default
Definition at line 41 of file GenHists.h.
std::string GenHists::m_volume [private] |
Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations.
Definition at line 45 of file GenHists.h.
std::string GenHists::m_filepath [private] |
Property: FilePath - path to use when registering histograms.
Must end in "/". Default "/file1/gen/"
Definition at line 49 of file GenHists.h.
double GenHists::m_maxEnergy [private] |
double GenHists::m_energyUnits [private] |
ITHistSvc* GenHists::m_hsvc [private] |
Definition at line 63 of file GenHists.h.
IGeometryInfo* GenHists::m_geo [private] |
Definition at line 66 of file GenHists.h.
TH1I* GenHists::m_nKineParts [private] |
Definition at line 69 of file GenHists.h.
TH1F* GenHists::m_kineEnergy [private] |
Definition at line 70 of file GenHists.h.
TH1F * GenHists::m_vtxTime [private] |
Definition at line 70 of file GenHists.h.
TH2F* GenHists::m_xy [private] |
Definition at line 71 of file GenHists.h.
TH2F * GenHists::m_yz [private] |
Definition at line 71 of file GenHists.h.
TH2F * GenHists::m_xz [private] |
Definition at line 71 of file GenHists.h.