6 #include <DD4hep/DD4hepUnits.h>
63 throw cms::Exception(
"CocoaDBMgr::DumpCocoaResults DB not available");
75 "OpticalAlignmentsRcd");
78 <<
" current " << myDbService->
currentTime() <<
" end " << myDbService->
endOfTime() << std::endl;
84 "OpticalAlignmentsRcd");
96 std::cout <<
"OpticalAlignmentsRcd WRITTEN TO DB : " << nrcd << std::endl;
101 std::pair<Alignments*, AlignmentErrorsExtended*> dtali =
BuildAlignments(
true);
106 nrcd = dt_Alignments->
m_align.size();
117 std::cout <<
"DTAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
122 &(*dt_AlignmentErrors), myDbService->
beginOfTime(), myDbService->
endOfTime(),
"DTAlignmentErrorExtendedRcd");
125 &(*dt_AlignmentErrors), appendTime,
"DTAlignmentErrorExtendedRcd");
128 std::cout <<
"DTAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
131 std::pair<Alignments*, AlignmentErrorsExtended*> cscali =
BuildAlignments(
false);
136 nrcd = csc_Alignments->
m_align.size();
144 std::cout <<
"CSCAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
151 "CSCAlignmentErrorExtendedRcd");
154 &(*csc_AlignmentErrors), appendTime,
"CSCAlignmentErrorExtendedRcd");
157 std::cout <<
"CSCAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
169 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO " << opto->
name();
177 CLHEP::HepRotation parentRmGlobInv = inverseOf(opto->
parent()->
rmGlob());
178 centreLocal = parentRmGlobInv * centreLocal;
181 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting coord ";
182 if (theCoordinateEntryVector.size() == 6) {
183 const Entry*
const translationX = theCoordinateEntryVector.at(0);
185 translationXDataForDB.
name_ = translationX->
name();
190 data.x_ = translationXDataForDB;
192 const Entry*
const translationY = theCoordinateEntryVector.at(1);
194 translationYDataForDB.
name_ = translationY->
name();
199 data.y_ = translationYDataForDB;
201 const Entry*
const translationZ = theCoordinateEntryVector.at(2);
203 translationZDataForDB.
name_ = translationZ->
name();
208 data.z_ = translationZDataForDB;
212 if (anglocal.size() == 3) {
213 const Entry*
const rotationX = theCoordinateEntryVector.at(3);
215 rotationXDataForDB.
name_ = rotationX->
name();
217 rotationXDataForDB.
value_ = anglocal.at(0);
220 data.angx_ = rotationXDataForDB;
222 const Entry*
const rotationY = theCoordinateEntryVector.at(4);
224 rotationYDataForDB.
name_ = rotationY->
name();
226 rotationYDataForDB.
value_ = anglocal.at(1);
229 data.angy_ = rotationYDataForDB;
231 const Entry*
const rotationZ = theCoordinateEntryVector.at(5);
233 rotationZDataForDB.
name_ = rotationZ->
name();
235 rotationZDataForDB.
value_ = anglocal.at(2);
238 data.angz_ = rotationZDataForDB;
242 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting entry " << std::endl;
245 extraEntry.
name_ = myDBExtraEntry->name();
246 extraEntry.
dim_type_ = myDBExtraEntry->type();
247 extraEntry.
value_ = myDBExtraEntry->value();
248 extraEntry.
error_ = myDBExtraEntry->sigma();
253 extraEntry.
quality_ = myDBExtraEntry->quality();
254 data.extraEntries_.emplace_back(extraEntry);
255 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO done extra entry " << extraEntry.
name_ << std::endl;
263 if (
entry->quality() > 0) {
266 return entry->sigma();
272 if (entry1 == entry2)
287 static std::vector<OpticalObject*>::const_iterator ite;
288 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
289 if ((*ite)->type() ==
"system")
294 std::cout <<
"@@@@ OPTALIGNINFO TO BE WRITTEN TO DB " <<
data << std::endl;
307 static std::vector<OpticalObject*>::const_iterator ite;
308 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
309 if ((*ite)->type() ==
"system")
311 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite) << std::endl;
312 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite)->getCmsswID() << std::endl;
314 if ((*ite)->getCmsswID() > 0) {
315 std::cout <<
" cal fill alignments " << std::endl;
317 std::cout <<
" fill alignments " << std::endl;
321 std::cout <<
"CocoaDBMgr::BuildAlignments add alignmentError " << alignmentErrors->
m_alignError.size()
327 std::cout <<
"CocoaDBMgr::BuildAlignments end with n alignment " << alignments->
m_align.size()
328 <<
" n alignmentError " << alignmentErrors->
m_alignError.size() << std::endl;
329 return std::pair<Alignments*, AlignmentErrorsExtended*>(alignments, alignmentErrors);
335 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO " << opto->
name() << std::endl;
341 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO buildalign" << opto->
name() << std::endl;
344 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO alig built " << opto->
name() << std::endl;
353 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoErrorFromOptO " << opto->
name() << std::endl;
363 CLHEP::HepMatrix errm(3, 3);
365 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptOfill errm " << opto->
name() << std::endl;
369 errm(0, 1) =
GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[1]) *
371 errm(0, 2) =
GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[2]) *
373 errm(1, 2) =
GetEntryError(theCoordinateEntryVector[1], theCoordinateEntryVector[2]) *
379 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errm filled" << opto->
name() << std::endl;
383 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errms filled " << opto->
name() << std::endl;
387 std::cout << alignError <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO error built " << opto->
name() << std::endl;