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 = 0
 
static ModeltheInstance = 0
 Only instance of Model. More...
 
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 38 of file Model.h.

Constructor & Destructor Documentation

Model::Model ( )

Definition at line 95 of file Model.cc.

96 {
97  // theMeasurementsTime = clock();
98 }
Model::~Model ( )
inline

Definition at line 43 of file Model.h.

References getInstance().

43 {};

Member Function Documentation

static void Model::addEntryToList ( Entry entry)
inlinestatic

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

Definition at line 145 of file Model.h.

References theEntryVector.

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

145  {
146  theEntryVector.push_back( entry );
147  //- std::cout << entry << entry->OptOCurrent()->name() << "ADDENTRY " << entry->name() << " " << EntryList().size() << std::endl;
148  }
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:206
static void Model::addMeasurementToList ( Measurement measadd)
inlinestatic

Definition at line 150 of file Model.h.

References theMeasurementVector.

Referenced by Measurement::postConstruct().

150  {
151  theMeasurementVector.push_back( measadd);
152  // std::cout << "ADD MEASUREMENT" << theMeasurementVector.size() << std::endl ;
153  }
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:209
void Model::BuildMeasurementsFromOA ( OpticalAlignMeasurements measList)

Definition at line 1632 of file Model.cc.

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

Referenced by CocoaAnalyzer::RunCocoa(), and setCocoaStatus().

1633 {
1634  std::vector<OpticalAlignMeasurementInfo>::iterator mite;
1635 
1636  if( ALIUtils::debug >= 5 ) std::cout << " BuildMeasurementsFromOA " << std::endl;
1637  std::vector<OpticalAlignMeasurementInfo> measInfos = measList.oaMeasurements_;
1638  for( mite = measInfos.begin(); mite != measInfos.end(); ++mite ) {
1639  std::string measType = (*mite).type_;
1640  std::string measName = (*mite).name_;
1641  if( ALIUtils::debug >= 4 ) std::cout << " BuildMeasurementsFromOA measType " << measType << " measName " << measName << std::endl;
1642  //---------- Create Measurement with appropiate dimension
1643  Measurement* meastemp = nullptr;
1644  if ( measType == ALIstring("SENSOR2D") ) {
1645  meastemp = new MeasurementSensor2D( 2, measType, measName );
1646  } else if ( measType == ALIstring("DISTANCEMETER3DIM") ) {
1647  meastemp = new MeasurementDistancemeter3dim( 1, measType, measName );
1648  } else if ( measType == ALIstring("DISTANCEMETER") ||
1649  measType == ALIstring("DISTANCEMETER1DIM") ) {
1650  meastemp = new MeasurementDistancemeter( 1, measType, measName );
1651  } else if ( measType == ALIstring("TILTMETER") ) {
1652  meastemp = new MeasurementTiltmeter( 1, measType, measName );
1653  } else if ( measType == ALIstring("COPS") ) {
1654  meastemp = new MeasurementCOPS( 4, measType, measName );
1655  // } else if ( measType == ALIstring("DIFFCENTRE") ) {
1656  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1657  // } else if ( measType == ALIstring("DIFFANGLE") ) {
1658  // meastemp = new MeasurementDiffAngle( 2, measType, measName );
1659  } else if ( measType == ALIstring("DIFFENTRY") ) {
1660  meastemp = new MeasurementDiffEntry( 1, measType, measName );
1661  } else {
1662  std::cerr << " !!! Model::BuildMeasurementsFromOA : measType not found " << measType << std::endl;
1663  throw std::exception();
1664  }
1665  meastemp->constructFromOA( *mite );
1666 
1667  }
1668 }
static ALIint debug
Definition: ALIUtils.h:36
std::vector< OpticalAlignMeasurementInfo > oaMeasurements_
std::string ALIstring
Definition: CocoaGlobals.h:9
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:96
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 548 of file Model.cc.

References begin.

Referenced by readSystemDescription(), and setMeasurementsTime().

548  {
549 
550 //---------- Loop Measurements
551  std::vector< Measurement* >::const_iterator vmcite;
552  for ( vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite) {
553 //---------- Transform for each Measurement the Measured OptO names to Measured OptO pointers
554  // (*vmcite)->buildOptOList();
555 
556 //---------- Build list of Entries that affect a Measurement
557  // (*vmcite)->buildAffectingEntryList();
558 
559  }
560 
561 }
#define begin
Definition: vmac.h:32
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:79
void Model::BuildSystemDescriptionFromOA ( OpticalAlignments optAlig)

Definition at line 1586 of file Model.cc.

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

Referenced by CocoaAnalyzer::RunCocoa(), and setCocoaStatus().

1587 {
1589 
1590  OpticalAlignInfo oai_system = FindOptAlignInfoByType( "system" );
1591 
1592  OpticalObject* OptOsystem = new OpticalObject( nullptr, "system", oai_system.name_, false );
1593 
1594  OptOsystem->constructFromOptAligInfo( oai_system );
1595 
1596  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
1597  // theOptOlist[OptOsystem->name()] = OptOsystem;
1598  theOptOList.push_back( OptOsystem );
1599 }
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:296
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1603
std::vector< OpticalAlignInfo > opticalAlignments() const
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:203
void constructFromOptAligInfo(const OpticalAlignInfo &oaInfo)
static void Model::cleanParamFittedSigmaVector ( )
inlinestaticprivate

Definition at line 271 of file Model.h.

References cuy::ii, and theParamFittedSigmaVector.

271  {
272  ALIuint pfsv_size = theParamFittedSigmaVector.size();
273  for( ALIuint ii = 0; ii < pfsv_size; ii++) {
274  theParamFittedSigmaVector.pop_back();
275  }
276  }
ii
Definition: cuy.py:588
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:288
unsigned int ALIuint
Definition: CocoaGlobals.h:17
static void Model::cleanParamFittedValueDisplacementMap ( )
inlinestaticprivate

Definition at line 278 of file Model.h.

References copyMeasurements(), and theParamFittedValueDisplacementMap.

278  {
280  }
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:290
void Model::CMSLinkCleanModel ( )
private

Definition at line 889 of file Model.cc.

References cuy::ii.

