6 #include <DD4hep/DD4hepUnits.h> 61 nrcd = optalign->opticalAlignments_.size();
63 throw cms::Exception(
"CocoaDBMgr::DumpCocoaResults DB not available");
73 <<
" current " << myDbService->
currentTime() <<
" end " << myDbService->
endOfTime() << std::endl;
86 std::cout <<
"OpticalAlignmentsRcd WRITTEN TO DB : " << nrcd << std::endl;
92 auto& dt_Alignments = dtali.first;
93 auto& dt_AlignmentErrors = dtali.second;
96 nrcd = dt_Alignments->m_align.size();
103 std::cout <<
"DTAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
105 nrcd = dt_AlignmentErrors->m_alignError.size();
108 *dt_AlignmentErrors, myDbService->
beginOfTime(),
"DTAlignmentErrorExtendedRcd");
111 *dt_AlignmentErrors, appendTime,
"DTAlignmentErrorExtendedRcd");
114 std::cout <<
"DTAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
118 auto& csc_Alignments = cscali.first;
119 auto& csc_AlignmentErrors = cscali.second;
122 nrcd = csc_Alignments->m_align.size();
129 std::cout <<
"CSCAlignmentRcd WRITTEN TO DB : " << nrcd << std::endl;
131 nrcd = csc_AlignmentErrors->m_alignError.size();
134 *csc_AlignmentErrors, myDbService->
beginOfTime(),
"CSCAlignmentErrorExtendedRcd");
137 *csc_AlignmentErrors, appendTime,
"CSCAlignmentErrorExtendedRcd");
140 std::cout <<
"CSCAlignmentErrorExtendedRcd WRITTEN TO DB : " << nrcd << std::endl;
152 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO " << opto->
name();
160 CLHEP::HepRotation parentRmGlobInv = inverseOf(opto->
parent()->
rmGlob());
161 centreLocal = parentRmGlobInv * centreLocal;
164 LogDebug(
"Alignment") <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting coord ";
165 if (theCoordinateEntryVector.size() == 6) {
166 const Entry*
const translationX = theCoordinateEntryVector.at(0);
168 translationXDataForDB.
name_ = translationX->
name();
173 data.x_ = translationXDataForDB;
175 const Entry*
const translationY = theCoordinateEntryVector.at(1);
177 translationYDataForDB.
name_ = translationY->
name();
182 data.y_ = translationYDataForDB;
184 const Entry*
const translationZ = theCoordinateEntryVector.at(2);
186 translationZDataForDB.
name_ = translationZ->
name();
191 data.z_ = translationZDataForDB;
195 if (anglocal.size() == 3) {
196 const Entry*
const rotationX = theCoordinateEntryVector.at(3);
198 rotationXDataForDB.
name_ = rotationX->
name();
200 rotationXDataForDB.
value_ = anglocal.at(0);
203 data.angx_ = rotationXDataForDB;
205 const Entry*
const rotationY = theCoordinateEntryVector.at(4);
207 rotationYDataForDB.
name_ = rotationY->
name();
209 rotationYDataForDB.
value_ = anglocal.at(1);
212 data.angy_ = rotationYDataForDB;
214 const Entry*
const rotationZ = theCoordinateEntryVector.at(5);
216 rotationZDataForDB.
name_ = rotationZ->
name();
218 rotationZDataForDB.
value_ = anglocal.at(2);
221 data.angz_ = rotationZDataForDB;
225 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO starting entry " << std::endl;
228 extraEntry.
name_ = myDBExtraEntry->name();
229 extraEntry.
dim_type_ = myDBExtraEntry->type();
230 extraEntry.
value_ = myDBExtraEntry->value();
231 extraEntry.
error_ = myDBExtraEntry->sigma();
236 extraEntry.
quality_ = myDBExtraEntry->quality();
237 data.extraEntries_.emplace_back(extraEntry);
238 std::cout <<
" CocoaDBMgr::GetOptAlignInfoFromOptO done extra entry " << extraEntry.
name_ << std::endl;
246 if (
entry->quality() > 0) {
249 return entry->sigma();
255 if (entry1 == entry2)
267 std::unique_ptr<OpticalAlignments> optalign = std::make_unique<OpticalAlignments>();
270 static std::vector<OpticalObject*>::const_iterator ite;
271 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
272 if ((*ite)->type() ==
"system")
275 optalign->opticalAlignments_.push_back(
data);
277 std::cout <<
"@@@@ OPTALIGNINFO TO BE WRITTEN TO DB " <<
data << std::endl;
285 std::unique_ptr<Alignments> alignments = std::make_unique<Alignments>();
286 std::unique_ptr<AlignmentErrorsExtended> alignmentErrors = std::make_unique<AlignmentErrorsExtended>();
290 static std::vector<OpticalObject*>::const_iterator ite;
291 for (ite = optolist.begin(); ite != optolist.end(); ++ite) {
292 if ((*ite)->type() ==
"system")
294 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite) << std::endl;
295 std::cout <<
"CocoaDBMgr::BuildAlignments getCmsswID " << (*ite)->getCmsswID() << std::endl;
297 if ((*ite)->getCmsswID() > 0) {
298 std::cout <<
" cal fill alignments " << std::endl;
300 std::cout <<
" fill alignments " << std::endl;
304 std::cout <<
"CocoaDBMgr::BuildAlignments add alignmentError " << alignmentErrors->m_alignError.size()
310 std::cout <<
"CocoaDBMgr::BuildAlignments end with n alignment " << alignments->m_align.size()
311 <<
" n alignmentError " << alignmentErrors->m_alignError.size() << std::endl;
319 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO " << opto->
name() << std::endl;
325 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO buildalign" << opto->
name() << std::endl;
328 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO alig built " << opto->
name() << std::endl;
337 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoErrorFromOptO " << opto->
name() << std::endl;
347 CLHEP::HepMatrix errm(3, 3);
349 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptOfill errm " << opto->
name() << std::endl;
353 errm(0, 1) =
GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[1]) *
355 errm(0, 2) =
GetEntryError(theCoordinateEntryVector[0], theCoordinateEntryVector[2]) *
357 errm(1, 2) =
GetEntryError(theCoordinateEntryVector[1], theCoordinateEntryVector[2]) *
363 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errm filled" << opto->
name() << std::endl;
367 std::cout <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO errms filled " << opto->
name() << std::endl;
371 std::cout << alignError <<
"@@@ CocoaDBMgr::GetAlignInfoFromOptO error built " << opto->
name() << std::endl;
const CLHEP::Hep3Vector & centreGlob() const
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
const ALIstring & name() const
AlignTransformErrorExtended * GetAlignInfoErrorFromOptO(OpticalObject *opto)
static ALIMatrix * GetAtWAMatrix()
cond::Time_t beginOfTime() const
static std::vector< OpticalObject * > & OptOList()
const ALIstring & name() const
static GlobalOptionMgr * getInstance()
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
const std::vector< Entry * > & ExtraEntryList() const
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
static CocoaDBMgr * instance
unsigned long long Time_t
std::unique_ptr< OpticalAlignments > BuildOpticalAlignments()
std::vector< double > getLocalRotationAngles(const std::vector< Entry *> &entries) const
bool isNewTagRequest(const std::string &recordName)
cond::Time_t currentTime() const
const AlgebraicSymMatrix33 matrix() const
const std::vector< Entry * > & CoordinateEntryList() const
AlignTransform * GetAlignInfoFromOptO(OpticalObject *opto)
double GetEntryError(const Entry *entry)
OpticalAlignInfo GetOptAlignInfoFromOptO(OpticalObject *opto)
cond::Time_t endOfTime() const
const CLHEP::HepRotation & rmGlob() const
static CocoaDBMgr * getInstance()
const ALIstring & type() const
std::pair< std::unique_ptr< Alignments >, std::unique_ptr< AlignmentErrorsExtended > > BuildAlignments(bool bDT)
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
char data[epos_bytes_allocation]
const OpticalObject * parent() const
const ALIstring & type() const
const ALIuint getCmsswID() const