CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Static Private Attributes
Model Class Reference

#include <Model.h>

Public Member Functions

void BuildMeasurementsFromOA (OpticalAlignMeasurements &measList)
 
void BuildSystemDescriptionFromOA (OpticalAlignments &optAlig)
 
void CMSLinkFit (ALIint cmslink)
 *************** FOR CMS LINK SYSTEM (to fit it part by part) More...
 
OpticalAlignInfo FindOptAlignInfoByType (const ALIstring &type)
 
 Model ()
 
 ~Model ()
 

Static Public Member Functions

static void addEntryToList (Entry *entry)
 ***************** SET DATA MEMBERS More...
 
static void addMeasurementToList (Measurement *measadd)
 
static ALIbool createCopyComponentList (const ALIstring &optoname)
 **************** FOR COPYING AN OPTO More...
 
static std::vector< Entry * > & EntryList ()
 
static cocoaStatus getCocoaStatus ()
 
static ALIbool getComponentOptOs (const ALIstring &opto_name, std::vector< OpticalObject *> &vcomponents)
 --— Get from theOptOList the list of pointers to component OptOs More...
 
static ALIbool getComponentOptOTypes (const ALIstring &opto_type, std::vector< ALIstring > &vcomponents)
 --— Get from theOptODictionary the list of component OptO types More...
 
static EntrygetEntryByName (const ALIstring &opto_name, const ALIstring &entry_name)
 --— Search an Entry name in the Entry* list and return a pointer to it More...
 
static EntrygetEntryByName (const ALIstring &opto_entry_name)
 
static FittedEntriesReadergetFittedEntriesReader ()
 
static ModelgetInstance ()
 -------— Gets the only instance of this class More...
 
static MeasurementgetMeasurementByName (const ALIstring &name, ALIbool exists=true)
 
static std::vector< OpticalAlignInfogetOpticalAlignments ()
 
static OpticalObjectgetOptOByName (const ALIstring &opto_name)
 --— Find an OptO name in theOptOList and return a pointer to it More...
 
static OpticalObjectgetOptOByType (const ALIstring &type)
 --— Find the first OptO of type 'opto_type' in theOptOList and return a pointer to it More...
 
static int getParameterValue (const ALIstring &sstr, ALIdouble &val)
 ************ ACCESS INFO FROM STATIC DATA More...
 
static ALIdouble getParamFittedSigmaVectorItem (const ALIuint position)
 
static ALIstringMatricesFName ()
 the name of the File for storing the matrices More...
 
static ALIstringMeasFName ()
 the name of the Measurements File More...
 
static std::vector< Measurement * > & MeasurementList ()
 
static struct tm & MeasurementsTime ()
 
static OpticalObjectnextOptOToCopy ()
 
static std::vector< std::vector< ALIstring > > & OptODictionary ()
 ACCESS STATIC DATA MEMBERS. More...
 
static std::vector< OpticalObject * > & OptOList ()
 
static std::string printCocoaStatus (const cocoaStatus cs)
 
static ALIbool readMeasurementsFromFile (ALIstring only1Date=ALIstring(""), ALIstring only1Time=ALIstring(""))
 
static void readSystemDescription ()
 -------— Read the different sections of the SDF and act accordingly More...
 
static ALIstringReportFName ()
 the name of the report File More...
 
static ALIstringSDFName ()
 the name of the System Description File More...
 
static void setCocoaStatus (const cocoaStatus cs)
 
static void setMatricesFName (const ALIstring &name)
 
static void setMeasurementsTime (struct tm &tim)
 
static void setReportFName (const ALIstring &name)
 
static void setSDFName (const ALIstring &name)
 

Static Public Attributes

static std::vector< ALIdoubleCMSLinkRangeDetValue
 
static ALIint Ncmslinkrange = 0
 *************** FOR RANGE STUDIES More...
 

Private Member Functions

void CMSLinkCleanModel ()
 

Static Private Member Functions

static void buildMeasurementsLinksToOptOs ()
 Read Measurements (to be implemented for reading from an external file the DATA of the measurements) More...
 
static void cleanParamFittedSigmaVector ()
 
static void cleanParamFittedValueDisplacementMap ()
 
static void CMSLinkDeleteOptOs ()
 
static void CMSLinkRecoverParamFittedSigma (ALIint cmslink)
 
static void CMSLinkRecoverParamFittedValueDisplacement (ALIint cmslink)
 
static void CMSLinkSaveParamFittedSigma (ALIint cmslink)
 
static void CMSLinkSaveParamFittedValueDisplacement (ALIint cmslink)
 
static void copyMeasurements (const std::vector< ALIstring > &wl)
 
static void deleteOptO (const ALIstring &opto_name)
 
static void deleteOptO (OpticalObject *opto)
 
static ALIbool fillCopyComponentList (const OpticalObject *opto)
 
static void recoverParamFittedSigma (const ALIstring &opto_name, const ALIstring &entry_name, const ALIuint position)
 
static void reorderOptODictionary (const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
 ********** private METHODS More...
 
static void saveParamFittedCorrelation (const ALIstring &opto_name1, const ALIstring &entry_name1, const ALIstring &opto_name2, const ALIstring &entry_name2)
 
static void saveParamFittedSigma (const ALIstring &opto_name, const ALIstring &entry_name)
 
static void SetValueDisplacementsFromReportOut ()
 

Static Private Attributes

static ALIint CMSLinkIteration = 0
 
static cocoaStatus theCocoaStatus = COCOA_Init
 
static std::vector< Entry * > theEntryVector
 std::vector of all Entries More...
 
static FittedEntriesReadertheFittedEntriesReader = nullptr
 
static ModeltheInstance = nullptr
 
static ALIstring theMatricesFName = "matrices.out"
 the name of the File for storing the matrices More...
 
static ALIstring theMeasFName = "Measurements.txt"
 the name of the Measurements File More...
 
static struct tm theMeasurementsTime
 
static std::vector< Measurement * > theMeasurementVector
 std::vector of all Measurements More...
 
static std::vector< OpticalAlignInfotheOpticalAlignments
 
static std::vector< std::vector< ALIstring > > theOptODictionary
 parameters More...
 
static std::vector< OpticalObject * > theOptOList
 map of OptO*/type of parent OptO, for navigation down the tree structure More...
 
static std::vector< OpticalObject * > theOptOsToCopyList
 
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
 
static std::vector< ALIdoubletheParamFittedSigmaVector
 
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
 
static ALIstring theReportFName = "report.out"
 the name of the report File More...
 
static ALIstring theSDFName = "SystemDescription.txt"
 the name of the System Description File More...
 

Detailed Description

Definition at line 54 of file Model.h.

Constructor & Destructor Documentation

◆ Model()

Model::Model ( )

Definition at line 90 of file Model.cc.

90  {
91  // theMeasurementsTime = clock();
92 }

◆ ~Model()

Model::~Model ( )
inline

Definition at line 58 of file Model.h.

58 {};

Member Function Documentation

◆ addEntryToList()

static void Model::addEntryToList ( Entry entry)
inlinestatic

***************** SET DATA MEMBERS

Definition at line 140 of file Model.h.

References mps_splice::entry, and theEntryVector.

Referenced by OpticalObject::fillCoordinateEntry(), OpticalObject::fillExtraEntry(), and OpticalObject::setAnglesNull().

140  {
141  theEntryVector.push_back(entry);
142  //- std::cout << entry << entry->OptOCurrent()->name() << "ADDENTRY " << entry->name() << " " << EntryList().size() << std::endl;
143  }
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:191

◆ addMeasurementToList()

static void Model::addMeasurementToList ( Measurement measadd)
inlinestatic

Definition at line 145 of file Model.h.

References theMeasurementVector.

Referenced by Measurement::postConstruct().

145  {
146  theMeasurementVector.push_back(measadd);
147  // std::cout << "ADD MEASUREMENT" << theMeasurementVector.size() << std::endl ;
148  }
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194

◆ BuildMeasurementsFromOA()

void Model::BuildMeasurementsFromOA ( OpticalAlignMeasurements measList)

Definition at line 1569 of file Model.cc.

References DMR_cfg::cerr, Measurement::constructFromOA(), gather_cfg::cout, ALIUtils::debug, cppFunctionSkipper::exception, OpticalAlignMeasurements::oaMeasurements_, and AlCaHLTBitMon_QueryRunRegistry::string.

1569  {
1570  std::vector<OpticalAlignMeasurementInfo>::iterator mite;
1571 
1572  if (ALIUtils::debug >= 5)
1573  std::cout << " BuildMeasurementsFromOA " << std::endl;
1574  std::vector<OpticalAlignMeasurementInfo> measInfos = measList.oaMeasurements_;
1575  for (mite = measInfos.begin(); mite != measInfos.end(); ++mite) {
1576  std::string measType = (*mite).type_;
1577  std::string measName = (*mite).name_;
1578  if (ALIUtils::debug >= 4)
1579  std::cout << " BuildMeasurementsFromOA measType " << measType << " measName " << measName << std::endl;
1580  //---------- Create Measurement with appropiate dimension
1581  Measurement* meastemp = nullptr;
1582  if (measType == ALIstring("SENSOR2D")) {
1583  meastemp = new MeasurementSensor2D(2, measType, measName);
1584  } else if (measType == ALIstring("DISTANCEMETER3DIM")) {
1585  meastemp = new MeasurementDistancemeter3dim(1, measType, measName);
1586  } else if (measType == ALIstring("DISTANCEMETER") || measType == ALIstring("DISTANCEMETER1DIM")) {
1587  meastemp = new MeasurementDistancemeter(1, measType, measName);
1588  } else if (measType == ALIstring("TILTMETER")) {
1589  meastemp = new MeasurementTiltmeter(1, measType, measName);
1590  } else if (measType == ALIstring("COPS")) {
1591  meastemp = new MeasurementCOPS(4, measType, measName);
1592  // } else if ( measType == ALIstring("DIFFCENTRE") ) {
1593  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1594  // } else if ( measType == ALIstring("DIFFANGLE") ) {
1595  // meastemp = new MeasurementDiffAngle( 2, measType, measName );
1596  } else if (measType == ALIstring("DIFFENTRY")) {
1597  meastemp = new MeasurementDiffEntry(1, measType, measName);
1598  } else {
1599  std::cerr << " !!! Model::BuildMeasurementsFromOA : measType not found " << measType << std::endl;
1600  throw std::exception();
1601  }
1602  meastemp->constructFromOA(*mite);
1603  }
1604 }
static ALIint debug
Definition: ALIUtils.h:34
std::vector< OpticalAlignMeasurementInfo > oaMeasurements_
std::string ALIstring
Definition: CocoaGlobals.h:9
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:89

◆ buildMeasurementsLinksToOptOs()

void Model::buildMeasurementsLinksToOptOs ( )
staticprivate

Read Measurements (to be implemented for reading from an external file the DATA of the measurements)

Build for each measuremnt its link to the OptO that take part in it

Definition at line 537 of file Model.cc.

Referenced by readSystemDescription().

537  {
538  //---------- Loop Measurements
539  std::vector<Measurement*>::const_iterator vmcite;
540  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
541  //---------- Transform for each Measurement the Measured OptO names to Measured OptO pointers
542  // (*vmcite)->buildOptOList();
543 
544  //---------- Build list of Entries that affect a Measurement
545  // (*vmcite)->buildAffectingEntryList();
546  }
547 }
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88

◆ BuildSystemDescriptionFromOA()

void Model::BuildSystemDescriptionFromOA ( OpticalAlignments optAlig)

Definition at line 1528 of file Model.cc.

References OpticalObject::constructFromOptAligInfo(), OpticalAlignInfo::name_, and OpticalAlignments::opticalAlignments().

1528  {
1530 
1531  OpticalAlignInfo oai_system = FindOptAlignInfoByType("system");
1532 
1533  OpticalObject* OptOsystem = new OpticalObject(nullptr, "system", oai_system.name_, false);
1534 
1535  OptOsystem->constructFromOptAligInfo(oai_system);
1536 
1537  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
1538  // theOptOlist[OptOsystem->name()] = OptOsystem;
1539  theOptOList.push_back(OptOsystem);
1540 }
std::vector< OpticalAlignInfo > opticalAlignments() const
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1543
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
void constructFromOptAligInfo(const OpticalAlignInfo &oaInfo)

◆ cleanParamFittedSigmaVector()

static void Model::cleanParamFittedSigmaVector ( )
inlinestaticprivate

Definition at line 257 of file Model.h.

References cuy::ii, and theParamFittedSigmaVector.

