CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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=1)
 
static std::vector
< OpticalAlignInfo
getOpticalAlignments ()
 
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
< OpticalAlignInfo
theOpticalAlignments
 
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 93 of file Model.cc.

94 {
95  // theMeasurementsTime = clock();
96 }
Model::~Model ( )
inline

Definition at line 43 of file Model.h.

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 1626 of file Model.cc.

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

Referenced by CocoaAnalyzer::RunCocoa().

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

References begin.

Referenced by readSystemDescription().

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

Definition at line 1580 of file Model.cc.

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

Referenced by CocoaAnalyzer::RunCocoa().

1581 {
1583 
1584  OpticalAlignInfo oai_system = FindOptAlignInfoByType( "system" );
1585 
1586  OpticalObject* OptOsystem = new OpticalObject( 0, "system", oai_system.name_, 0 );
1587 
1588  OptOsystem->constructFromOptAligInfo( oai_system );
1589 
1590  //- Model::_OptOtree.insert( std::multimap< ALIstring, OpticalObject*, std::less<ALIstring> >::value_type(OptOsystem->type(), OptOsystem) );
1591  // theOptOlist[OptOsystem->name()] = OptOsystem;
1592  theOptOList.push_back( OptOsystem );
1593 }
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:296
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1597
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  }
int 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 theParamFittedValueDisplacementMap.

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

Definition at line 887 of file Model.cc.

References cuy::ii.

888 {
889  deleteOptO("s");
890  //---------- Clean OptOdicitionary (in case this is not first reading)
891  ALIuint odsize = theOptODictionary.size();
892  for( ALIuint ii = 0; ii < odsize; ii++) {
893  theOptODictionary.pop_back();
894  }
895 
896 }
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1147
int 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 902 of file Model.cc.

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

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

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

Definition at line 829 of file Model.cc.

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

Definition at line 1058 of file Model.cc.

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

Definition at line 1119 of file Model.cc.

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

Definition at line 966 of file Model.cc.

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

Definition at line 1031 of file Model.cc.

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

Definition at line 1458 of file Model.cc.

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

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

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

Definition at line 769 of file Model.cc.

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

Referenced by OpticalObject::createComponentOptOs().

770 {
771  //---------- 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)
772  if(ALIUtils::debug >= 3) std::cout << "createCopyComponentList " << typ << std::endl;
773  OpticalObject* start_opto = getOptOByType( typ );
774 
775  //---------- clean list of OptOs to copy
777 
778  //---------- Fill list of OptOs to copy
779  fillCopyComponentList( start_opto );
780  //- if(ALIUtils::debug >= 9) std::cout << "createCopyComponentList " << typ << theOptOsToCopyList.size() << std::endl;
781 
783  return 1;
784 }
static ALIint debug
Definition: ALIUtils.h:35
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:610
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:790
tuple cout
Definition: gather_cfg.py:145
void Model::deleteOptO ( const ALIstring opto_name)
staticprivate

Definition at line 1147 of file Model.cc.

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

Definition at line 1157 of file Model.cc.

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

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

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

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

Definition at line 1597 of file Model.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, cppFunctionSkipper::exception, and OpticalAlignInfo::name_.

1598 {
1599  OpticalAlignInfo oai;
1600 
1601  ALIbool bFound = 0;
1602  std::vector<OpticalAlignInfo>::iterator ite;
1603  for( ite = theOpticalAlignments.begin(); ite != theOpticalAlignments.end(); ++ite ){
1604  // std::cout << " Model::FindOptAlignInfoByType " << (*ite).type_ << " =? " << type << std::endl;
1605  if( (*ite).type_ == type ) {
1606  if( !bFound ){
1607  oai = *ite;
1608  bFound = 1;
1609  } else {
1610  std::cerr << "!! WARNING: Model::FindOptAlignInfoByType more than one objects of type " << type << std::endl;
1611  std::cerr << " returning object " << oai.name_ << std::endl
1612  << " skipping object " << (*ite).name_ << std::endl;
1613  }
1614  }
1615  }
1616  if( !bFound ) {
1617  std::cerr << "!! ERROR: Model::FindOptAlignInfoByType object not found, of type " << type << std::endl;
1618  std::exception();
1619  }
1620 
1621  return oai;
1622 }
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 723 of file Model.cc.

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

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

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

References begin.

Referenced by OpticalObject::createComponentOptOs().

691 {
692  //---------- clean std::vector in which you are going to store opto types
693  std::vector<ALIstring>::iterator vsite;
694  for (vsite = vcomponents.begin(); vsite != vcomponents.end(); ++vsite) {
695  vcomponents.pop_back();
696  }
697 
698  //---------- Looks the theOptODictionary item that has 'opto_type' as the first ALIstring,
699  ALIint ALIstring_found = 0;
700  std::vector< std::vector<ALIstring> >::iterator vvsite;
701  for( vvsite = OptODictionary().begin(); vvsite != OptODictionary().end(); ++vvsite) {
702  if( *( (*vvsite).begin() ) == opto_type ) {
703  ALIstring_found = 1;
704  //tt copies this item to 'vcomponents', substracting the first ALIstring, that is the opto_type itself,
705  vcomponents = *vvsite;
706  vcomponents.erase( vcomponents.begin() );
707  break;
708  }
709  }
710 
711  if ( ALIstring_found ) {
712  return 1;
713  } else {
714  return 0;
715  }
716 }
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:30
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 633 of file Model.cc.

References begin, ecal_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, ALIUtils::debug, and cmsRelvalreport::exit.

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