890 {
891  deleteOptO("s");
892  //---------- Clean OptOdicitionary (in case this is not first reading)
893  ALIuint odsize = theOptODictionary.size();
894  for( ALIuint ii = 0; ii < odsize; ii++) {
895  theOptODictionary.pop_back();
896  }
897 
898 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1149
ii
Definition: cuy.py:588
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:197
unsigned int ALIuint
Definition: CocoaGlobals.h:17
void Model::CMSLinkDeleteOptOs ( )
staticprivate

Definition at line 904 of file Model.cc.

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

905 {
906  ALIint cmslink_iter = Model::CMSLinkIteration;
907  ALIdouble cmslink_method;
908 
910  assert(gomgr->getGlobalOptionValue("cms_link_method", cmslink_method));
911  ALIdouble cmslink_halfplanes;
912  assert(gomgr->getGlobalOptionValue("cms_link_halfplanes", cmslink_halfplanes));
913  if(ALIUtils::debug >= 2) std::cout << "CMSLinkDeleteOptOs: cms_link_halfplanes " << cmslink_halfplanes << cmslink_iter << std::endl;
914 
915  if( cmslink_iter == 1){
916  //---------- First fit: delete everything but laser1 and det_tkU
917  // deleteOptO("s/laserboxL/laser2");
918  //- std::cout << "delete mabs" << std::endl;
919  deleteOptO("s/mabsL");
920  //------- Method 1: detectors at tracker down
921  if (cmslink_method == 1){
922  deleteOptO("s/tracker/det_trkDL");
923  deleteOptO("s/tracker/det_trkDR");
924  }
925 
926  if( cmslink_halfplanes == 2) {
927  // deleteOptO("s/laserboxR/laser2");
928  deleteOptO("s/mabsR");
929  }
930 
931  } else if( cmslink_iter == 2) {
932  //---------- Second fit (method 1): delete everything but laser1 and det3
933  // deleteOptO("s/laserboxL/laser2");
934  deleteOptO("s/mabsL");
935  deleteOptO("s/tracker/CST/wheel_trkL/peri/mirror"); //??
936  deleteOptO("s/tracker/CST/wheel_trkL/det_trkU");
937  //------- Method 1: detectors on CST, Method 2: detectors on tracker
938  //not necessary deleteOptO("s/tracker/CST/det6");
939 
940  if( cmslink_halfplanes <= 1) {
941  deleteOptO("s/tracker/CST/wheel_trkR");
942  } else if( cmslink_halfplanes == 2) {
943  // deleteOptO("s/laserboxR/laser2");
944  deleteOptO("s/mabsR");
945  deleteOptO("s/tracker/CST/wheel_trkR/peri/mirror"); //??
946  deleteOptO("s/tracker/CST/wheel_trkR/det_trkU");
947  }
948 
949  } else if( cmslink_iter == 3) {
950  //---------- Third fit: delete everything but laser2 and mabs
951  // deleteOptO("s/laserboxL/laser1");
952  deleteOptO("s/tracker");
953 
954  if( cmslink_halfplanes == 2) {
955  // deleteOptO("s/laserboxR/laser1");
956  }
957  //---------- Do nothing
958  } else {
959 
960  }
961 
962 }
static ALIint CMSLinkIteration
Definition: Model.h:253
long double ALIdouble
Definition: CocoaGlobals.h:11
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1149
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:36
static GlobalOptionMgr * getInstance()
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
void Model::CMSLinkFit ( ALIint  cmslink)

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

Definition at line 831 of file Model.cc.

832 {
833  /*
834  //---------- Get number of fits
835  ALIint cmslinkNoFits = 0;
836  if( cmslink == 1) {
837  cmslinkNoFits = 3;
838  } else if( cmslink == 2) {
839  cmslinkNoFits = 2;
840  }
841  if(ALIUtils::debug >= 4) std::cout << " Start CMS link fit with method " << cmslink << " (number of fits = " << cmslinkNoFits << ")" << std::endl;
842 
843  //----------- Loop number of cms_link fits
844  for(ALIint ilink = ALIint(Model::GlobalOptions()["cms_link"]); ilink <= cmslinkNoFits; ilink++) {
845 
846  //----- Iteration 2 of method 2 resembles iteration 3 of method 1
847  ALIdouble cmslink_method;
848  assert(Model::getGlobalOptionValue("cms_link_method", cmslink_method));
849  if( cmslink_method == 2 && ilink == 2) ilink = 3;
850 
851 //---- Set variable CMSLinkIteration, Checked in Fit.C and other //- std::cout << "ilink" << ilink << std::endl;
852  Model::setGlobalOption("cms_link", ilink);
853  Model::CMSLinkIteration = ilink;
854 
855  if(ilink > 1)Model::readSystemDescription(); //already read once to fill value Model::GlobalOptions()["cms_link"]
856 
857  //---------- Delete the OptO not fitted in this iteration
858  // Model::CMSLinkDeleteOptOs();
859  // cannot be here because you may recover a parameter saved in previous iteration that now it is deleted (!!MODIFY THIS)
860 
861  //---------- Recover parameters fitted in previous iteration
862  Model::CMSLinkRecoverParamFittedSigma( ilink );
863 
864  Model::CMSLinkRecoverParamFittedValueDisplacement( ilink );
865 
866  //---------- Delete the OptO not fitted in this iteration
867  Model::CMSLinkDeleteOptOs();
868 
869  //---------- Start fit
870  Fit::startFit();
871 
872  //---------- Save parameters fitted in this iteration (to be used in next one)
873  Model::CMSLinkSaveParamFittedSigma( ilink );
874 
875  Model::CMSLinkSaveParamFittedValueDisplacement( ilink );
876 
877  //---------- Delete whole system to start anew in next iteration
878  Model::CMSLinkCleanModel();
879 
880  }
881  */
882 }
void Model::CMSLinkRecoverParamFittedSigma ( ALIint  cmslink)
staticprivate

Definition at line 1060 of file Model.cc.

1061 {
1062  /*
1063  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
1064 
1065  if( cms_link == 2) {
1066  //---------- Second fit: recover laserbox angles
1067  recoverParamFittedSigma("s/laserboxL","Angles X",0);
1068  recoverParamFittedSigma("s/laserboxL","Angles Y",1);
1069 
1070  if( cms_link_halfplanes == 2) {
1071  recoverParamFittedSigma("s/laserboxR","Angles X",0);
1072  recoverParamFittedSigma("s/laserboxR","Angles Y",1);
1073  }
1074 
1075  } else if( cms_link == 3) {
1076  //---------- Third fit: recover laserbox angles and position and rotate angles to mabs
1077  recoverParamFittedSigma("s/laserboxL","Centre X",0);
1078  recoverParamFittedSigma("s/laserboxL","Centre Y",1);
1079  recoverParamFittedSigma("s/laserboxL","Centre Z",2);
1080  recoverParamFittedSigma("s/laserboxL","Angles X",3);
1081 
1082  //----- Angle around Y is converted to angle around Z when turning 90 deg
1083  Entry* slaZ = getEntryByName("s/laserboxL","Angles Z");
1084  //--- prec_level_laser
1085  Entry* smaZ = getEntryByName("s/mabsL","Angles Z");
1086  slaZ->setQuality(0);
1087  slaZ->setValue( smaZ->value() );
1088  // smaZ->setQuality(0); //!!???!!?
1089 
1090  Entry* slaY = getEntryByName("s/laserboxL","Angles Y");
1091  slaY->setQuality(0);
1092 
1093  if( cms_link_halfplanes == 2) {
1094  recoverParamFittedSigma("s/laserboxR","Centre X",0);
1095  recoverParamFittedSigma("s/laserboxR","Centre Y",1);
1096  recoverParamFittedSigma("s/laserboxR","Centre Z",2);
1097  recoverParamFittedSigma("s/laserboxR","Angles X",3);
1098 
1099  //----- Angle around Y is converted to angle around Z when turning 90 deg
1100  Entry* slaZ = getEntryByName("s/laserboxR","Angles Z");
1101  //--- prec_level_laser
1102  Entry* smaZ = getEntryByName("s/mabsR","Angles Z");
1103  slaZ->setQuality(0);
1104  slaZ->setValue( smaZ->value() );
1105  // smaZ->setQuality(0); //!!???!!?
1106 
1107  Entry* slaY = getEntryByName("s/laserboxR","Angles Y");
1108  slaY->setQuality(0);
1109  }
1110  } else {
1111  //---------- Do nothing
1112 
1113  }
1114  */
1115 }
void Model::CMSLinkRecoverParamFittedValueDisplacement ( ALIint  cmslink)
staticprivate

Definition at line 1121 of file Model.cc.

1122 {
1123  /*
1124  //---------- Second fit: recover laserbox angles
1125  if( cms_link == 2 || cms_link == 3 ) {
1126 
1127  std::map<ALIstring, ALIdouble, std::less<ALIstring> >::const_iterator vsdmite;
1128  if ( ALIUtils::debug >= 99) std::cout << "theParamFittedValueDisplacementMap.size " << theParamFittedValueDisplacementMap.size() << std::endl;
1129  for( vsdmite = theParamFittedValueDisplacementMap.begin(); vsdmite != theParamFittedValueDisplacementMap.end(); vsdmite++) {
1130  std::cout << "reoverValueDisp" << (*vsdmite).first << " " << (*vsdmite).second << std::endl;
1131  Entry* this_entry = getEntryByName( (*vsdmite).first);
1132  this_entry->displaceOriginal( (*vsdmite).second );
1133  this_entry->OptOCurrent()->resetGlobalCoordinates();
1134  this_entry->setValueDisplacementByFitting( (*vsdmite).second );
1135 
1136  }
1137 
1138  //---------- Do nothing
1139  } else {
1140 
1141  }
1142  */
1143 }
void Model::CMSLinkSaveParamFittedSigma ( ALIint  cmslink)
staticprivate

Definition at line 968 of file Model.cc.

969 {
970  /*
971  ALIdouble cms_link_halfplanes = (GlobalOptions()["cms_link_halfplanes"]);
972 
973  cleanParamFittedSigmaVector();
974 
975  //---------- First fit: Save laserbox angles fitted at tracker
976  if( cms_link == 1) {
977  //? if (GlobalOptions()["cms_link_method"] < 10){
978  saveParamFittedSigma("s/laserboxL","Angles X");
979  saveParamFittedSigma("s/laserboxL","Angles Y");
980 
981  saveParamFittedCorrelation("s/laserboxL","Angles X",
982  "s/tracker/CST","Centre Y");
983  saveParamFittedCorrelation("s/laserboxL","Angles Y",
984  "s/tracker/CST","Centre X");
985  if( cms_link_halfplanes == 2) {
986  saveParamFittedSigma("s/laserboxR","Angles X");
987  saveParamFittedSigma("s/laserboxR","Angles Y");
988 
989  saveParamFittedCorrelation("s/laserboxR","Angles X",
990  "s/tracker/CST","Centre Y");
991  saveParamFittedCorrelation("s/laserboxR","Angles Y",
992  "s/tracker/CST","Centre X");
993  }
994 
995  } else if( cms_link == 2) {
996  //---------- Second fit: Save laserbox angles and position
997  saveParamFittedSigma("s/laserboxL","Centre X");
998  saveParamFittedSigma("s/laserboxL","Centre Y");
999  // Make quality unk to cal
1000  saveParamFittedSigma("s/laserboxL","Centre Z");
1001  saveParamFittedSigma("s/laserboxL","Angles X");
1002  saveParamFittedSigma("s/laserboxL","Angles Y");
1003 
1004  saveParamFittedCorrelation("s/laserboxL","Centre X",
1005  "s/laserboxL","Angles Y");
1006  saveParamFittedCorrelation("s/laserboxL","Centre Y",
1007  "s/laserboxL","Angles X");
1008 
1009  if( cms_link_halfplanes == 2) {
1010  saveParamFittedSigma("s/laserboxR","Centre X");
1011  saveParamFittedSigma("s/laserboxR","Centre Y");
1012  // Make quality unk to cal
1013  saveParamFittedSigma("s/laserboxR","Centre Z");
1014  saveParamFittedSigma("s/laserboxR","Angles X");
1015  saveParamFittedSigma("s/laserboxR","Angles Y");
1016 
1017  saveParamFittedCorrelation("s/laserboxR","Centre X",
1018  "s/laserboxR","Angles Y");
1019  saveParamFittedCorrelation("s/laserboxR","Centre Y",
1020  "s/laserboxR","Angles X");
1021  }
1022  } else {
1023  //---------- Do nothing
1024 
1025  }
1026  */
1027 }
void Model::CMSLinkSaveParamFittedValueDisplacement ( ALIint  cmslink)
staticprivate

Definition at line 1033 of file Model.cc.

1034 {
1035  /*
1036  cleanParamFittedValueDisplacementMap();
1037 
1038  //----------
1039  if( cms_link == 1 || cms_link == 2 ) {
1040  std::vector<Entry*>::const_iterator vecite;
1041  for( vecite = EntryList().begin(); vecite != EntryList().end(); vecite++) {
1042  if( (*vecite)->valueDisplacementByFitting() != 0 ) {
1043  ALIstring names = (*vecite)->OptOCurrent()->name() + "/" + (*vecite)->name();
1044  std::cout << "saeParamFittedValueDisplacementMap" << names << (*vecite)->valueDisplacementByFitting() << std::endl;
1045  theParamFittedValueDisplacementMap[ names ] = (*vecite)->valueDisplacementByFitting();
1046  }
1047  }
1048 
1049  //---------- Do nothing
1050  } else {
1051 
1052  }
1053  */
1054 }
void Model::copyMeasurements ( const std::vector< ALIstring > &  wl)
staticprivate

Definition at line 1460 of file Model.cc.

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

Referenced by cleanParamFittedValueDisplacementMap().

1461 {
1462 
1463  //----- Check format, e.g. @copy_measurements _1/_2/*_1
1464 
1465 
1466  //----- get list of Measurement's that satisfy the query in their name
1467  //t std::string querystr = wl[1].substr( wl[1].find("/")+1, wl[1].length() );
1468  std::string subsstr1 = wl[1].substr( 0, wl[1].find("/") );
1469  std::string subsstr2 = wl[1].substr( wl[1].find("/")+1, wl[1].rfind("/") - wl[1].find("/")-1 );
1470  std::string querystr = wl[1].substr( wl[1].rfind("/")+1, wl[1].length() );
1471 
1472  std::cout << " Model::copyMeasurements " << " subsstr1 " << subsstr1 << " subsstr2 " << subsstr2 << " querystr " << querystr << std::endl;
1473 
1474  std::vector< Measurement* > measToCopy;
1475  std::vector< Measurement* >::iterator mite;
1476  for( mite = theMeasurementVector.begin(); mite != theMeasurementVector.end(); ++mite) {
1477  Measurement* meas = (*mite);
1478  //improve this
1479  if( meas->name().find( querystr ) != std::string::npos ) {
1480  measToCopy.push_back( meas );
1481  }
1482  }
1483 
1484  //---- Build new measurements
1485  Measurement* meastemp = nullptr;
1486  for( mite = measToCopy.begin(); mite != measToCopy.end(); ++mite) {
1487  Measurement* meas = (*mite);
1488  std::vector<ALIstring> wlt;
1489  wlt.push_back( meas->type() );
1490 
1491  //---- create new name
1492  std::string newName = ALIUtils::changeName( meas->name(), subsstr1, subsstr2 );
1493  std::cout << " newName " << newName << std::endl;
1494  wlt.push_back( newName );
1495 
1496  ALIstring measType = wlt[0];
1497  ALIstring measName;
1498  if( wlt.size() == 2 ) {
1499  measName = wlt[1];
1500  } else {
1501  measName = "";
1502  }
1503  if ( meas->type() == ALIstring("SENSOR2D") ) {
1504  meastemp = new MeasurementSensor2D( 2, measType, measName );
1505  // } else if ( meas->type() == ALIstring("DISTANCEMETER3DIM") ) {
1506  // meastemp = new MeasurementDistancemeter3dim( 1, measType, measName );
1507  } else if ( meas->type() == ALIstring("DISTANCEMETER") ||
1508  meas->type() == ALIstring("DISTANCEMETER1DIM") ) {
1509  meastemp = new MeasurementDistancemeter( 1, measType, measName );
1510  } else if ( meas->type() == ALIstring("TILTMETER") ) {
1511  meastemp = new MeasurementTiltmeter( 1, measType, measName );
1512  // } else if ( meas->type() == ALIstring("DIFFCENTRE") ) {
1513  // meastemp = new MeasurementDiffCentre( 1, measType, measName );
1514  // } else if ( meas->type() == ALIstring("DIFFANGLE") ) {
1515  // meastemp = new MeasurementDiffAngle( 1, measType, measName );
1516  } else if ( meas->type() == ALIstring("DIFFENTRY") ) {
1517  meastemp = new MeasurementDiffEntry( 1, measType, measName );
1518  } else if ( meas->type() == ALIstring("COPS") ) {
1519  meastemp = new MeasurementCOPS( 4, measType, measName );
1520  } else {
1521  throw cms::Exception("LogicError")
1522  << "@SUB=Model::copyMeasurements\n"
1523  << "unknown measurement type: " << meas->type();
1524  }
1525 
1526  //later meastemp->copyConversionFactor( wordlist );
1527  meastemp->copyMeas(meas, subsstr1, subsstr2);
1528 
1529  break;
1530  }
1531 
1532 }
string newName
Definition: mps_merge.py:84
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:209
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:573
const ALIstring & type() const
Definition: Measurement.h:86
std::string ALIstring
Definition: CocoaGlobals.h:9
const ALIstring & name() const
Definition: Measurement.h:90
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:650
ALIbool Model::createCopyComponentList ( const ALIstring optoname)
static

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

Definition at line 771 of file Model.cc.

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

Referenced by OpticalObject::createComponentOptOs().

772 {
773  //---------- 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)
774  if(ALIUtils::debug >= 3) std::cout << "createCopyComponentList " << typ << std::endl;
775  OpticalObject* start_opto = getOptOByType( typ );
776 
777  //---------- clean list of OptOs to copy
779 
780  //---------- Fill list of OptOs to copy
781  fillCopyComponentList( start_opto );
782  //- if(ALIUtils::debug >= 9) std::cout << "createCopyComponentList " << typ << theOptOsToCopyList.size() << std::endl;
783 
785  return true;
786 }
static ALIint debug
Definition: ALIUtils.h:36
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:612
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:230
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:232
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:792
void Model::deleteOptO ( const ALIstring opto_name)
staticprivate

Definition at line 1149 of file Model.cc.

1150 {
1151  OpticalObject* opto = getOptOByName( opto_name );
1152  deleteOptO( opto );
1153 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1149
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:580
void Model::deleteOptO ( OpticalObject opto)
staticprivate

Definition at line 1159 of file Model.cc.

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

1160 {
1161  if(ALIUtils::debug >= 5 ) std::cout << "DELETING OptO" << opto->name() << std::endl;
1162 
1163  //---------- Delete Coordinate Entries of this OptO
1164  std::vector<Entry*>::const_iterator vecite;
1165  std::vector<Entry*>::iterator veite2;
1166  if ( ALIUtils::debug >= 9) std::cout << "SIZE" << theEntryVector.size() <<std::endl;
1167  for( vecite = opto->CoordinateEntryList().begin(); vecite != opto->CoordinateEntryList().end(); ++vecite) {
1168  // ALIuint pos = FindItemInVector( (*veite), opto->CoordinateEntryList() );
1169  veite2 = find( theEntryVector.begin(), theEntryVector.end(), (*vecite) );
1170  //- if ( ALIUtils::debug >= 9) std::cout << (*veite2) << "DELETE ENTRY " << (*vecite) <<(*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1171  delete ( (*veite2) );
1172  theEntryVector.erase( veite2 );
1173  }
1174 
1175  for( vecite = opto->ExtraEntryList().begin(); vecite != opto->ExtraEntryList().end(); ++vecite) {
1176  // ALIuint pos = FindItemInVector( (*veite), opto->CoordinateEntryList() );
1177  veite2 = find( theEntryVector.begin(), theEntryVector.end(), (*vecite) );
1178  //- if(ALIUtils::debug >= 9) std::cout << (*veite2) << "DELETE ENTRY " << (*veite2)->OptOCurrent()->name() << (*veite2)->name() << std::endl;
1179  delete ( (*veite2) );
1180  theEntryVector.erase( veite2 );
1181  }
1182 
1183 
1184  for( vecite = theEntryVector.begin(); vecite != theEntryVector.end(); ++vecite ) {
1185  // std::cout << (*vecite) << "ENTReY " << (*vecite)->OptOCurrent()->name() << (*vecite)->name() << std::endl;
1186  }
1187 
1188  //---------- Delete all Measurement in which opto takes part
1189  std::vector<Measurement*> MeasToBeDeleted;
1190  std::vector<Measurement*>::const_iterator vmite;
1191  std::vector<OpticalObject*>::const_iterator vocite;
1192  for( vmite = MeasurementList().begin(); vmite != MeasurementList().end(); ++vmite ) {
1193  if(ALIUtils::debug >= 5) std::cout << "Deleting Measurement" << (*vmite)->name() << std::endl;
1194  //----- If any of the OptO Measured is opto, delete this Measurement
1195  for( vocite = (*vmite)->OptOList().begin(); vocite != (*vmite)->OptOList().end(); ++vocite) {
1196  if( (*vocite) == opto ) {
1197  //- std::cout << "MEASTBD" << (*vmite) << std::endl;
1198  MeasToBeDeleted.push_back( *vmite );
1199  //? delete (*vmite);
1200  break;
1201  }
1202  }
1203  }
1204 
1205  //---------- Delete Measurements from list
1206  std::vector<Measurement*>::const_iterator vmcite;
1207  std::vector<Measurement*>::iterator vmite2;
1208  if ( ALIUtils::debug >= 9) std::cout << "SIZEMEAS" << MeasToBeDeleted.size() <<std::endl;
1209  for( vmcite = MeasToBeDeleted.begin(); vmcite != MeasToBeDeleted.end(); ++vmcite) {
1210  vmite2 = find( theMeasurementVector.begin(), theMeasurementVector.end(), (*vmcite) );
1211  // std::cout << (*vmite2) << "DELETE MSEASU " << (*vmcite) << (*vmite2)->name()[0] << std::endl;
1212  delete ( (*vmite2) );
1213  theMeasurementVector.erase( vmite2 );
1214  }
1215 
1216 
1217  //---------- Delete components
1218  // std::vector<OpticalObject*>::iterator voite;
1219  std::vector<OpticalObject*> vopto;
1220  // ALIbool opto_found = getComponentOptOs( opto->name(), vopto );
1221  for( vocite = vopto.begin(); vocite != vopto.end(); ++vocite ) {
1222  deleteOptO( *vocite );
1223  }
1224 
1225  //---------- Delete this OptO
1226  //---------- Delete OptO (only from list, to delete it really first delete components)
1227  /* map< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator msoite =
1228 find( theOptOList.begin(), theOptOList.end(),
1229 map< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type( opto->name(), opto) );*/
1230  std::vector< OpticalObject* >::iterator dvoite =
1231  find( theOptOList.begin(), theOptOList.end(),
1233  //- std::cout << (*dvoite) << "DELETE OPTO " << opto <<"WW" << (*dvoite)->name() << std::endl;
1234  theOptOList.erase( dvoite );
1235  delete opto;
1236 
1237 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1149
const std::vector< Entry * > & ExtraEntryList() const
Definition: OpticalObject.h:69
const std::vector< Entry * > & CoordinateEntryList() const
Definition: OpticalObject.h:65
static ALIint debug
Definition: ALIUtils.h:36
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:203
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:209
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:206
const ALIstring & name() const
Definition: OpticalObject.h:60
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:79
static std::vector< Entry* >& Model::EntryList ( )
inlinestatic
ALIbool Model::fillCopyComponentList ( const OpticalObject opto)
staticprivate

Definition at line 792 of file Model.cc.

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

793 {
794  if(ALIUtils::debug >= 3) std::cout << "entering fillCopyComponentList(): OptO" << opto->name() << std::endl;
795  //---------- Get list of components of 'opto'
796  std::vector<OpticalObject*> vopto;
797  ALIbool opto_found = getComponentOptOs( opto->name(), vopto);
798  if( !opto_found ) {
799  if(ALIUtils::debug >= 5) std::cout << "fillCopyComponentList: NO COMPONENTS TO COPY IN THIS OptO" << opto->name() << std::endl ;
800  }
801 
802  //---------- Loop list of components of 'opto'
803  std::vector<OpticalObject*>::const_iterator vocite;
804  for( vocite = vopto.begin(); vocite != vopto.end(); ++vocite ){
805  theOptOsToCopyList.push_back( *vocite );
806  if(ALIUtils::debug >= 5) std::cout << "fillCopyOptOList " << (*vocite)->type() << " " << (*vocite)->name() << std::endl;
807  //---------- Add components of this component
808  fillCopyComponentList( *vocite );
809  }
810  return opto_found;
811 }
static ALIbool getComponentOptOs(const ALIstring &opto_name, std::vector< OpticalObject * > &vcomponents)
--— Get from theOptOList the list of pointers to component OptOs
Definition: Model.cc:725
static ALIint debug
Definition: ALIUtils.h:36
bool ALIbool
Definition: CocoaGlobals.h:19
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:230
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:792
const ALIstring & name() const
Definition: OpticalObject.h:60
OpticalAlignInfo Model::FindOptAlignInfoByType ( const ALIstring type)

Definition at line 1603 of file Model.cc.

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

Referenced by setCocoaStatus().

1604 {
1605  OpticalAlignInfo oai;
1606 
1607  ALIbool bFound = false;
1608  std::vector<OpticalAlignInfo>::iterator ite;
1609  for( ite = theOpticalAlignments.begin(); ite != theOpticalAlignments.end(); ++ite ){
1610  // std::cout << " Model::FindOptAlignInfoByType " << (*ite).type_ << " =? " << type << std::endl;
1611  if( (*ite).type_ == type ) {
1612  if( !bFound ){
1613  oai = *ite;
1614  bFound = true;
1615  } else {
1616  std::cerr << "!! WARNING: Model::FindOptAlignInfoByType more than one objects of type " << type << std::endl;
1617  std::cerr << " returning object " << oai.name_ << std::endl
1618  << " skipping object " << (*ite).name_ << std::endl;
1619  }
1620  }
1621  }
1622  if( !bFound ) {
1623  std::cerr << "!! ERROR: Model::FindOptAlignInfoByType object not found, of type " << type << std::endl;
1624  std::exception();
1625  }
1626 
1627  return oai;
1628 }
type
Definition: HCALResponse.h:21
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:296
bool ALIbool
Definition: CocoaGlobals.h:19
static cocoaStatus Model::getCocoaStatus ( )
inlinestatic

Definition at line 48 of file Model.h.

References theCocoaStatus.

Referenced by Fit::fitParameters().

48 { return theCocoaStatus;}
static cocoaStatus theCocoaStatus
Definition: Model.h:286
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 725 of file Model.cc.

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

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

726 {
727  //---------- clean std::vector in which you are going to store opto pointers
728  std::vector<OpticalObject*>::iterator voite;
729  for (voite = vcomponents.begin(); voite != vcomponents.end(); ++voite) {
730  vcomponents.pop_back();
731  }
732 
733  //---------- Get OptO corresponding to name 'opto_name'
734  OpticalObject* opto = getOptOByName( opto_name );
735 
736  if ( ALIUtils::debug >= 99) std::cout << opto_name << "getComponentOptOs: opto " << opto << opto->name() << std::endl;
737  std::vector<OpticalObject*>::const_iterator vocite;
738 
739  if ( ALIUtils::debug >= 99) std::cout << "optolist size " << OptOList().size() << std::endl;
740  ALIbool opto_found = false;
741  for (vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite) {
742  if( (*vocite)->parent() != nullptr ) {
743  // std::cout << "looping OptOlist" << (*vocite)->name() << " parent " <<(*vocite)->parent()->name() << std::endl;
744  if( (*vocite)->parent()->name() == opto_name ) {
745  opto_found = true;
746  vcomponents.push_back( (*vocite) );
747  }
748  }
749  }
750 
751  /* std::pair<multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator,
752  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::iterator>
753  pmmao = _OptOtree.equal_range(opto_name);
754 
755  if( pmmao.first != _OptOtree.end()) {
756  std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::const_iterator socite;
757  for (socite = pmmao.first; socite != (pmmao.second); socite++) {
758  vcomponents.push_back( (*socite).second );
759  }
760  }
761  */
762  return opto_found;
763 
764 }
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:580
static ALIint debug
Definition: ALIUtils.h:36
#define nullptr
bool ALIbool
Definition: CocoaGlobals.h:19
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:71
#define begin
Definition: vmac.h:32
const ALIstring & name() const
Definition: OpticalObject.h:60
ALIbool Model::getComponentOptOTypes ( const ALIstring opto_type,
std::vector< ALIstring > &  vcomponents 
)
static

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

Definition at line 692 of file Model.cc.

References begin.

Referenced by OpticalObject::createComponentOptOs(), and getEntryByName().

693 {
694  //---------- clean std::vector in which you are going to store opto types
695  std::vector<ALIstring>::iterator vsite;
696  for (vsite = vcomponents.begin(); vsite != vcomponents.end(); ++vsite) {
697  vcomponents.pop_back();
698  }
699 
700  //---------- Looks the theOptODictionary item that has 'opto_type' as the first ALIstring,
701  ALIint ALIstring_found = 0;
702  std::vector< std::vector<ALIstring> >::iterator vvsite;
703  for( vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
704  if( *( (*vvsite).begin() ) == opto_type ) {
705  ALIstring_found = 1;
706  //tt copies this item to 'vcomponents', substracting the first ALIstring, that is the opto_type itself,
707  vcomponents = *vvsite;
708  vcomponents.erase( vcomponents.begin() );
709  break;
710  }
711  }
712 
713  if ( ALIstring_found ) {
714  return true;
715  } else {
716  return false;
717  }
718 }
int ALIint
Definition: CocoaGlobals.h:15
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:67
#define begin
Definition: vmac.h:32
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 635 of file Model.cc.

References begin, MessageLogger_cfi::cerr, gather_cfg::cout, ALIUtils::debug, and cmsRelvalreport::exit.

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

636 {
637  //---------- Look for Entry name type in EntryList
638  std::vector<Entry*>::const_iterator vecite;
639  for( vecite = EntryList().begin(); vecite != EntryList().end(); ++vecite) {
640  if( ALIUtils::debug >= 4 ) std::cout << "getEntryByName: " <<(*vecite)->OptOCurrent()->name()
641  << " E " << (*vecite)->name() << " Searching: " << opto_name << " E " << entry_name << std::endl;
642  //- std::cout << " optoName " << (*vecite)->OptOCurrent()->name()<< " " << (*vecite)->name() << std::endl;
643  if( (*vecite)->OptOCurrent()->name() == opto_name &&
644  (*vecite)->name() == entry_name ) {
645  return *vecite;
646  }
647  }
648  //---------- Entry not found!
649  std::cerr << "!!!EXITING at getEntryByName: Entry name not found:" << opto_name << " " << entry_name << std::endl;
650  exit(1);
651 }
static ALIint debug
Definition: ALIUtils.h:36
static std::vector< Entry * > & EntryList()
Definition: Model.h:75
#define begin
Definition: vmac.h:32
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 122 of file Model.h.

References mps_splice::entry, getComponentOptOs(), getComponentOptOTypes(), and getEntryByName().

122  {
123  ALIint slash_pos = opto_entry_name.rfind('/');
124  ALIint length = opto_entry_name.length();
125  ALIstring opto_name = opto_entry_name.substr(0, slash_pos);
126  ALIstring entry_name = opto_entry_name.substr(slash_pos+1, length);
127  Entry* entry = getEntryByName( opto_name, entry_name);
128  return entry;
129  }
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:635
std::string ALIstring
Definition: CocoaGlobals.h:9
static FittedEntriesReader* Model::getFittedEntriesReader ( )
inlinestatic

Definition at line 267 of file Model.h.

References theFittedEntriesReader.

Referenced by Fit::fitNextEvent().

267  {
268  return theFittedEntriesReader; }
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:294
Model & Model::getInstance ( )
static

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

Definition at line 83 of file Model.cc.

Referenced by CocoaAnalyzer::RunCocoa(), and ~Model().

84 {
85  if(!theInstance) {
86  theInstance = new Model;
87  }
88  return *theInstance;
89 }
static Model * theInstance
Only instance of Model.
Definition: Model.h:191
Model()
Definition: Model.cc:95
Measurement * Model::getMeasurementByName ( const ALIstring name,
ALIbool  exists = true 
)
static

Definition at line 655 of file Model.cc.

References MessageLogger_cfi::cerr.

Referenced by MeasurementList().

656 {
657  //---------- Look for Optical Object name in OptOList
658  std::vector< Measurement* >::const_iterator vmcite;
659  for( vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite ) {
660  if( (*vmcite)->name() == meas_name ) break;
661  }
662 
663  if ( vmcite != theMeasurementVector.end() ) {
664  //---------- If opto_name found, return pointer to it
665  return (*vmcite);
666  }else {
667  if( exists ) {
668  //---------- If opto_name not found, exit
669  std::cerr << " LIST OF Measurements " << std::endl;
670  for( vmcite = theMeasurementVector.begin(); vmcite != theMeasurementVector.end(); ++vmcite ) {
671  std::cerr << (*vmcite)->name() << std::endl;
672  }
673  std::cerr << "!!EXITING at getMeasurementByName: Measurement " << meas_name << " doesn't exist!!" << std::endl;
674  abort();
675  // return (OpticalObject*)0;
676  } else {
677  return nullptr;
678  }
679 
680  }
681 
682 
683 }
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:209
static std::vector<OpticalAlignInfo> Model::getOpticalAlignments ( )
inlinestatic

Definition at line 141 of file Model.h.

References theOpticalAlignments.

Referenced by OpticalObject::createComponentOptOsFromOptAlignInfo().

141 { return theOpticalAlignments; }
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:296
OpticalObject * Model::getOptOByName ( const ALIstring opto_name)
static

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

Definition at line 580 of file Model.cc.

References begin, MessageLogger_cfi::cerr, gather_cfg::cout, ALIUtils::debug, and cmsRelvalreport::exit.

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

581 {
582  //---------- Look for Optical Object name in OptOList
583  std::vector< OpticalObject* >::const_iterator vocite;
584  for( vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite ) {
585  if( (*vocite)->name() == opto_name ) break;
586  }
587 
588  if ( vocite == OptOList().end() ) {
589  //---------- If opto_name not found, exit
590  std::cerr << " LIST OF OpticalObjects " << std::endl;
591  for( vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite ) {
592  std::cerr << (*vocite)->name() << std::endl;
593  }
594  std::cerr << "!!EXITING at getOptOByName: Optical Object " << opto_name << " doesn't exist!!" << std::endl;
595  exit(4);
596  // return (OpticalObject*)0;
597  } else {
598  //---------- If opto_name found, return pointer to it
599  if( ALIUtils::debug>999) {
600  std::cout << opto_name.c_str() << "SSOptOitem" << (*vocite) << (*vocite)->name() << "len" << OptOList().size() << std::endl;
601  }
602  return (*vocite);
603  }
604 
605 }
static ALIint debug
Definition: ALIUtils.h:36
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:71
#define begin
Definition: vmac.h:32
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 612 of file Model.cc.

References begin, MessageLogger_cfi::cerr, and cmsRelvalreport::exit.

Referenced by MatricesFName().

613 {
614  //---------- Look for Optical Object type in OptOList
615  std::vector< OpticalObject* >::const_iterator vocite;
616  for( vocite = OptOList().begin(); vocite != OptOList().end(); ++vocite ) {
617  // std::cout << "OPTOList" << (*msocite).first << std::endl;
618  if( (*vocite)->type() == opto_type ) break;
619  }
620 
621  if ( vocite == OptOList().end() ) {
622  //---------- If opto_type not found, exit
623  std::cerr << "!!EXITING at getOptOByType: Optical Object " << opto_type << " doesn't exist!!" << std::endl;
624  exit(4);
625  } else {
626  //---------- If opto_type found, return pointer to it
627  return (*vocite);
628  }
629 
630 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:71
#define begin
Definition: vmac.h:32
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 567 of file Model.cc.

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

Referenced by MatricesFName().

568 {
570  ALIint iret = parmgr->getParameterValue( sstr, val );
571 
572  return iret;
573 
574 }
static ParameterMgr * getInstance()
Definition: ParameterMgr.cc:19
int ALIint
Definition: CocoaGlobals.h:15
ALIint getParameterValue(const ALIstring &name, ALIdouble &val)
ALIdouble Model::getParamFittedSigmaVectorItem ( const ALIuint  position)
static

Definition at line 1321 of file Model.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, and position.

1322 {
1323  if( position >= theParamFittedSigmaVector.size() ) {
1324  std::cerr << "!!EXITING at getParamFittedSigma: position" << position <<
1325  " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size() << std::endl;
1326  exit(3);
1327  }
1328  std::vector<ALIdouble>::const_iterator vdcite = theParamFittedSigmaVector.begin() + position;
1329  return (*vdcite);
1330 
1331 }
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:288
static int position[264][3]
Definition: ReadPGInfo.cc:509
static ALIstring& Model::MatricesFName ( )
inlinestatic

the name of the File for storing the matrices

Definition at line 101 of file Model.h.

References getEntryByName(), getOptOByName(), getOptOByType(), getParameterValue(), theMatricesFName, and heppy_batch::val.

Referenced by Fit::dumpMatrices().

101  {
102  return theMatricesFName;
103  }
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:218
static ALIstring& Model::MeasFName ( )
inlinestatic

the name of the Measurements File

Definition at line 91 of file Model.h.

References theMeasFName.

91  {
92  return theMeasFName;
93  }
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:214
static std::vector< Measurement* >& Model::MeasurementList ( )
inlinestatic
static struct tm& Model::MeasurementsTime ( )
inlinestatic

Definition at line 137 of file Model.h.

References theMeasurementsTime.

137  {
138  return theMeasurementsTime;
139  }
static struct tm theMeasurementsTime
Definition: Model.h:292
OpticalObject * Model::nextOptOToCopy ( )
static

Definition at line 818 of file Model.cc.

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

Referenced by OpticalObject::copyData().

819 {
820  if(ALIUtils::debug >= 5) std::cout << "entering nextOptOToCopy() " << std::endl;
822  // if(ALIUtils::debug >= 5) std::cout <<" nextOptOToCopy " << (*(theOptOsToCopyListIterator-1))->name() << std::endl;
823  return *(theOptOsToCopyListIterator-1);
824 }
static ALIint debug
Definition: ALIUtils.h:36
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:232
static std::vector< std::vector<ALIstring> >& Model::OptODictionary ( )
inlinestatic

ACCESS STATIC DATA MEMBERS.

Definition at line 67 of file Model.h.

References theOptODictionary.

Referenced by readSystemDescription().

67  {
68  return theOptODictionary;
69  }
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:197
static std::vector< OpticalObject* >& Model::OptOList ( )
inlinestatic
std::string Model::printCocoaStatus ( const cocoaStatus  cs)
static

Definition at line 1559 of file Model.cc.

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

Referenced by setCocoaStatus().

1560 {
1561  std::string str ="";
1562 
1563  if( cs == COCOA_Init ) {
1564  str = "COCOA_Init ";
1565  }else if( cs == COCOA_ReadingModel) {
1566  str = "COCOA_ReadingModel";
1567  }else if( cs == COCOA_InitFit) {
1568  str = "COCOA_InitFit";
1569  }else if( cs == COCOA_FitOK) {
1570  str = "COCOA_FitOK";
1571  }else if( cs == COCOA_FitImproving) {
1572  str = "COCOA_FitImproving";
1573  }else if( cs == COCOA_FitCannotImprove) {
1574  str = "COCOA_FitCannotImprove";
1575  }else if( cs == COCOA_FitChi2Worsened) {
1576  str = "COCOA_FitChi2Worsened";
1577  }else if( cs == COCOA_FitMatrixNonInversable) {
1578  str = "COCOA_FitMatrixNonInversable";
1579  }
1580 
1581  return str;
1582 }
auto_ptr< ClusterSequence > cs
ALIbool Model::readMeasurementsFromFile ( ALIstring  only1Date = ALIstring(""),
ALIstring  only1Time = ALIstring("") 
)
static

Definition at line 1338 of file Model.cc.

References begin, MessageLogger_cfi::cerr, Measurement::correctValueAndSigma(), gather_cfg::cout, ALIUtils::debug, Measurement::dim(), ALIUtils::dumpVS(), end, ALIFileIn::eof(), ALIFileIn::ErrorInLine(), cmsRelvalreport::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().

Referenced by setMeasurementsTime().

1339 {
1340  if(ALIUtils::debug >= 5) std::cout << " readMeasurementsFromFile " << Measurement::measurementsFileName() << std::endl;
1341  if( Measurement::measurementsFileName() == "") return true;
1342 
1344  std::vector<ALIstring> wordlist;
1345  //---------- read date
1346  // ALIint retfil = filein.getWordsInLine(wordlist);
1347  // std::cout << "@@@@@@@@@@@@@@@ RETFIL " << retfil << std::endl;
1348  //if( retfil == 0 ) {
1349  if( filein.getWordsInLine(wordlist) == 0 ) {
1350  if(ALIUtils::debug>=4 ) std::cout << "@@@@ No more measurements left" << std::endl;
1351  return false;
1352  }
1353 
1355  // struct tm tim;
1356  //t Model::setMeasurementsTime( tim );
1357 
1358  //if you are looking for only one measurement with a given date and time, loop all measurements until you find it
1359  if( Measurement::only1 ) {
1360  for(;;) {
1361  if( wordlist[0] == "DATE:" && wordlist[1] == Measurement::only1Date && wordlist[2] == Measurement::only1Time ) break;
1362  filein.getWordsInLine(wordlist);
1363  if(filein.eof() ) {
1364  std::cerr << "!! EXITING date not found in measurements file" << Measurement::only1Date << " " << Measurement::only1Time << std::endl;
1365  exit(1);
1366  }
1367  }
1368  }
1369 
1370  //set date and time of current measurement
1371  if( wordlist[0] == "DATE:" ) {
1372  Measurement::setCurrentDate( wordlist );
1373  }
1374 
1375  //---------- loop measurements
1376  ALIint nMeas = Model::MeasurementList().size();
1377  if(ALIUtils::debug >= 4) {
1378  std::cout << " Reading " << nMeas << " measurements from file " << Measurement::measurementsFileName()
1379  << " DATE: " << wordlist[1] << " " << wordlist[1] << std::endl;
1380  }
1381  ALIint ii;
1382  for(ii = 0; ii < nMeas; ii++) {
1383  filein.getWordsInLine(wordlist);
1384  if( wordlist[0] == ALIstring("SENSOR2D") || wordlist[0] == ALIstring("TILTMETER") || wordlist[0] == ALIstring("DISTANCEMETER") || wordlist[0] == ALIstring("DISTANCEMETER1DIM") || wordlist[0] == ALIstring("COPS") ) {
1385  if( wordlist.size() != 2 ) {
1386  std::cerr << "!!!EXITING Model::readMeasurementsFromFile. number of words should be 2 instead of " << wordlist.size() << std::endl;
1387  ALIUtils::dumpVS( wordlist, " " );
1388  exit(1);
1389  }
1390  std::vector< Measurement* >::const_iterator vmcite;
1391  for( vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite ) {
1392  //-------- Measurement found, fill data
1393  /* ALIint last_slash = (*vmcite)->name().rfind('/');
1394  ALIstring oname = (*vmcite)->name();
1395  if( last_slash != -1 ) {
1396  oname = oname.substr(last_slash+1, (*vmcite)->name().size()-1);
1397  }
1398  */
1399  ALIint fcolon = (*vmcite)->name().find(':');
1400  ALIstring oname = (*vmcite)->name();
1401  oname = oname.substr(fcolon+1,oname.length());
1402  //- std::cout << " measurement name " << (*vmcite)->name() << " short " << oname << std::endl;
1403  if( oname == wordlist[1] ) {
1404  //- std::cout << " measurement name found " << oname << std::endl;
1405  if( (*vmcite)->type() != wordlist[0] ) {
1406  std::cerr << "!!! Reading measurement from file: type in file is "
1407  << wordlist[0] << " and should be " << (*vmcite)->type() << std::endl;
1408  exit(1);
1409  }
1410  Measurement* meastemp = *vmcite;
1411 
1413  ALIbool sigmaFF = gomgr->GlobalOptions()["measurementErrorFromFile"];
1414  //---------- Read the data
1415  for ( ALIuint ii=0; ii < meastemp->dim(); ii++){
1416  filein.getWordsInLine( wordlist );
1417  ALIdouble sigma = 0.;
1418  if( !sigmaFF ) {
1419  // keep the sigma, do not read it from file
1420  const ALIdouble* sigmav = meastemp->sigma();
1421  sigma = sigmav[ii];
1422  }
1423  //---- Check measurement value type is OK
1424  if( meastemp->valueType(ii) != wordlist[0] ) {
1425  filein.ErrorInLine();
1426  std::cerr << "!!!FATAL ERROR: Measurement value type is " << wordlist[0] << " while in setup definition was " << meastemp->valueType(ii) << std::endl;
1427  exit(1);
1428  }
1429  meastemp->fillData( ii, wordlist );
1430  if( !sigmaFF ) {
1431  meastemp->setSigma( ii, sigma );
1432  }
1433  }
1434  meastemp->correctValueAndSigma();
1435  break;
1436  }
1437  }
1438  if( vmcite == MeasurementList().end() ) {
1439  for( vmcite = MeasurementList().begin(); vmcite != MeasurementList().end(); ++vmcite ) {
1440  std::cerr << "MEAS: " << (*vmcite)->name() << " " << (*vmcite)->type() << std::endl;
1441  }
1442  std::cerr << "!!! Reading measurement from file: measurement not found in list: type in file is " << wordlist[1] << std::endl;
1443  exit(1);
1444  }
1445  } else {
1446  std::cerr << " wrong type of measurement: " << wordlist[0] << std::endl
1447  << " Available types are SENSOR2D, TILTMETER, DISTANCEMETER, DISTANCEMETER1DIM, COPS" << std::endl;
1448  exit(1);
1449  }
1450  }
1451  //- std::cout << " returning readmeasff" << std::endl;
1452 
1453  return true;
1454 }
static ALIbool only1
Definition: Measurement.h:267
long double ALIdouble
Definition: CocoaGlobals.h:11
ALIbool eof()
Definition: ALIFileIn.cc:211
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:23
const ALIuint dim() const
Definition: Measurement.h:82
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:140
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:36
static ALIstring only1Time
Definition: Measurement.h:269
static GlobalOptionMgr * getInstance()
bool ALIbool
Definition: CocoaGlobals.h:19
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:201
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:171
const ALIdouble * sigma() const
Definition: Measurement.h:132
#define end
Definition: vmac.h:39
ii
Definition: cuy.py:588
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:83
static ALIstring & measurementsFileName()
Definition: Measurement.h:213
void ErrorInLine()
Definition: ALIFileIn.cc:204
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:501
#define begin
Definition: vmac.h:32
std::string ALIstring
Definition: CocoaGlobals.h:9
virtual void correctValueAndSigma()
Definition: Measurement.h:67
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static ALIstring only1Date
Definition: Measurement.h:268
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:79
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:632
unsigned int ALIuint
Definition: CocoaGlobals.h:17
void Model::readSystemDescription ( )
static

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

Definition at line 103 of file Model.cc.

References ParameterMgr::addParameter(), ParameterMgr::addRandomFlatParameter(), ParameterMgr::addRandomGaussParameter(), begin, buildMeasurementsLinksToOptOs(), MessageLogger_cfi::cerr, ALIFileIn::close(), COCOA_Init, Measurement::construct(), OpticalObject::construct(), popcon2dropbox::copy(), gather_cfg::cout, ALIUtils::debug, ALIUtils::dumpVS(), relativeConstraints::empty, end, ALIFileIn::eof(), ALIFileIn::ErrorInLine(), cmsRelvalreport::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().

Referenced by setCocoaStatus().

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

Definition at line 1300 of file Model.cc.

1301 {
1302  /*
1303  if( position >= theParamFittedSigmaVector.size() ) {
1304  std::cerr << "!!EXITING at recoverParamFittedSigma: position" << position <<
1305  " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size() << std::endl;
1306  exit(3);
1307  }
1308  ALIdouble sigma = getParamFittedSigmaVectorItem( position );
1309 
1310  Entry* entry = getEntryByName(opto_name, entry_name);
1311  entry->setSigma( sigma );
1312  entry->setQuality( 1 );
1313  std::cout << "recover " << opto_name << entry_name << entry->sigma() <<std::endl;
1314  */
1315 }
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 513 of file Model.cc.

References begin.

Referenced by setMeasurementsTime().

513  {
514 
515  // int ALIstring_found = 0;
516  std::vector< std::vector<ALIstring> >::iterator vvsite;
517  std::vector< ALIstring >::iterator vsite;
518 
519 //---------------------------------------- Look for 'ssearch' as the first ALIstring of an OptODictionary item
520  for( vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
521  if( *( (*vvsite).begin() ) == ssearch ) {
522  // ALIstring_found = 1;
523  OptODictionary2.push_back(*vvsite);
524 
525  //- std::cout << "VVSITE";
526  //- ostream_iterator<ALIstring> outs(std::cout,"&");
527  //- copy( (*vvsite).begin(), (*vvsite).end(), outs);
528 
529 //---------------------------------- look for components of this _OptODictionary item
530  for( vsite = (*vvsite).begin()+1; vsite != (*vvsite).end(); ++vsite ) {
531  reorderOptODictionary( *vsite, OptODictionary2 );
532  }
533  break;
534  }
535  }
536 
537  /* //------- object 'system' should exist
538  if(!ALIstring_found && ssearch == "system") {
539  std::cerr << "SYSTEM_TREE_DATA section: no 'object system' found " << std::endl;
540  exit(9);
541  } */
542 
543 }
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:67
#define begin
Definition: vmac.h:32
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:513
static ALIstring& Model::ReportFName ( )
inlinestatic

the name of the report File

Definition at line 96 of file Model.h.

References theReportFName.

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

96  {
97  return theReportFName;
98  }
static ALIstring theReportFName
the name of the report File
Definition: Model.h:216
void Model::saveParamFittedCorrelation ( const ALIstring opto_name1,
const ALIstring entry_name1,
const ALIstring opto_name2,
const ALIstring entry_name2 
)
staticprivate

Definition at line 1264 of file Model.cc.

1265 {
1266  /*
1267 //---------- Get sigma of param Optical
1268  Entry* entry1 = getEntryByName(opto_name1, entry_name1);
1269  Entry* entry2 = getEntryByName(opto_name2, entry_name2);
1270  ALIuint fit_pos1 = entry1->fitPos();
1271  ALIuint fit_pos2 = entry2->fitPos();
1272 
1273  //---------- Get correlation if entry has been fitted
1274  ALIuint pmsize = Fit::propagationMatrix().NoLines();
1275  if( fit_pos1 >= 0 && fit_pos1 < pmsize && fit_pos2 >= 0 && fit_pos2 < pmsize ) {
1276  ALIdouble error1 = sqrt( Fit::propagationMatrix()( fit_pos1, fit_pos1) );
1277  ALIdouble error2 = sqrt( Fit::propagationMatrix()( fit_pos2, fit_pos2) );
1278  ALIdouble correl = Fit::propagationMatrix()( fit_pos1, fit_pos2) / error1 / error2;
1279  theParamFittedSigmaVector.push_back( correl );
1280  if(ALIUtils::debug>=9) {
1281  std::cout << "saveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1282  opto_name2 << entry_name2 << fit_pos2 << "MM " << correl << std::endl;
1283  }
1284  } else {
1285  if(ALIUtils::debug>=9) {
1286  std::cout << "NOsaveParamFittedCorre" << opto_name1 << entry_name1 << fit_pos1 <<
1287  opto_name2 << entry_name2 << fit_pos2 << "MM " << std::endl;
1288  theParamFittedSigmaVector.push_back( 0. );
1289  }
1290 
1291  }
1292  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1293  */
1294 }
void Model::saveParamFittedSigma ( const ALIstring opto_name,
const ALIstring entry_name 
)
staticprivate

Definition at line 1243 of file Model.cc.

1244 {
1245  /*
1246 //---------- Get sigma of param Optical
1247  Entry* entry = getEntryByName(opto_name, entry_name);
1248  ALIuint fit_pos = entry->fitPos();
1249  if( fit_pos < 0 || fit_pos >= Fit::propagationMatrix().NoLines()) {
1250  std::cerr << "!!EXITING at saveParamFittedSigma: fit position incorrect " <<
1251  fit_pos << "propagationMatrix size =" << Fit::propagationMatrix().NoLines() << opto_name << std::endl;
1252  exit(3);
1253  }
1254  std::cout << entry_name << "saveParamFittedSigma" << fit_pos << sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) << std::endl;
1255  theParamFittedSigmaVector.push_back( sqrt(Fit::propagationMatrix()( fit_pos, fit_pos)) );
1256  //- Fit::propagationMatrix().Dump(" the 2PropagationMatrix");
1257  */
1258 }
static ALIstring& Model::SDFName ( )
inlinestatic

the name of the System Description File

Definition at line 86 of file Model.h.

References theSDFName.

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

86  {
87  return theSDFName;
88  }
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:212
static void Model::setCocoaStatus ( const cocoaStatus  cs)
inlinestatic
static void Model::setMatricesFName ( const ALIstring name)
inlinestatic

Definition at line 164 of file Model.h.

References dataset::name, and theMatricesFName.

164  {
166  }
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:218
static void Model::setMeasurementsTime ( struct tm &  tim)
inlinestatic

Definition at line 168 of file Model.h.

References buildMeasurementsLinksToOptOs(), readMeasurementsFromFile(), reorderOptODictionary(), SetValueDisplacementsFromReportOut(), and theMeasurementsTime.

168  {
169  theMeasurementsTime = tim;
170  }
static struct tm theMeasurementsTime
Definition: Model.h:292
static void Model::setReportFName ( const ALIstring name)
inlinestatic

Definition at line 160 of file Model.h.

References dataset::name, and theReportFName.

160  {
162  }
static ALIstring theReportFName
the name of the report File
Definition: Model.h:216
static void Model::setSDFName ( const ALIstring name)
inlinestatic

Definition at line 156 of file Model.h.

References dataset::name, and theSDFName.

156  {
157  theSDFName = name;
158  }
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:212
void Model::SetValueDisplacementsFromReportOut ( )
staticprivate

Definition at line 1536 of file Model.cc.

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

Referenced by setMeasurementsTime().

1537 {
1538  if( ALIUtils::debug >= 3 ) std::cout << " Model::SetValueDisplacementsFromReportOut() " << std::endl;
1539 
1540  EntryMgr* entryMgr = EntryMgr::getInstance();
1541 
1542  if( entryMgr->numberOfEntries() != 0 ){
1543  EntryData* entryData;
1544 
1545  std::vector<Entry*>::const_iterator vecite;
1546  for ( vecite = Model::EntryList().begin();
1547  vecite != Model::EntryList().end(); ++vecite ) {
1548  //----- Find the EntryData corresponding to this entry
1549  entryData = entryMgr->findEntryByLongName( (*vecite)->OptOCurrent()->longName(), (*vecite)->name() );
1550  if( ALIUtils::debug >= 3 ) std::cout << "SetValueDisplacementsFromReportOut "<< (*vecite)->OptOCurrent()->longName() << " " << (*vecite)->name() << " " << entryData->valueDisplacement() << std::endl;
1551  (*vecite)->addFittedDisplacementToValue( entryData->valueDisplacement() );
1552  }
1553  }
1554 
1555 }
static ALIint debug
Definition: ALIUtils.h:36
static std::vector< Entry * > & EntryList()
Definition: Model.h:75
ALIint numberOfEntries()
Definition: EntryMgr.h:41
static EntryMgr * getInstance()
Definition: EntryMgr.cc:17
EntryData * findEntryByLongName(const ALIstring &optoName, const ALIstring &entryName="")
Definition: EntryMgr.cc:83
ALIdouble valueDisplacement() const
Definition: EntryData.h:32

Member Data Documentation

ALIint Model::CMSLinkIteration = 0
staticprivate

Definition at line 253 of file Model.h.

Referenced by CMSLinkDeleteOptOs().

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

Definition at line 239 of file Model.h.

ALIint Model::Ncmslinkrange = 0
static

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

Definition at line 238 of file Model.h.

cocoaStatus Model::theCocoaStatus = COCOA_Init
staticprivate

Definition at line 286 of file Model.h.

Referenced by getCocoaStatus(), and setCocoaStatus().

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

std::vector of all Entries

Definition at line 206 of file Model.h.

Referenced by addEntryToList(), and EntryList().

FittedEntriesReader * Model::theFittedEntriesReader = 0
staticprivate

Definition at line 294 of file Model.h.

Referenced by getFittedEntriesReader().

Model * Model::theInstance = 0
staticprivate

Only instance of Model.

Definition at line 191 of file Model.h.

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

the name of the File for storing the matrices

Definition at line 218 of file Model.h.

Referenced by MatricesFName(), and setMatricesFName().

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

the name of the Measurements File

Definition at line 214 of file Model.h.

Referenced by MeasFName().

struct tm Model::theMeasurementsTime
staticprivate

Definition at line 292 of file Model.h.

Referenced by MeasurementsTime(), and setMeasurementsTime().

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

std::vector of all Measurements

Definition at line 209 of file Model.h.

Referenced by addMeasurementToList(), and MeasurementList().

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

Definition at line 296 of file Model.h.

Referenced by getOpticalAlignments().

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

parameters

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

Definition at line 197 of file Model.h.

Referenced by OptODictionary().

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 203 of file Model.h.

Referenced by OptOList().

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

Definition at line 230 of file Model.h.

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

Definition at line 232 of file Model.h.

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

Definition at line 288 of file Model.h.

Referenced by cleanParamFittedSigmaVector().

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

Definition at line 290 of file Model.h.

Referenced by cleanParamFittedValueDisplacementMap().

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

the name of the report File

Definition at line 216 of file Model.h.

Referenced by ReportFName(), and setReportFName().

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

the name of the System Description File

Definition at line 212 of file Model.h.

Referenced by SDFName(), and setSDFName().