65 throw cms::Exception(
"CocoaDBMgr::DumpCocoaResults DB not available");
77 "OpticalAlignmentsRcd");
80 <<
" current " << myDbService->
currentTime() <<
" end " << myDbService->
endOfTime() << std::endl;
86 "OpticalAlignmentsRcd");
98 std::cout <<
"OpticalAlignmentsRcd WRITTEN TO DB : " << nrcd << std::endl;
103 std::pair<Alignments*, AlignmentErrorsExtended*> dtali = BuildAlignments(
true);
108 nrcd = dt_Alignments->
m_align.size();
119 std::cout <<
"DTAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
124 &(*dt_AlignmentErrors), myDbService->
beginOfTime(), myDbService->
endOfTime(),
"DTAlignmentErrorExtendedRcd");
127 &(*dt_AlignmentErrors), appendTime,
"DTAlignmentErrorExtendedRcd");
130 std::cout <<
"DTAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
133 std::pair<Alignments*, AlignmentErrorsExtended*> cscali = BuildAlignments(
false);
138 nrcd = csc_Alignments->
m_align.size();
146 std::cout <<
"CSCAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
153 "CSCAlignmentErrorExtendedRcd");
156 &(*csc_AlignmentErrors), appendTime,
"CSCAlignmentErrorExtendedRcd");
159 std::cout <<
"CSCAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
171 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO " << opto->
name();
179 CLHEP::HepRotation parentRmGlobInv = inverseOf(opto->
parent()->
rmGlob());
180 centreLocal = parentRmGlobInv * centreLocal;
183 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting coord ";
184 if (theCoordinateEntryVector.size() == 6) {
185 const Entry*
const translationX = theCoordinateEntryVector.at(0);
187 translationXDataForDB.
name_ = translationX->name();
188 translationXDataForDB.
dim_type_ = translationX->type();
189 translationXDataForDB.
value_ = centreLocal.x() * 1._m;
190 translationXDataForDB.
error_ = GetEntryError(translationX) * 1._m;
191 translationXDataForDB.
quality_ = translationX->quality();
192 data.x_ = translationXDataForDB;
194 const Entry*
const translationY = theCoordinateEntryVector.at(1);
196 translationYDataForDB.
name_ = translationY->name();
197 translationYDataForDB.
dim_type_ = translationY->type();
198 translationYDataForDB.
value_ = centreLocal.y() * 1._m;
199 translationYDataForDB.
error_ = GetEntryError(translationY) * 1._m;
200 translationYDataForDB.
quality_ = translationY->quality();
201 data.y_ = translationYDataForDB;
203 const Entry*
const translationZ = theCoordinateEntryVector.at(2);
205 translationZDataForDB.
name_ = translationZ->name();
206 translationZDataForDB.
dim_type_ = translationZ->type();
207 translationZDataForDB.
value_ = centreLocal.z() * 1._m;
208 translationZDataForDB.
error_ = GetEntryError(translationZ) * 1._m;
209 translationZDataForDB.
quality_ = translationZ->quality();
210 data.z_ = translationZDataForDB;
214 if (anglocal.size() == 3) {
215 const Entry*
const rotationX = theCoordinateEntryVector.at(3);
217 rotationXDataForDB.
name_ = rotationX->name();
218 rotationXDataForDB.
dim_type_ = rotationX->type();
219 rotationXDataForDB.
value_ = anglocal.at(0);
220 rotationXDataForDB.
error_ = GetEntryError(rotationX);
221 rotationXDataForDB.
quality_ = rotationX->quality();
222 data.angx_ = rotationXDataForDB;
224 const Entry*
const rotationY = theCoordinateEntryVector.at(4);
226 rotationYDataForDB.
name_ = rotationY->name();
227 rotationYDataForDB.
dim_type_ = rotationY->type();
228 rotationYDataForDB.
value_ = anglocal.at(1);
229 rotationYDataForDB.
error_ = GetEntryError(rotationY);
230 rotationYDataForDB.
quality_ = rotationY->quality();
231 data.angy_ = rotationYDataForDB;
233 const Entry*
const rotationZ = theCoordinateEntryVector.at(5);
235 rotationZDataForDB.
name_ = rotationZ->name();
236 rotationZDataForDB.
dim_type_ = rotationZ->type();
237 rotationZDataForDB.
value_ = anglocal.at(2);
238 rotationZDataForDB.
error_ = GetEntryError(rotationZ);
239 rotationZDataForDB.
quality_ = rotationZ->quality();
240 data.angz_ = rotationZDataForDB;
244 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting entry " << std::endl;
247 extraEntry.
name_ = myDBExtraEntry->name();
248 extraEntry.
dim_type_ = myDBExtraEntry->type();
249 extraEntry.
value_ = myDBExtraEntry->value();
250 extraEntry.
error_ = myDBExtraEntry->sigma();
252 extraEntry.
value_ *= 1._m;
253 extraEntry.
error_ *= 1._m;
255 extraEntry.
quality_ = myDBExtraEntry->quality();
256 data.extraEntries_.emplace_back(extraEntry);
257 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO done extra entry " << extraEntry.
name_ << std::endl;
265 if (
entry->quality() > 0) {
268 return entry->sigma();
274 if (entry1 == entry2)
275 return GetEntryError(entry1);
277 if (entry1->quality() > 0 && entry2->quality() > 0) {
289 static std::vector<OpticalObject*>::const_iterator ite;
290 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
291 if ((*ite)->type() ==
"system")
296 std::cout <<
"@@@@ OPTALIGNINFO TO BE WRITTEN TO DB " <<
data << std::endl;
309 static std::vector<OpticalObject*>::const_iterator ite;
310 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
311 if ((*ite)->type() ==
"system")
313 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite) << std::endl;
314 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite)->getCmsswID() << std::endl;
316 if ((*ite)->getCmsswID() > 0) {
317 std::cout <<
" cal fill alignments " << std::endl;
318 alignments->
m_align.push_back(*(GetAlignInfoFromOptO(*ite)));
319 std::cout <<
" fill alignments " << std::endl;
322 alignmentErrors->
m_alignError.push_back(*(GetAlignInfoErrorFromOptO(*ite)));
323 std::cout <<
"CocoaDBMgr::BuildAlignments add alignmentError " << alignmentErrors->
m_alignError.size()
329 std::cout <<
"CocoaDBMgr::BuildAlignments end with n alignment " << alignments->
m_align.size()
330 <<
" n alignmentError " << alignmentErrors->
m_alignError.size() << std::endl;
331 return std::pair<Alignments*, AlignmentErrorsExtended*>(alignments, alignmentErrors);
337 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO " << opto->
name() << std::endl;
343 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO buildalign" << opto->
name() << std::endl;
346 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO alig built " << opto->
name() << std::endl;
355 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoErrorFromOptO " << opto->
name() << std::endl;
365 CLHEP::HepMatrix errm(3, 3);
367 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptOfill errm " << opto->
name() << std::endl;
368 errm(0, 0) = GetEntryError(theCoordinateEntryVector[0]) * 1._m;
369 errm(1, 1) = GetEntryError(theCoordinateEntryVector[1]) * 1._m;
370 errm(2, 2) = GetEntryError(theCoordinateEntryVector[2]) * 1._m;
371 errm(0, 1) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[1]) * 1._m;
372 errm(0, 2) = GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[2]) * 1._m;
373 errm(1, 2) = GetEntryError(theCoordinateEntryVector[1], theCoordinateEntryVector[2]) * 1._m;
378 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errm filled" << opto->
name() << std::endl;
382 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errms filled " << opto->
name() << std::endl;
386 std::cout << alignError <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO error built " << opto->
name() << std::endl;