#include <DybInputLoadTool.h>
Inheritance diagram for DybInputLoadTool:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
typedef std::pair< std::string, DayaBay::HeaderObject * > | ExecutionFrameEntry |
typedef std::vector< ExecutionFrameEntry > | ExecutionFrame |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
DybInputLoadTool (const std::string &type, const std::string &name, const IInterface *parent) | |
virtual | ~DybInputLoadTool () |
StatusCode | queryInterface (const InterfaceID &riid, void **ppvIf) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
DayaBay::HeaderObject * | get_header (int entry, const std::string &path, bool input_headers=true, int fileNumber=-1) |
IDybInputLoadTool::ExecutionFrame | get_frame (int entry, const std::string &path=DayaBay::RegistrationSequenceLocation::Default, bool input_headers=true) |
int | get_entries (const std::string &path) |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | evtColSvc () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | evtSvc () const |
IIncidentSvc * | incSvc () const |
IChronoStatSvc * | chronoSvc () const |
IHistogramSvc * | histoSvc () const |
IAlgContextSvc * | contextSvc () const |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
DataObject * | 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 |
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 |
virtual unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual unsigned long | addRef () |
virtual const std::string & | name () const |
virtual const std::string & | type () const |
virtual const IInterface * | parent () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysStart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
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 |
PropertyMgr * | getPropertyMgr () |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
IMessageSvc * | msgSvc () const |
IToolSvc * | toolSvc () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
void | declInterface (const InterfaceID &, void *) |
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 |
IAuditorSvc * | auditorSvc () 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 |
virtual const std::string & | type () const =0 |
virtual const IInterface * | parent () const =0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | reinitialize ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () const =0 |
virtual StatusCode | sysInitialize ()=0 |
virtual StatusCode | sysStart ()=0 |
virtual StatusCode | sysStop ()=0 |
virtual StatusCode | sysFinalize ()=0 |
virtual StatusCode | sysReinitialize ()=0 |
virtual StatusCode | sysRestart ()=0 |
virtual unsigned long | refCount () const =0 |
virtual const std::string & | name () const =0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
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 |
int | outputLevel () const |
virtual unsigned long | refCount () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Types | |
typedef std::pair< int, std::string > | HoID |
typedef std::map< HoID, DayaBay::HeaderObject * > | HoCache |
Private Member Functions | |
RootInputStream * | get_stream (const std::string &path) |
template<class PerType> | |
PerType * | get_pobj (int entry, const std::string &path, int fileNumber=-1) |
DataObject * | get_dataobject (int clID, const std::string &path) |
Private Attributes | |
std::string | m_rioSvcName |
std::string | m_convSvcName |
IRootIOSvc * | m_rioSvc |
IConversionSvc * | m_convSvc |
HoCache | m_hocache |
bool | m_cache_hos |
This will allow loading of HeaderObjects w/out using the full Gaudi mechanism and, in particular, w/out involving the event store. It should probably not be used in jobs where the normal input mechanism is used.
Brett Viren <bv@bnl.gov> Mon Nov 15 13:25:03 2010
Definition at line 31 of file DybInputLoadTool.h.
typedef std::pair<int,std::string> DybInputLoadTool::HoID [private] |
Definition at line 73 of file DybInputLoadTool.h.
typedef std::map<HoID,DayaBay::HeaderObject*> DybInputLoadTool::HoCache [private] |
Definition at line 74 of file DybInputLoadTool.h.
typedef std::pair<std::string,DayaBay::HeaderObject*> IDybInputLoadTool::ExecutionFrameEntry [inherited] |
Definition at line 29 of file IDybInputLoadTool.h.
typedef std::vector<ExecutionFrameEntry> IDybInputLoadTool::ExecutionFrame [inherited] |
Definition at line 30 of file IDybInputLoadTool.h.
DybInputLoadTool::DybInputLoadTool | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 18 of file DybInputLoadTool.cc.
00021 : GaudiTool(type,name,parent) 00022 , m_rioSvc(0) 00023 , m_convSvc(0) 00024 , m_cache_hos(false) 00025 { 00026 declareInterface<IDybInputLoadTool>(this); 00027 declareProperty("RootIOSvc",m_rioSvcName="RootIOCnvSvc", 00028 "Name of the IRootIOSvc to use"); 00029 declareProperty("ConversionSvc",m_convSvcName="RootIOCnvSvc", 00030 "Name of the IConversionSvc to use"); 00031 }
DybInputLoadTool::~DybInputLoadTool | ( | ) | [virtual] |
StatusCode DybInputLoadTool::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvIf | |||
) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 37 of file DybInputLoadTool.cc.
00038 { 00039 if ( riid == IDybInputLoadTool::interfaceID() ) { 00040 *ppvIf = (IDybInputLoadTool*)this; 00041 addRef(); 00042 return StatusCode::SUCCESS; 00043 } 00044 return AlgTool::queryInterface( riid, ppvIf ); 00045 }
StatusCode DybInputLoadTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 48 of file DybInputLoadTool.cc.
00049 { 00050 MsgStream log(msgSvc(), "DybInputLoadTool"); 00051 { // IRootIOSvc 00052 IService* isvc = 0; 00053 StatusCode sc = this->service(m_rioSvcName,isvc,true); 00054 if(sc.isFailure()){ 00055 log << MSG::ERROR << "Failed to get "<<m_rioSvcName<<" RootIOCnvSvc" << endreq; 00056 return sc; 00057 } 00058 00059 sc = isvc->queryInterface(IRootIOSvc::interfaceID(), (void**)&m_rioSvc); 00060 if (sc.isFailure()) { 00061 log << MSG::ERROR << "Service " << m_rioSvcName 00062 << " does not implement IRootIOSvc" << endreq; 00063 return sc; 00064 } 00065 } 00066 00067 { // IConversionSvc 00068 IService* isvc = 0; 00069 StatusCode sc = this->service(m_convSvcName,isvc,true); 00070 if(sc.isFailure()){ 00071 log << MSG::ERROR << "Failed to get "<<m_convSvcName<<" ConversionSvc" << endreq; 00072 return sc; 00073 } 00074 00075 sc = isvc->queryInterface(IConversionSvc::interfaceID(), (void**)&m_convSvc); 00076 if (sc.isFailure()) { 00077 log << MSG::ERROR << "Service " << m_convSvcName 00078 << " does not implement IConversionSvc" << endreq; 00079 return sc; 00080 } 00081 } 00082 return StatusCode::SUCCESS; 00083 }
StatusCode DybInputLoadTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 85 of file DybInputLoadTool.cc.
00086 { 00087 return StatusCode::SUCCESS; 00088 }
HeaderObject * DybInputLoadTool::get_header | ( | int | entry, | |
const std::string & | path, | |||
bool | input_headers = true , |
|||
int | fileNumber = -1 | |||
) | [virtual] |
Implements IDybInputLoadTool.
Definition at line 196 of file DybInputLoadTool.cc.
00198 { 00199 MsgStream log(msgSvc(), "DybInputLoadTool"); 00200 00201 // See if we are cacheing hos and if we have a ho we know. 00202 if (m_cache_hos) { 00203 HoID id(entry,path); 00204 HoCache::iterator it = m_hocache.find(id); 00205 if (it != m_hocache.end()) { 00206 return it->second; 00207 } 00208 } 00209 00210 PerHeaderObject* pho = this->get_pobj<PerHeaderObject>(entry,path,fileNumber); 00211 if (!pho) return 0; 00212 00213 log << MSG::DEBUG << "get_header("<<entry<<",\"" << path << "\"," 00214 << " id=" << pho->clID 00215 << " w/ " 00216 << pho->inputHeaders.size() 00217 << " inputHeaders, " << input_headers<<",f#"<<fileNumber 00218 <<") -> ho @ " << pho->context.GetTimeStamp() 00219 <<endreq; 00220 00221 std::vector<PerRef> pinputHeaders = pho->inputHeaders; 00222 pho->inputHeaders.clear(); 00223 00224 std::vector<const IHeader*> tinputHeaders; 00225 if (input_headers) { 00226 00227 if (fileNumber == -1) { // we MUST set a file number when 00228 // resolving references 00229 RootInputStream* ris = this->get_stream(path); 00230 fileNumber = ris->fileNumber(); 00231 log << MSG::DEBUG << "get_header: using file number " << fileNumber << endreq; 00232 } 00233 00234 for (size_t ind=0; ind< pinputHeaders.size(); ++ind) { 00235 HeaderObject* ho = this->get_header(pinputHeaders[ind].entry(), 00236 pinputHeaders[ind].path(), 00237 input_headers, fileNumber); 00238 if (ho) tinputHeaders.push_back(ho); 00239 } 00240 } 00241 log << MSG::DEBUG << "get_header: restored " << tinputHeaders.size() 00242 << " inputHeaders out of a possible " 00243 << pinputHeaders.size() << endreq; 00244 00245 DataObject* dobj = this->get_dataobject(pho->clID, path); 00246 if (!dobj) return 0; 00247 00248 HeaderObject* ho = dynamic_cast<HeaderObject*>(dobj); 00249 if (input_headers) ho->setInputHeaders(tinputHeaders); 00250 00251 log << MSG::DEBUG << "get_header: got HO: id#" << ho->clID() 00252 << " \"" << ho->defLoc() << "\" @ " << ho->context().AsString() 00253 << endreq; 00254 00255 // If we are cacheing hos keep the ho we know. 00256 if (m_cache_hos) { 00257 m_hocache[HoID(entry,path)] = ho; 00258 } 00259 00260 return ho; 00261 }
IDybInputLoadTool::ExecutionFrame DybInputLoadTool::get_frame | ( | int | entry, | |
const std::string & | path = DayaBay::RegistrationSequenceLocation::Default , |
|||
bool | input_headers = true | |||
) | [virtual] |
Implements IDybInputLoadTool.
Definition at line 264 of file DybInputLoadTool.cc.
00266 { 00267 MsgStream log(msgSvc(), "DybInputLoadTool"); 00268 00269 IDybInputLoadTool::ExecutionFrame ef; 00270 00271 PerRegistrationSequence* prs = this->get_pobj<PerRegistrationSequence>(entry,path); 00272 if (!prs) return ef; 00273 00274 m_cache_hos = true; 00275 m_hocache.clear(); 00276 for (size_t ind=0; ind < prs->reglist.size(); ++ind) { 00277 RootInputStream* ris = this->get_stream(path); 00278 int fileNumber = ris->fileNumber(); 00279 00280 HeaderObject* ho = this->get_header(prs->reglist[ind].entry, 00281 prs->reglist[ind].path, 00282 input_headers, fileNumber); 00283 if (!ho) { 00284 log << MSG::ERROR << "Failed to get Header object at entry " 00285 << prs->reglist[ind].entry << " and path " << prs->reglist[ind].path << endreq; 00286 continue; 00287 } 00288 00289 IDybInputLoadTool::ExecutionFrameEntry entry(prs->reglist[ind].path,ho); 00290 ef.push_back(entry); 00291 } 00292 m_cache_hos = false; 00293 m_hocache.clear(); 00294 return ef; 00295 }
int DybInputLoadTool::get_entries | ( | const std::string & | path | ) | [virtual] |
Implements IDybInputLoadTool.
Definition at line 297 of file DybInputLoadTool.cc.
00298 { 00299 IRootIOSvc::InputStreamMap& ism = m_rioSvc->inputStreams(); 00300 IRootIOSvc::InputStreamMap::iterator it = ism.find(path); 00301 if (it != ism.end()) { 00302 return it->second->entries(); 00303 } 00304 return -1; 00305 }
RootInputStream * DybInputLoadTool::get_stream | ( | const std::string & | path | ) | [private] |
Definition at line 90 of file DybInputLoadTool.cc.
00091 { 00092 IRootIOSvc::InputStreamMap& ism = m_rioSvc->inputStreams(); 00093 IRootIOSvc::InputStreamMap::iterator it = ism.find(path); 00094 if (it != ism.end()) { 00095 return it->second; 00096 } 00097 it = ism.find("default"); 00098 if (it != ism.end()) { 00099 return it->second; 00100 } 00101 return 0; 00102 }
PerType * DybInputLoadTool::get_pobj | ( | int | entry, | |
const std::string & | path, | |||
int | fileNumber = -1 | |||
) | [private] |
Definition at line 110 of file DybInputLoadTool.cc.
00111 { 00112 MsgStream log(msgSvc(), "DybInputLoadTool"); 00113 00114 RootInputStream* ris = this->get_stream(path); 00115 if (!ris) { 00116 log << MSG::ERROR << "Failed to get input stream for " << path << endreq; 00117 return 0; 00118 } 00119 00120 if (fileNumber == -1) { 00121 bool ok = ris->setEntry(entry); 00122 if (!ok) { 00123 log << MSG::ERROR << "Failed to setEntry(" << entry 00124 << ") with stream \"" << path << "\"" << endreq; 00125 return 0; 00126 } 00127 } 00128 else { 00129 bool ok = ris->setFileEntry(fileNumber,entry); 00130 if (!ok) { 00131 log << MSG::ERROR << "Failed to setFileEntry(" << fileNumber << "," << entry 00132 << ") with stream \"" << path << "\"" << endreq; 00133 return 0; 00134 } 00135 } 00136 00137 PerType* pto = dynamic_cast<PerType*>(ris->obj()); 00138 if (!pto) { 00139 log << MSG::ERROR << "Cast failed for object at entry = " << entry 00140 << " in stream \"" << path << "\"" << endreq; 00141 return 0; 00142 } 00143 00144 return pto; 00145 }
DataObject * DybInputLoadTool::get_dataobject | ( | int | clID, | |
const std::string & | path | |||
) | [private] |
Definition at line 155 of file DybInputLoadTool.cc.
00156 { 00157 MsgStream log(msgSvc(), "DybInputLoadTool"); 00158 00159 IConverter* converter = m_convSvc->converter(clID); 00160 if (!converter) { 00161 log << MSG::ERROR << "Failed to get converter for class ID = " << clID 00162 << " in stream \"" << path << "\"" << endreq; 00163 return 0; 00164 } 00165 00166 RootIOBaseCnv* riocnv = dynamic_cast<RootIOBaseCnv*>(converter); 00167 if (!riocnv) { 00168 log << MSG::ERROR << "Converter not a RootIOBaseCnv for class ID = " << clID 00169 << " in stream \"" << path << "\"" << endreq; 00170 return 0; 00171 } 00172 00173 RootInputStream* ris = this->get_stream(path); 00174 if (!ris) { 00175 log << MSG::ERROR << "Failed to get input stream for " << path << endreq; 00176 return 0; 00177 } 00178 00179 RootInputAddress ria(clID,path); 00180 ria.setStream(ris); 00181 ria.readDone(); // It is assumed that the persistent 00182 // object is already read into memory 00183 // (in this case, it is done in 00184 // get_pobj()) so we tell createObj() 00185 // not to do it again. 00186 DataObject* dobj = 0; 00187 StatusCode sc = riocnv->createObj(&ria,dobj); 00188 if (sc.isFailure()) { 00189 log << MSG::ERROR << "Failed to createObj for class ID = " << clID 00190 << " in stream \"" << path << "\"" << endreq; 00191 return 0; 00192 } 00193 return dobj; 00194 }
const InterfaceID & IDybInputLoadTool::interfaceID | ( | ) | [static, inherited] |
Reimplemented from IAlgTool.
Definition at line 7 of file IDybInputLoadTool.cc.
00008 { 00009 return IID_IDybInputLoadTool; 00010 }
std::string DybInputLoadTool::m_rioSvcName [private] |
Definition at line 69 of file DybInputLoadTool.h.
std::string DybInputLoadTool::m_convSvcName [private] |
Definition at line 69 of file DybInputLoadTool.h.
IRootIOSvc* DybInputLoadTool::m_rioSvc [private] |
Definition at line 70 of file DybInputLoadTool.h.
IConversionSvc* DybInputLoadTool::m_convSvc [private] |
Definition at line 71 of file DybInputLoadTool.h.
HoCache DybInputLoadTool::m_hocache [private] |
Definition at line 75 of file DybInputLoadTool.h.
bool DybInputLoadTool::m_cache_hos [private] |
Definition at line 76 of file DybInputLoadTool.h.