96 {
97
98 StatusCode sc;
99
100 sc = DataSvc::initialize();
101 if (sc.isFailure() ) return sc;
102
103
104 MsgStream log(
msgSvc(), name());
105 IConversionSvc* cnv_svc;
106 sc = serviceLocator()->service("DetectorPersistencySvc", cnv_svc, true);
107 if (sc .isFailure() ) {
108 log << MSG::ERROR << "Unable to find DetectorPersistencySvc " << endreq;
109 return sc;
110 }
111
112 IIncidentSvc* incsvc;
113 sc = service("IncidentSvc", incsvc);
114 int priority = 100;
115 if( sc.isSuccess() ){
116 incsvc -> addListener(this, "NewRun", priority);
117 }
118
119 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
120 if (sc .isFailure() ) {
121 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
122 return sc;
123 }
124
125 sc = setDataLoader(cnv_svc);
126 if (sc.isFailure() ) {
127 log << MSG::ERROR << "Unable to set data loader " << endreq;
128 return sc;
129 }
130 sc = setProperties();
131
132
133 IAddressCreator* calibCreator = 0;
134
135
136
137 sc = serviceLocator()->service("DetectorPersistencySvc", calibCreator);
138
139 if( sc.isFailure() ) {
140 log << MSG::ERROR << "Unable to locate DetectorPersistencySvc." << endreq;
141 return StatusCode::FAILURE;
142 }
143
144
145 DataObject* rootObj = new DataObject();
146 sc = setRoot(m_rootName, rootObj);
147 if (!sc.isSuccess() ) {
148 log << MSG::ERROR << "Unable to set calib data store root." << endreq;
149 delete rootObj;
150 return sc;
151 }
152
153
154
155
156
157
158
159
160 typedef std::vector<CalibData::CalibModelSvc::CalibPair>::const_iterator
164 const std::vector<CalibData::CalibModelSvc::CalibPair>&
pairs =
166 int jj =0;
167 for (pairIt =
pairs.begin(); pairIt !=
pairs.end(); pairIt++,jj++) {
168
170
171 std::string calibTypePath(pairIt->first);
172
173
174
175 unsigned long iargs[]={0,0};
176 IOpaqueAddress* pAddress;
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195 std::string fullpath = calibTypePath;
196 std::string args[] = {fullpath};
197
198
199
200
201 sc = calibCreator->createAddress(m_calibType[jj],
202 pairIt->second,
203 args, iargs, pAddress);
204
205
206 if (!sc.isSuccess()) {
207 log<< MSG::INFO
208 << "Unable to create Calib address with path " << fullpath << endreq;
209 }
210
211
212
213 sc = registerAddress(fullpath, pAddress);
214 if (!sc.isSuccess()) {
215 log<< MSG::ERROR << "Unable to register Calib address with path"
216 << fullpath << endreq;
217 }
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246 }
247
248
249
250 return StatusCode::SUCCESS;
251}
const std::vector< CalibPair > & getPairs() const
CalibPairCol::const_iterator PairIt
_EXTERN_ CalibPairCol pairs