257  {
258  ALIuint pfsv_size = theParamFittedSigmaVector.size();
259  for (ALIuint ii = 0; ii < pfsv_size; ii++) {
260  theParamFittedSigmaVector.pop_back();
261  }
262  }
ii
Definition: cuy.py:589
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:274
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ cleanParamFittedValueDisplacementMap()

static void Model::cleanParamFittedValueDisplacementMap ( )
inlinestaticprivate

Definition at line 264 of file Model.h.

References theParamFittedValueDisplacementMap.

264  {
267  }
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:276

◆ CMSLinkCleanModel()

void Model::CMSLinkCleanModel ( )
private

Definition at line 856 of file Model.cc.

References cuy::ii.

856  {
857  deleteOptO("s");
858  //---------- Clean OptOdicitionary (in case this is not first reading)
859  ALIuint odsize = theOptODictionary.size();
860  for (ALIuint ii = 0; ii < odsize; ii++) {
861  theOptODictionary.pop_back();
862  }
863 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1102
ii
Definition: cuy.py:589
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ CMSLinkDeleteOptOs()

void Model::CMSLinkDeleteOptOs ( )
staticprivate

Definition at line 868 of file Model.cc.

References cms::cuda::assert(), CMSLinkIteration, gather_cfg::cout, ALIUtils::debug, GlobalOptionMgr::getGlobalOptionValue(), and GlobalOptionMgr::getInstance().

868  {
869  ALIint cmslink_iter = Model::CMSLinkIteration;
870  ALIdouble cmslink_method;
871 
873  assert(gomgr->getGlobalOptionValue("cms_link_method", cmslink_method));
874  ALIdouble cmslink_halfplanes;
875  assert(gomgr->getGlobalOptionValue("cms_link_halfplanes", cmslink_halfplanes));
876  if (ALIUtils::debug >= 2)
877  std::cout << "CMSLinkDeleteOptOs: cms_link_halfplanes " << cmslink_halfplanes << cmslink_iter << std::endl;
878 
879  if (cmslink_iter == 1) {
880  //---------- First fit: delete everything but laser1 and det_tkU
881  // deleteOptO("s/laserboxL/laser2");
882  //- std::cout << "delete mabs" << std::endl;
883  deleteOptO("s/mabsL");
884  //------- Method 1: detectors at tracker down
885  if (cmslink_method == 1) {
886  deleteOptO("s/tracker/det_trkDL");
887  deleteOptO("s/tracker/det_trkDR");
888  }
889 
890  if (cmslink_halfplanes == 2) {
891  // deleteOptO("s/laserboxR/laser2");
892  deleteOptO("s/mabsR");
893  }
894 
895  } else if (cmslink_iter == 2) {
896  //---------- Second fit (method 1): delete everything but laser1 and det3
897  // deleteOptO("s/laserboxL/laser2");
898  deleteOptO("s/mabsL");
899  deleteOptO("s/tracker/CST/wheel_trkL/peri/mirror"); //??
900  deleteOptO("s/tracker/CST/wheel_trkL/det_trkU");
901  //------- Method 1: detectors on CST, Method 2: detectors on tracker
902  //not necessary deleteOptO("s/tracker/CST/det6");
903 
904  if (cmslink_halfplanes <= 1) {
905  deleteOptO("s/tracker/CST/wheel_trkR");
906  } else if (cmslink_halfplanes == 2) {
907  // deleteOptO("s/laserboxR/laser2");
908  deleteOptO("s/mabsR");
909  deleteOptO("s/tracker/CST/wheel_trkR/peri/mirror"); //??
910  deleteOptO("s/tracker/CST/wheel_trkR/det_trkU");
911  }
912 
913  } else if (cmslink_iter == 3) {
914  //---------- Third fit: delete everything but laser2 and mabs
915  // deleteOptO("s/laserboxL/laser1");
916  deleteOptO("s/tracker");
917 
918  if (cmslink_halfplanes == 2) {
919  // deleteOptO("s/laserboxR/laser1");
920  }
921  //---------- Do nothing
922  } else {
923  }
924 }
static ALIint CMSLinkIteration
Definition: Model.h:237
long double ALIdouble
Definition: CocoaGlobals.h:11
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1102
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
assert(be >=bs)
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found

◆ CMSLinkFit()

void Model::CMSLinkFit ( ALIint  cmslink)

*************** FOR CMS LINK SYSTEM (to fit it part by part)

Definition at line 800 of file Model.cc.

800  {
801  /*
802  //---------- Get number of fits
803  ALIint cmslinkNoFits = 0;
804  if( cmslink == 1) {
805  cmslinkNoFits = 3;
806  } else if( cmslink == 2) {
807  cmslinkNoFits = 2;
808  }
809  if(ALIUtils::debug >= 4) std::cout << " Start CMS link fit with method " << cmslink << " (number of fits = " << cmslinkNoFits << ")" << std::endl;
810 
811  //----------- Loop number of cms_link fits
812  for(ALIint ilink = ALIint(Model::GlobalOptions()["cms_link"]); ilink <= cmslinkNoFits; ilink++) {
813 
814  //----- Iteration 2 of method 2 resembles iteration 3 of method 1
815  ALIdouble cmslink_method;
816  assert(Model::getGlobalOptionValue("cms_link_method", cmslink_method));
817  if( cmslink_method == 2 && ilink == 2) ilink = 3;
818 
819 //---- Set variable CMSLinkIteration, Checked in Fit.C and other //- std::cout << "ilink" << ilink << std::endl;
820  Model::setGlobalOption("cms_link", ilink);
821  Model::CMSLinkIteration = ilink;
822 
823  if(ilink > 1)Model::readSystemDescription(); //already read once to fill value Model::GlobalOptions()["cms_link"]
824 
825  //---------- Delete the OptO not fitted in this iteration
826  // Model::CMSLinkDeleteOptOs();
827  // cannot be here because you may recover a parameter saved in previous iteration that now it is deleted (!!MODIFY THIS)
828 
829  //---------- Recover parameters fitted in previous iteration
830  Model::CMSLinkRecoverParamFittedSigma( ilink );
831 
832  Model::CMSLinkRecoverParamFittedValueDisplacement( ilink );
833 
834  //---------- Delete the OptO not fitted in this iteration
835  Model::CMSLinkDeleteOptOs();
836 
837  //---------- Start fit
838  Fit::startFit();
839 
840  //---------- Save parameters fitted in this iteration (to be used in next one)
841  Model::CMSLinkSaveParamFittedSigma( ilink );
842 
843  Model::CMSLinkSaveParamFittedValueDisplacement( ilink );
844 
845  //---------- Delete whole system to start anew in next iteration
846  Model::CMSLinkCleanModel();
847 
848  }
849  */
850 }

◆ CMSLinkRecoverParamFittedSigma()

void Model::CMSLinkRecoverParamFittedSigma ( ALIint  cmslink)
staticprivate

Definition at line 1017 of file Model.cc.

1017  {
1018  /*
1019  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
1020 
1021  if( cms_link == 2) {
1022  //---------- Second fit: recover laserbox angles
1023  recoverParamFittedSigma("s/laserboxL","Angles X",0);
1024  recoverParamFittedSigma("s/laserboxL","Angles Y",1);
1025 
1026  if( cms_link_halfplanes == 2) {
1027  recoverParamFittedSigma("s/laserboxR","Angles X",0);
1028  recoverParamFittedSigma("s/laserboxR","Angles Y",1);
1029  }
1030 
1031  } else if( cms_link == 3) {
1032  //---------- Third fit: recover laserbox angles and position and rotate angles to mabs
1033  recoverParamFittedSigma("s/laserboxL","Centre X",0);
1034  recoverParamFittedSigma("s/laserboxL","Centre Y",1);
1035  recoverParamFittedSigma("s/laserboxL","Centre Z",2);
1036  recoverParamFittedSigma("s/laserboxL","Angles X",3);
1037 
1038  //----- Angle around Y is converted to angle around Z when turning 90 deg
1039  Entry* slaZ = getEntryByName("s/laserboxL","Angles Z");
1040  //--- prec_level_laser
1041  Entry* smaZ = getEntryByName("s/mabsL","Angles Z");
1042  slaZ->setQuality(0);
1043  slaZ->setValue( smaZ->value() );
1044  // smaZ->setQuality(0); //!!???!!?
1045 
1046  Entry* slaY = getEntryByName("s/laserboxL","Angles Y");
1047  slaY->setQuality(0);
1048 
1049  if( cms_link_halfplanes == 2) {
1050  recoverParamFittedSigma("s/laserboxR","Centre X",0);
1051  recoverParamFittedSigma("s/laserboxR","Centre Y",1);
1052  recoverParamFittedSigma("s/laserboxR","Centre Z",2);
1053  recoverParamFittedSigma("s/laserboxR","Angles X",3);
1054 
1055  //----- Angle around Y is converted to angle around Z when turning 90 deg
1056  Entry* slaZ = getEntryByName("s/laserboxR","Angles Z");
1057  //--- prec_level_laser
1058  Entry* smaZ = getEntryByName("s/mabsR","Angles Z");
1059  slaZ->setQuality(0);
1060  slaZ->setValue( smaZ->value() );
1061  // smaZ->setQuality(0); //!!???!!?
1062 
1063  Entry* slaY = getEntryByName("s/laserboxR","Angles Y");
1064  slaY->setQuality(0);
1065  }
1066  } else {
1067  //---------- Do nothing
1068 
1069  }
1070  */
1071 }

◆ CMSLinkRecoverParamFittedValueDisplacement()

void Model::CMSLinkRecoverParamFittedValueDisplacement ( ALIint  cmslink)
staticprivate

Definition at line 1076 of file Model.cc.

1076  {
1077  /*
1078  //---------- Second fit: recover laserbox angles
1079  if( cms_link == 2 || cms_link == 3 ) {
1080 
1081  std::map<ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator vsdmite;
1082  if ( ALIUtils::debug >= 99) std::cout << "theParamFittedValueDisplacementMap.size " << theParamFittedValueDisplacementMap.size() << std::endl;
1083  for( vsdmite = theParamFittedValueDisplacementMap.begin(); vsdmite != theParamFittedValueDisplacementMap.end(); vsdmite++) {
1084  std::cout << "reoverValueDisp" << (*vsdmite).first << " " << (*vsdmite).second << std::endl;
1085  Entry* this_entry = getEntryByName( (*vsdmite).first);
1086  this_entry->displaceOriginal( (*vsdmite).second );
1087  this_entry->OptOCurrent()->resetGlobalCoordinates();
1088  this_entry->setValueDisplacementByFitting( (*vsdmite).second );
1089 
1090  }
1091 
1092  //---------- Do nothing
1093  } else {
1094 
1095  }
1096  */
1097 }

◆ CMSLinkSaveParamFittedSigma()

void Model::CMSLinkSaveParamFittedSigma ( ALIint  cmslink)
staticprivate

Definition at line 929 of file Model.cc.

929  {
930  /*
931  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
932 
933  cleanParamFittedSigmaVector();
934 
935  //---------- First fit: Save laserbox angles fitted at tracker
936  if( cms_link == 1) {
937  //? if (GlobalOptions()["cms_link_method"] < 10){
938  saveParamFittedSigma("s/laserboxL","Angles X");
939  saveParamFittedSigma("s/laserboxL","Angles Y");
940 
941  saveParamFittedCorrelation("s/laserboxL","Angles X",
942  "s/tracker/CST","Centre Y");
943  saveParamFittedCorrelation("s/laserboxL","Angles Y",
944  "s/tracker/CST","Centre X");
945  if( cms_link_halfplanes == 2) {
946  saveParamFittedSigma("s/laserboxR","Angles X");
947  saveParamFittedSigma("s/laserboxR","Angles Y");
948 
949  saveParamFittedCorrelation("s/laserboxR","Angles X",
950  "s/tracker/CST","Centre Y");
951  saveParamFittedCorrelation("s/laserboxR","Angles Y",
952  "s/tracker/CST","Centre X");
953  }
954 
955  } else if( cms_link == 2) {
956  //---------- Second fit: Save laserbox angles and position
957  saveParamFittedSigma("s/laserboxL","Centre X");
958  saveParamFittedSigma("s/laserboxL","Centre Y");
959  // Make quality unk to cal
960  saveParamFittedSigma("s/laserboxL","Centre Z");
961  saveParamFittedSigma("s/laserboxL","Angles X");
962  saveParamFittedSigma("s/laserboxL","Angles Y");
963 
964  saveParamFittedCorrelation("s/laserboxL","Centre X",
965  "s/laserboxL","Angles Y");
966  saveParamFittedCorrelation("s/laserboxL","Centre Y",
967  "s/laserboxL","Angles X");
968 
969  if( cms_link_halfplanes == 2) {
970  saveParamFittedSigma("s/laserboxR","Centre X");
971  saveParamFittedSigma("s/laserboxR","Centre Y");
972  // Make quality unk to cal
973  saveParamFittedSigma("s/laserboxR","Centre Z");
974  saveParamFittedSigma("s/laserboxR","Angles X");
975  saveParamFittedSigma("s/laserboxR","Angles Y");
976 
977  saveParamFittedCorrelation("s/laserboxR","Centre X",
978  "s/laserboxR","Angles Y");
979  saveParamFittedCorrelation("s/laserboxR","Centre Y",
980  "s/laserboxR","Angles X");
981  }
982  } else {
983  //---------- Do nothing
984 
985  }
986  */
987 }

◆ CMSLinkSaveParamFittedValueDisplacement()

void Model::CMSLinkSaveParamFittedValueDisplacement ( ALIint  cmslink)
staticprivate

Definition at line 992 of file Model.cc.

992  {
993  /*
994  cleanParamFittedValueDisplacementMap();
995 
996  //----------
997  if( cms_link == 1 || cms_link == 2 ) {
998  std::vector<Entry*>::const_iterator vecite;
999  for( vecite = EntryList().begin(); vecite != EntryList().end(); vecite++) {
1000  if( (*vecite)->valueDisplacementByFitting() != 0 ) {
1001  ALIstring names = (*vecite)->OptOCurrent()->name() + "/" + (*vecite)->name();
1002  std::cout << "saeParamFittedValueDisplacementMap" << names << (*vecite)->valueDisplacementByFitting() << std::endl;
1003  theParamFittedValueDisplacementMap[ names ] = (*vecite)->valueDisplacementByFitting();
1004  }
1005  }
1006 
1007  //---------- Do nothing
1008  } else {
1009 
1010  }
1011  */
1012 }

◆ copyMeasurements()

void Model::copyMeasurements ( const std::vector< ALIstring > &  wl)
staticprivate

Definition at line 1411 of file Model.cc.

References ALIUtils::changeName(), Measurement::copyMeas(), gather_cfg::cout, Exception, spr::find(), Measurement::name(), mps_merge::newName, AlCaHLTBitMon_QueryRunRegistry::string, Measurement::type(), and LaserClient_cfi::wl.

1411  {
1412  //----- Check format, e.g. @copy_measurements _1/_2/*_1
1413 
1414  //----- get list of Measurement's that satisfy the query in their name
1415  //t std::string querystr = wl[1].substr( wl[1].find("/")+1, wl[1].length() );
1416  std::string subsstr1 = wl[1].substr(0, wl[1].find('/'));
1417  std::string subsstr2 = wl[1].substr(wl[1].find('/') + 1, wl[1].rfind('/') - wl[1].find('/') - 1);
1418  std::string querystr = wl[1].substr(wl[1].rfind('/') + 1, wl[1].length());
1419 
1420  std::cout << " Model::copyMeasurements "
1421  << " subsstr1 " << subsstr1 << " subsstr2 " << subsstr2 << " querystr " << querystr << std::endl;
1422 
1423  std::vector<Measurement*> measToCopy;
1424  std::vector<Measurement*>::iterator mite;
1425  for (mite = theMeasurementVector.begin(); mite != theMeasurementVector.end(); ++mite) {
1426  Measurement* meas = (*mite);
1427  //improve this
1428  if (meas->name().find(querystr) != std::string::npos) {
1429  measToCopy.push_back(meas);
1430  }
1431  }
1432 
1433  //---- Build new measurements
1434  Measurement* meastemp = nullptr;
1435  for (mite = measToCopy.begin(); mite != measToCopy.end(); ++mite) {
1436  Measurement* meas = (*mite);
1437  std::vector<ALIstring> wlt;
1438  wlt.push_back(meas->type());
1439 
1440  //---- create new name
1441  std::string newName = ALIUtils::changeName(meas->name(), subsstr1, subsstr2);
1442  std::cout << " newName " << newName << std::endl;
1443  wlt.push_back(newName);
1444 
1445  ALIstring measType = wlt[0];
1446  ALIstring measName;
1447  if (wlt.size() == 2) {
1448  measName = wlt[1];
1449  } else {
1450  measName = "";
1451  }
1452  if (meas->type() == ALIstring("SENSOR2D")) {
1453  meastemp = new MeasurementSensor2D(2, measType, measName);
1454  // } else if ( meas->type() == ALIstring("DISTANCEMETER3DIM") ) {
1455  // meastemp = new MeasurementDistancemeter3dim( 1, measType, measName );
1456  } else if (meas->type() == ALIstring("DISTANCEMETER") || meas->type() == ALIstring("DISTANCEMETER1DIM")) {
1457  meastemp = new MeasurementDistancemeter(1, measType, measName);
1458  } else if (meas->type() == ALIstring("TILTMETER")) {
1459  meastemp = new MeasurementTiltmeter(1, measType, measName);
1460  // } else if ( meas->type() == ALIstring("DIFFCENTRE") ) {
1461  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1462  // } else if ( meas->type() == ALIstring("DIFFANGLE") ) {
1463  // meastemp = new MeasurementDiffAngle( 1, measType, measName );
1464  } else if (meas->type() == ALIstring("DIFFENTRY")) {
1465  meastemp = new MeasurementDiffEntry(1, measType, measName);
1466  } else if (meas->type() == ALIstring("COPS")) {
1467  meastemp = new MeasurementCOPS(4, measType, measName);
1468  } else {
1469  throw cms::Exception("LogicError") << "@SUB=Model::copyMeasurements\n"
1470  << "unknown measurement type: " << meas->type();
1471  }
1472 
1473  //later meastemp->copyConversionFactor( wordlist );
1474  meastemp->copyMeas(meas, subsstr1, subsstr2);
1475 
1476  break;
1477  }
1478 }
string newName
Definition: mps_merge.py:86
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:535
const ALIstring & type() const
Definition: Measurement.h:84
std::string ALIstring
Definition: CocoaGlobals.h:9
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:621
const ALIstring & name() const
Definition: Measurement.h:86

◆ createCopyComponentList()

ALIbool Model::createCopyComponentList ( const ALIstring optoname)
static

**************** FOR COPYING AN OPTO

Definition at line 742 of file Model.cc.

References gather_cfg::cout, and ALIUtils::debug.

Referenced by OpticalObject::createComponentOptOs().

742  {
743  //---------- 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)
744  if (ALIUtils::debug >= 3)
745  std::cout << "createCopyComponentList " << typ << std::endl;
746  OpticalObject* start_opto = getOptOByType(typ);
747 
748  //---------- clean list of OptOs to copy
750 
751  //---------- Fill list of OptOs to copy
752  fillCopyComponentList(start_opto);
753  //- if(ALIUtils::debug >= 9) std::cout << "createCopyComponentList " << typ << theOptOsToCopyList.size() << std::endl;
754 
756  return true;
757 }
static ALIint debug
Definition: ALIUtils.h:34
static OpticalObject * getOptOByType(const ALIstring &type)
--— Find the first OptO of type &#39;opto_type&#39; in theOptOList and return a pointer to it ...
Definition: Model.cc:593
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:216
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:218
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:762

◆ deleteOptO() [1/2]

void Model::deleteOptO ( const ALIstring opto_name)
staticprivate

Definition at line 1102 of file Model.cc.

1102  {
1103  OpticalObject* opto = getOptOByName(opto_name);
1104  deleteOptO(opto);
1105 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1102
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:562

◆ deleteOptO() [2/2]

void Model::deleteOptO ( OpticalObject opto)
staticprivate

Definition at line 1110 of file Model.cc.

References OpticalObject::CoordinateEntryList(), gather_cfg::cout, ALIUtils::debug, OpticalObject::ExtraEntryList(), spr::find(), and OpticalObject::name().

1110  {
1111  if (ALIUtils::debug >= 5)
1112  std::cout << "DELETING OptO" << opto->name() << std::endl;
1113 
1114  //---------- Delete Coordinate Entries of this OptO
1115  std::vector<Entry*>::const_iterator vecite;
1116  std::vector<Entry*>::iterator veite2;
1117  if (ALIUtils::debug >= 9)
1118  std::cout << "SIZE" << theEntryVector.size() << std::endl;
1119  for (vecite = opto->CoordinateEntryList().begin(); vecite != opto->CoordinateEntryList().end(); ++vecite) {
1120  // ALIuint pos = FindItemInVector( (*veite), opto->CoordinateEntryList() );
1121  veite2 = find(theEntryVector.begin(), theEntryVector.end(), (*vecite));
1122  //- if ( ALIUtils::debug >= 9) std::cout << (*veite2) << "DELETE ENTRY " << (*vecite) <<(*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1123  delete ((*veite2));
1124  theEntryVector.erase(veite2);
1125  }
1126 
1127  for (vecite = opto->ExtraEntryList().begin(); vecite != opto->ExtraEntryList().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 " << (*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1131  delete ((*veite2));
1132  theEntryVector.erase(veite2);
1133  }
1134 
1135  for (vecite = theEntryVector.begin(); vecite != theEntryVector.end(); ++vecite) {
1136  // std::cout << (*vecite) << "ENTReY " << (*vecite)->OptOCurrent()->name() << (*vecite)->name() << std::endl;
1137  }
1138 
1139  //---------- Delete all Measurement in which opto takes part
1140  std::vector<Measurement*> MeasToBeDeleted;
1141  std::vector<Measurement*>::const_iterator vmite;
1142  std::vector<OpticalObject*>::const_iterator vocite;
1143  for (vmite = MeasurementList().begin(); vmite != MeasurementList().end(); ++vmite) {
1144  if (ALIUtils::debug >= 5)
1145  std::cout << "Deleting Measurement" << (*vmite)->name() << std::endl;
1146  //----- If any of the OptO Measured is opto, delete this Measurement
1147  for (vocite = (*vmite)->OptOList().begin(); vocite != (*vmite)->OptOList().end(); ++vocite) {
1148  if ((*vocite) == opto) {
1149  //- std::cout << "MEASTBD" << (*vmite) << std::endl;
1150  MeasToBeDeleted.push_back(*vmite);
1151  //? delete (*vmite);
1152  break;
1153  }
1154  }
1155  }
1156 
1157  //---------- Delete Measurements from list
1158  std::vector<Measurement*>::const_iterator vmcite;
1159  std::vector<Measurement*>::iterator vmite2;
1160  if (ALIUtils::debug >= 9)
1161  std::cout << "SIZEMEAS" << MeasToBeDeleted.size() << std::endl;
1162  for (vmcite = MeasToBeDeleted.begin(); vmcite != MeasToBeDeleted.end(); ++vmcite) {
1163  vmite2 = find(theMeasurementVector.begin(), theMeasurementVector.end(), (*vmcite));
1164  // std::cout << (*vmite2) << "DELETE MSEASU " << (*vmcite) << (*vmite2)->name()[0] << std::endl;
1165  delete ((*vmite2));
1166  theMeasurementVector.erase(vmite2);
1167  }
1168 
1169  //---------- Delete components
1170  // std::vector<OpticalObject*>::iterator voite;
1171  std::vector<OpticalObject*> vopto;
1172  // ALIbool opto_found = getComponentOptOs( opto->name(), vopto );
1173  for (vocite = vopto.begin(); vocite != vopto.end(); ++vocite) {
1174  deleteOptO(*vocite);
1175  }
1176 
1177  //---------- Delete this OptO
1178  //---------- Delete OptO (only from list, to delete it really first delete components)
1179  /* map< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator msoite =
1180 find( theOptOList.begin(), theOptOList.end(),
1181 map< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type( opto->name(), opto) );*/
1182  std::vector<OpticalObject*>::iterator dvoite =
1184  //- std::cout << (*dvoite) << "DELETE OPTO " << opto <<"WW" << (*dvoite)->name() << std::endl;
1185  theOptOList.erase(dvoite);
1186  delete opto;
1187 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1102
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< Entry * > & ExtraEntryList() const
Definition: OpticalObject.h:65
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194
const std::vector< Entry * > & CoordinateEntryList() const
Definition: OpticalObject.h:63
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:191
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88

◆ EntryList()

static std::vector<Entry*>& Model::EntryList ( )
inlinestatic

◆ fillCopyComponentList()

ALIbool Model::fillCopyComponentList ( const OpticalObject opto)
staticprivate

Definition at line 762 of file Model.cc.

References gather_cfg::cout, ALIUtils::debug, and OpticalObject::name().

762  {
763  if (ALIUtils::debug >= 3)
764  std::cout << "entering fillCopyComponentList(): OptO" << opto->name() << std::endl;
765  //---------- Get list of components of 'opto'
766  std::vector<OpticalObject*> vopto;
767  ALIbool opto_found = getComponentOptOs(opto->name(), vopto);
768  if (!opto_found) {
769  if (ALIUtils::debug >= 5)
770  std::cout << "fillCopyComponentList: NO COMPONENTS TO COPY IN THIS OptO" << opto->name() << std::endl;
771  }
772 
773  //---------- Loop list of components of 'opto'
774  std::vector<OpticalObject*>::const_iterator vocite;
775  for (vocite = vopto.begin(); vocite != vopto.end(); ++vocite) {
776  theOptOsToCopyList.push_back(*vocite);
777  if (ALIUtils::debug >= 5)
778  std::cout << "fillCopyOptOList " << (*vocite)->type() << " " << (*vocite)->name() << std::endl;
779  //---------- Add components of this component
780  fillCopyComponentList(*vocite);
781  }
782  return opto_found;
783 }
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
bool ALIbool
Definition: CocoaGlobals.h:19
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:216
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:762
static ALIbool getComponentOptOs(const ALIstring &opto_name, std::vector< OpticalObject *> &vcomponents)
--— Get from theOptOList the list of pointers to component OptOs
Definition: Model.cc:697

◆ FindOptAlignInfoByType()

OpticalAlignInfo Model::FindOptAlignInfoByType ( const ALIstring type)

Definition at line 1543 of file Model.cc.

References DMR_cfg::cerr, cppFunctionSkipper::exception, and OpticalAlignInfo::name_.

1543  {
1544  OpticalAlignInfo oai;
1545 
1546  ALIbool bFound = false;
1547  std::vector<OpticalAlignInfo>::iterator ite;
1548  for (ite = theOpticalAlignments.begin(); ite != theOpticalAlignments.end(); ++ite) {
1549  // std::cout << " Model::FindOptAlignInfoByType " << (*ite).type_ << " =? " << type << std::endl;
1550  if ((*ite).type_ == type) {
1551  if (!bFound) {
1552  oai = *ite;
1553  bFound = true;
1554  } else {
1555  std::cerr << "!! WARNING: Model::FindOptAlignInfoByType more than one objects of type " << type << std::endl;
1556  std::cerr << " returning object " << oai.name_ << std::endl << " skipping object " << (*ite).name_ << std::endl;
1557  }
1558  }
1559  }
1560  if (!bFound) {
1561  std::cerr << "!! ERROR: Model::FindOptAlignInfoByType object not found, of type " << type << std::endl;
1562  std::exception();
1563  }
1564 
1565  return oai;
1566 }
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282
bool ALIbool
Definition: CocoaGlobals.h:19

◆ getCocoaStatus()

static cocoaStatus Model::getCocoaStatus ( )
inlinestatic

Definition at line 63 of file Model.h.

References theCocoaStatus.

Referenced by Fit::fitParameters().

63 { return theCocoaStatus; }
static cocoaStatus theCocoaStatus
Definition: Model.h:272

◆ getComponentOptOs()

ALIbool Model::getComponentOptOs ( const ALIstring opto_name,
std::vector< OpticalObject *> &  vcomponents 
)
static

--— Get from theOptOList the list of pointers to component OptOs

Definition at line 697 of file Model.cc.

References gather_cfg::cout, ALIUtils::debug, and OpticalObject::name().

Referenced by OpticalObject::displaceCentreGlob(), OpticalObject::displaceCentreGlobOriginal(), OpticalObject::displaceCentreGlobOriginalOriginal(), OpticalObject::displaceRmGlobAroundGlobal(), OpticalObject::displaceRmGlobAroundLocal(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), OpticalObject::propagateGlobalRMOriginalOriginalChangeToChildren(), OpticalObject::resetGlobalCoordinates(), OpticalObject::resetOriginalOriginalCoordinates(), OpticalObject::setGlobalCoordinatesOfComponents(), and OpticalObject::setGlobalRMOriginalOriginal().

697  {
698  //---------- clean std::vector in which you are going to store opto pointers
699  std::vector<OpticalObject*>::iterator voite;
700  for (voite = vcomponents.begin(); voite != vcomponents.end(); ++voite) {
701  vcomponents.pop_back();
702  }
703 
704  //---------- Get OptO corresponding to name 'opto_name'
705  OpticalObject* opto = getOptOByName(opto_name);
706 
707  if (ALIUtils::debug >= 99)
708  std::cout << opto_name << "getComponentOptOs: opto " << opto << opto->name() << std::endl;
709  std::vector<OpticalObject*>::const_iterator vocite;
710 
711  if (ALIUtils::debug >= 99)
712  std::cout << "optolist size " << OptOList().size() << std::endl;
713  ALIbool opto_found = false;
714  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
715  if ((*vocite)->parent() != nullptr) {
716  // std::cout << "looping OptOlist" << (*vocite)->name() << " parent " <<(*vocite)->parent()->name() << std::endl;
717  if ((*vocite)->parent()->name() == opto_name) {
718  opto_found = true;
719  vcomponents.push_back((*vocite));
720  }
721  }
722  }
723 
724  /* std::pair<multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator,
725  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator>
726  pmmao = _OptOtree.equal_range(opto_name);
727 
728  if( pmmao.first != _OptOtree.end()) {
729  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::const_iterator socite;
730  for (socite = pmmao.first; socite != (pmmao.second); socite++) {
731  vcomponents.push_back( (*socite).second );
732  }
733  }
734  */
735  return opto_found;
736 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:562
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
bool ALIbool
Definition: CocoaGlobals.h:19

◆ getComponentOptOTypes()

ALIbool Model::getComponentOptOTypes ( const ALIstring opto_type,
std::vector< ALIstring > &  vcomponents 
)
static

--— Get from theOptODictionary the list of component OptO types

Definition at line 666 of file Model.cc.

Referenced by OpticalObject::createComponentOptOs().

666  {
667  //---------- clean std::vector in which you are going to store opto types
668  std::vector<ALIstring>::iterator vsite;
669  for (vsite = vcomponents.begin(); vsite != vcomponents.end(); ++vsite) {
670  vcomponents.pop_back();
671  }
672 
673  //---------- Looks the theOptODictionary item that has 'opto_type' as the first ALIstring,
674  ALIint ALIstring_found = 0;
675  std::vector<std::vector<ALIstring> >::iterator vvsite;
676  for (vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
677  if (*((*vvsite).begin()) == opto_type) {
678  ALIstring_found = 1;
679  //tt copies this item to 'vcomponents', substracting the first ALIstring, that is the opto_type itself,
680  vcomponents = *vvsite;
681  vcomponents.erase(vcomponents.begin());
682  break;
683  }
684  }
685 
686  if (ALIstring_found) {
687  return true;
688  } else {
689  return false;
690  }
691 }
int ALIint
Definition: CocoaGlobals.h:15
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82

◆ getEntryByName() [1/2]

Entry * Model::getEntryByName ( const ALIstring opto_name,
const ALIstring entry_name 
)
static

--— Search an Entry name in the Entry* list and return a pointer to it

Definition at line 615 of file Model.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, and beamvalidation::exit().

Referenced by MeasurementDiffEntry::calculateSimulatedValue(), FittedEntry::FittedEntry(), getEntryByName(), FittedEntriesReader::readFittedEntriesFromFile(), Fit::setCorrelationFromParamFitted(), and FittedEntriesSet::SetOptOEntries().

615  {
616  //---------- Look for Entry name type in EntryList
617  std::vector<Entry*>::const_iterator vecite;
618  for (vecite = EntryList().begin(); vecite != EntryList().end(); ++vecite) {
619  if (ALIUtils::debug >= 4)
620  std::cout << "getEntryByName: " << (*vecite)->OptOCurrent()->name() << " E " << (*vecite)->name()
621  << " Searching: " << opto_name << " E " << entry_name << std::endl;
622  //- std::cout << " optoName " << (*vecite)->OptOCurrent()->name()<< " " << (*vecite)->name() << std::endl;
623  if ((*vecite)->OptOCurrent()->name() == opto_name && (*vecite)->name() == entry_name) {
624  return *vecite;
625  }
626  }
627  //---------- Entry not found!
628  std::cerr << "!!!EXITING at getEntryByName: Entry name not found:" << opto_name << " " << entry_name << std::endl;
629  exit(1);
630 }
static ALIint debug
Definition: ALIUtils.h:34
static std::vector< Entry * > & EntryList()
Definition: Model.h:86
def exit(msg="")

◆ getEntryByName() [2/2]

static Entry* Model::getEntryByName ( const ALIstring opto_entry_name)
inlinestatic

--— Search an Entry from the full entry path (first substract the name of the OptO and then look in the Entry* list)

Definition at line 120 of file Model.h.

References mps_splice::entry, and getEntryByName().

120  {
121  ALIint slash_pos = opto_entry_name.rfind('/');
122  ALIint length = opto_entry_name.length();
123  ALIstring opto_name = opto_entry_name.substr(0, slash_pos);
124  ALIstring entry_name = opto_entry_name.substr(slash_pos + 1, length);
125  Entry* entry = getEntryByName(opto_name, entry_name);
126  return entry;
127  }
Definition: Entry.h:18
int ALIint
Definition: CocoaGlobals.h:15
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:615
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ getFittedEntriesReader()

static FittedEntriesReader* Model::getFittedEntriesReader ( )
inlinestatic

Definition at line 254 of file Model.h.

References theFittedEntriesReader.

Referenced by Fit::fitNextEvent().

254 { return theFittedEntriesReader; }
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:280

◆ getInstance()

Model & Model::getInstance ( )
static

-------— Gets the only instance of this class

Definition at line 80 of file Model.cc.

Referenced by CocoaAnalyzer::runCocoa().

80  {
81  if (!theInstance) {
82  theInstance = new Model;
83  }
84  return *theInstance;
85 }
static Model * theInstance
Definition: Model.h:176
Model()
Definition: Model.cc:90

◆ getMeasurementByName()

Measurement * Model::getMeasurementByName ( const ALIstring name,
ALIbool  exists = true 
)
static

Definition at line 633 of file Model.cc.

References DMR_cfg::cerr.

633  {
634  //---------- Look for Optical Object name in OptOList
635  std::vector<Measurement*>::const_iterator vmcite;
636  for (vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite) {
637  if ((*vmcite)->name() == meas_name)
638  break;
639  }
640 
641  if (vmcite != theMeasurementVector.end()) {
642  //---------- If opto_name found, return pointer to it
643  return (*vmcite);
644  } else {
645  if (exists) {
646  //---------- If opto_name not found, exit
647  std::cerr << " LIST OF Measurements " << std::endl;
648  for (vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite) {
649  std::cerr << (*vmcite)->name() << std::endl;
650  }
651  std::cerr << "!!EXITING at getMeasurementByName: Measurement " << meas_name << " doesn't exist!!" << std::endl;
652  abort();
653  // return (OpticalObject*)0;
654  } else {
655  return nullptr;
656  }
657  }
658 }
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194

◆ getOpticalAlignments()

static std::vector<OpticalAlignInfo> Model::getOpticalAlignments ( )
inlinestatic

Definition at line 137 of file Model.h.

References theOpticalAlignments.

Referenced by OpticalObject::createComponentOptOsFromOptAlignInfo().

137 { return theOpticalAlignments; }
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282

◆ getOptOByName()

OpticalObject * Model::getOptOByName ( const ALIstring opto_name)
static

--— Find an OptO name in theOptOList and return a pointer to it

Definition at line 562 of file Model.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, and beamvalidation::exit().

Referenced by Measurement::buildOptOList(), Fit::findEntryFitPosition(), and FittedEntriesSet::SetOptOEntries().

562  {
563  //---------- Look for Optical Object name in OptOList
564  std::vector<OpticalObject*>::const_iterator vocite;
565  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
566  if ((*vocite)->name() == opto_name)
567  break;
568  }
569 
570  if (vocite == OptOList().end()) {
571  //---------- If opto_name not found, exit
572  std::cerr << " LIST OF OpticalObjects " << std::endl;
573  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
574  std::cerr << (*vocite)->name() << std::endl;
575  }
576  std::cerr << "!!EXITING at getOptOByName: Optical Object " << opto_name << " doesn't exist!!" << std::endl;
577  exit(4);
578  // return (OpticalObject*)0;
579  } else {
580  //---------- If opto_name found, return pointer to it
581  if (ALIUtils::debug > 999) {
582  std::cout << opto_name.c_str() << "SSOptOitem" << (*vocite) << (*vocite)->name() << "len" << OptOList().size()
583  << std::endl;
584  }
585  return (*vocite);
586  }
587 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
static ALIint debug
Definition: ALIUtils.h:34
def exit(msg="")

◆ getOptOByType()

OpticalObject * Model::getOptOByType ( const ALIstring type)
static

--— Find the first OptO of type 'opto_type' in theOptOList and return a pointer to it

Definition at line 593 of file Model.cc.

References DMR_cfg::cerr, and beamvalidation::exit().

593  {
594  //---------- Look for Optical Object type in OptOList
595  std::vector<OpticalObject*>::const_iterator vocite;
596  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
597  // std::cout << "OPTOList" << (*msocite).first << std::endl;
598  if ((*vocite)->type() == opto_type)
599  break;
600  }
601 
602  if (vocite == OptOList().end()) {
603  //---------- If opto_type not found, exit
604  std::cerr << "!!EXITING at getOptOByType: Optical Object " << opto_type << " doesn't exist!!" << std::endl;
605  exit(4);
606  } else {
607  //---------- If opto_type found, return pointer to it
608  return (*vocite);
609  }
610 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
def exit(msg="")

◆ getParameterValue()

ALIint Model::getParameterValue ( const ALIstring sstr,
ALIdouble val 
)
static

************ ACCESS INFO FROM STATIC DATA

--— Search a string in theParameters and return 1 if found

Definition at line 552 of file Model.cc.

References ParameterMgr::getInstance(), ParameterMgr::getParameterValue(), and heppy_batch::val.

552  {
554  ALIint iret = parmgr->getParameterValue(sstr, val);
555 
556  return iret;
557 }
static ParameterMgr * getInstance()
Definition: ParameterMgr.cc:18
int ALIint
Definition: CocoaGlobals.h:15
ALIint getParameterValue(const ALIstring &name, ALIdouble &val)

◆ getParamFittedSigmaVectorItem()

ALIdouble Model::getParamFittedSigmaVectorItem ( const ALIuint  position)
static

Definition at line 1267 of file Model.cc.

References DMR_cfg::cerr, beamvalidation::exit(), and position.

1267  {
1268  if (position >= theParamFittedSigmaVector.size()) {
1269  std::cerr << "!!EXITING at getParamFittedSigma: position" << position
1270  << " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size()
1271  << std::endl;
1272  exit(3);
1273  }
1274  std::vector<ALIdouble>::const_iterator vdcite = theParamFittedSigmaVector.begin() + position;
1275  return (*vdcite);
1276 }
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:274
static int position[264][3]
Definition: ReadPGInfo.cc:289
def exit(msg="")

◆ MatricesFName()

static ALIstring& Model::MatricesFName ( )
inlinestatic

the name of the File for storing the matrices

Definition at line 102 of file Model.h.

References theMatricesFName.

Referenced by Fit::dumpMatrices().

102 { return theMatricesFName; }
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:203

◆ MeasFName()

static ALIstring& Model::MeasFName ( )
inlinestatic

the name of the Measurements File

Definition at line 96 of file Model.h.

References theMeasFName.

96 { return theMeasFName; }
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:199

◆ MeasurementList()

static std::vector<Measurement*>& Model::MeasurementList ( )
inlinestatic

◆ MeasurementsTime()

static struct tm& Model::MeasurementsTime ( )
inlinestatic

Definition at line 135 of file Model.h.

References theMeasurementsTime.

135 { return theMeasurementsTime; }
static struct tm theMeasurementsTime
Definition: Model.h:278

◆ nextOptOToCopy()

OpticalObject * Model::nextOptOToCopy ( )
static

Definition at line 788 of file Model.cc.

References gather_cfg::cout, and ALIUtils::debug.

Referenced by OpticalObject::copyData().

788  {
789  if (ALIUtils::debug >= 5)
790  std::cout << "entering nextOptOToCopy() " << std::endl;
792  // if(ALIUtils::debug >= 5) std::cout <<" nextOptOToCopy " << (*(theOptOsToCopyListIterator-1))->name() << std::endl;
793  return *(theOptOsToCopyListIterator - 1);
794 }
static ALIint debug
Definition: ALIUtils.h:34
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:218

◆ OptODictionary()

static std::vector<std::vector<ALIstring> >& Model::OptODictionary ( )
inlinestatic

ACCESS STATIC DATA MEMBERS.

Definition at line 82 of file Model.h.

References theOptODictionary.

Referenced by readSystemDescription().

82 { return theOptODictionary; }
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182

◆ OptOList()

static std::vector<OpticalObject*>& Model::OptOList ( )
inlinestatic

◆ printCocoaStatus()

std::string Model::printCocoaStatus ( const cocoaStatus  cs)
static

Definition at line 1503 of file Model.cc.

References COCOA_FitCannotImprove, COCOA_FitChi2Worsened, COCOA_FitImproving, COCOA_FitMatrixNonInversable, COCOA_FitOK, COCOA_Init, COCOA_InitFit, COCOA_ReadingModel, callgraph::cs, str, and AlCaHLTBitMon_QueryRunRegistry::string.

1503  {
1504  std::string str = "";
1505 
1506  if (cs == COCOA_Init) {
1507  str = "COCOA_Init ";
1508  } else if (cs == COCOA_ReadingModel) {
1509  str = "COCOA_ReadingModel";
1510  } else if (cs == COCOA_InitFit) {
1511  str = "COCOA_InitFit";
1512  } else if (cs == COCOA_FitOK) {
1513  str = "COCOA_FitOK";
1514  } else if (cs == COCOA_FitImproving) {
1515  str = "COCOA_FitImproving";
1516  } else if (cs == COCOA_FitCannotImprove) {
1517  str = "COCOA_FitCannotImprove";
1518  } else if (cs == COCOA_FitChi2Worsened) {
1519  str = "COCOA_FitChi2Worsened";
1520  } else if (cs == COCOA_FitMatrixNonInversable) {
1521  str = "COCOA_FitMatrixNonInversable";
1522  }
1523 
1524  return str;
1525 }
#define str(s)

◆ readMeasurementsFromFile()

ALIbool Model::readMeasurementsFromFile ( ALIstring  only1Date = ALIstring(""),
ALIstring  only1Time = ALIstring("") 
)
static

Definition at line 1281 of file Model.cc.

References DMR_cfg::cerr, Measurement::correctValueAndSigma(), gather_cfg::cout, ALIUtils::debug, Measurement::dim(), ALIUtils::dumpVS(), relativeConstraints::empty, mps_fire::end, ALIFileIn::eof(), ALIFileIn::ErrorInLine(), beamvalidation::exit(), Measurement::fillData(), GlobalOptionMgr::getInstance(), ALIFileIn::getInstance(), ALIFileIn::getWordsInLine(), GlobalOptionMgr::GlobalOptions(), cuy::ii, MeasurementList(), Measurement::measurementsFileName(), heppy_report::oname, Measurement::only1, Measurement::only1Date, Measurement::only1Time, Measurement::setCurrentDate(), Measurement::setSigma(), Measurement::sigma(), and Measurement::valueType().

1281  {
1282  if (ALIUtils::debug >= 5)
1283  std::cout << " readMeasurementsFromFile " << Measurement::measurementsFileName() << std::endl;
1285  return true;
1286 
1288  std::vector<ALIstring> wordlist;
1289  //---------- read date
1290  // ALIint retfil = filein.getWordsInLine(wordlist);
1291  // std::cout << "@@@@@@@@@@@@@@@ RETFIL " << retfil << std::endl;
1292  //if( retfil == 0 ) {
1293  if (filein.getWordsInLine(wordlist) == 0) {
1294  if (ALIUtils::debug >= 4)
1295  std::cout << "@@@@ No more measurements left" << std::endl;
1296  return false;
1297  }
1298 
1300  // struct tm tim;
1301  //t Model::setMeasurementsTime( tim );
1302 
1303  //if you are looking for only one measurement with a given date and time, loop all measurements until you find it
1304  if (Measurement::only1) {
1305  for (;;) {
1306  if (wordlist[0] == "DATE:" && wordlist[1] == Measurement::only1Date && wordlist[2] == Measurement::only1Time)
1307  break;
1308  filein.getWordsInLine(wordlist);
1309  if (filein.eof()) {
1310  std::cerr << "!! EXITING date not found in measurements file" << Measurement::only1Date << " "
1311  << Measurement::only1Time << std::endl;
1312  exit(1);
1313  }
1314  }
1315  }
1316 
1317  //set date and time of current measurement
1318  if (wordlist[0] == "DATE:") {
1319  Measurement::setCurrentDate(wordlist);
1320  }
1321 
1322  //---------- loop measurements
1323  ALIint nMeas = Model::MeasurementList().size();
1324  if (ALIUtils::debug >= 4) {
1325  std::cout << " Reading " << nMeas << " measurements from file " << Measurement::measurementsFileName()
1326  << " DATE: " << wordlist[1] << " " << wordlist[1] << std::endl;
1327  }
1328  ALIint ii;
1329  for (ii = 0; ii < nMeas; ii++) {
1330  filein.getWordsInLine(wordlist);
1331  if (wordlist[0] == ALIstring("SENSOR2D") || wordlist[0] == ALIstring("TILTMETER") ||
1332  wordlist[0] == ALIstring("DISTANCEMETER") || wordlist[0] == ALIstring("DISTANCEMETER1DIM") ||
1333  wordlist[0] == ALIstring("COPS")) {
1334  if (wordlist.size() != 2) {
1335  std::cerr << "!!!EXITING Model::readMeasurementsFromFile. number of words should be 2 instead of "
1336  << wordlist.size() << std::endl;
1337  ALIUtils::dumpVS(wordlist, " ");
1338  exit(1);
1339  }
1340  std::vector<Measurement*>::const_iterator vmcite;
1341  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
1342  //-------- Measurement found, fill data
1343  /* ALIint last_slash = (*vmcite)->name().rfind('/');
1344  ALIstring oname = (*vmcite)->name();
1345  if( last_slash != -1 ) {
1346  oname = oname.substr(last_slash+1, (*vmcite)->name().size()-1);
1347  }
1348  */
1349  ALIint fcolon = (*vmcite)->name().find(':');
1350  ALIstring oname = (*vmcite)->name();
1351  oname = oname.substr(fcolon + 1, oname.length());
1352  //- std::cout << " measurement name " << (*vmcite)->name() << " short " << oname << std::endl;
1353  if (oname == wordlist[1]) {
1354  //- std::cout << " measurement name found " << oname << std::endl;
1355  if ((*vmcite)->type() != wordlist[0]) {
1356  std::cerr << "!!! Reading measurement from file: type in file is " << wordlist[0] << " and should be "
1357  << (*vmcite)->type() << std::endl;
1358  exit(1);
1359  }
1360  Measurement* meastemp = *vmcite;
1361 
1363  ALIbool sigmaFF = gomgr->GlobalOptions()["measurementErrorFromFile"];
1364  //---------- Read the data
1365  for (ALIuint ii = 0; ii < meastemp->dim(); ii++) {
1366  filein.getWordsInLine(wordlist);
1367  ALIdouble sigma = 0.;
1368  if (!sigmaFF) {
1369  // keep the sigma, do not read it from file
1370  const ALIdouble* sigmav = meastemp->sigma();
1371  sigma = sigmav[ii];
1372  }
1373  //---- Check measurement value type is OK
1374  if (meastemp->valueType(ii) != wordlist[0]) {
1375  filein.ErrorInLine();
1376  std::cerr << "!!!FATAL ERROR: Measurement value type is " << wordlist[0]
1377  << " while in setup definition was " << meastemp->valueType(ii) << std::endl;
1378  exit(1);
1379  }
1380  meastemp->fillData(ii, wordlist);
1381  if (!sigmaFF) {
1382  meastemp->setSigma(ii, sigma);
1383  }
1384  }
1385  meastemp->correctValueAndSigma();
1386  break;
1387  }
1388  }
1389  if (vmcite == MeasurementList().end()) {
1390  for (vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
1391  std::cerr << "MEAS: " << (*vmcite)->name() << " " << (*vmcite)->type() << std::endl;
1392  }
1393  std::cerr << "!!! Reading measurement from file: measurement not found in list: type in file is " << wordlist[1]
1394  << std::endl;
1395  exit(1);
1396  }
1397  } else {
1398  std::cerr << " wrong type of measurement: " << wordlist[0] << std::endl
1399  << " Available types are SENSOR2D, TILTMETER, DISTANCEMETER, DISTANCEMETER1DIM, COPS" << std::endl;
1400  exit(1);
1401  }
1402  }
1403  //- std::cout << " returning readmeasff" << std::endl;
1404 
1405  return true;
1406 }
static ALIbool only1
Definition: Measurement.h:212
long double ALIdouble
Definition: CocoaGlobals.h:11
ALIbool eof()
Definition: ALIFileIn.cc:200
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:21
const ALIuint dim() const
Definition: Measurement.h:82
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
static ALIstring only1Time
Definition: Measurement.h:214
static GlobalOptionMgr * getInstance()
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:116
bool ALIbool
Definition: CocoaGlobals.h:19
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:131
ii
Definition: cuy.py:589
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:73
static ALIstring & measurementsFileName()
Definition: Measurement.h:162
void ErrorInLine()
Definition: ALIFileIn.cc:195
const ALIdouble * sigma() const
Definition: Measurement.h:112
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
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
virtual void correctValueAndSigma()
Definition: Measurement.h:66
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88
static ALIstring only1Date
Definition: Measurement.h:213
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:605
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ readSystemDescription()

void Model::readSystemDescription ( )
static

-------— Read the different sections of the SDF and act accordingly

Definition at line 97 of file Model.cc.

References ParameterMgr::addParameter(), ParameterMgr::addRandomFlatParameter(), ParameterMgr::addRandomGaussParameter(), cms::cuda::assert(), buildMeasurementsLinksToOptOs(), DMR_cfg::cerr, ALIFileIn::close(), COCOA_Init, Measurement::construct(), OpticalObject::construct(), filterCSVwithJSON::copy, gather_cfg::cout, ALIUtils::debug, ALIUtils::dumpVS(), relativeConstraints::empty, mps_fire::end, ALIFileIn::eof(), ALIFileIn::ErrorInLine(), beamvalidation::exit(), spr::find(), ALIUtils::getFloat(), EntryMgr::getInstance(), ParameterMgr::getInstance(), ErrorCorrelationMgr::getInstance(), GlobalOptionMgr::getInstance(), ALIFileIn::getInstance(), ALIUtils::getInt(), ALIFileIn::getWordsInLine(), cuy::ii, ALIUtils::IsNumber(), ALIFileIn::nline(), Measurement::only1, Measurement::only1Date, Measurement::only1Time, OptODictionary(), EntryMgr::readEntryFromReportOut(), ErrorCorrelationMgr::readFromReportFile(), SDFName(), sectGlobalOptions, sectMeasurements, sectParameters, sectReportOut, sectSystemTreeData, sectSystemTreeDescription, ALIUtils::SetAngleDimensionFactors(), setCocoaStatus(), Measurement::setConversionFactor(), GlobalOptionMgr::setGlobalOption(), ALIUtils::SetLengthDimensionFactors(), ALIUtils::SetOutputAngleDimensionFactors(), ALIUtils::SetOutputLengthDimensionFactors(), and ParameterMgr::setRandomSeed().

97  {
99 
100  ALIint data_reading = 0; // variable to identify the first line of section SYSTEM_TREE_DATA
101 
102  //---------- Open the system description file
104 
105  //----------- Set section titles
106  std::vector<ALIstring> SectionTitle;
107  SectionTitle.push_back(ALIstring("GLOBAL_OPTIONS"));
108  SectionTitle.push_back(ALIstring("PARAMETERS"));
109  SectionTitle.push_back(ALIstring("SYSTEM_TREE_DESCRIPTION"));
110  SectionTitle.push_back(ALIstring("SYSTEM_TREE_DATA"));
111  SectionTitle.push_back(ALIstring("MEASUREMENTS"));
112  SectionTitle.push_back(ALIstring("REPORT.OUT"));
113  std::vector<ALIstring>::iterator SectionTitleIterator;
114 
115  //---------------------------------------- Loops lines in SDF file
116  std::vector<ALIstring> wordlist;
117  ALIint InSectionNo = -1;
118  ALIint currentSectionNo = -1;
119  while (!filein.eof()) {
120  if (!filein.getWordsInLine(wordlist))
121  break; //----- Read line
122  assert(!wordlist.empty());
123 
124  //----- checking
125  if (ALIUtils::debug > 99) {
126  ALIUtils::dumpVS(wordlist, " ", std::cout);
127  }
128 
129  //---------- Get in which section the current line is and act accordingly
130  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
131  //@@@ ---------- Check if word is start of section
132  SectionTitleIterator = find(SectionTitle.begin(), SectionTitle.end(), *wordlist.begin());
133  if (SectionTitleIterator != SectionTitle.end()) {
134  //---------- Check that previous sections are correct
135  currentSectionNo = SectionTitleIterator - SectionTitle.begin();
136  if (currentSectionNo != InSectionNo + 1) {
137  if (currentSectionNo != sectReportOut) {
139  std::cerr << "BAD ORDER OF SECTIONS, reading section " << *SectionTitleIterator << std::endl
140  << " currentSectionNo = " << currentSectionNo << " InSectionNo = " << InSectionNo << std::endl
141  << " --------- Please see documentation ---------- " << std::endl;
142  exit(1);
143  }
144  } else {
145  if (currentSectionNo != sectReportOut) {
146  InSectionNo++;
147  }
148  }
149  if (currentSectionNo == sectMeasurements) {
151  }
152 
153  if (ALIUtils::debug >= 4)
154  std::cout << std::endl << "START OF SECTION: " << currentSectionNo << " " << *SectionTitleIterator << std::endl;
155 
156  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
157  //@@@ ---------- Reading GLOBAL_OPTIONS section
158  } else if (currentSectionNo == sectGlobalOptions) {
159  //- std::cout << "utilsdebug " << ALIUtils::debug << std::endl;
160  //-------- Check format of line read
161  //----- Two words
162  if (wordlist.size() == 2) {
163  //----- Second word is number
164  int isnumber = ALIUtils::IsNumber(wordlist[1]);
165  if (!isnumber && wordlist[0] != ALIstring("external_meas")) {
167  std::cerr << ": EXPECTING A NUMBER, FOUND: " << wordlist[1] << std::endl;
168  exit(2);
169  }
170 
172  gomgr->setGlobalOption(wordlist[0], ALIUtils::getFloat(wordlist[1]), ALIFileIn::getInstance(Model::SDFName()));
173 
174  //-or GlobalOptions.insert(std::pair<const ALIstring, ALIdouble>(wordlist[0] , atof(wordlist[1].c_str()) ) );
175 
176  if (ALIUtils::debug >= 1) {
177  ALIUtils::dumpVS(wordlist, "GLOBAL_OPTION: ", std::cout);
178  }
179 
180  } else {
181  std::cout << "error < 1" << std::endl;
183  std::cerr << ": IN GLOBAL_OPTIONS section TWO-WORD LINES ARE EXPECTED " << std::endl;
184  exit(2);
185  }
186 
187  //------- Set dimension factors for lengths and angles
192 
193  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
194  //@@@ ---------- Reading PARAMETERS section
195  } else if (currentSectionNo == sectParameters ||
196  currentSectionNo ==
197  -1) { // Allow parameters in first lines (for easy study of different parameter values)
198 
199  //---------- Check format of line read
200  //----- Two words
201  if (wordlist.size() == 2) {
202  /* now checked in ParameterMgr
203  //----- Second is number
204  int isnumber = ALIUtils::IsNumber( wordlist[1] );
205  if( !isnumber ) {
206  ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
207  std::cerr << ": EXPECTING A NUMBER, FOUND: " << wordlist[1] << std::endl;
208  exit(2);
209  } */
210 
211  //old---------- Create parameter with value read (or overwrite existing value)
212  //---------- Create parameter with value read if parameter does not exist yet
214  parmgr->addParameter(wordlist[0], wordlist[1]);
215 
216  } else if (wordlist.size() == 3) {
217  if (wordlist[1] != "seed") {
219  std::cerr << ": For a three-word parameter line, second has to be 'seed', it is " << wordlist[1]
220  << std::endl;
221  exit(1);
222  }
223 
224  if (wordlist[0] == "gauss" || wordlist[0] == "flat") {
226  } else {
228  std::cerr << ": For a three-word parameter line, first has to be 'gauss' or 'flat', it is " << wordlist[0]
229  << std::endl;
230  exit(1);
231  }
232  } else if (wordlist.size() == 4) {
233  if (wordlist[0] == "gauss") {
234  ParameterMgr::getInstance()->addRandomGaussParameter(wordlist[1], wordlist[2], wordlist[3]);
235  } else if (wordlist[0] == "flat") {
236  ParameterMgr::getInstance()->addRandomFlatParameter(wordlist[1], wordlist[2], wordlist[3]);
237  } else {
239  std::cerr << ": For a four-word parameter line, first has to be 'gauss' or 'flat', it is " << wordlist[0]
240  << std::endl;
241  exit(1);
242  }
243  } else {
245  std::cerr << ": IN PARAMETERS section TWO-WORD-LINES ARE EXPECTED " << std::endl;
246  ALIUtils::dumpVS(wordlist, " ");
247  exit(2);
248  }
249 
250  //print it out
251  if (ALIUtils::debug >= 1) {
252  ALIUtils::dumpVS(wordlist, "PARAMETERS: ", std::cout);
253  }
254 
255  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
256  //@@@ ---------- Reading SYSTEM_TREE_DESCRIPTION section
257  } else if (currentSectionNo == sectSystemTreeDescription) {
258  //---------- Convert the numbers found in list of components (e.g. 2 laser -> laser laser )
259  //----- Backup wordlist and erase it
260  std::vector<ALIstring> wordlist2 = wordlist;
261  std::vector<ALIstring>::iterator vsite;
262  ALIint wsiz = wordlist.size();
263  for (ALIint ii = 0; ii < wsiz; ii++) {
264  wordlist.pop_back();
265  }
266  //----- Loop objects looking for numbers to convert
267  for (vsite = wordlist2.begin(); vsite != wordlist2.end(); ++vsite) {
268  if (ALIUtils::IsNumber(*vsite)) {
269  int nOpticalObjects = atoi((*vsite).c_str());
270  //----- If number is 1 it is not necessary
271  if (nOpticalObjects == 1) {
272  if (ALIUtils::debug >= 0)
273  std::cerr << "WARNING: in line " << ALIFileIn::getInstance(Model::SDFName()).nline()
274  << " number of repeated OpticalObjects = 1. Please avoid the numbering " << std::endl;
275  //- wordlist.erase( wordlist.begin() + (vsite-wordlist2.begin()) );
276  } else {
277  //----- The number cannot be the last in the list and you cannot put two numbers together
278  if (vsite + 1 == wordlist.end() || ALIUtils::IsNumber(*(vsite + 1))) {
280  std::cerr << "NUMBER SHOULD BE FOLLOWED BY an OpticalObject type" << std::endl;
281  exit(2);
282  }
283  //----- Right format: convert
284  //--- Substitute the number by the object type in wordlist
285  //- *( wordlist.begin() + (vsite-wordlist2.begin()) ) = *(vsite+1);
286  //--- Add n-1 object types to wordlist (the nth object will be added as the object taht goes after the number)
287  for (ALIint ii = 0; ii < nOpticalObjects - 1; ii++) {
288  //-std::cout << ii << "inserting in wordlist " << *(vsite+1) << std::endl;
289  wordlist.push_back(*(vsite + 1));
290  }
291  }
292  } else {
293  //----- Not number, add it to wordlist
294  wordlist.push_back(*vsite);
295  }
296  }
297 
298  //---------- Dump system structure
299  if (ALIUtils::debug >= 1) {
300  ALIUtils::dumpVS(wordlist, "SYSTEM TREE DESCRIPTION: before ordering, OBJECT: ", std::cout);
301  }
302 
303  //---------- Fill the list of Optical Object with components (theOptODictionary)
304  //----- First word is 'object': new OptO
305  if (wordlist[0] == ALIstring("object")) {
306  //----- Check out repeated objects
307  std::vector<std::vector<ALIstring> >::iterator vvsite;
308  for (vvsite = theOptODictionary.begin(); vvsite != theOptODictionary.end(); ++vvsite) {
309  //- std::cout << " system" << vvsite << std::endl;
310 
311  if (*((*vvsite).begin()) == wordlist[1]) {
313  std::cerr << "SYSTEM_TREE_DESCRIPTION: REPEATED object " << *((*vvsite).begin())
314  << " ( NOT ALLOWED NEITHER WITH EQUAL NOR WITH DIFFERENT COMPONENTS)" << std::endl;
315  exit(1);
316  }
317  }
318  //------- Add an item to theOptODictionary
319  std::vector<ALIstring> vstemp;
320  copy(wordlist.begin() + 1, wordlist.end(), back_inserter(vstemp));
321  Model::OptODictionary().push_back(vstemp);
322  } else {
323  //----- First word is not 'object': add to previous OptO
324  if (OptODictionary().empty()) {
326  std::cerr << "SYSTEM_TREE_DESCRIPTION section: FIRST LINE SHOULD START WITH 'object'" << std::endl;
327  exit(2);
328  }
329  copy(wordlist.begin(), wordlist.end(), back_inserter(*(OptODictionary().end() - 1)));
330  }
331 
332  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
333  //---------------------------------- Reading SYSTEM_TREE_DATA section
334  } else if (currentSectionNo == sectSystemTreeData) {
335  //---------- First line of data:
336  if (!data_reading) {
337  // ALIint dictsize = theOptODictionary.size();
338  //------- Reorder theOptODictionary
339  std::vector<std::vector<ALIstring> > OptODictionary2;
340  reorderOptODictionary("system", OptODictionary2);
341  if (OptODictionary2.empty()) {
342  std::cerr << "SYSTEM_TREE_DESCRIPTION section: no object 'system' found " << std::endl;
343  exit(9);
344  }
345  //------- We start reordering with 'system', therefore if 'system' is not the top most object, the objects not hanging from it would not be considered
346  //---- Check if all the objects are here
347  std::vector<std::vector<ALIstring> >::const_iterator vvscite, vvscite2;
348  // ALIint dictsizen = 0;
349  for (vvscite = theOptODictionary.begin(); vvscite != theOptODictionary.end(); ++vvscite) {
350  ALIbool ofound = false;
351  for (vvscite2 = OptODictionary2.begin(); vvscite2 != OptODictionary2.end(); ++vvscite2) {
352  if (*((*vvscite).begin()) == *((*vvscite2).begin())) {
353  ofound = true;
354  break;
355  }
356  }
357  if (!ofound) {
358  std::cerr << "!!!SYSTEM_TREE_DESCRIPTION section: object " << *((*vvscite).begin())
359  << " is not hanging from object 'system' " << std::endl;
360  for (vvscite = OptODictionary().begin(); vvscite != OptODictionary().end(); ++vvscite) {
361  const std::vector<ALIstring>& ptemp = *vvscite;
362  ALIUtils::dumpVS(ptemp, "OBJECT ", std::cerr);
363  }
364  exit(9);
365  }
366  }
367  theOptODictionary = OptODictionary2;
368 
369  data_reading = 1;
370 
371  //------- Dump ordered OptOs
372  if (ALIUtils::debug >= 3) {
373  std::vector<std::vector<ALIstring> >::iterator itevs;
374  for (itevs = OptODictionary().begin(); itevs != OptODictionary().end(); ++itevs) {
375  std::vector<ALIstring> ptemp = *itevs;
376  ALIUtils::dumpVS(ptemp, " SYSTEM TREE DESCRIPTION: after ordering: OBJECT ", std::cout);
377  }
378  }
379 
380  //---------- Create OpticalObject 'system' (first OpticalObject object):
381  //---------- it will create its components and recursively all the System Tree of Optical Objects
382  if (wordlist[0] != "system") {
383  std::cerr << "SYSTEM_TREE_DATA section: object 'system' is not the first one " << std::endl;
384  exit(9);
385  }
386 
387  OpticalObject* OptOsystem = new OpticalObject(nullptr, "system", wordlist[1], false);
388  OptOsystem->construct();
389  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
390  // theOptOlist[OptOsystem->name()] = OptOsystem;
391  theOptOList.push_back(OptOsystem);
392 
393  } else {
394  //----------- All system is read by the Optical Objects, it should not reach here
396  std::cerr << " STILL SOME LINES AFTER ALL SYSTEM TREE IS READ!!!" << std::endl;
397  exit(9);
398  }
399 
400  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
401  //----------------------------------- Reading MEASUREMENTS section
402  } else if (currentSectionNo == sectMeasurements) {
403  //---------- Create Measurement with appropiate dimension
404  Measurement* meastemp = nullptr;
405  ALIstring measType = wordlist[0];
406  ALIstring measName;
407  if (wordlist.size() == 2) {
408  measName = wordlist[1];
409  wordlist.pop_back();
410  } else {
411  measName = "";
412  }
413  if (measType == ALIstring("SENSOR2D")) {
414  meastemp = new MeasurementSensor2D(2, measType, measName);
415  meastemp->setConversionFactor(wordlist);
416  meastemp->construct();
417  } else if (measType == ALIstring("DISTANCEMETER3DIM")) {
418  meastemp = new MeasurementDistancemeter3dim(1, measType, measName);
419  meastemp->setConversionFactor(wordlist);
420  meastemp->construct();
421  } else if (measType == ALIstring("DISTANCEMETER") || measType == ALIstring("DISTANCEMETER1DIM")) {
422  meastemp = new MeasurementDistancemeter(1, measType, measName);
423  meastemp->setConversionFactor(wordlist);
424  meastemp->construct();
425  } else if (measType == ALIstring("TILTMETER")) {
426  meastemp = new MeasurementTiltmeter(1, measType, measName);
427  meastemp->setConversionFactor(wordlist);
428  meastemp->construct();
429  } else if (measType == ALIstring("COPS")) {
430  meastemp = new MeasurementCOPS(4, measType, measName);
431  meastemp->setConversionFactor(wordlist);
432  meastemp->construct();
433  } else if (measType == ALIstring("DIFFENTRY")) {
434  meastemp = new MeasurementDiffEntry(1, measType, measName);
435  meastemp->construct();
436  } else if (measType == ALIstring("measurements_from_file") || measType == ALIstring("@measurements_from_file")) {
437  new CocoaDaqReaderText(wordlist[1]);
438  //m Measurement::setMeasurementsFileName( wordlist[1] );
439  //m if ( ALIUtils::debug >= 2) std::cout << " setting measurements_from_file " << measType << " == " << Measurement::measurementsFileName() << std::endl;
440  if (wordlist.size() == 4) {
441  Measurement::only1 = true;
442  Measurement::only1Date = wordlist[2];
443  Measurement::only1Time = wordlist[3];
444  //- std::cout << " setting Measurement::only1" << Measurement::only1 << std::endl;
445  }
446  } else if (measType == ALIstring("measurements_from_file_ROOT") ||
447  measType == ALIstring("@measurements_from_file")) {
448  new CocoaDaqReaderRoot(wordlist[1]);
449  } else if (wordlist[0] == ALIstring("correlations_from_file") ||
450  wordlist[0] == ALIstring("@correlations_from_file")) {
452  } else if (wordlist[0] == ALIstring("copy_measurements") || wordlist[0] == ALIstring("@copy_measurements")) {
453  copyMeasurements(wordlist);
454  // } else if( wordlist[0] == "scan" || wordlist[0] == "@scan" ) {
455  // ScanMgr::getInstance()->addOptOEntry( wordlist );
456  } else if (wordlist[0] == ALIstring("fittedEntries_from_file")) {
457  theFittedEntriesReader = new FittedEntriesReader(wordlist[1]);
458  if (ALIUtils::debug >= 2)
459  std::cout << " setting fittedEntries_from_file " << wordlist[0] << " == " << wordlist[1] << std::endl;
460  } else {
461  std::cerr << "Measurement:" << std::endl;
463  std::cerr << "!!! type of measurement not allowed: " << wordlist[0] << std::endl;
464  std::cerr << " Allowed types: SENSOR2D, DISTANCEMETER, DISTANCEMETER1DIM, TILTMETER, COPS, DIFFENTRY "
465  << std::endl;
466  exit(2);
467  }
468  //- meastemp->setGlobalName( wordlist[0] );
469  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
470  //@@@ ---------- Reading REPORT OUT section
471  } else if (currentSectionNo == sectReportOut) {
472  //----- It must be after global options section
473  if (InSectionNo + 1 != sectParameters) {
475  std::cerr << "BAD ORDER OF SECTIONS, reading section " << *SectionTitleIterator << std::endl
476  << " currentSectionNo = " << currentSectionNo << " InSectionNo = " << InSectionNo << std::endl
477  << " --------- Please see documentation ---------- " << std::endl;
478  exit(1);
479  }
480 
482  }
483  }
484 
485  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
486  //@@@ All system read
487  //---------- make Measurements links to their OptOs
488  if (ALIUtils::debug >= 2)
489  std::cout << std::endl << "@@@@ Building Measurements links to OptOs" << std::endl;
491 
492  if (ALIUtils::debug >= 1) {
493  std::cout << "---------- SYSTEM SUCCESFULLY READ ----------" << std::endl << std::endl;
494  }
495  filein.close();
496 
497  return;
498 }
static ALIbool only1
Definition: Measurement.h:212
ALIbool eof()
Definition: ALIFileIn.cc:200
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:21
static void setCocoaStatus(const cocoaStatus cs)
Definition: Model.h:64
static void SetOutputLengthDimensionFactors()
Definition: ALIUtils.cc:126
static void buildMeasurementsLinksToOptOs()
Read Measurements (to be implemented for reading from an external file the DATA of the measurements) ...
Definition: Model.cc:537
static ParameterMgr * getInstance()
Definition: ParameterMgr.cc:18
int ALIint
Definition: CocoaGlobals.h:15
void readFromReportFile(const ALIstring &filename)
static ALIint debug
Definition: ALIUtils.h:34
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:93
static ErrorCorrelationMgr * getInstance()
static ALIstring only1Time
Definition: Measurement.h:214
static GlobalOptionMgr * getInstance()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
const ALIint nline()
Definition: ALIFileIn.h:41
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:373
static void copyMeasurements(const std::vector< ALIstring > &wl)
Definition: Model.cc:1411
bool ALIbool
Definition: CocoaGlobals.h:19
void addRandomGaussParameter(const ALIstring &name, const ALIstring &valMean, const ALIstring &valStdDev)
Definition: ParameterMgr.cc:75
void setRandomSeed(const long seed)
Definition: ParameterMgr.cc:72
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
void close()
Definition: ALIFileIn.cc:217
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
virtual void setConversionFactor(const std::vector< ALIstring > &wordlist)
Definition: Measurement.h:69
static void SetValueDisplacementsFromReportOut()
Definition: Model.cc:1481
static void SetAngleDimensionFactors()
Definition: ALIUtils.cc:104
static void SetOutputAngleDimensionFactors()
Definition: ALIUtils.cc:153
ii
Definition: cuy.py:589
void setGlobalOption(const ALIstring go, const ALIdouble val, ALIFileIn &filein)
void addRandomFlatParameter(const ALIstring &name, const ALIstring &valMean, const ALIstring &valInterval)
Definition: ParameterMgr.cc:93
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:73
void ErrorInLine()
Definition: ALIFileIn.cc:195
static void SetLengthDimensionFactors()
Definition: ALIUtils.cc:81
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:280
static EntryMgr * getInstance()
Definition: EntryMgr.cc:16
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
std::string ALIstring
Definition: CocoaGlobals.h:9
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:504
ALIbool readEntryFromReportOut(const std::vector< ALIstring > &wl)
Definition: EntryMgr.cc:29
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182
static int getInt(const ALIstring &str)
Convert a string to an integer, checking that it is really an integer.
Definition: ALIUtils.cc:384
void addParameter(const ALIstring &name, const ALIstring &valstr)
Definition: ParameterMgr.cc:63
static ALIstring only1Date
Definition: Measurement.h:213
void construct()
Definition: Measurement.cc:59
def exit(msg="")
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82

◆ recoverParamFittedSigma()

void Model::recoverParamFittedSigma ( const ALIstring opto_name,
const ALIstring entry_name,
const ALIuint  position 
)
staticprivate

Definition at line 1248 of file Model.cc.

1248  {
1249  /*
1250  if( position >= theParamFittedSigmaVector.size() ) {
1251  std::cerr << "!!EXITING at recoverParamFittedSigma: position" << position <<
1252  " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size() << std::endl;
1253  exit(3);
1254  }
1255  ALIdouble sigma = getParamFittedSigmaVectorItem( position );
1256 
1257  Entry* entry = getEntryByName(opto_name, entry_name);
1258  entry->setSigma( sigma );
1259  entry->setQuality( 1 );
1260  std::cout << "recover " << opto_name << entry_name << entry->sigma() <<std::endl;
1261  */
1262 }

◆ reorderOptODictionary()

void Model::reorderOptODictionary ( const ALIstring ssearch,
std::vector< std::vector< ALIstring > > &  OptODictionary2 
)
staticprivate

********** private METHODS

Reorder the list of OptOs in a hierarchical structure (tree-like)

Definition at line 504 of file Model.cc.

504  {
505  // int ALIstring_found = 0;
506  std::vector<std::vector<ALIstring> >::iterator vvsite;
507  std::vector<ALIstring>::iterator vsite;
508 
509  //---------------------------------------- Look for 'ssearch' as the first ALIstring of an OptODictionary item
510  for (vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
511  if (*((*vvsite).begin()) == ssearch) {
512  // ALIstring_found = 1;
513  OptODictionary2.push_back(*vvsite);
514 
515  //- std::cout << "VVSITE";
516  //- ostream_iterator<ALIstring> outs(std::cout,"&");
517  //- copy( (*vvsite).begin(), (*vvsite).end(), outs);
518 
519  //---------------------------------- look for components of this _OptODictionary item
520  for (vsite = (*vvsite).begin() + 1; vsite != (*vvsite).end(); ++vsite) {
521  reorderOptODictionary(*vsite, OptODictionary2);
522  }
523  break;
524  }
525  }
526 
527  /* //------- object 'system' should exist
528  if(!ALIstring_found && ssearch == "system") {
529  std::cerr << "SYSTEM_TREE_DATA section: no 'object system' found " << std::endl;
530  exit(9);
531  } */
532 }
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:504
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82

◆ ReportFName()

static ALIstring& Model::ReportFName ( )
inlinestatic

the name of the report File

Definition at line 99 of file Model.h.

References theReportFName.

Referenced by Fit::fitNextEvent(), Fit::getFitQuality(), Fit::PrintChi2(), and CocoaAnalyzer::runCocoa().

99 { return theReportFName; }
static ALIstring theReportFName
the name of the report File
Definition: Model.h:201

◆ saveParamFittedCorrelation()

void Model::saveParamFittedCorrelation ( const ALIstring opto_name1,
const ALIstring entry_name1,
const ALIstring opto_name2,
const ALIstring entry_name2 
)
staticprivate

Definition at line 1211 of file Model.cc.

1214  {
1215  /*
1216 //---------- Get sigma of param Optical
1217  Entry* entry1 = getEntryByName(opto_name1, entry_name1);
1218  Entry* entry2 = getEntryByName(opto_name2, entry_name2);
1219  ALIuint fit_pos1 = entry1->fitPos();
1220  ALIuint fit_pos2 = entry2->fitPos();
1221 
1222  //---------- Get correlation if entry has been fitted
1223  ALIuint pmsize = Fit::propagationMatrix().NoLines();
1224  if( fit_pos1 >= 0 && fit_pos1 < pmsize && fit_pos2 >= 0 && fit_pos2 < pmsize ) {
1225  ALIdouble error1 = sqrt( Fit::propagationMatrix()( fit_pos1, fit_pos1) );
1226  ALIdouble error2 = sqrt( Fit::propagationMatrix()( fit_pos2, fit_pos2) );
1227  ALIdouble correl = Fit::propagationMatrix()( fit_pos1, fit_pos2) / error1 / error2;
1228  theParamFittedSigmaVector.push_back( correl );
1229  if(ALIUtils::debug>=9) {
1230  std::cout << "saveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1231  opto_name2 << entry_name2 << fit_pos2 << "MM " << correl << std::endl;
1232  }
1233  } else {
1234  if(ALIUtils::debug>=9) {
1235  std::cout << "NOsaveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1236  opto_name2 << entry_name2 << fit_pos2 << "MM " << std::endl;
1237  theParamFittedSigmaVector.push_back( 0. );
1238  }
1239 
1240  }
1241  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1242  */
1243 }

◆ saveParamFittedSigma()

void Model::saveParamFittedSigma ( const ALIstring opto_name,
const ALIstring entry_name 
)
staticprivate

Definition at line 1192 of file Model.cc.

1192  {
1193  /*
1194 //---------- Get sigma of param Optical
1195  Entry* entry = getEntryByName(opto_name, entry_name);
1196  ALIuint fit_pos = entry->fitPos();
1197  if( fit_pos < 0 || fit_pos >= Fit::propagationMatrix().NoLines()) {
1198  std::cerr << "!!EXITING at saveParamFittedSigma: fit position incorrect " <<
1199  fit_pos << "propagationMatrix size =" << Fit::propagationMatrix().NoLines() << opto_name << std::endl;
1200  exit(3);
1201  }
1202  std::cout << entry_name << "saveParamFittedSigma" << fit_pos << sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) << std::endl;
1203  theParamFittedSigmaVector.push_back( sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) );
1204  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1205  */
1206 }

◆ SDFName()

static ALIstring& Model::SDFName ( )
inlinestatic

the name of the System Description File

Definition at line 93 of file Model.h.

References theSDFName.

Referenced by MeasurementDiffEntry::buildOptONamesList(), Measurement::construct(), OpticalObject::construct(), Entry::fill(), Entry::fillFromInputFileQuality(), Entry::fillFromInputFileSigma(), Entry::fillFromInputFileValue(), and readSystemDescription().

93 { return theSDFName; }
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:197

◆ setCocoaStatus()

static void Model::setCocoaStatus ( const cocoaStatus  cs)
inlinestatic

Definition at line 64 of file Model.h.

References callgraph::cs, and theCocoaStatus.

Referenced by Fit::fitNextEvent(), and readSystemDescription().

64 { theCocoaStatus = cs; }
static cocoaStatus theCocoaStatus
Definition: Model.h:272

◆ setMatricesFName()

static void Model::setMatricesFName ( const ALIstring name)
inlinestatic

Definition at line 155 of file Model.h.

References Skims_PA_cff::name, and theMatricesFName.

155 { theMatricesFName = name; }
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:203

◆ setMeasurementsTime()

static void Model::setMeasurementsTime ( struct tm &  tim)
inlinestatic

Definition at line 157 of file Model.h.

References theMeasurementsTime.

157 { theMeasurementsTime = tim; }
static struct tm theMeasurementsTime
Definition: Model.h:278

◆ setReportFName()

static void Model::setReportFName ( const ALIstring name)
inlinestatic

Definition at line 153 of file Model.h.

References Skims_PA_cff::name, and theReportFName.

153 { theReportFName = name; }
static ALIstring theReportFName
the name of the report File
Definition: Model.h:201

◆ setSDFName()

static void Model::setSDFName ( const ALIstring name)
inlinestatic

Definition at line 151 of file Model.h.

References Skims_PA_cff::name, and theSDFName.

151 { theSDFName = name; }
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:197

◆ SetValueDisplacementsFromReportOut()

void Model::SetValueDisplacementsFromReportOut ( )
staticprivate

Definition at line 1481 of file Model.cc.

References gather_cfg::cout, ALIUtils::debug, EntryList(), EntryMgr::findEntryByLongName(), EntryMgr::getInstance(), EntryMgr::numberOfEntries(), and EntryData::valueDisplacement().

1481  {
1482  if (ALIUtils::debug >= 3)
1483  std::cout << " Model::SetValueDisplacementsFromReportOut() " << std::endl;
1484 
1485  EntryMgr* entryMgr = EntryMgr::getInstance();
1486 
1487  if (entryMgr->numberOfEntries() != 0) {
1488  EntryData* entryData;
1489 
1490  std::vector<Entry*>::const_iterator vecite;
1491  for (vecite = Model::EntryList().begin(); vecite != Model::EntryList().end(); ++vecite) {
1492  //----- Find the EntryData corresponding to this entry
1493  entryData = entryMgr->findEntryByLongName((*vecite)->OptOCurrent()->longName(), (*vecite)->name());
1494  if (ALIUtils::debug >= 3)
1495  std::cout << "SetValueDisplacementsFromReportOut " << (*vecite)->OptOCurrent()->longName() << " "
1496  << (*vecite)->name() << " " << entryData->valueDisplacement() << std::endl;
1497  (*vecite)->addFittedDisplacementToValue(entryData->valueDisplacement());
1498  }
1499  }
1500 }
ALIdouble valueDisplacement() const
Definition: EntryData.h:31
static ALIint debug
Definition: ALIUtils.h:34
ALIint numberOfEntries()
Definition: EntryMgr.h:36
static EntryMgr * getInstance()
Definition: EntryMgr.cc:16
EntryData * findEntryByLongName(const ALIstring &optoName, const ALIstring &entryName="")
Definition: EntryMgr.cc:82
static std::vector< Entry * > & EntryList()
Definition: Model.h:86

Member Data Documentation

◆ CMSLinkIteration

ALIint Model::CMSLinkIteration = 0
staticprivate

Definition at line 237 of file Model.h.

Referenced by CMSLinkDeleteOptOs().

◆ CMSLinkRangeDetValue

std::vector< ALIdouble > Model::CMSLinkRangeDetValue
static

Definition at line 223 of file Model.h.

◆ Ncmslinkrange

ALIint Model::Ncmslinkrange = 0
static

*************** FOR RANGE STUDIES

Definition at line 222 of file Model.h.

◆ theCocoaStatus

cocoaStatus Model::theCocoaStatus = COCOA_Init
staticprivate

Definition at line 272 of file Model.h.

Referenced by getCocoaStatus(), and setCocoaStatus().

◆ theEntryVector

std::vector< Entry * > Model::theEntryVector
staticprivate

std::vector of all Entries

Definition at line 191 of file Model.h.

Referenced by addEntryToList(), and EntryList().

◆ theFittedEntriesReader

FittedEntriesReader * Model::theFittedEntriesReader = nullptr
staticprivate

Definition at line 280 of file Model.h.

Referenced by getFittedEntriesReader().

◆ theInstance

Model * Model::theInstance = nullptr
staticprivate

Definition at line 176 of file Model.h.

◆ theMatricesFName

ALIstring Model::theMatricesFName = "matrices.out"
staticprivate

the name of the File for storing the matrices

Definition at line 203 of file Model.h.

Referenced by MatricesFName(), and setMatricesFName().

◆ theMeasFName

ALIstring Model::theMeasFName = "Measurements.txt"
staticprivate

the name of the Measurements File

Definition at line 199 of file Model.h.

Referenced by MeasFName().

◆ theMeasurementsTime

struct tm Model::theMeasurementsTime
staticprivate

Definition at line 278 of file Model.h.

Referenced by MeasurementsTime(), and setMeasurementsTime().

◆ theMeasurementVector

std::vector< Measurement * > Model::theMeasurementVector
staticprivate

std::vector of all Measurements

Definition at line 194 of file Model.h.

Referenced by addMeasurementToList(), and MeasurementList().

◆ theOpticalAlignments

std::vector< OpticalAlignInfo > Model::theOpticalAlignments
staticprivate

Definition at line 282 of file Model.h.

Referenced by getOpticalAlignments().

◆ theOptODictionary

std::vector< std::vector< ALIstring > > Model::theOptODictionary
staticprivate

parameters

std::vector of OptOs with components (in tree structure)

Definition at line 182 of file Model.h.

Referenced by OptODictionary().

◆ theOptOList

std::vector< OpticalObject * > Model::theOptOList
staticprivate

map of OptO*/type of parent OptO, for navigation down the tree structure

map of OptO*/name of OptO for quick search based on name

Definition at line 188 of file Model.h.

Referenced by OptOList().

◆ theOptOsToCopyList

std::vector< OpticalObject * > Model::theOptOsToCopyList
staticprivate

Definition at line 216 of file Model.h.

◆ theOptOsToCopyListIterator

std::vector< OpticalObject * >::const_iterator Model::theOptOsToCopyListIterator
staticprivate

Definition at line 218 of file Model.h.

◆ theParamFittedSigmaVector

std::vector< ALIdouble > Model::theParamFittedSigmaVector
staticprivate

Definition at line 274 of file Model.h.

Referenced by cleanParamFittedSigmaVector().

◆ theParamFittedValueDisplacementMap

std::map< ALIstring, ALIdouble, std::less< ALIstring > > Model::theParamFittedValueDisplacementMap
staticprivate

Definition at line 276 of file Model.h.

Referenced by cleanParamFittedValueDisplacementMap().

◆ theReportFName

ALIstring Model::theReportFName = "report.out"
staticprivate

the name of the report File

Definition at line 201 of file Model.h.

Referenced by ReportFName(), and setReportFName().

◆ theSDFName

ALIstring Model::theSDFName = "SystemDescription.txt"
staticprivate

the name of the System Description File

Definition at line 197 of file Model.h.

Referenced by SDFName(), and setSDFName().