26 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h"
27 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
45 : theDim(measdim), theType(
type), theName(
name) {
63 std::vector<ALIstring> wordlist;
70 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() << std::endl <<
" MEASURED OPTO NAMES: ";
71 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
72 copy(wordlist.begin(), wordlist.end(), outs);
77 for (
unsigned int ii = 0;
ii <
dim();
ii++) {
92 std::vector<std::string>::const_iterator site;
93 std::vector<ALIstring> wordlist;
95 for (site = objNames.begin(); site != objNames.end(); ++site) {
96 if (site != objNames.begin())
97 wordlist.push_back(
"&");
98 wordlist.push_back(*site);
103 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() <<
" " << measInfo << std::endl
104 <<
" MEASURED OPTO NAMES: ";
112 for (
unsigned int ii = 0;
ii <
dim();
ii++) {
114 wordlist.push_back((measInfo.
values_)[
ii].name_);
118 std::cout <<
"Measurement::constructFromOA: meas value " <<
ii <<
" " <<
dim() <<
" = simulated_value"
121 wordlist.push_back(
"simulated_value");
124 std::cout <<
"Measurement::constructFromOA: meas value " <<
ii <<
" " <<
dim() <<
" = "
125 << measInfo.
values_.size() << std::endl;
131 wordlist.push_back(ctmp);
137 wordlist.push_back(ctmp);
175 int NPairs = (
wl.size() + 1) / 2;
178 for (
int ii = 0;
ii < NPairs;
ii++) {
183 std::cerr <<
"!!! Measured Optical Objects should be separated by '&', not by" <<
wl[2 *
ii + 1] << std::endl;
194 std::cout <<
"@@ Filling coordinate " << coor << std::endl;
202 if (wordlist.size() != 3) {
204 std::cerr <<
" Incorrect format for Measurement value:" << std::endl;
205 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
206 copy(wordlist.begin(), wordlist.end(), outs);
207 std::cout << std::endl <<
"There should be three words: name value sigma " << std::endl;
214 std::cerr <<
"Trying to fill Measurement coordinate No " << coor <<
" but the dimension is " <<
theDim << std::endl;
227 if (wordlist[1] ==
ALIstring(
"simulated_value")) {
231 std::cerr <<
"!!! parameter for value not found: " << wordlist[1].c_str() << std::endl;
238 val = atof(wordlist[1].c_str());
249 std::cerr <<
"!!! parameter for sigma not found: " << wordlist[2].c_str() << std::endl;
255 sig = atof(wordlist[2].c_str());
269 std::cout <<
"@@ Filling coordinate " << coor << std::endl;
276 std::cerr <<
"Trying to fill Measurement coordinate No " << coor <<
" but the dimension is " <<
theDim << std::endl;
294 sig = oaParam->
sigma();
310 std::vector<ALIstring>::iterator vsite;
317 int i2p = (*vsite).find_first_of(twopoints, 3 *
ii);
321 std::cerr << i2p <<
"!!! Bad position of '..' in reference ALIstring: " << (*vsite).c_str() << std::endl;
331 if (Ntwopoints != 0) {
337 ALIint colon = referenceOptO.find(
':');
340 std::cout <<
"colon in reference OptO name " << colon << referenceOptO.c_str() << std::endl;
342 referenceOptO = referenceOptO.substr(0, colon);
346 std::cout <<
"Measurement::buildOptOList: OptO in Measurement: " << OptOitem->
name() << std::endl;
350 std::cerr <<
"!!! Error in Measurement: can't find Optical Object " << (*vsite).c_str() << std::endl;
362 std::vector<OpticalObject*>::const_iterator vocite;
374 std::cout <<
"Measurement::addAffectingEntriesFromOptO: OptO taking part in Measurement: " << optoP->
name()
377 std::vector<Entry*>::const_iterator vecite;
378 std::vector<Entry*>::const_iterator fvecite;
387 std::cout <<
"Entry that may affect Measurement: " << (*vecite)->name() << std::endl;
395 std::cout <<
"Entry that may affect Measurement: " << (*vecite)->name() << std::endl;
398 if (optoP->
parent() !=
nullptr) {
410 int pos1st = firstref.length();
412 for (
int ii = 0;
ii < Ntwopoints;
ii++) {
413 pos1st = firstref.find_last_of(
slash, pos1st - 1);
419 std::cout <<
"before change ref: " << ref <<
" 1ref " << firstref << std::endl;
421 ref.replace(0, (Ntwopoints * 3) - 1, firstref, 0, pos1st);
423 std::cout <<
"after change ref: " << ref <<
" 1ref " << firstref << std::endl;
429 <<
"@@@ Start calculation of simulated value of " << meas->
type() <<
" Measurement " << meas->
name()
444 ALIVRMLMgr::getInstance().newLightRay();
470 std::cerr <<
" Detector can not make measurement with these optical objects " << std::endl;
477 std::vector<ALIstring>::const_iterator vsite;
491 std::vector<ALIdouble> deriv;
500 <<
"%%% Derivative w.r.t. entry " <<
entry->name() <<
": displacement = " << displacement << std::endl;
507 entry->displace(displacement);
510 std::cout <<
"Get simulated value for displacement " << displacement << std::endl;
518 std::cout <<
"iteration " << count_itera <<
" COOR " <<
ii <<
" difference ="
522 << displacement <<
" sum derivatives = " << sumderiv << std::endl;
529 if (count_itera >= 100) {
530 std::cerr <<
"EXITING: too many iterations in derivative, displacement is " << displacement
531 <<
" sum of derivatives is " << sumderiv << std::endl;
546 <<
"### DERIVATIVE: " << deriv[
ii] << std::endl;
551 entry->OptOCurrent()->resetGlobalCoordinates();
569 std::vector<ALIstring>::const_iterator vscite =
571 ALIint colon = (*vscite).find(
':');
574 behav = (*vscite).substr(colon + 1, (*vscite).size());
586 std::vector<OpticalObject*>::const_iterator vocite;
588 if (*vocite == Popto) {
590 std::cerr <<
" ERROR in getPreviousOptO of measurement " <<
name() << std::endl;
591 std::cerr <<
" OptO " << Popto->
name() <<
" is the first one " << std::endl;
594 return *(vocite - 1);
599 std::cerr <<
" ERROR in getPreviousOptO of measurement " <<
name() << std::endl;
600 std::cerr <<
" OptO " << Popto->
name() <<
" not found " << std::endl;
606 if (
wl.size() != 3) {
607 std::cerr <<
"!!!EXITING: reading DATE of measurements set: it must have three words, it is though " << std::endl;
610 }
else if (
wl[0] !=
"DATE:") {
611 std::cerr <<
"!!!EXITING: reading DATE of measurements set: first word must be 'DATE:', it is though " << std::endl;
642 std::vector<std::string> wordlist;
644 ALIuint nOptos = optolist.size();
648 if (
ii != nOptos - 1)
649 wordlist.push_back(
"&");
655 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() << std::endl <<
" MEASURED OPTO NAMES: ";
656 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
657 copy(wordlist.begin(), wordlist.end(), outs);
671 <<
" !!! Error in your code, you cannot ask for the name of the Measurement before the OptONameList is build "
675 std::vector<ALIstring>::iterator vsite = (
_OptONameList.end() - 1);