00001 #ifndef ROOTCNVSVC_H
00002 #define ROOTCNVSVC_H 1
00003
00004 #include <map>
00005
00006 #include "GaudiKernel/ConversionSvc.h"
00007 #include "GaudiKernel/DataObject.h"
00008 #include "commonData.h"
00009 #include "Util.h"
00010
00011 template <class TYPE> class SvcFactory;
00012 class RootInterface;
00013 class DigiCnv;
00014 class DstCnv;
00015 class EvtHeaderCnv;
00016 class EvtNavigatorCnv;
00017 class EventCnv;
00018 class McCnv;
00019 class RootEvtSelector;
00020 class RecTrackCnv;
00021 class EvtRecCnv;
00022 class TrigCnv;
00023 class HltCnv;
00024
00025 static const InterfaceID IID_IRootCnvSvc("IRootCnvSvc", 1, 0);
00026
00040 class RootCnvSvc : virtual public ConversionSvc {
00041
00042 friend class SvcFactory<RootCnvSvc>;
00043
00044 public:
00048 class Leaf : public std::vector<Leaf*> {
00049 public:
00050 std::string path;
00051 std::string treename;
00052 std::string branchname;
00053 CLID clid;
00054 Leaf(const std::string& p, const CLID& c, const std::string& tree, const std::string& branch)
00055 : path(p), treename(tree), branchname(branch),clid(c){}
00056
00057 bool operator==(const Leaf& copy) const {
00058 return path == copy.path &&
00059 treename == copy.treename &&
00060 branchname == copy.branchname &&
00061 clid == copy.clid ;
00062 }
00063 };
00064
00065 private:
00067 StatusCode addConverters ();
00068
00069 bool m_selectFromTag;
00070 std::vector<std::string> m_tagInputFile;
00071
00072
00074 RootInterface* m_rootInterface;
00076 RootEvtSelector* m_evtsel;
00078 typedef std::map<std::string, Leaf*> LeafMap;
00079 LeafMap m_leaves;
00080
00083 const int m_minSplit;
00084
00086 std::vector<std::string> m_difileName;
00087
00089 std::string m_dofileName;
00090
00091
00093 int m_dsplitMode;
00094
00096 int m_dbufSize;
00097
00099 int m_dcompressionLevel;
00100
00102 std::string m_dtreeName;
00103
00105 DigiCnv *m_dCnv;
00106 DstCnv *m_dstCnv;
00107 McCnv *m_mcCnv;
00108 TrigCnv *m_trigCnv;
00109 HltCnv *m_hltCnv;
00110 EvtRecCnv *m_evtRecCnv;
00111
00112 RecTrackCnv *m_rectrackCnv;
00113 EvtHeaderCnv *m_evtheaderCnv;
00114 EvtNavigatorCnv *m_evtnavigatorCnv;
00115 EventCnv *m_eventCnv;
00116
00118 commonData m_common;
00119
00120 StatusCode initFiles();
00121
00122 public:
00123
00124 RootInterface * getRootInterface() {return m_rootInterface;}
00125
00126 virtual StatusCode initialize();
00127
00128 virtual StatusCode finalize();
00129
00130 virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
00131
00133 virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
00134
00136 virtual StatusCode declareObject(const Leaf& leaf);
00137
00139 virtual StatusCode commitOutput(const std::string& output, bool do_commit);
00140
00142 virtual StatusCode createAddress( long int svc_type,
00143 const CLID& clid,
00144 const std::string* par,
00145 const unsigned long* ip,
00146 IOpaqueAddress*& refpAddress);
00147
00148 virtual StatusCode createAddress(DataObject *obj, IOpaqueAddress*& refpAddress);
00149 virtual StatusCode createAddress(std::string path, IOpaqueAddress*& refpAddress);
00150
00151 DigiCnv *getDigiCnv() {return m_dCnv;}
00152 DstCnv *getDstCnv() {return m_dstCnv;}
00153 McCnv *getMcCnv() {return m_mcCnv;}
00154 TrigCnv *getTrigCnv() { return m_trigCnv; }
00155 HltCnv *getHltCnv() { return m_hltCnv; }
00156 EvtRecCnv *getEvtRecCnv() { return m_evtRecCnv; }
00157
00158 void setDigiCnv(DigiCnv *reccnv){m_dCnv=reccnv;}
00159 void setDstCnv(DstCnv *dstcnv){m_dstCnv=dstcnv;}
00160 void setMcCnv (McCnv *mccnv) {m_mcCnv=mccnv;}
00161 void setTrigCnv (TrigCnv *trigcnv) { m_trigCnv = trigcnv; }
00162 void setHltCnv (HltCnv *hltcnv) { m_hltCnv = hltcnv; }
00163 void setEvtRecCnv (EvtRecCnv *evtreccnv) { m_evtRecCnv = evtreccnv; }
00164 void setRecTrackCnv (RecTrackCnv *rectrackcnv) {m_rectrackCnv=rectrackcnv;}
00165 void setEvtHeaderCnv (EvtHeaderCnv *evtheadercnv){m_evtheaderCnv=evtheadercnv;}
00166 void setEvtNavigatorCnv (EvtNavigatorCnv *evtnavigatorcnv){m_evtnavigatorCnv=evtnavigatorcnv;}
00167 void setEventCnv(EventCnv* eventCnv){m_eventCnv=eventCnv;}
00168
00169
00170 RecTrackCnv *getRecTrackCnv() {return m_rectrackCnv;}
00171 EvtHeaderCnv *getEvtHeaderCnv(){return m_evtheaderCnv;}
00172 EvtNavigatorCnv *getEvtNavigatorCnv(){return m_evtnavigatorCnv;}
00173 EventCnv *getEventCnv(){return m_eventCnv;}
00174 protected:
00175
00176
00177 RootCnvSvc(const std::string& name, ISvcLocator* svc);
00178
00179 virtual ~RootCnvSvc() { };
00180
00181
00182 };
00183
00184 #endif // ROOTCNVSVC_H