634 {
635  //---------- Look for Entry name type in EntryList
636  std::vector<Entry*>::const_iterator vecite;
637  for( vecite = EntryList().begin(); vecite != EntryList().end(); ++vecite) {
638  if( ALIUtils::debug >= 4 ) std::cout << "getEntryByName: " <<(*vecite)->OptOCurrent()->name()
639  << " E " << (*vecite)->name() << " Searching: " << opto_name << " E " << entry_name << std::endl;
640  //- std::cout << " optoName " << (*vecite)->OptOCurrent()->name()<< " " << (*vecite)->name() << std::endl;
641  if( (*vecite)->OptOCurrent()->name() == opto_name &&
642  (*vecite)->name() == entry_name ) {
643  return *vecite;
644  }
645  }
646  //---------- Entry not found!
647  std::cerr << "!!!EXITING at getEntryByName: Entry name not found:" << opto_name << " " << entry_name << std::endl;
648  exit(1);
649 }
static ALIint debug
Definition: ALIUtils.h:35
static std::vector< Entry * > & EntryList()
Definition: Model.h:75
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:145
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, 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:633
std::string ALIstring
Definition: CocoaGlobals.h:9
list entry
Definition: mps_splice.py:62
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 81 of file Model.cc.

Referenced by CocoaAnalyzer::RunCocoa().

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

Definition at line 653 of file Model.cc.

References ecal_dqm_sourceclient-live_cfg::cerr.

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

References begin, ecal_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, ALIUtils::debug, and cmsRelvalreport::exit.

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

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

References begin, ecal_dqm_sourceclient-live_cfg::cerr, and cmsRelvalreport::exit.

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

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

566 {
568  ALIint iret = parmgr->getParameterValue( sstr, val );
569 
570  return iret;
571 
572 }
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 1319 of file Model.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, cmsRelvalreport::exit, and position.

1320 {
1321  if( position >= theParamFittedSigmaVector.size() ) {
1322  std::cerr << "!!EXITING at getParamFittedSigma: position" << position <<
1323  " bigger than dimension of theParamFittedSigmaVector " << theParamFittedSigmaVector.size() << std::endl;
1324  exit(3);
1325  }
1326  std::vector<ALIdouble>::const_iterator vdcite = theParamFittedSigmaVector.begin() + position;
1327  return (*vdcite);
1328 
1329 }
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 theMatricesFName.

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 816 of file Model.cc.

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

Referenced by OpticalObject::copyData().

817 {
818  if(ALIUtils::debug >= 5) std::cout << "entering nextOptOToCopy() " << std::endl;
820  // if(ALIUtils::debug >= 5) std::cout <<" nextOptOToCopy " << (*(theOptOsToCopyListIterator-1))->name() << std::endl;
821  return *(theOptOsToCopyListIterator-1);
822 }
static ALIint debug
Definition: ALIUtils.h:35
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:232
tuple cout
Definition: gather_cfg.py:145
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 1553 of file Model.cc.

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

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

Definition at line 1336 of file Model.cc.

References begin, ecal_dqm_sourceclient-live_cfg::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().

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

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

Definition at line 101 of file Model.cc.

References ParameterMgr::addParameter(), ParameterMgr::addRandomFlatParameter(), ParameterMgr::addRandomGaussParameter(), assert(), begin, buildMeasurementsLinksToOptOs(), ecal_dqm_sourceclient-live_cfg::cerr, ALIFileIn::close(), COCOA_Init, Measurement::construct(), OpticalObject::construct(), filterCSVwithJSON::copy, gather_cfg::cout, ALIUtils::debug, ALIUtils::dumpVS(), end, ALIFileIn::eof(), ALIFileIn::ErrorInLine(), cmsRelvalreport::exit, spr::find(), ALIUtils::getFloat(), ParameterMgr::getInstance(), EntryMgr::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(), ParameterMgr::setRandomSeed(), and findQualityFiles::size.

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

Definition at line 1298 of file Model.cc.

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

References begin.

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

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

Definition at line 1241 of file Model.cc.

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

Definition at line 49 of file Model.h.

References fwrapper::cs, and theCocoaStatus.

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

49 { theCocoaStatus = cs; }
auto_ptr< ClusterSequence > cs
static cocoaStatus theCocoaStatus
Definition: Model.h:286
static void Model::setMatricesFName ( const ALIstring name)
inlinestatic

Definition at line 164 of file Model.h.

References mergeVDriftHistosByStation::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 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 mergeVDriftHistosByStation::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 mergeVDriftHistosByStation::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 1530 of file Model.cc.

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

1531 {
1532  if( ALIUtils::debug >= 3 ) std::cout << " Model::SetValueDisplacementsFromReportOut() " << std::endl;
1533 
1534  EntryMgr* entryMgr = EntryMgr::getInstance();
1535 
1536  if( entryMgr->numberOfEntries() != 0 ){
1537  EntryData* entryData;
1538 
1539  std::vector<Entry*>::const_iterator vecite;
1540  for ( vecite = Model::EntryList().begin();
1541  vecite != Model::EntryList().end(); ++vecite ) {
1542  //----- Find the EntryData corresponding to this entry
1543  entryData = entryMgr->findEntryByLongName( (*vecite)->OptOCurrent()->longName(), (*vecite)->name() );
1544  if( ALIUtils::debug >= 3 ) std::cout << "SetValueDisplacementsFromReportOut "<< (*vecite)->OptOCurrent()->longName() << " " << (*vecite)->name() << " " << entryData->valueDisplacement() << std::endl;
1545  (*vecite)->addFittedDisplacementToValue( entryData->valueDisplacement() );
1546  }
1547  }
1548 
1549 }
static ALIint debug
Definition: ALIUtils.h:35
static std::vector< Entry * > & EntryList()
Definition: Model.h:75
ALIint numberOfEntries()
Definition: EntryMgr.h:41
static EntryMgr * getInstance()
Definition: EntryMgr.cc:17
tuple cout
Definition: gather_cfg.py:145
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().