CMS 3D CMS Logo

Model.cc
Go to the documentation of this file.
1 // COCOA class implementation file
2 //Id: Model.cc
3 //CAT: Model
4 //
5 // History: v1.0
6 // Pedro Arce
7 
9 
22 //t#include "Alignment/CocoaModel/interface/MeasurementDiffAngle.h"
23 //t#include "Alignment/CocoaModel/interface/MeasurementCentreEntry.h"
28 //#include "Alignment/Scan/interface/ScanMgr.h"
32 
35 
37 
38 #include <cstdlib>
39 #include <cctype>
40 //#include <algo.h>
41 #include <cassert>
42 #include <ctime>
43 
44 #include <algorithm>
45 
46 #ifdef OS_OSPACE_STD_NAMESPACE
47 using namespace os_std;
48 #endif
49 
50 //using namespace os_std;
51 
52 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
53 Model* Model::theInstance = nullptr;
54 //map< ALIstring, ALIdouble, std::less<ALIstring> > Model::theParameters;
55 std::vector<std::vector<ALIstring> > Model::theOptODictionary;
56 //-map< ALIstring, int, std::less<ALIstring> > Model::theStandardMeasurerTypes;
57 //-multimap< ALIstring, OpticalObject*, std::less<ALIstring> > Model::_OptOtree;
58 //map< ALIstring, OpticalObject*, std::less<ALIstring> > Model::theOptOlist;
59 std::vector<OpticalObject*> Model::theOptOList;
60 std::vector<Entry*> Model::theEntryVector;
61 std::vector<Measurement*> Model::theMeasurementVector;
62 std::vector<ALIdouble> Model::theParamFittedSigmaVector;
63 std::map<ALIstring, ALIdouble, std::less<ALIstring> > Model::theParamFittedValueDisplacementMap;
64 std::vector<OpticalObject*> Model::theOptOsToCopyList;
65 std::vector<OpticalObject*>::const_iterator Model::theOptOsToCopyListIterator;
68 std::vector<ALIdouble> Model::CMSLinkRangeDetValue;
69 ALIstring Model::theSDFName = "SystemDescription.txt";
70 ALIstring Model::theMeasFName = "Measurements.txt";
71 ALIstring Model::theReportFName = "report.out";
72 ALIstring Model::theMatricesFName = "matrices.out";
73 //struct tm Model::theMeasurementsTime = struct tm();
74 // struct tm Model::theMeasurementsTime;
77 std::vector<OpticalAlignInfo> Model::theOpticalAlignments;
78 
79 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
80 //@@ Gets the only instance of Model
81 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
83  if (!theInstance) {
84  theInstance = new Model;
85  }
86  return *theInstance;
87 }
88 
89 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
90 //@@ Constructor
91 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
93  // theMeasurementsTime = clock();
94 }
95 
96 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
97 //@@ Reads the System Description file section by section and acts accordingly
98 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
101 
102  ALIint data_reading = 0; // variable to identify the first line of section SYSTEM_TREE_DATA
103 
104  //---------- Open the system description file
106 
107  //----------- Set section titles
108  std::vector<ALIstring> SectionTitle;
109  SectionTitle.push_back(ALIstring("GLOBAL_OPTIONS"));
110  SectionTitle.push_back(ALIstring("PARAMETERS"));
111  SectionTitle.push_back(ALIstring("SYSTEM_TREE_DESCRIPTION"));
112  SectionTitle.push_back(ALIstring("SYSTEM_TREE_DATA"));
113  SectionTitle.push_back(ALIstring("MEASUREMENTS"));
114  SectionTitle.push_back(ALIstring("REPORT.OUT"));
115  std::vector<ALIstring>::iterator SectionTitleIterator;
116 
117  //---------------------------------------- Loops lines in SDF file
118  std::vector<ALIstring> wordlist;
119  ALIint InSectionNo = -1;
120  ALIint currentSectionNo = -1;
121  while (!filein.eof()) {
122  if (!filein.getWordsInLine(wordlist))
123  break; //----- Read line
124  assert(!wordlist.empty());
125 
126  //----- checking
127  if (ALIUtils::debug > 99) {
128  ALIUtils::dumpVS(wordlist, " ", std::cout);
129  }
130 
131  //---------- Get in which section the current line is and act accordingly
132  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
133  //@@@ ---------- Check if word is start of section
134  SectionTitleIterator = find(SectionTitle.begin(), SectionTitle.end(), *wordlist.begin());
135  if (SectionTitleIterator != SectionTitle.end()) {
136  //---------- Check that previous sections are correct
137  currentSectionNo = SectionTitleIterator - SectionTitle.begin();
138  if (currentSectionNo != InSectionNo + 1) {
139  if (currentSectionNo != sectReportOut) {
141  std::cerr << "BAD ORDER OF SECTIONS, reading section " << *SectionTitleIterator << std::endl
142  << " currentSectionNo = " << currentSectionNo << " InSectionNo = " << InSectionNo << std::endl
143  << " --------- Please see documentation ---------- " << std::endl;
144  exit(1);
145  }
146  } else {
147  if (currentSectionNo != sectReportOut) {
148  InSectionNo++;
149  }
150  }
151  if (currentSectionNo == sectMeasurements) {
152  SetValueDisplacementsFromReportOut();
153  }
154 
155  if (ALIUtils::debug >= 4)
156  std::cout << std::endl << "START OF SECTION: " << currentSectionNo << " " << *SectionTitleIterator << std::endl;
157 
158  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
159  //@@@ ---------- Reading GLOBAL_OPTIONS section
160  } else if (currentSectionNo == sectGlobalOptions) {
161  //- std::cout << "utilsdebug " << ALIUtils::debug << std::endl;
162  //-------- Check format of line read
163  //----- Two words
164  if (wordlist.size() == 2) {
165  //----- Second word is number
166  int isnumber = ALIUtils::IsNumber(wordlist[1]);
167  if (!isnumber && wordlist[0] != ALIstring("external_meas")) {
169  std::cerr << ": EXPECTING A NUMBER, FOUND: " << wordlist[1] << std::endl;
170  exit(2);
171  }
172 
174  gomgr->setGlobalOption(wordlist[0], ALIUtils::getFloat(wordlist[1]), ALIFileIn::getInstance(Model::SDFName()));
175 
176  //-or GlobalOptions.insert(std::pair<const ALIstring, ALIdouble>(wordlist[0] , atof(wordlist[1].c_str()) ) );
177 
178  if (ALIUtils::debug >= 1) {
179  ALIUtils::dumpVS(wordlist, "GLOBAL_OPTION: ", std::cout);
180  }
181 
182  } else {
183  std::cout << "error < 1" << std::endl;
185  std::cerr << ": IN GLOBAL_OPTIONS section TWO-WORD LINES ARE EXPECTED " << std::endl;
186  exit(2);
187  }
188 
189  //------- Set dimension factors for lengths and angles
194 
195  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
196  //@@@ ---------- Reading PARAMETERS section
197  } else if (currentSectionNo == sectParameters ||
198  currentSectionNo ==
199  -1) { // Allow parameters in first lines (for easy study of different parameter values)
200 
201  //---------- Check format of line read
202  //----- Two words
203  if (wordlist.size() == 2) {
204  /* now checked in ParameterMgr
205  //----- Second is number
206  int isnumber = ALIUtils::IsNumber( wordlist[1] );
207  if( !isnumber ) {
208  ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
209  std::cerr << ": EXPECTING A NUMBER, FOUND: " << wordlist[1] << std::endl;
210  exit(2);
211  } */
212 
213  //old---------- Create parameter with value read (or overwrite existing value)
214  //---------- Create parameter with value read if parameter does not exist yet
216  parmgr->addParameter(wordlist[0], wordlist[1]);
217 
218  } else if (wordlist.size() == 3) {
219  if (wordlist[1] != "seed") {
221  std::cerr << ": For a three-word parameter line, second has to be 'seed', it is " << wordlist[1]
222  << std::endl;
223  exit(1);
224  }
225 
226  if (wordlist[0] == "gauss" || wordlist[0] == "flat") {
228  } else {
230  std::cerr << ": For a three-word parameter line, first has to be 'gauss' or 'flat', it is " << wordlist[0]
231  << std::endl;
232  exit(1);
233  }
234  } else if (wordlist.size() == 4) {
235  if (wordlist[0] == "gauss") {
236  ParameterMgr::getInstance()->addRandomGaussParameter(wordlist[1], wordlist[2], wordlist[3]);
237  } else if (wordlist[0] == "flat") {
238  ParameterMgr::getInstance()->addRandomFlatParameter(wordlist[1], wordlist[2], wordlist[3]);
239  } else {
241  std::cerr << ": For a four-word parameter line, first has to be 'gauss' or 'flat', it is " << wordlist[0]
242  << std::endl;
243  exit(1);
244  }
245  } else {
247  std::cerr << ": IN PARAMETERS section TWO-WORD-LINES ARE EXPECTED " << std::endl;
248  ALIUtils::dumpVS(wordlist, " ");
249  exit(2);
250  }
251 
252  //print it out
253  if (ALIUtils::debug >= 1) {
254  ALIUtils::dumpVS(wordlist, "PARAMETERS: ", std::cout);
255  }
256 
257  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
258  //@@@ ---------- Reading SYSTEM_TREE_DESCRIPTION section
259  } else if (currentSectionNo == sectSystemTreeDescription) {
260  //---------- Convert the numbers found in list of components (e.g. 2 laser -> laser laser )
261  //----- Backup wordlist and erase it
262  std::vector<ALIstring> wordlist2 = wordlist;
263  std::vector<ALIstring>::iterator vsite;
264  ALIint wsiz = wordlist.size();
265  for (ALIint ii = 0; ii < wsiz; ii++) {
266  wordlist.pop_back();
267  }
268  //----- Loop objects looking for numbers to convert
269  for (vsite = wordlist2.begin(); vsite != wordlist2.end(); ++vsite) {
270  if (ALIUtils::IsNumber(*vsite)) {
271  int nOpticalObjects = atoi((*vsite).c_str());
272  //----- If number is 1 it is not necessary
273  if (nOpticalObjects == 1) {
274  if (ALIUtils::debug >= 0)
275  std::cerr << "WARNING: in line " << ALIFileIn::getInstance(Model::SDFName()).nline()
276  << " number of repeated OpticalObjects = 1. Please avoid the numbering " << std::endl;
277  //- wordlist.erase( wordlist.begin() + (vsite-wordlist2.begin()) );
278  } else {
279  //----- The number cannot be the last in the list and you cannot put two numbers together
280  if (vsite + 1 == wordlist.end() || ALIUtils::IsNumber(*(vsite + 1))) {
282  std::cerr << "NUMBER SHOULD BE FOLLOWED BY an OpticalObject type" << std::endl;
283  exit(2);
284  }
285  //----- Right format: convert
286  //--- Substitute the number by the object type in wordlist
287  //- *( wordlist.begin() + (vsite-wordlist2.begin()) ) = *(vsite+1);
288  //--- Add n-1 object types to wordlist (the nth object will be added as the object taht goes after the number)
289  for (ALIint ii = 0; ii < nOpticalObjects - 1; ii++) {
290  //-std::cout << ii << "inserting in wordlist " << *(vsite+1) << std::endl;
291  wordlist.push_back(*(vsite + 1));
292  }
293  }
294  } else {
295  //----- Not number, add it to wordlist
296  wordlist.push_back(*vsite);
297  }
298  }
299 
300  //---------- Dump system structure
301  if (ALIUtils::debug >= 1) {
302  ALIUtils::dumpVS(wordlist, "SYSTEM TREE DESCRIPTION: before ordering, OBJECT: ", std::cout);
303  }
304 
305  //---------- Fill the list of Optical Object with components (theOptODictionary)
306  //----- First word is 'object': new OptO
307  if (wordlist[0] == ALIstring("object")) {
308  //----- Check out repeated objects
309  std::vector<std::vector<ALIstring> >::iterator vvsite;
310  for (vvsite = theOptODictionary.begin(); vvsite != theOptODictionary.end(); ++vvsite) {
311  //- std::cout << " system" << vvsite << std::endl;
312 
313  if (*((*vvsite).begin()) == wordlist[1]) {
315  std::cerr << "SYSTEM_TREE_DESCRIPTION: REPEATED object " << *((*vvsite).begin())
316  << " ( NOT ALLOWED NEITHER WITH EQUAL NOR WITH DIFFERENT COMPONENTS)" << std::endl;
317  exit(1);
318  }
319  }
320  //------- Add an item to theOptODictionary
321  std::vector<ALIstring> vstemp;
322  copy(wordlist.begin() + 1, wordlist.end(), back_inserter(vstemp));
323  Model::OptODictionary().push_back(vstemp);
324  } else {
325  //----- First word is not 'object': add to previous OptO
326  if (OptODictionary().empty()) {
328  std::cerr << "SYSTEM_TREE_DESCRIPTION section: FIRST LINE SHOULD START WITH 'object'" << std::endl;
329  exit(2);
330  }
331  copy(wordlist.begin(), wordlist.end(), back_inserter(*(OptODictionary().end() - 1)));
332  }
333 
334  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
335  //---------------------------------- Reading SYSTEM_TREE_DATA section
336  } else if (currentSectionNo == sectSystemTreeData) {
337  //---------- First line of data:
338  if (!data_reading) {
339  // ALIint dictsize = theOptODictionary.size();
340  //------- Reorder theOptODictionary
341  std::vector<std::vector<ALIstring> > OptODictionary2;
342  reorderOptODictionary("system", OptODictionary2);
343  if (OptODictionary2.empty()) {
344  std::cerr << "SYSTEM_TREE_DESCRIPTION section: no object 'system' found " << std::endl;
345  exit(9);
346  }
347  //------- We start reordering with 'system', therefore if 'system' is not the top most object, the objects not hanging from it would not be considered
348  //---- Check if all the objects are here
349  std::vector<std::vector<ALIstring> >::const_iterator vvscite, vvscite2;
350  // ALIint dictsizen = 0;
351  for (vvscite = theOptODictionary.begin(); vvscite != theOptODictionary.end(); ++vvscite) {
352  ALIbool ofound = false;
353  for (vvscite2 = OptODictionary2.begin(); vvscite2 != OptODictionary2.end(); ++vvscite2) {
354  if (*((*vvscite).begin()) == *((*vvscite2).begin())) {
355  ofound = true;
356  break;
357  }
358  }
359  if (!ofound) {
360  std::cerr << "!!!SYSTEM_TREE_DESCRIPTION section: object " << *((*vvscite).begin())
361  << " is not hanging from object 'system' " << std::endl;
362  for (vvscite = OptODictionary().begin(); vvscite != OptODictionary().end(); ++vvscite) {
363  std::vector<ALIstring> ptemp = *vvscite;
364  ALIUtils::dumpVS(ptemp, "OBJECT ", std::cerr);
365  }
366  exit(9);
367  }
368  }
369  theOptODictionary = OptODictionary2;
370 
371  data_reading = 1;
372 
373  //------- Dump ordered OptOs
374  if (ALIUtils::debug >= 3) {
375  std::vector<std::vector<ALIstring> >::iterator itevs;
376  for (itevs = OptODictionary().begin(); itevs != OptODictionary().end(); ++itevs) {
377  std::vector<ALIstring> ptemp = *itevs;
378  ALIUtils::dumpVS(ptemp, " SYSTEM TREE DESCRIPTION: after ordering: OBJECT ", std::cout);
379  }
380  }
381 
382  //---------- Create OpticalObject 'system' (first OpticalObject object):
383  //---------- it will create its components and recursively all the System Tree of Optical Objects
384  if (wordlist[0] != "system") {
385  std::cerr << "SYSTEM_TREE_DATA section: object 'system' is not the first one " << std::endl;
386  exit(9);
387  }
388 
389  OpticalObject* OptOsystem = new OpticalObject(nullptr, "system", wordlist[1], false);
390  OptOsystem->construct();
391  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
392  // theOptOlist[OptOsystem->name()] = OptOsystem;
393  theOptOList.push_back(OptOsystem);
394 
395  } else {
396  //----------- All system is read by the Optical Objects, it should not reach here
398  std::cerr << " STILL SOME LINES AFTER ALL SYSTEM TREE IS READ!!!" << std::endl;
399  exit(9);
400  }
401 
402  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
403  //----------------------------------- Reading MEASUREMENTS section
404  } else if (currentSectionNo == sectMeasurements) {
405  //---------- Create Measurement with appropiate dimension
406  Measurement* meastemp = nullptr;
407  ALIstring measType = wordlist[0];
408  ALIstring measName;
409  if (wordlist.size() == 2) {
410  measName = wordlist[1];
411  wordlist.pop_back();
412  } else {
413  measName = "";
414  }
415  if (measType == ALIstring("SENSOR2D")) {
416  meastemp = new MeasurementSensor2D(2, measType, measName);
417  meastemp->setConversionFactor(wordlist);
418  meastemp->construct();
419  } else if (measType == ALIstring("DISTANCEMETER3DIM")) {
420  meastemp = new MeasurementDistancemeter3dim(1, measType, measName);
421  meastemp->setConversionFactor(wordlist);
422  meastemp->construct();
423  } else if (measType == ALIstring("DISTANCEMETER") || measType == ALIstring("DISTANCEMETER1DIM")) {
424  meastemp = new MeasurementDistancemeter(1, measType, measName);
425  meastemp->setConversionFactor(wordlist);
426  meastemp->construct();
427  } else if (measType == ALIstring("TILTMETER")) {
428  meastemp = new MeasurementTiltmeter(1, measType, measName);
429  meastemp->setConversionFactor(wordlist);
430  meastemp->construct();
431  } else if (measType == ALIstring("COPS")) {
432  meastemp = new MeasurementCOPS(4, measType, measName);
433  meastemp->setConversionFactor(wordlist);
434  meastemp->construct();
435  } else if (measType == ALIstring("DIFFCENTRE")) {
436  //t meastemp = new MeasurementDiffCentre( 1, measType, measName );
437  meastemp->construct();
438  } else if (measType == ALIstring("DIFFANGLE")) {
439  //t meastemp = new MeasurementDiffAngle( 2, measType, measName );
440  meastemp->construct();
441  } else if (measType == ALIstring("DIFFENTRY")) {
442  meastemp = new MeasurementDiffEntry(1, measType, measName);
443  meastemp->construct();
444  } else if (measType == ALIstring("measurements_from_file") || measType == ALIstring("@measurements_from_file")) {
445  new CocoaDaqReaderText(wordlist[1]);
446  //m Measurement::setMeasurementsFileName( wordlist[1] );
447  //m if ( ALIUtils::debug >= 2) std::cout << " setting measurements_from_file " << measType << " == " << Measurement::measurementsFileName() << std::endl;
448  if (wordlist.size() == 4) {
449  Measurement::only1 = true;
450  Measurement::only1Date = wordlist[2];
451  Measurement::only1Time = wordlist[3];
452  //- std::cout << " setting Measurement::only1" << Measurement::only1 << std::endl;
453  }
454  } else if (measType == ALIstring("measurements_from_file_ROOT") ||
455  measType == ALIstring("@measurements_from_file")) {
456  new CocoaDaqReaderRoot(wordlist[1]);
457  } else if (wordlist[0] == ALIstring("correlations_from_file") ||
458  wordlist[0] == ALIstring("@correlations_from_file")) {
460  } else if (wordlist[0] == ALIstring("copy_measurements") || wordlist[0] == ALIstring("@copy_measurements")) {
461  copyMeasurements(wordlist);
462  // } else if( wordlist[0] == "scan" || wordlist[0] == "@scan" ) {
463  // ScanMgr::getInstance()->addOptOEntry( wordlist );
464  } else if (wordlist[0] == ALIstring("fittedEntries_from_file")) {
465  theFittedEntriesReader = new FittedEntriesReader(wordlist[1]);
466  if (ALIUtils::debug >= 2)
467  std::cout << " setting fittedEntries_from_file " << wordlist[0] << " == " << wordlist[1] << std::endl;
468  } else {
469  std::cerr << "Measurement:" << std::endl;
471  std::cerr << "!!! type of measurement not allowed: " << wordlist[0] << std::endl;
472  std::cerr << " Allowed types: SENSOR2D, DISTANCEMETER, DISTANCEMETER1DIM, TILTMETER, COPS, DIFFENTRY "
473  << std::endl;
474  exit(2);
475  }
476  //- meastemp->setGlobalName( wordlist[0] );
477  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
478  //@@@ ---------- Reading REPORT OUT section
479  } else if (currentSectionNo == sectReportOut) {
480  //----- It must be after global options section
481  if (InSectionNo + 1 != sectParameters) {
483  std::cerr << "BAD ORDER OF SECTIONS, reading section " << *SectionTitleIterator << std::endl
484  << " currentSectionNo = " << currentSectionNo << " InSectionNo = " << InSectionNo << std::endl
485  << " --------- Please see documentation ---------- " << std::endl;
486  exit(1);
487  }
488 
490  }
491  }
492 
493  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
494  //@@@ All system read
495  //---------- make Measurements links to their OptOs
496  if (ALIUtils::debug >= 2)
497  std::cout << std::endl << "@@@@ Building Measurements links to OptOs" << std::endl;
499 
500  if (ALIUtils::debug >= 1) {
501  std::cout << "---------- SYSTEM SUCCESFULLY READ ----------" << std::endl << std::endl;
502  }
503  filein.close();
504 
505  return;
506 }
507 
508 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
509 //@@ reorderOptODictionary: REBUILDS THE SYSTEM_TREE_DESCRIPTION SECTION 'objects'
510 //@@ (_OptODictionary) IN A HIERARCHICAL (TREE LIKE) ORDER
511 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
512 void Model::reorderOptODictionary(const ALIstring& ssearch, std::vector<std::vector<ALIstring> >& OptODictionary2) {
513  // int ALIstring_found = 0;
514  std::vector<std::vector<ALIstring> >::iterator vvsite;
515  std::vector<ALIstring>::iterator vsite;
516 
517  //---------------------------------------- Look for 'ssearch' as the first ALIstring of an OptODictionary item
518  for (vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
519  if (*((*vvsite).begin()) == ssearch) {
520  // ALIstring_found = 1;
521  OptODictionary2.push_back(*vvsite);
522 
523  //- std::cout << "VVSITE";
524  //- ostream_iterator<ALIstring> outs(std::cout,"&");
525  //- copy( (*vvsite).begin(), (*vvsite).end(), outs);
526 
527  //---------------------------------- look for components of this _OptODictionary item
528  for (vsite = (*vvsite).begin() + 1; vsite != (*vvsite).end(); ++vsite) {
529  reorderOptODictionary(*vsite, OptODictionary2);
530  }
531  break;
532  }
533  }
534 
535  /* //------- object 'system' should exist
536  if(!ALIstring_found && ssearch == "system") {
537  std::cerr << "SYSTEM_TREE_DATA section: no 'object system' found " << std::endl;
538  exit(9);
539  } */
540 }
541 
542 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
543 //@@ BuildMeasurementLinksToOptOs
544 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
546  //---------- Loop Measurements
547  std::vector<Measurement*>::const_iterator vmcite;
548  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
549  //---------- Transform for each Measurement the Measured OptO names to Measured OptO pointers
550  // (*vmcite)->buildOptOList();
551 
552  //---------- Build list of Entries that affect a Measurement
553  // (*vmcite)->buildAffectingEntryList();
554  }
555 }
556 
557 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
558 //@@ Get the value of a parameter in theParameters std::vector
559 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
562  ALIint iret = parmgr->getParameterValue(sstr, val);
563 
564  return iret;
565 }
566 
567 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
568 //@@ getOptOByName: Find an OptO name in _OptOlist and return a pointer to it
569 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
571  //---------- Look for Optical Object name in OptOList
572  std::vector<OpticalObject*>::const_iterator vocite;
573  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
574  if ((*vocite)->name() == opto_name)
575  break;
576  }
577 
578  if (vocite == OptOList().end()) {
579  //---------- If opto_name not found, exit
580  std::cerr << " LIST OF OpticalObjects " << std::endl;
581  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
582  std::cerr << (*vocite)->name() << std::endl;
583  }
584  std::cerr << "!!EXITING at getOptOByName: Optical Object " << opto_name << " doesn't exist!!" << std::endl;
585  exit(4);
586  // return (OpticalObject*)0;
587  } else {
588  //---------- If opto_name found, return pointer to it
589  if (ALIUtils::debug > 999) {
590  std::cout << opto_name.c_str() << "SSOptOitem" << (*vocite) << (*vocite)->name() << "len" << OptOList().size()
591  << std::endl;
592  }
593  return (*vocite);
594  }
595 }
596 
597 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
598 //@@ getOptOByType: Find an OptO type in _OptOList (the first one with this type)
599 //@@ and return a pointer to it
600 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
602  //---------- Look for Optical Object type in OptOList
603  std::vector<OpticalObject*>::const_iterator vocite;
604  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
605  // std::cout << "OPTOList" << (*msocite).first << std::endl;
606  if ((*vocite)->type() == opto_type)
607  break;
608  }
609 
610  if (vocite == OptOList().end()) {
611  //---------- If opto_type not found, exit
612  std::cerr << "!!EXITING at getOptOByType: Optical Object " << opto_type << " doesn't exist!!" << std::endl;
613  exit(4);
614  } else {
615  //---------- If opto_type found, return pointer to it
616  return (*vocite);
617  }
618 }
619 
620 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
621 //@@ Find an Entry name in theEntryVector and return a pointer to it
622 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
623 Entry* Model::getEntryByName(const ALIstring& opto_name, const ALIstring& entry_name) {
624  //---------- Look for Entry name type in EntryList
625  std::vector<Entry*>::const_iterator vecite;
626  for (vecite = EntryList().begin(); vecite != EntryList().end(); ++vecite) {
627  if (ALIUtils::debug >= 4)
628  std::cout << "getEntryByName: " << (*vecite)->OptOCurrent()->name() << " E " << (*vecite)->name()
629  << " Searching: " << opto_name << " E " << entry_name << std::endl;
630  //- std::cout << " optoName " << (*vecite)->OptOCurrent()->name()<< " " << (*vecite)->name() << std::endl;
631  if ((*vecite)->OptOCurrent()->name() == opto_name && (*vecite)->name() == entry_name) {
632  return *vecite;
633  }
634  }
635  //---------- Entry not found!
636  std::cerr << "!!!EXITING at getEntryByName: Entry name not found:" << opto_name << " " << entry_name << std::endl;
637  exit(1);
638 }
639 
640 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
642  //---------- Look for Optical Object name in OptOList
643  std::vector<Measurement*>::const_iterator vmcite;
644  for (vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite) {
645  if ((*vmcite)->name() == meas_name)
646  break;
647  }
648 
649  if (vmcite != theMeasurementVector.end()) {
650  //---------- If opto_name found, return pointer to it
651  return (*vmcite);
652  } else {
653  if (exists) {
654  //---------- If opto_name not found, exit
655  std::cerr << " LIST OF Measurements " << std::endl;
656  for (vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite) {
657  std::cerr << (*vmcite)->name() << std::endl;
658  }
659  std::cerr << "!!EXITING at getMeasurementByName: Measurement " << meas_name << " doesn't exist!!" << std::endl;
660  abort();
661  // return (OpticalObject*)0;
662  } else {
663  return nullptr;
664  }
665  }
666 }
667 
668 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
669 //@@ Get an OptO list of components
670 //@@ Looks the theOptODictionary item that has 'opto_type' as the first ALIstring,
671 //@@ copies this item to 'vcomponents', substracting the first ALIstring, that is the opto_type itself,
672 //@@ Returns 1 if item found, 0 if not
673 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
674 ALIbool Model::getComponentOptOTypes(const ALIstring& opto_type, std::vector<ALIstring>& vcomponents) {
675  //---------- clean std::vector in which you are going to store opto types
676  std::vector<ALIstring>::iterator vsite;
677  for (vsite = vcomponents.begin(); vsite != vcomponents.end(); ++vsite) {
678  vcomponents.pop_back();
679  }
680 
681  //---------- Looks the theOptODictionary item that has 'opto_type' as the first ALIstring,
682  ALIint ALIstring_found = 0;
683  std::vector<std::vector<ALIstring> >::iterator vvsite;
684  for (vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
685  if (*((*vvsite).begin()) == opto_type) {
686  ALIstring_found = 1;
687  //tt copies this item to 'vcomponents', substracting the first ALIstring, that is the opto_type itself,
688  vcomponents = *vvsite;
689  vcomponents.erase(vcomponents.begin());
690  break;
691  }
692  }
693 
694  if (ALIstring_found) {
695  return true;
696  } else {
697  return false;
698  }
699 }
700 
701 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
702 //@@ Get from _OptOList the list of OptOs pointers that has as parent 'opto_name'
703 //@@ and store it in vcomponents
704 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
705 ALIbool Model::getComponentOptOs(const ALIstring& opto_name, std::vector<OpticalObject*>& vcomponents) {
706  //---------- clean std::vector in which you are going to store opto pointers
707  std::vector<OpticalObject*>::iterator voite;
708  for (voite = vcomponents.begin(); voite != vcomponents.end(); ++voite) {
709  vcomponents.pop_back();
710  }
711 
712  //---------- Get OptO corresponding to name 'opto_name'
713  OpticalObject* opto = getOptOByName(opto_name);
714 
715  if (ALIUtils::debug >= 99)
716  std::cout << opto_name << "getComponentOptOs: opto " << opto << opto->name() << std::endl;
717  std::vector<OpticalObject*>::const_iterator vocite;
718 
719  if (ALIUtils::debug >= 99)
720  std::cout << "optolist size " << OptOList().size() << std::endl;
721  ALIbool opto_found = false;
722  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
723  if ((*vocite)->parent() != nullptr) {
724  // std::cout << "looping OptOlist" << (*vocite)->name() << " parent " <<(*vocite)->parent()->name() << std::endl;
725  if ((*vocite)->parent()->name() == opto_name) {
726  opto_found = true;
727  vcomponents.push_back((*vocite));
728  }
729  }
730  }
731 
732  /* std::pair<multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator,
733  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator>
734  pmmao = _OptOtree.equal_range(opto_name);
735 
736  if( pmmao.first != _OptOtree.end()) {
737  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::const_iterator socite;
738  for (socite = pmmao.first; socite != (pmmao.second); socite++) {
739  vcomponents.push_back( (*socite).second );
740  }
741  }
742  */
743  return opto_found;
744 }
745 
747 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
748 //@@ createCopyComponentList:
749 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
751  //---------- Find an OptO with the same type (YOU HAVE TO BE SURE THAT ALL EXISTING OPTOs OF THIS TYPE HAVE SAME COMPONENTS, IF NOT COPYING MAY GIVE YOU UNPREDICTABLE RESULTS)
752  if (ALIUtils::debug >= 3)
753  std::cout << "createCopyComponentList " << typ << std::endl;
754  OpticalObject* start_opto = getOptOByType(typ);
755 
756  //---------- clean list of OptOs to copy
757  theOptOsToCopyList.erase(theOptOsToCopyList.begin(), theOptOsToCopyList.end());
758 
759  //---------- Fill list of OptOs to copy
760  fillCopyComponentList(start_opto);
761  //- if(ALIUtils::debug >= 9) std::cout << "createCopyComponentList " << typ << theOptOsToCopyList.size() << std::endl;
762 
763  theOptOsToCopyListIterator = theOptOsToCopyList.begin();
764  return true;
765 }
766 
767 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
768 //@@ fillCopyOptOList: Fill list of objects to copy with the components of 'opto'
769 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
771  if (ALIUtils::debug >= 3)
772  std::cout << "entering fillCopyComponentList(): OptO" << opto->name() << std::endl;
773  //---------- Get list of components of 'opto'
774  std::vector<OpticalObject*> vopto;
775  ALIbool opto_found = getComponentOptOs(opto->name(), vopto);
776  if (!opto_found) {
777  if (ALIUtils::debug >= 5)
778  std::cout << "fillCopyComponentList: NO COMPONENTS TO COPY IN THIS OptO" << opto->name() << std::endl;
779  }
780 
781  //---------- Loop list of components of 'opto'
782  std::vector<OpticalObject*>::const_iterator vocite;
783  for (vocite = vopto.begin(); vocite != vopto.end(); ++vocite) {
784  theOptOsToCopyList.push_back(*vocite);
785  if (ALIUtils::debug >= 5)
786  std::cout << "fillCopyOptOList " << (*vocite)->type() << " " << (*vocite)->name() << std::endl;
787  //---------- Add components of this component
788  fillCopyComponentList(*vocite);
789  }
790  return opto_found;
791 }
792 
793 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
794 //@@ nextOptOToCopy: return next object to copy from theOptOsToCopyListIterator
795 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
797  if (ALIUtils::debug >= 5)
798  std::cout << "entering nextOptOToCopy() " << std::endl;
799  ++theOptOsToCopyListIterator;
800  // if(ALIUtils::debug >= 5) std::cout <<" nextOptOToCopy " << (*(theOptOsToCopyListIterator-1))->name() << std::endl;
801  return *(theOptOsToCopyListIterator - 1);
802 }
803 
805 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
806 //@@ If fitting CMS link, it has to be fitted part by part, in several iterations
807 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
808 void Model::CMSLinkFit(ALIint cmslink) {
809  /*
810  //---------- Get number of fits
811  ALIint cmslinkNoFits = 0;
812  if( cmslink == 1) {
813  cmslinkNoFits = 3;
814  } else if( cmslink == 2) {
815  cmslinkNoFits = 2;
816  }
817  if(ALIUtils::debug >= 4) std::cout << " Start CMS link fit with method " << cmslink << " (number of fits = " << cmslinkNoFits << ")" << std::endl;
818 
819  //----------- Loop number of cms_link fits
820  for(ALIint ilink = ALIint(Model::GlobalOptions()["cms_link"]); ilink <= cmslinkNoFits; ilink++) {
821 
822  //----- Iteration 2 of method 2 resembles iteration 3 of method 1
823  ALIdouble cmslink_method;
824  assert(Model::getGlobalOptionValue("cms_link_method", cmslink_method));
825  if( cmslink_method == 2 && ilink == 2) ilink = 3;
826 
827 //---- Set variable CMSLinkIteration, Checked in Fit.C and other //- std::cout << "ilink" << ilink << std::endl;
828  Model::setGlobalOption("cms_link", ilink);
829  Model::CMSLinkIteration = ilink;
830 
831  if(ilink > 1)Model::readSystemDescription(); //already read once to fill value Model::GlobalOptions()["cms_link"]
832 
833  //---------- Delete the OptO not fitted in this iteration
834  // Model::CMSLinkDeleteOptOs();
835  // cannot be here because you may recover a parameter saved in previous iteration that now it is deleted (!!MODIFY THIS)
836 
837  //---------- Recover parameters fitted in previous iteration
838  Model::CMSLinkRecoverParamFittedSigma( ilink );
839 
840  Model::CMSLinkRecoverParamFittedValueDisplacement( ilink );
841 
842  //---------- Delete the OptO not fitted in this iteration
843  Model::CMSLinkDeleteOptOs();
844 
845  //---------- Start fit
846  Fit::startFit();
847 
848  //---------- Save parameters fitted in this iteration (to be used in next one)
849  Model::CMSLinkSaveParamFittedSigma( ilink );
850 
851  Model::CMSLinkSaveParamFittedValueDisplacement( ilink );
852 
853  //---------- Delete whole system to start anew in next iteration
854  Model::CMSLinkCleanModel();
855 
856  }
857  */
858 }
859 
860 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
861 //@@ CMSLinkCleanModel: clean Model for new iteration while fitting CMS link
862 //@@ part by part
863 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
865  deleteOptO("s");
866  //---------- Clean OptOdicitionary (in case this is not first reading)
867  ALIuint odsize = theOptODictionary.size();
868  for (ALIuint ii = 0; ii < odsize; ii++) {
869  theOptODictionary.pop_back();
870  }
871 }
872 
873 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
874 //@@ CMSLinkDeleteOptOs
875 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
877  ALIint cmslink_iter = Model::CMSLinkIteration;
878  ALIdouble cmslink_method;
879 
881  assert(gomgr->getGlobalOptionValue("cms_link_method", cmslink_method));
882  ALIdouble cmslink_halfplanes;
883  assert(gomgr->getGlobalOptionValue("cms_link_halfplanes", cmslink_halfplanes));
884  if (ALIUtils::debug >= 2)
885  std::cout << "CMSLinkDeleteOptOs: cms_link_halfplanes " << cmslink_halfplanes << cmslink_iter << std::endl;
886 
887  if (cmslink_iter == 1) {
888  //---------- First fit: delete everything but laser1 and det_tkU
889  // deleteOptO("s/laserboxL/laser2");
890  //- std::cout << "delete mabs" << std::endl;
891  deleteOptO("s/mabsL");
892  //------- Method 1: detectors at tracker down
893  if (cmslink_method == 1) {
894  deleteOptO("s/tracker/det_trkDL");
895  deleteOptO("s/tracker/det_trkDR");
896  }
897 
898  if (cmslink_halfplanes == 2) {
899  // deleteOptO("s/laserboxR/laser2");
900  deleteOptO("s/mabsR");
901  }
902 
903  } else if (cmslink_iter == 2) {
904  //---------- Second fit (method 1): delete everything but laser1 and det3
905  // deleteOptO("s/laserboxL/laser2");
906  deleteOptO("s/mabsL");
907  deleteOptO("s/tracker/CST/wheel_trkL/peri/mirror"); //??
908  deleteOptO("s/tracker/CST/wheel_trkL/det_trkU");
909  //------- Method 1: detectors on CST, Method 2: detectors on tracker
910  //not necessary deleteOptO("s/tracker/CST/det6");
911 
912  if (cmslink_halfplanes <= 1) {
913  deleteOptO("s/tracker/CST/wheel_trkR");
914  } else if (cmslink_halfplanes == 2) {
915  // deleteOptO("s/laserboxR/laser2");
916  deleteOptO("s/mabsR");
917  deleteOptO("s/tracker/CST/wheel_trkR/peri/mirror"); //??
918  deleteOptO("s/tracker/CST/wheel_trkR/det_trkU");
919  }
920 
921  } else if (cmslink_iter == 3) {
922  //---------- Third fit: delete everything but laser2 and mabs
923  // deleteOptO("s/laserboxL/laser1");
924  deleteOptO("s/tracker");
925 
926  if (cmslink_halfplanes == 2) {
927  // deleteOptO("s/laserboxR/laser1");
928  }
929  //---------- Do nothing
930  } else {
931  }
932 }
933 
934 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
935 //@@ CMSLinkSaveParamFittedSigma
936 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
938  /*
939  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
940 
941  cleanParamFittedSigmaVector();
942 
943  //---------- First fit: Save laserbox angles fitted at tracker
944  if( cms_link == 1) {
945  //? if (GlobalOptions()["cms_link_method"] < 10){
946  saveParamFittedSigma("s/laserboxL","Angles X");
947  saveParamFittedSigma("s/laserboxL","Angles Y");
948 
949  saveParamFittedCorrelation("s/laserboxL","Angles X",
950  "s/tracker/CST","Centre Y");
951  saveParamFittedCorrelation("s/laserboxL","Angles Y",
952  "s/tracker/CST","Centre X");
953  if( cms_link_halfplanes == 2) {
954  saveParamFittedSigma("s/laserboxR","Angles X");
955  saveParamFittedSigma("s/laserboxR","Angles Y");
956 
957  saveParamFittedCorrelation("s/laserboxR","Angles X",
958  "s/tracker/CST","Centre Y");
959  saveParamFittedCorrelation("s/laserboxR","Angles Y",
960  "s/tracker/CST","Centre X");
961  }
962 
963  } else if( cms_link == 2) {
964  //---------- Second fit: Save laserbox angles and position
965  saveParamFittedSigma("s/laserboxL","Centre X");
966  saveParamFittedSigma("s/laserboxL","Centre Y");
967  // Make quality unk to cal
968  saveParamFittedSigma("s/laserboxL","Centre Z");
969  saveParamFittedSigma("s/laserboxL","Angles X");
970  saveParamFittedSigma("s/laserboxL","Angles Y");
971 
972  saveParamFittedCorrelation("s/laserboxL","Centre X",
973  "s/laserboxL","Angles Y");
974  saveParamFittedCorrelation("s/laserboxL","Centre Y",
975  "s/laserboxL","Angles X");
976 
977  if( cms_link_halfplanes == 2) {
978  saveParamFittedSigma("s/laserboxR","Centre X");
979  saveParamFittedSigma("s/laserboxR","Centre Y");
980  // Make quality unk to cal
981  saveParamFittedSigma("s/laserboxR","Centre Z");
982  saveParamFittedSigma("s/laserboxR","Angles X");
983  saveParamFittedSigma("s/laserboxR","Angles Y");
984 
985  saveParamFittedCorrelation("s/laserboxR","Centre X",
986  "s/laserboxR","Angles Y");
987  saveParamFittedCorrelation("s/laserboxR","Centre Y",
988  "s/laserboxR","Angles X");
989  }
990  } else {
991  //---------- Do nothing
992 
993  }
994  */
995 }
996 
997 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
998 //@@ CMSLinkSaveParamFittedValueDisplacement:
999 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1001  /*
1002  cleanParamFittedValueDisplacementMap();
1003 
1004  //----------
1005  if( cms_link == 1 || cms_link == 2 ) {
1006  std::vector<Entry*>::const_iterator vecite;
1007  for( vecite = EntryList().begin(); vecite != EntryList().end(); vecite++) {
1008  if( (*vecite)->valueDisplacementByFitting() != 0 ) {
1009  ALIstring names = (*vecite)->OptOCurrent()->name() + "/" + (*vecite)->name();
1010  std::cout << "saeParamFittedValueDisplacementMap" << names << (*vecite)->valueDisplacementByFitting() << std::endl;
1011  theParamFittedValueDisplacementMap[ names ] = (*vecite)->valueDisplacementByFitting();
1012  }
1013  }
1014 
1015  //---------- Do nothing
1016  } else {
1017 
1018  }
1019  */
1020 }
1021 
1022 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1023 //@@ CMSLinkRecoverParamFittedSigma:
1024 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1026  /*
1027  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
1028 
1029  if( cms_link == 2) {
1030  //---------- Second fit: recover laserbox angles
1031  recoverParamFittedSigma("s/laserboxL","Angles X",0);
1032  recoverParamFittedSigma("s/laserboxL","Angles Y",1);
1033 
1034  if( cms_link_halfplanes == 2) {
1035  recoverParamFittedSigma("s/laserboxR","Angles X",0);
1036  recoverParamFittedSigma("s/laserboxR","Angles Y",1);
1037  }
1038 
1039  } else if( cms_link == 3) {
1040  //---------- Third fit: recover laserbox angles and position and rotate angles to mabs
1041  recoverParamFittedSigma("s/laserboxL","Centre X",0);
1042  recoverParamFittedSigma("s/laserboxL","Centre Y",1);
1043  recoverParamFittedSigma("s/laserboxL","Centre Z",2);
1044  recoverParamFittedSigma("s/laserboxL","Angles X",3);
1045 
1046  //----- Angle around Y is converted to angle around Z when turning 90 deg
1047  Entry* slaZ = getEntryByName("s/laserboxL","Angles Z");
1048  //--- prec_level_laser
1049  Entry* smaZ = getEntryByName("s/mabsL","Angles Z");
1050  slaZ->setQuality(0);
1051  slaZ->setValue( smaZ->value() );
1052  // smaZ->setQuality(0); //!!???!!?
1053 
1054  Entry* slaY = getEntryByName("s/laserboxL","Angles Y");
1055  slaY->setQuality(0);
1056 
1057  if( cms_link_halfplanes == 2) {
1058  recoverParamFittedSigma("s/laserboxR","Centre X",0);
1059  recoverParamFittedSigma("s/laserboxR","Centre Y",1);
1060  recoverParamFittedSigma("s/laserboxR","Centre Z",2);
1061  recoverParamFittedSigma("s/laserboxR","Angles X",3);
1062 
1063  //----- Angle around Y is converted to angle around Z when turning 90 deg
1064  Entry* slaZ = getEntryByName("s/laserboxR","Angles Z");
1065  //--- prec_level_laser
1066  Entry* smaZ = getEntryByName("s/mabsR","Angles Z");
1067  slaZ->setQuality(0);
1068  slaZ->setValue( smaZ->value() );
1069  // smaZ->setQuality(0); //!!???!!?
1070 
1071  Entry* slaY = getEntryByName("s/laserboxR","Angles Y");
1072  slaY->setQuality(0);
1073  }
1074  } else {
1075  //---------- Do nothing
1076 
1077  }
1078  */
1079 }
1080 
1081 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1082 //@@ CMSLinkRecoverParamFittedValueDisplacement:
1083 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1085  /*
1086  //---------- Second fit: recover laserbox angles
1087  if( cms_link == 2 || cms_link == 3 ) {
1088 
1089  std::map<ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator vsdmite;
1090  if ( ALIUtils::debug >= 99) std::cout << "theParamFittedValueDisplacementMap.size " << theParamFittedValueDisplacementMap.size() << std::endl;
1091  for( vsdmite = theParamFittedValueDisplacementMap.begin(); vsdmite != theParamFittedValueDisplacementMap.end(); vsdmite++) {
1092  std::cout << "reoverValueDisp" << (*vsdmite).first << " " << (*vsdmite).second << std::endl;
1093  Entry* this_entry = getEntryByName( (*vsdmite).first);
1094  this_entry->displaceOriginal( (*vsdmite).second );
1095  this_entry->OptOCurrent()->resetGlobalCoordinates();
1096  this_entry->setValueDisplacementByFitting( (*vsdmite).second );
1097 
1098  }
1099 
1100  //---------- Do nothing
1101  } else {
1102 
1103  }
1104  */
1105 }
1106 
1107 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1108 //@@ Delete an OptO
1109 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1110 void Model::deleteOptO(const ALIstring& opto_name) {
1111  OpticalObject* opto = getOptOByName(opto_name);
1112  deleteOptO(opto);
1113 }
1114 
1115 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1116 //@@ deleteOptO: delete OptO, its Entries, and the Measurements in which it participates. Then deleteOptO of components
1117 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1119  if (ALIUtils::debug >= 5)
1120  std::cout << "DELETING OptO" << opto->name() << std::endl;
1121 
1122  //---------- Delete Coordinate Entries of this OptO
1123  std::vector<Entry*>::const_iterator vecite;
1124  std::vector<Entry*>::iterator veite2;
1125  if (ALIUtils::debug >= 9)
1126  std::cout << "SIZE" << theEntryVector.size() << std::endl;
1127  for (vecite = opto->CoordinateEntryList().begin(); vecite != opto->CoordinateEntryList().end(); ++vecite) {
1128  // ALIuint pos = FindItemInVector( (*veite), opto->CoordinateEntryList() );
1129  veite2 = find(theEntryVector.begin(), theEntryVector.end(), (*vecite));
1130  //- if ( ALIUtils::debug >= 9) std::cout << (*veite2) << "DELETE ENTRY " << (*vecite) <<(*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1131  delete ((*veite2));
1132  theEntryVector.erase(veite2);
1133  }
1134 
1135  for (vecite = opto->ExtraEntryList().begin(); vecite != opto->ExtraEntryList().end(); ++vecite) {
1136  // ALIuint pos = FindItemInVector( (*veite), opto->CoordinateEntryList() );
1137  veite2 = find(theEntryVector.begin(), theEntryVector.end(), (*vecite));
1138  //- if(ALIUtils::debug >= 9) std::cout << (*veite2) << "DELETE ENTRY " << (*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1139  delete ((*veite2));
1140  theEntryVector.erase(veite2);
1141  }
1142 
1143  for (vecite = theEntryVector.begin(); vecite != theEntryVector.end(); ++vecite) {
1144  // std::cout << (*vecite) << "ENTReY " << (*vecite)->OptOCurrent()->name() << (*vecite)->name() << std::endl;
1145  }
1146 
1147  //---------- Delete all Measurement in which opto takes part
1148  std::vector<Measurement*> MeasToBeDeleted;
1149  std::vector<Measurement*>::const_iterator vmite;
1150  std::vector<OpticalObject*>::const_iterator vocite;
1151  for (vmite = MeasurementList().begin(); vmite != MeasurementList().end(); ++vmite) {
1152  if (ALIUtils::debug >= 5)
1153  std::cout << "Deleting Measurement" << (*vmite)->name() << std::endl;
1154  //----- If any of the OptO Measured is opto, delete this Measurement
1155  for (vocite = (*vmite)->OptOList().begin(); vocite != (*vmite)->OptOList().end(); ++vocite) {
1156  if ((*vocite) == opto) {
1157  //- std::cout << "MEASTBD" << (*vmite) << std::endl;
1158  MeasToBeDeleted.push_back(*vmite);
1159  //? delete (*vmite);
1160  break;
1161  }
1162  }
1163  }
1164 
1165  //---------- Delete Measurements from list
1166  std::vector<Measurement*>::const_iterator vmcite;
1167  std::vector<Measurement*>::iterator vmite2;
1168  if (ALIUtils::debug >= 9)
1169  std::cout << "SIZEMEAS" << MeasToBeDeleted.size() << std::endl;
1170  for (vmcite = MeasToBeDeleted.begin(); vmcite != MeasToBeDeleted.end(); ++vmcite) {
1171  vmite2 = find(theMeasurementVector.begin(), theMeasurementVector.end(), (*vmcite));
1172  // std::cout << (*vmite2) << "DELETE MSEASU " << (*vmcite) << (*vmite2)->name()[0] << std::endl;
1173  delete ((*vmite2));
1174  theMeasurementVector.erase(vmite2);
1175  }
1176 
1177  //---------- Delete components
1178  // std::vector<OpticalObject*>::iterator voite;
1179  std::vector<OpticalObject*> vopto;
1180  // ALIbool opto_found = getComponentOptOs( opto->name(), vopto );
1181  for (vocite = vopto.begin(); vocite != vopto.end(); ++vocite) {
1182  deleteOptO(*vocite);
1183  }
1184 
1185  //---------- Delete this OptO
1186  //---------- Delete OptO (only from list, to delete it really first delete components)
1187  /* map< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator msoite =
1188 find( theOptOList.begin(), theOptOList.end(),
1189 map< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type( opto->name(), opto) );*/
1190  std::vector<OpticalObject*>::iterator dvoite =
1191  find(theOptOList.begin(), theOptOList.end(), std::vector<OpticalObject*>::value_type(opto));
1192  //- std::cout << (*dvoite) << "DELETE OPTO " << opto <<"WW" << (*dvoite)->name() << std::endl;
1193  theOptOList.erase(dvoite);
1194  delete opto;
1195 }
1196 
1197 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1198 //@@
1199 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1200 void Model::saveParamFittedSigma(const ALIstring& opto_name, const ALIstring& entry_name) {
1201  /*
1202 //---------- Get sigma of param Optical
1203  Entry* entry = getEntryByName(opto_name, entry_name);
1204  ALIuint fit_pos = entry->fitPos();
1205  if( fit_pos < 0 || fit_pos >= Fit::propagationMatrix().NoLines()) {
1206  std::cerr << "!!EXITING at saveParamFittedSigma: fit position incorrect " <<
1207  fit_pos << "propagationMatrix size =" << Fit::propagationMatrix().NoLines() << opto_name << std::endl;
1208  exit(3);
1209  }
1210  std::cout << entry_name << "saveParamFittedSigma" << fit_pos << sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) << std::endl;
1211  theParamFittedSigmaVector.push_back( sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) );
1212  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1213  */
1214 }
1215 
1216 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1217 //@@
1218 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1220  const ALIstring& entry_name1,
1221  const ALIstring& opto_name2,
1222  const ALIstring& entry_name2) {
1223  /*
1224 //---------- Get sigma of param Optical
1225  Entry* entry1 = getEntryByName(opto_name1, entry_name1);
1226  Entry* entry2 = getEntryByName(opto_name2, entry_name2);
1227  ALIuint fit_pos1 = entry1->fitPos();
1228  ALIuint fit_pos2 = entry2->fitPos();
1229 
1230  //---------- Get correlation if entry has been fitted
1231  ALIuint pmsize = Fit::propagationMatrix().NoLines();
1232  if( fit_pos1 >= 0 && fit_pos1 < pmsize && fit_pos2 >= 0 && fit_pos2 < pmsize ) {
1233  ALIdouble error1 = sqrt( Fit::propagationMatrix()( fit_pos1, fit_pos1) );
1234  ALIdouble error2 = sqrt( Fit::propagationMatrix()( fit_pos2, fit_pos2) );
1235  ALIdouble correl = Fit::propagationMatrix()( fit_pos1, fit_pos2) / error1 / error2;
1236  theParamFittedSigmaVector.push_back( correl );
1237  if(ALIUtils::debug>=9) {
1238  std::cout << "saveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1239  opto_name2 << entry_name2 << fit_pos2 << "MM " << correl << std::endl;
1240  }
1241  } else {
1242  if(ALIUtils::debug>=9) {
1243  std::cout << "NOsaveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1244  opto_name2 << entry_name2 << fit_pos2 << "MM " << std::endl;
1245  theParamFittedSigmaVector.push_back( 0. );
1246  }
1247 
1248  }
1249  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1250  */
1251 }
1252 
1253 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1254 //@@
1255 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1256 void Model::recoverParamFittedSigma(const ALIstring& opto_name, const ALIstring& entry_name, const ALIuint position) {
1257  /*
1258  if( position >= theParamFittedSigmaVector.size() ) {
1259  std::cerr << "!!EXITING at recoverParamFittedSigma: position" << position <<
1260  " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size() << std::endl;
1261  exit(3);
1262  }
1263  ALIdouble sigma = getParamFittedSigmaVectorItem( position );
1264 
1265  Entry* entry = getEntryByName(opto_name, entry_name);
1266  entry->setSigma( sigma );
1267  entry->setQuality( 1 );
1268  std::cout << "recover " << opto_name << entry_name << entry->sigma() <<std::endl;
1269  */
1270 }
1271 
1272 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1273 //@@ getParamFittedSigmaVectorItem
1274 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1276  if (position >= theParamFittedSigmaVector.size()) {
1277  std::cerr << "!!EXITING at getParamFittedSigma: position" << position
1278  << " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size()
1279  << std::endl;
1280  exit(3);
1281  }
1282  std::vector<ALIdouble>::const_iterator vdcite = theParamFittedSigmaVector.begin() + position;
1283  return (*vdcite);
1284 }
1285 
1286 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1287 //@@ getParamFittedSigmaVectorItem
1288 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1290  if (ALIUtils::debug >= 5)
1291  std::cout << " readMeasurementsFromFile " << Measurement::measurementsFileName() << std::endl;
1293  return true;
1294 
1296  std::vector<ALIstring> wordlist;
1297  //---------- read date
1298  // ALIint retfil = filein.getWordsInLine(wordlist);
1299  // std::cout << "@@@@@@@@@@@@@@@ RETFIL " << retfil << std::endl;
1300  //if( retfil == 0 ) {
1301  if (filein.getWordsInLine(wordlist) == 0) {
1302  if (ALIUtils::debug >= 4)
1303  std::cout << "@@@@ No more measurements left" << std::endl;
1304  return false;
1305  }
1306 
1308  // struct tm tim;
1309  //t Model::setMeasurementsTime( tim );
1310 
1311  //if you are looking for only one measurement with a given date and time, loop all measurements until you find it
1312  if (Measurement::only1) {
1313  for (;;) {
1314  if (wordlist[0] == "DATE:" && wordlist[1] == Measurement::only1Date && wordlist[2] == Measurement::only1Time)
1315  break;
1316  filein.getWordsInLine(wordlist);
1317  if (filein.eof()) {
1318  std::cerr << "!! EXITING date not found in measurements file" << Measurement::only1Date << " "
1319  << Measurement::only1Time << std::endl;
1320  exit(1);
1321  }
1322  }
1323  }
1324 
1325  //set date and time of current measurement
1326  if (wordlist[0] == "DATE:") {
1327  Measurement::setCurrentDate(wordlist);
1328  }
1329 
1330  //---------- loop measurements
1331  ALIint nMeas = Model::MeasurementList().size();
1332  if (ALIUtils::debug >= 4) {
1333  std::cout << " Reading " << nMeas << " measurements from file " << Measurement::measurementsFileName()
1334  << " DATE: " << wordlist[1] << " " << wordlist[1] << std::endl;
1335  }
1336  ALIint ii;
1337  for (ii = 0; ii < nMeas; ii++) {
1338  filein.getWordsInLine(wordlist);
1339  if (wordlist[0] == ALIstring("SENSOR2D") || wordlist[0] == ALIstring("TILTMETER") ||
1340  wordlist[0] == ALIstring("DISTANCEMETER") || wordlist[0] == ALIstring("DISTANCEMETER1DIM") ||
1341  wordlist[0] == ALIstring("COPS")) {
1342  if (wordlist.size() != 2) {
1343  std::cerr << "!!!EXITING Model::readMeasurementsFromFile. number of words should be 2 instead of "
1344  << wordlist.size() << std::endl;
1345  ALIUtils::dumpVS(wordlist, " ");
1346  exit(1);
1347  }
1348  std::vector<Measurement*>::const_iterator vmcite;
1349  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
1350  //-------- Measurement found, fill data
1351  /* ALIint last_slash = (*vmcite)->name().rfind('/');
1352  ALIstring oname = (*vmcite)->name();
1353  if( last_slash != -1 ) {
1354  oname = oname.substr(last_slash+1, (*vmcite)->name().size()-1);
1355  }
1356  */
1357  ALIint fcolon = (*vmcite)->name().find(':');
1358  ALIstring oname = (*vmcite)->name();
1359  oname = oname.substr(fcolon + 1, oname.length());
1360  //- std::cout << " measurement name " << (*vmcite)->name() << " short " << oname << std::endl;
1361  if (oname == wordlist[1]) {
1362  //- std::cout << " measurement name found " << oname << std::endl;
1363  if ((*vmcite)->type() != wordlist[0]) {
1364  std::cerr << "!!! Reading measurement from file: type in file is " << wordlist[0] << " and should be "
1365  << (*vmcite)->type() << std::endl;
1366  exit(1);
1367  }
1368  Measurement* meastemp = *vmcite;
1369 
1371  ALIbool sigmaFF = gomgr->GlobalOptions()["measurementErrorFromFile"];
1372  //---------- Read the data
1373  for (ALIuint ii = 0; ii < meastemp->dim(); ii++) {
1374  filein.getWordsInLine(wordlist);
1375  ALIdouble sigma = 0.;
1376  if (!sigmaFF) {
1377  // keep the sigma, do not read it from file
1378  const ALIdouble* sigmav = meastemp->sigma();
1379  sigma = sigmav[ii];
1380  }
1381  //---- Check measurement value type is OK
1382  if (meastemp->valueType(ii) != wordlist[0]) {
1383  filein.ErrorInLine();
1384  std::cerr << "!!!FATAL ERROR: Measurement value type is " << wordlist[0]
1385  << " while in setup definition was " << meastemp->valueType(ii) << std::endl;
1386  exit(1);
1387  }
1388  meastemp->fillData(ii, wordlist);
1389  if (!sigmaFF) {
1390  meastemp->setSigma(ii, sigma);
1391  }
1392  }
1393  meastemp->correctValueAndSigma();
1394  break;
1395  }
1396  }
1397  if (vmcite == MeasurementList().end()) {
1398  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
1399  std::cerr << "MEAS: " << (*vmcite)->name() << " " << (*vmcite)->type() << std::endl;
1400  }
1401  std::cerr << "!!! Reading measurement from file: measurement not found in list: type in file is " << wordlist[1]
1402  << std::endl;
1403  exit(1);
1404  }
1405  } else {
1406  std::cerr << " wrong type of measurement: " << wordlist[0] << std::endl
1407  << " Available types are SENSOR2D, TILTMETER, DISTANCEMETER, DISTANCEMETER1DIM, COPS" << std::endl;
1408  exit(1);
1409  }
1410  }
1411  //- std::cout << " returning readmeasff" << std::endl;
1412 
1413  return true;
1414 }
1415 
1416 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1417 
1418 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1419 void Model::copyMeasurements(const std::vector<ALIstring>& wl) {
1420  //----- Check format, e.g. @copy_measurements _1/_2/*_1
1421 
1422  //----- get list of Measurement's that satisfy the query in their name
1423  //t std::string querystr = wl[1].substr( wl[1].find("/")+1, wl[1].length() );
1424  std::string subsstr1 = wl[1].substr(0, wl[1].find('/'));
1425  std::string subsstr2 = wl[1].substr(wl[1].find('/') + 1, wl[1].rfind('/') - wl[1].find('/') - 1);
1426  std::string querystr = wl[1].substr(wl[1].rfind('/') + 1, wl[1].length());
1427 
1428  std::cout << " Model::copyMeasurements "
1429  << " subsstr1 " << subsstr1 << " subsstr2 " << subsstr2 << " querystr " << querystr << std::endl;
1430 
1431  std::vector<Measurement*> measToCopy;
1432  std::vector<Measurement*>::iterator mite;
1433  for (mite = theMeasurementVector.begin(); mite != theMeasurementVector.end(); ++mite) {
1434  Measurement* meas = (*mite);
1435  //improve this
1436  if (meas->name().find(querystr) != std::string::npos) {
1437  measToCopy.push_back(meas);
1438  }
1439  }
1440 
1441  //---- Build new measurements
1442  Measurement* meastemp = nullptr;
1443  for (mite = measToCopy.begin(); mite != measToCopy.end(); ++mite) {
1444  Measurement* meas = (*mite);
1445  std::vector<ALIstring> wlt;
1446  wlt.push_back(meas->type());
1447 
1448  //---- create new name
1449  std::string newName = ALIUtils::changeName(meas->name(), subsstr1, subsstr2);
1450  std::cout << " newName " << newName << std::endl;
1451  wlt.push_back(newName);
1452 
1453  ALIstring measType = wlt[0];
1454  ALIstring measName;
1455  if (wlt.size() == 2) {
1456  measName = wlt[1];
1457  } else {
1458  measName = "";
1459  }
1460  if (meas->type() == ALIstring("SENSOR2D")) {
1461  meastemp = new MeasurementSensor2D(2, measType, measName);
1462  // } else if ( meas->type() == ALIstring("DISTANCEMETER3DIM") ) {
1463  // meastemp = new MeasurementDistancemeter3dim( 1, measType, measName );
1464  } else if (meas->type() == ALIstring("DISTANCEMETER") || meas->type() == ALIstring("DISTANCEMETER1DIM")) {
1465  meastemp = new MeasurementDistancemeter(1, measType, measName);
1466  } else if (meas->type() == ALIstring("TILTMETER")) {
1467  meastemp = new MeasurementTiltmeter(1, measType, measName);
1468  // } else if ( meas->type() == ALIstring("DIFFCENTRE") ) {
1469  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1470  // } else if ( meas->type() == ALIstring("DIFFANGLE") ) {
1471  // meastemp = new MeasurementDiffAngle( 1, measType, measName );
1472  } else if (meas->type() == ALIstring("DIFFENTRY")) {
1473  meastemp = new MeasurementDiffEntry(1, measType, measName);
1474  } else if (meas->type() == ALIstring("COPS")) {
1475  meastemp = new MeasurementCOPS(4, measType, measName);
1476  } else {
1477  throw cms::Exception("LogicError") << "@SUB=Model::copyMeasurements\n"
1478  << "unknown measurement type: " << meas->type();
1479  }
1480 
1481  //later meastemp->copyConversionFactor( wordlist );
1482  meastemp->copyMeas(meas, subsstr1, subsstr2);
1483 
1484  break;
1485  }
1486 }
1487 
1488 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1490  if (ALIUtils::debug >= 3)
1491  std::cout << " Model::SetValueDisplacementsFromReportOut() " << std::endl;
1492 
1493  EntryMgr* entryMgr = EntryMgr::getInstance();
1494 
1495  if (entryMgr->numberOfEntries() != 0) {
1496  EntryData* entryData;
1497 
1498  std::vector<Entry*>::const_iterator vecite;
1499  for (vecite = Model::EntryList().begin(); vecite != Model::EntryList().end(); ++vecite) {
1500  //----- Find the EntryData corresponding to this entry
1501  entryData = entryMgr->findEntryByLongName((*vecite)->OptOCurrent()->longName(), (*vecite)->name());
1502  if (ALIUtils::debug >= 3)
1503  std::cout << "SetValueDisplacementsFromReportOut " << (*vecite)->OptOCurrent()->longName() << " "
1504  << (*vecite)->name() << " " << entryData->valueDisplacement() << std::endl;
1505  (*vecite)->addFittedDisplacementToValue(entryData->valueDisplacement());
1506  }
1507  }
1508 }
1509 
1510 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1512  std::string str = "";
1513 
1514  if (cs == COCOA_Init) {
1515  str = "COCOA_Init ";
1516  } else if (cs == COCOA_ReadingModel) {
1517  str = "COCOA_ReadingModel";
1518  } else if (cs == COCOA_InitFit) {
1519  str = "COCOA_InitFit";
1520  } else if (cs == COCOA_FitOK) {
1521  str = "COCOA_FitOK";
1522  } else if (cs == COCOA_FitImproving) {
1523  str = "COCOA_FitImproving";
1524  } else if (cs == COCOA_FitCannotImprove) {
1525  str = "COCOA_FitCannotImprove";
1526  } else if (cs == COCOA_FitChi2Worsened) {
1527  str = "COCOA_FitChi2Worsened";
1528  } else if (cs == COCOA_FitMatrixNonInversable) {
1529  str = "COCOA_FitMatrixNonInversable";
1530  }
1531 
1532  return str;
1533 }
1534 
1535 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1537  theOpticalAlignments = optAlig.opticalAlignments();
1538 
1539  OpticalAlignInfo oai_system = FindOptAlignInfoByType("system");
1540 
1541  OpticalObject* OptOsystem = new OpticalObject(nullptr, "system", oai_system.name_, false);
1542 
1543  OptOsystem->constructFromOptAligInfo(oai_system);
1544 
1545  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
1546  // theOptOlist[OptOsystem->name()] = OptOsystem;
1547  theOptOList.push_back(OptOsystem);
1548 }
1549 
1550 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1552  OpticalAlignInfo oai;
1553 
1554  ALIbool bFound = false;
1555  std::vector<OpticalAlignInfo>::iterator ite;
1556  for (ite = theOpticalAlignments.begin(); ite != theOpticalAlignments.end(); ++ite) {
1557  // std::cout << " Model::FindOptAlignInfoByType " << (*ite).type_ << " =? " << type << std::endl;
1558  if ((*ite).type_ == type) {
1559  if (!bFound) {
1560  oai = *ite;
1561  bFound = true;
1562  } else {
1563  std::cerr << "!! WARNING: Model::FindOptAlignInfoByType more than one objects of type " << type << std::endl;
1564  std::cerr << " returning object " << oai.name_ << std::endl << " skipping object " << (*ite).name_ << std::endl;
1565  }
1566  }
1567  }
1568  if (!bFound) {
1569  std::cerr << "!! ERROR: Model::FindOptAlignInfoByType object not found, of type " << type << std::endl;
1570  std::exception();
1571  }
1572 
1573  return oai;
1574 }
1575 
1576 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1578  std::vector<OpticalAlignMeasurementInfo>::iterator mite;
1579 
1580  if (ALIUtils::debug >= 5)
1581  std::cout << " BuildMeasurementsFromOA " << std::endl;
1582  std::vector<OpticalAlignMeasurementInfo> measInfos = measList.oaMeasurements_;
1583  for (mite = measInfos.begin(); mite != measInfos.end(); ++mite) {
1584  std::string measType = (*mite).type_;
1585  std::string measName = (*mite).name_;
1586  if (ALIUtils::debug >= 4)
1587  std::cout << " BuildMeasurementsFromOA measType " << measType << " measName " << measName << std::endl;
1588  //---------- Create Measurement with appropiate dimension
1589  Measurement* meastemp = nullptr;
1590  if (measType == ALIstring("SENSOR2D")) {
1591  meastemp = new MeasurementSensor2D(2, measType, measName);
1592  } else if (measType == ALIstring("DISTANCEMETER3DIM")) {
1593  meastemp = new MeasurementDistancemeter3dim(1, measType, measName);
1594  } else if (measType == ALIstring("DISTANCEMETER") || measType == ALIstring("DISTANCEMETER1DIM")) {
1595  meastemp = new MeasurementDistancemeter(1, measType, measName);
1596  } else if (measType == ALIstring("TILTMETER")) {
1597  meastemp = new MeasurementTiltmeter(1, measType, measName);
1598  } else if (measType == ALIstring("COPS")) {
1599  meastemp = new MeasurementCOPS(4, measType, measName);
1600  // } else if ( measType == ALIstring("DIFFCENTRE") ) {
1601  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1602  // } else if ( measType == ALIstring("DIFFANGLE") ) {
1603  // meastemp = new MeasurementDiffAngle( 2, measType, measName );
1604  } else if (measType == ALIstring("DIFFENTRY")) {
1605  meastemp = new MeasurementDiffEntry(1, measType, measName);
1606  } else {
1607  std::cerr << " !!! Model::BuildMeasurementsFromOA : measType not found " << measType << std::endl;
1608  throw std::exception();
1609  }
1610  meastemp->constructFromOA(*mite);
1611  }
1612 }
ErrorCorrelationMgr.h
ALIUtils::getFloat
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:373
Measurement::only1Time
static ALIstring only1Time
Definition: Measurement.h:214
Model::CMSLinkRecoverParamFittedValueDisplacement
static void CMSLinkRecoverParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1084
Model::theOptODictionary
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
CocoaDaqReaderRoot
Definition: CocoaDaqReaderRoot.h:13
OpticalObject.h
Model::buildMeasurementsLinksToOptOs
static void buildMeasurementsLinksToOptOs()
Read Measurements (to be implemented for reading from an external file the DATA of the measurements)
Definition: Model.cc:545
ParameterMgr::addParameter
void addParameter(const ALIstring &name, const ALIstring &valstr)
Definition: ParameterMgr.cc:63
ParameterMgr::getInstance
static ParameterMgr * getInstance()
Definition: ParameterMgr.cc:18
Model::CMSLinkCleanModel
void CMSLinkCleanModel()
Definition: Model.cc:864
Model::CMSLinkRecoverParamFittedSigma
static void CMSLinkRecoverParamFittedSigma(ALIint cmslink)
Definition: Model.cc:1025
Model::EntryList
static std::vector< Entry * > & EntryList()
Definition: Model.h:86
OpticalAlignInfo::name_
std::string name_
Definition: OpticalAlignInfo.h:92
Model.h
Model::readMeasurementsFromFile
static ALIbool readMeasurementsFromFile(ALIstring only1Date=ALIstring(""), ALIstring only1Time=ALIstring(""))
Definition: Model.cc:1289
Measurement::copyMeas
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:621
Model::nextOptOToCopy
static OpticalObject * nextOptOToCopy()
Definition: Model.cc:796
MeasurementDiffEntry
Definition: MeasurementDiffEntry.h:18
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
EntryMgr
Definition: EntryMgr.h:15
ALIUtils::getInt
static int getInt(const ALIstring &str)
Convert a string to an integer, checking that it is really an integer.
Definition: ALIUtils.cc:384
cocoaStatus
cocoaStatus
Definition: Model.h:41
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:47
Model::copyMeasurements
static void copyMeasurements(const std::vector< ALIstring > &wl)
Definition: Model.cc:1419
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
Measurement::fillData
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
Model::theInstance
static Model * theInstance
Definition: Model.h:176
CocoaDaqReaderText
Definition: CocoaDaqReaderText.h:10
GlobalOptionMgr::GlobalOptions
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
Definition: GlobalOptionMgr.h:31
Model::MeasurementList
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88
GlobalOptionMgr
Definition: GlobalOptionMgr.h:18
Model::theMatricesFName
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:203
sectMeasurements
Definition: Model.h:37
OpticalObject::name
const ALIstring & name() const
Definition: OpticalObject.h:58
ALIUtils::SetLengthDimensionFactors
static void SetLengthDimensionFactors()
Definition: ALIUtils.cc:81
GlobalOptionMgr::getInstance
static GlobalOptionMgr * getInstance()
Definition: GlobalOptionMgr.cc:18
Measurement::constructFromOA
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:89
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Model::getEntryByName
static Entry * getEntryByName(const ALIstring &opto_name, const ALIstring &entry_name)
--— Search an Entry name in the Entry* list and return a pointer to it
Definition: Model.cc:623
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
Model::BuildMeasurementsFromOA
void BuildMeasurementsFromOA(OpticalAlignMeasurements &measList)
Definition: Model.cc:1577
MeasurementCOPS
Definition: MeasurementCOPS.h:18
ALIFileIn::nline
const ALIint nline()
Definition: ALIFileIn.h:41
ParameterMgr::addRandomGaussParameter
void addRandomGaussParameter(const ALIstring &name, const ALIstring &valMean, const ALIstring &valStdDev)
Definition: ParameterMgr.cc:75
ParameterMgr::setRandomSeed
void setRandomSeed(const long seed)
Definition: ParameterMgr.cc:72
GlobalOptionMgr.h
OpticalAlignInfo
Definition: OpticalAlignInfo.h:71
Model::Ncmslinkrange
static ALIint Ncmslinkrange
*************** FOR RANGE STUDIES
Definition: Model.h:222
cms::cuda::assert
assert(be >=bs)
GlobalOptionMgr::getGlobalOptionValue
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
Definition: GlobalOptionMgr.cc:115
EntryMgr::findEntryByLongName
EntryData * findEntryByLongName(const ALIstring &optoName, const ALIstring &entryName="")
Definition: EntryMgr.cc:82
Model::theOptOsToCopyList
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:216
ParameterMgr::getParameterValue
ALIint getParameterValue(const ALIstring &name, ALIdouble &val)
Definition: ParameterMgr.cc:114
Model::CMSLinkSaveParamFittedValueDisplacement
static void CMSLinkSaveParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1000
Model::getParamFittedSigmaVectorItem
static ALIdouble getParamFittedSigmaVectorItem(const ALIuint position)
Definition: Model.cc:1275
COCOA_ReadingModel
Definition: Model.h:43
MeasurementDiffEntry.h
Model::theOpticalAlignments
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282
OpticalObject
Definition: OpticalObject.h:35
ALIUtils::IsNumber
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
OpticalAlignMeasurements
Definition: OpticalAlignMeasurements.h:22
EntryAngle.h
Model::getComponentOptOs
static ALIbool getComponentOptOs(const ALIstring &opto_name, std::vector< OpticalObject * > &vcomponents)
--— Get from theOptOList the list of pointers to component OptOs
Definition: Model.cc:705
Model::getOptOByType
static OpticalObject * getOptOByType(const ALIstring &type)
--— Find the first OptO of type 'opto_type' in theOptOList and return a pointer to it
Definition: Model.cc:601
MeasurementCOPS.h
Model::saveParamFittedSigma
static void saveParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name)
Definition: Model.cc:1200
Model::setCocoaStatus
static void setCocoaStatus(const cocoaStatus cs)
Definition: Model.h:64
ParameterMgr.h
sectSystemTreeDescription
Definition: Model.h:35
Model::theMeasurementVector
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194
ErrorCorrelationMgr::getInstance
static ErrorCorrelationMgr * getInstance()
Definition: ErrorCorrelationMgr.cc:15
Model::Model
Model()
Definition: Model.cc:92
Measurement::dim
const ALIuint dim() const
Definition: Measurement.h:82
EntryData::valueDisplacement
ALIdouble valueDisplacement() const
Definition: EntryData.h:31
OpticalAlignments::opticalAlignments
std::vector< OpticalAlignInfo > opticalAlignments() const
Definition: OpticalAlignments.h:27
MeasurementTiltmeter.h
MeasurementSensor2D.h
sectParameters
Definition: Model.h:34
Model::getOptOByName
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:570
Model::SDFName
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:93
COCOA_FitCannotImprove
Definition: Model.h:49
Measurement::measurementsFileName
static ALIstring & measurementsFileName()
Definition: Measurement.h:162
mps_fire.end
end
Definition: mps_fire.py:242
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
str
#define str(s)
Definition: TestProcessor.cc:52
MeasurementTiltmeter
Definition: MeasurementTiltmeter.h:18
Model::BuildSystemDescriptionFromOA
void BuildSystemDescriptionFromOA(OpticalAlignments &optAlig)
Definition: Model.cc:1536
Measurement
Definition: Measurement.h:27
Model::theSDFName
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:197
MeasurementDistancemeter3dim.h
Model::CMSLinkRangeDetValue
static std::vector< ALIdouble > CMSLinkRangeDetValue
Definition: Model.h:223
MeasurementDistancemeter
Definition: MeasurementDistancemeter.h:18
CocoaDaqReaderRoot.h
Model::theFittedEntriesReader
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:280
Model::recoverParamFittedSigma
static void recoverParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name, const ALIuint position)
Definition: Model.cc:1256
COCOA_FitOK
Definition: Model.h:47
ALIFileIn::getInstance
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:22
Model::getMeasurementByName
static Measurement * getMeasurementByName(const ALIstring &name, ALIbool exists=true)
Definition: Model.cc:641
ParameterMgr::addRandomFlatParameter
void addRandomFlatParameter(const ALIstring &name, const ALIstring &valMean, const ALIstring &valInterval)
Definition: ParameterMgr.cc:93
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Measurement.h
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
Model::theReportFName
static ALIstring theReportFName
the name of the report File
Definition: Model.h:201
MeasurementDistancemeter.h
OpticalObject::ExtraEntryList
const std::vector< Entry * > & ExtraEntryList() const
Definition: OpticalObject.h:65
Model::theEntryVector
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:191
MeasurementSensor2D
Definition: MeasurementSensor2D.h:18
ALIFileIn::ErrorInLine
void ErrorInLine()
Definition: ALIFileIn.cc:196
OpticalObject::constructFromOptAligInfo
void constructFromOptAligInfo(const OpticalAlignInfo &oaInfo)
Definition: OpticalObject.cc:2016
ALIUtils::SetAngleDimensionFactors
static void SetAngleDimensionFactors()
Definition: ALIUtils.cc:104
Model::theCocoaStatus
static cocoaStatus theCocoaStatus
Definition: Model.h:272
ALIUtils.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
Model::reorderOptODictionary
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:512
COCOA_InitFit
Definition: Model.h:44
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
Measurement::valueType
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:116
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
Model::CMSLinkDeleteOptOs
static void CMSLinkDeleteOptOs()
Definition: Model.cc:876
OpticalAlignMeasurements::oaMeasurements_
std::vector< OpticalAlignMeasurementInfo > oaMeasurements_
Definition: OpticalAlignMeasurements.h:27
ALIuint
unsigned int ALIuint
Definition: CocoaGlobals.h:17
Measurement::type
const ALIstring & type() const
Definition: Measurement.h:84
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
ALIFileIn::close
void close()
Definition: ALIFileIn.cc:218
Model::theOptOList
static std::vector< OpticalObject * > theOptOList
map of OptO*‍/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
EntryMgr.h
OpticalObject::CoordinateEntryList
const std::vector< Entry * > & CoordinateEntryList() const
Definition: OpticalObject.h:63
OpticalAlignMeasurements.h
Entry
Definition: Entry.h:18
ALIFileIn::eof
ALIbool eof()
Definition: ALIFileIn.cc:201
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
ALIUtils::SetOutputAngleDimensionFactors
static void SetOutputAngleDimensionFactors()
Definition: ALIUtils.cc:153
Model::CMSLinkSaveParamFittedSigma
static void CMSLinkSaveParamFittedSigma(ALIint cmslink)
Definition: Model.cc:937
Measurement::only1Date
static ALIstring only1Date
Definition: Measurement.h:213
COCOA_FitChi2Worsened
Definition: Model.h:50
GlobalOptionMgr::setGlobalOption
void setGlobalOption(const ALIstring go, const ALIdouble val, ALIFileIn &filein)
Definition: GlobalOptionMgr.cc:137
COCOA_FitMatrixNonInversable
Definition: Model.h:51
Model::SetValueDisplacementsFromReportOut
static void SetValueDisplacementsFromReportOut()
Definition: Model.cc:1489
Model::theOptOsToCopyListIterator
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:218
mps_merge.newName
string newName
Definition: mps_merge.py:86
Measurement::setSigma
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:131
Measurement::setCurrentDate
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:605
ErrorCorrelationMgr::readFromReportFile
void readFromReportFile(const ALIstring &filename)
Definition: ErrorCorrelationMgr.cc:24
Measurement::setConversionFactor
virtual void setConversionFactor(const std::vector< ALIstring > &wordlist)
Definition: Measurement.h:69
Model
Definition: Model.h:54
ALIUtils::dumpVS
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:465
Model::readSystemDescription
static void readSystemDescription()
-------— Read the different sections of the SDF and act accordingly
Definition: Model.cc:99
Measurement::construct
void construct()
Definition: Measurement.cc:59
Measurement::only1
static ALIbool only1
Definition: Measurement.h:212
OpticalAlignments.h
Measurement::correctValueAndSigma
virtual void correctValueAndSigma()
Definition: Measurement.h:66
heppy_batch.val
val
Definition: heppy_batch.py:351
ALIUtils::SetOutputLengthDimensionFactors
static void SetOutputLengthDimensionFactors()
Definition: ALIUtils.cc:126
Model::CMSLinkFit
void CMSLinkFit(ALIint cmslink)
*************** FOR CMS LINK SYSTEM (to fit it part by part)
Definition: Model.cc:808
Model::createCopyComponentList
static ALIbool createCopyComponentList(const ALIstring &optoname)
**************** FOR COPYING AN OPTO
Definition: Model.cc:750
Measurement::name
const ALIstring & name() const
Definition: Measurement.h:86
ParameterMgr
Definition: ParameterMgr.h:15
Model::getInstance
static Model & getInstance()
-------— Gets the only instance of this class
Definition: Model.cc:82
EntryData.h
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:245
EntryData
Definition: EntryData.h:15
sectGlobalOptions
Definition: Model.h:33
Model::getParameterValue
static int getParameterValue(const ALIstring &sstr, ALIdouble &val)
************ ACCESS INFO FROM STATIC DATA
Definition: Model.cc:560
Model::getComponentOptOTypes
static ALIbool getComponentOptOTypes(const ALIstring &opto_type, std::vector< ALIstring > &vcomponents)
--— Get from theOptODictionary the list of component OptO types
Definition: Model.cc:674
Exception.h
OpticalObject::construct
void construct()
Definition: OpticalObject.cc:70
EntryMgr::numberOfEntries
ALIint numberOfEntries()
Definition: EntryMgr.h:36
Model::OptODictionary
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82
COCOA_Init
Definition: Model.h:42
Model::fillCopyComponentList
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:770
OpticalAlignments
Definition: OpticalAlignments.h:22
ALIint
int ALIint
Definition: CocoaGlobals.h:15
Model::CMSLinkIteration
static ALIint CMSLinkIteration
Definition: Model.h:237
FittedEntriesReader.h
ALIFileIn::getWordsInLine
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:74
Model::theMeasFName
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:199
MeasurementDistancemeter3dim
Definition: MeasurementDistancemeter3dim.h:18
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
EntryMgr::getInstance
static EntryMgr * getInstance()
Definition: EntryMgr.cc:16
CocoaDaqReaderText.h
COCOA_FitImproving
Definition: Model.h:48
Model::printCocoaStatus
static std::string printCocoaStatus(const cocoaStatus cs)
Definition: Model.cc:1511
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
Model::FindOptAlignInfoByType
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1551
sectReportOut
Definition: Model.h:38
ALIUtils::changeName
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:535
Model::theParamFittedSigmaVector
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:274
sectSystemTreeData
Definition: Model.h:36
Model::deleteOptO
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1110
cuy.ii
ii
Definition: cuy.py:590
heppy_report.oname
oname
Definition: heppy_report.py:58
ALIFileIn.h
Model::theParamFittedValueDisplacementMap
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:276
Model::saveParamFittedCorrelation
static void saveParamFittedCorrelation(const ALIstring &opto_name1, const ALIstring &entry_name1, const ALIstring &opto_name2, const ALIstring &entry_name2)
Definition: Model.cc:1219
FittedEntriesReader
Definition: FittedEntriesReader.h:14
ALIFileIn
Definition: ALIFileIn.h:20
Measurement::sigma
const ALIdouble * sigma() const
Definition: Measurement.h:112
EntryMgr::readEntryFromReportOut
ALIbool readEntryFromReportOut(const std::vector< ALIstring > &wl)
Definition: EntryMgr.cc:29