BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibTreeCnvSvc Class Reference

#include <CalibTreeCnvSvc.h>

Inheritance diagram for CalibTreeCnvSvc:

Public Member Functions

 CalibTreeCnvSvc (const std::string &name, ISvcLocator *svc)
virtual ~CalibTreeCnvSvc ()
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
std::string getrootfile ()
IConverter * createConverter (long typ, const CLID &clid, const ICnvFactory *fac)
Public Member Functions inherited from ICalibTreeSvc
 DeclareInterfaceID (ICalibTreeSvc, 1, 0)
 DeclareInterfaceID (ICalibTreeSvc, 1, 0)
 DeclareInterfaceID (ICalibTreeSvc, 1, 0)

Friends

class SvcFactory< CalibTreeCnvSvc >
 Only factories can access protected constructors.

Detailed Description


A conversion service for GLAST calibration bulk data in ROOT format.

Author
J. Bogart
Date
July 2004

Definition at line 35 of file CalibTreeCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibTreeCnvSvc()

CalibTreeCnvSvc::CalibTreeCnvSvc ( const std::string & name,
ISvcLocator * svc )

Definition at line 37 of file CalibTreeCnvSvc.cxx.

38 : ConversionSvc( name, svc, CALIBTREE_StorageType ), m_detPersSvc( 0 ), m_detDataSvc( 0 ) {
39
40 // huangb add
41}

Referenced by CalibTreeCnvSvc().

◆ ~CalibTreeCnvSvc()

virtual CalibTreeCnvSvc::~CalibTreeCnvSvc ( )
inlinevirtual

Definition at line 41 of file CalibTreeCnvSvc.h.

41{}

Member Function Documentation

◆ createAddress()

StatusCode CalibTreeCnvSvc::createAddress ( long svc_type,
const CLID & clid,
const std::string * par,
const unsigned long * ip,
IOpaqueAddress *& refpAddress )
virtual

Create a ROOT address using explicit arguments to identify a single object

Parameters
svc_typethe service type
CLIDthe CLID of the ROOT Element for which an address is created
paran array of three strings containing the format version, calibration type name and the flavor, in this order
iphas a single element, the serial number of the MySQL row which corresponds to this element
refpAddressthe new address created
Returns
a StatusCode giving the status of the address creation

Definition at line 142 of file CalibTreeCnvSvc.cxx.

144 {
145 // createAddress of CalibTreeCnvSvc
146 MsgStream log( msgSvc(), name() );
147 if ( svc_type != CALIBTREE_StorageType )
148 {
149 log << MSG::ERROR << "bad storage type" << (int)svc_type << endmsg;
150 return StatusCode::FAILURE;
151 }
152 std::string dataIdent;
153 std::string fullpath;
154 int index;
155 if ( clid == CLID_Calib_MdcCal ) { index = 0; }
156 else if ( clid == CLID_Calib_TofCal ) { index = 1; }
157 else if ( clid == CLID_Calib_DedxCal ) { index = 2; }
158 else if ( clid == CLID_Calib_EmcCal ) { index = 3; }
159 else { log << MSG::WARNING << "Wrong CLID" << endmsg; }
160
161 // see if svctype set in the CalibDataSvc is MYSQL_StorageType or CALIBROOT_StorageType
162 /* IInstrumentName* iInstrumentName;
163 StatusCode sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
164 (void**) &iInstrumentName);
165
166 if ( !sc.isSuccess() ) {
167 log << MSG::ERROR
168 << "Cannot query IInstrumentName interface of CalibDataSvc"
169 << endmsg;
170 return sc;
171 } else {
172 log << MSG::DEBUG
173 << "Retrieved IInstrumentName interface of CalibDataSvc"
174 << endmsg;
175 }
176
177 int svctype = iInstrumentName->getsvctype();
178 if(svctype== CALIBROOT_StorageType)
179 {
180 dataIdent = m_rootfile[index];
181 fullpath = par[0];
182 }
183
184 if(svctype== MYSQL_StorageType)
185 { log << MSG::INFO<<"rootfile is not set in the jobOption,get it from MySQL"<<endmsg;
186 dataIdent = par[0];
187 fullpath = par[1];
188 }
189
190 if ((svctype != CALIBROOT_StorageType)&&(svctype!= MYSQL_StorageType)) {
191 log << MSG::ERROR << "bad storage type" << (int)svctype << endmsg;
192 return StatusCode::FAILURE;
193 }
194 */
195 // std::string dataIdent(par[0]); // file identifier for PDS version of data
196 // log << MSG::INFO<<"dataIdent is:"<<dataIdent<<endmsg;
197 // std::string fullpath(par[1]); // path within TCDS for the object
198 // log << MSG::INFO<<"fullpath is :"<<fullpath<<endmsg;
199
200 int runfrm = ip[0];
201 int runto = ip[1];
202 dataIdent = par[0];
203 fullpath = par[1];
204
205 // for now have to ignore fmtVersion because of defective implementation
206 // of GenericAddress. If we want it, should probably write new
207 // opaque address implementation for this package to use. All
208 // dealings with (calibration) opaque addresses are confined to
209 // the CalibSvc package.
210 refpAddress =
211 new GenericAddress( CALIBTREE_StorageType, clid, dataIdent, fullpath, runfrm, runto );
212
213 return StatusCode::SUCCESS;
214}
IMessageSvc * msgSvc()

◆ createConverter()

IConverter * CalibTreeCnvSvc::createConverter ( long typ,
const CLID & clid,
const ICnvFactory * fac )

Definition at line 228 of file CalibTreeCnvSvc.cxx.

229 {
230 if ( wanted == TreeCorrectedETSCnv::classID() )
231 return new TreeCorrectedETSCnv( serviceLocator().get() );
232 if ( wanted == TreeDedxCalibDataCnv::classID() )
233 return new TreeDedxCalibDataCnv( serviceLocator().get() );
234 if ( wanted == TreeDedxSimDataCnv::classID() )
235 return new TreeDedxSimDataCnv( serviceLocator().get() );
236 if ( wanted == TreeEmcCalibDataCnv::classID() )
237 return new TreeEmcCalibDataCnv( serviceLocator().get() );
238 if ( wanted == TreeEsTimeCalibDataCnv::classID() )
239 return new TreeEsTimeCalibDataCnv( serviceLocator().get() );
240 if ( wanted == TreeEstTofCalibDataCnv::classID() )
241 return new TreeEstTofCalibDataCnv( serviceLocator().get() );
242 if ( wanted == TreeInjSigIntervalCnv::classID() )
243 return new TreeInjSigIntervalCnv( serviceLocator().get() );
244 if ( wanted == TreeInjSigTimeCnv::classID() )
245 return new TreeInjSigTimeCnv( serviceLocator().get() );
246 if ( wanted == TreeMdcAlignDataCnv::classID() )
247 return new TreeMdcAlignDataCnv( serviceLocator().get() );
248 if ( wanted == TreeMdcCalibDataCnv::classID() )
249 return new TreeMdcCalibDataCnv( serviceLocator().get() );
250 if ( wanted == TreeMdcDataConstCnv::classID() )
251 return new TreeMdcDataConstCnv( serviceLocator().get() );
252 if ( wanted == TreeMucCalibDataCnv::classID() )
253 return new TreeMucCalibDataCnv( serviceLocator().get() );
254 if ( wanted == TreeOffEvtFilterCnv::classID() )
255 return new TreeOffEvtFilterCnv( serviceLocator().get() );
256 if ( wanted == TreeTofCalibDataCnv::classID() )
257 return new TreeTofCalibDataCnv( serviceLocator().get() );
258 if ( wanted == TreeTofElecDataCnv::classID() )
259 return new TreeTofElecDataCnv( serviceLocator().get() );
260 if ( wanted == TreeTofSimDataCnv::classID() )
261 return new TreeTofSimDataCnv( serviceLocator().get() );
262
263 return ConversionSvc::createConverter( typ, wanted, fac );
264}
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()

◆ finalize()

StatusCode CalibTreeCnvSvc::finalize ( )
virtual

Definition at line 136 of file CalibTreeCnvSvc.cxx.

136 {
137 // If anything was allocated, get rid of it. So far, nothing was.
138
139 return ConversionSvc::finalize();
140}

◆ getrootfile()

std::string CalibTreeCnvSvc::getrootfile ( )
inlinevirtual

Method to write a ROOT file corresponding to TDS object

Parameters
fileNamethe name of the file to be written
Returns
the document issued from the parsing

Implements ICalibTreeSvc.

Definition at line 78 of file CalibTreeCnvSvc.h.

78{ return m_rootfile[0]; }

◆ initialize()

StatusCode CalibTreeCnvSvc::initialize ( )
virtual

Definition at line 59 of file CalibTreeCnvSvc.cxx.

59 {
60 StatusCode sc = ConversionSvc::initialize();
61
62 MsgStream log( msgSvc(), "CalibTreeCnvSvc" );
63
64 if ( !sc.isSuccess() ) return sc;
65
66 // Locate the Calib Data Service. Since it inherits from DataSvc
67 // it has to implement IDataProviderSvc
68 m_detDataSvc = 0;
69 /*sc = serviceLocator()->getService
70 ("CalibDataSvc", IID_IDataProviderSvc,(IInterface*&) m_detDataSvc);*/
71 sc = serviceLocator()->getService( "CalibDataSvc", IDataProviderSvc::interfaceID(),
72 (IInterface*&)m_detDataSvc );
73 if ( !sc.isSuccess() )
74 {
75 log << MSG::ERROR << "Could not locate CalibDataSvc" << endmsg;
76 return sc;
77 }
78
79 /* IInstrumentName* iInstrumentName;
80 sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
81 (void**) &iInstrumentName);
82 */
83 // Set the CalibDataSvc as data provider service
84 sc = setDataProvider( m_detDataSvc );
85 if ( !sc.isSuccess() )
86 {
87 log << MSG::ERROR << "Could not set data provider" << endmsg;
88 return sc;
89 }
90 // huangb add
91 // sc = setProperties();
92
93 // Locate IConversionSvc interface of the DetectorPersistencySvc
94 sc = serviceLocator()->service( "DetectorPersistencySvc", m_detPersSvc, true );
95 if ( !sc.isSuccess() )
96 {
97 log << MSG::ERROR << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
98 << endmsg;
99 return sc;
100 }
101 else
102 {
103 log << MSG::DEBUG << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
104 << endmsg;
105 }
106
107 // Query the IAddressCreator interface of the detector persistency service
108 IAddressCreator* iAddrCreator;
109 /*sc = m_detPersSvc->queryInterface(IID_IAddressCreator,
110 (void**) &iAddrCreator);*/
111 sc = m_detPersSvc->queryInterface( IAddressCreator::interfaceID(), (void**)&iAddrCreator );
112 if ( !sc.isSuccess() )
113 {
114 log << MSG::ERROR << "Cannot query IAddressCreator interface of DetectorPersistencySvc"
115 << endmsg;
116 return sc;
117 }
118 else
119 {
120 log << MSG::DEBUG << "Retrieved IAddressCreator interface of DetectorPersistencySvc"
121 << endmsg;
122 }
123 log << MSG::DEBUG << "Set it as the address creator of the CalibTreeCnvSvc" << endmsg;
124 sc = setAddressCreator( iAddrCreator );
125 if ( !sc.isSuccess() )
126 {
127 log << MSG::ERROR << "Cannot set the address creator" << endmsg;
128 return sc;
129 }
130
131 // set properties if there are any??
132
133 return sc;
134}

◆ updateObj()

StatusCode CalibTreeCnvSvc::updateObj ( IOpaqueAddress * pAddress,
DataObject * pObject )
virtual

Definition at line 216 of file CalibTreeCnvSvc.cxx.

216 {
217
218 // using facilities::Timestamp;
219
220 MsgStream log( msgSvc(), "CalibTreeCnvSvc" );
221
222 // Don't update when we're using enter time
223 log << MSG::DEBUG << "CalibTreeCnvSvc::updateObj starting ...." << endmsg;
224
225 return StatusCode::SUCCESS;
226}

◆ SvcFactory< CalibTreeCnvSvc >

friend class SvcFactory< CalibTreeCnvSvc >
friend

Only factories can access protected constructors.

Definition at line 1 of file CalibTreeCnvSvc.h.


The documentation for this class was generated from the following files: