CMS 3D CMS Logo

Model.h
Go to the documentation of this file.
1 // COCOA class header file
2 //Id: Model.h
3 //CAT: Model
4 //
5 // Utility class that steers the reading of the system description file
6 // and contains the static data
7 //
8 // History: v1.0
9 // Pedro Arce
10 
11 #ifndef MODEL_H
12 #define MODEL_H
13 
14 #include <vector>
15 #include <map>
16 //#include <multimap.h>
17 
19 class Entry;
20 //#include "Alignment/CocoaModel/interface/Entry.h" //temporal
21 class OpticalObject;
22 //#include "Alignment/CocoaModel/interface/OpticalObject.h"
23 class Measurement;
24 class ALIFileIn;
26 
27 class OpticalAlignments;
29 
31 
39 };
40 
52 };
53 
54 class Model {
55 public:
56  //---------- Constructor / destructor
57  Model();
58  ~Model(){};
59 
61  static Model& getInstance();
62 
64  static void setCocoaStatus(const cocoaStatus cs) { theCocoaStatus = cs; }
66 
68  static void readSystemDescription();
69 
70  //----------- Build OpticalObjects's from info in XML file
73  //----------- Build Measurements's from info in XML file
75 
77 
78  // static std::map< ALIstring, ALIdouble, std::less<ALIstring> >& Parameters() {
79  // return theParameters;
80  // }
81 
82  static std::vector<std::vector<ALIstring> >& OptODictionary() { return theOptODictionary; }
83 
84  static std::vector<OpticalObject*>& OptOList() { return theOptOList; }
85 
86  static std::vector<Entry*>& EntryList() { return theEntryVector; }
87 
88  static std::vector<Measurement*>& MeasurementList() { return theMeasurementVector; }
89 
90  static Measurement* getMeasurementByName(const ALIstring& name, ALIbool exists = true);
91 
93  static ALIstring& SDFName() { return theSDFName; }
94 
96  static ALIstring& MeasFName() { return theMeasFName; }
97 
99  static ALIstring& ReportFName() { return theReportFName; }
100 
103 
105 
107  static int getParameterValue(const ALIstring& sstr, ALIdouble& val);
108 
110  static OpticalObject* getOptOByName(const ALIstring& opto_name);
111 
113  static OpticalObject* getOptOByType(const ALIstring& type);
114 
116  static Entry* getEntryByName(const ALIstring& opto_name, const ALIstring& entry_name);
117 
120  static Entry* getEntryByName(const ALIstring& opto_entry_name) {
121  ALIint slash_pos = opto_entry_name.rfind('/');
122  ALIint length = opto_entry_name.length();
123  ALIstring opto_name = opto_entry_name.substr(0, slash_pos);
124  ALIstring entry_name = opto_entry_name.substr(slash_pos + 1, length);
125  Entry* entry = getEntryByName(opto_name, entry_name);
126  return entry;
127  }
128 
130  static ALIbool getComponentOptOTypes(const ALIstring& opto_type, std::vector<ALIstring>& vcomponents);
131 
133  static ALIbool getComponentOptOs(const ALIstring& opto_name, std::vector<OpticalObject*>& vcomponents);
134 
135  static struct tm& MeasurementsTime() { return theMeasurementsTime; }
136 
137  static std::vector<OpticalAlignInfo> getOpticalAlignments() { return theOpticalAlignments; }
138 
140  static void addEntryToList(Entry* entry) {
141  theEntryVector.push_back(entry);
142  //- std::cout << entry << entry->OptOCurrent()->name() << "ADDENTRY " << entry->name() << " " << EntryList().size() << std::endl;
143  }
144 
145  static void addMeasurementToList(Measurement* measadd) {
146  theMeasurementVector.push_back(measadd);
147  // std::cout << "ADD MEASUREMENT" << theMeasurementVector.size() << std::endl ;
148  }
149 
150  //----- Set the name of the System Description File
151  static void setSDFName(const ALIstring& name) { theSDFName = name; }
152  //----- Set the name of the report File
153  static void setReportFName(const ALIstring& name) { theReportFName = name; }
154  //----- Set the name of the matrices File
155  static void setMatricesFName(const ALIstring& name) { theMatricesFName = name; }
156 
157  static void setMeasurementsTime(struct tm& tim) { theMeasurementsTime = tim; }
158 
159  static ALIbool readMeasurementsFromFile(ALIstring only1Date = ALIstring(""), ALIstring only1Time = ALIstring(""));
160 
162 private:
164  static void reorderOptODictionary(const ALIstring& ssearch, std::vector<std::vector<ALIstring> >& OptODictionary2);
165 
167  // static void readMeasurements( ALIFileIn& filein );
168 
170  static void buildMeasurementsLinksToOptOs();
171 
173 
177 
179  //- static std::map< ALIstring, ALIdouble, std::less<ALIstring> > theParameters;
180 
182  static std::vector<std::vector<ALIstring> > theOptODictionary;
183 
185  //- static multimap< ALIstring, OpticalObject*, std::less<ALIstring> > theOptOtree;
187  // static map< ALIstring, OpticalObject*, std::less<ALIstring> > theOptOList;
188  static std::vector<OpticalObject*> theOptOList;
189 
191  static std::vector<Entry*> theEntryVector;
192 
194  static std::vector<Measurement*> theMeasurementVector;
195 
204 
206 public:
207  //----- Steers the storing of the components of OptO named 'optoname'
208  static ALIbool createCopyComponentList(const ALIstring& optoname);
209  //----- Get next object to copy from the stored list of components and copy it
210  static OpticalObject* nextOptOToCopy();
211 
212 private:
213  //----- Stores the components of opto
214  static ALIbool fillCopyComponentList(const OpticalObject* opto);
215  //----- List of components of an OptO to copy
216  static std::vector<OpticalObject*> theOptOsToCopyList;
217  //----- Iterator of the list of components of an OptO to copy
218  static std::vector<OpticalObject*>::const_iterator theOptOsToCopyListIterator;
219 
221 public:
223  static std::vector<ALIdouble> CMSLinkRangeDetValue;
224 
226 public:
227  void CMSLinkFit(ALIint cmslink);
228 
229 private:
230  void CMSLinkCleanModel();
231  static void CMSLinkDeleteOptOs();
232  static void CMSLinkSaveParamFittedSigma(ALIint cmslink);
233  static void CMSLinkSaveParamFittedValueDisplacement(ALIint cmslink);
234  static void CMSLinkRecoverParamFittedSigma(ALIint cmslink);
236 
238 
239  //----- METHODS FOR FITTING IN SEVERAL STEPS
240  static void deleteOptO(const ALIstring& opto_name);
241  static void deleteOptO(OpticalObject* opto);
242 
243  static void saveParamFittedSigma(const ALIstring& opto_name, const ALIstring& entry_name);
244 
245  static void saveParamFittedCorrelation(const ALIstring& opto_name1,
246  const ALIstring& entry_name1,
247  const ALIstring& opto_name2,
248  const ALIstring& entry_name2);
249 
250  static void recoverParamFittedSigma(const ALIstring& opto_name, const ALIstring& entry_name, const ALIuint position);
251 
252 public:
255 
256 private:
258  ALIuint pfsv_size = theParamFittedSigmaVector.size();
259  for (ALIuint ii = 0; ii < pfsv_size; ii++) {
260  theParamFittedSigmaVector.pop_back();
261  }
262  }
263 
267  }
268 
269  static void copyMeasurements(const std::vector<ALIstring>& wl);
270 
271 private:
273 
274  static std::vector<ALIdouble> theParamFittedSigmaVector;
275 
276  static std::map<ALIstring, ALIdouble, std::less<ALIstring> > theParamFittedValueDisplacementMap;
277 
278  static struct tm theMeasurementsTime;
279 
281 
282  static std::vector<OpticalAlignInfo> theOpticalAlignments;
283 };
284 
285 #endif
cocoaStatus
Definition: Model.h:41
type
Definition: HCALResponse.h:21
void BuildMeasurementsFromOA(OpticalAlignMeasurements &measList)
Definition: Model.cc:1577
static ALIbool getComponentOptOs(const ALIstring &opto_name, std::vector< OpticalObject * > &vcomponents)
--— Get from theOptOList the list of pointers to component OptOs
Definition: Model.cc:705
static ALIint CMSLinkIteration
Definition: Model.h:237
long double ALIdouble
Definition: CocoaGlobals.h:11
static void saveParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name)
Definition: Model.cc:1200
static void CMSLinkSaveParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1000
static void setMeasurementsTime(struct tm &tim)
Definition: Model.h:157
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1551
static ALIstring & MeasFName()
the name of the Measurements File
Definition: Model.h:96
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1110
static cocoaStatus getCocoaStatus()
Definition: Model.h:63
~Model()
Definition: Model.h:58
Definition: Entry.h:18
static void setCocoaStatus(const cocoaStatus cs)
Definition: Model.h:64
static std::string printCocoaStatus(const cocoaStatus cs)
Definition: Model.cc:1511
unique_ptr< ClusterSequence > cs
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
static void buildMeasurementsLinksToOptOs()
Read Measurements (to be implemented for reading from an external file the DATA of the measurements) ...
Definition: Model.cc:545
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:276
void CMSLinkCleanModel()
Definition: Model.cc:864
int ALIint
Definition: CocoaGlobals.h:15
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:570
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:93
static OpticalObject * nextOptOToCopy()
Definition: Model.cc:796
static ALIstring & ReportFName()
the name of the report File
Definition: Model.h:99
static Model * theInstance
Definition: Model.h:176
static Entry * getEntryByName(const ALIstring &opto_entry_name)
Definition: Model.h:120
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:203
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:197
static Entry * getEntryByName(const ALIstring &opto_name, const ALIstring &entry_name)
--— Search an Entry name in the Entry* list and return a pointer to it
Definition: Model.cc:623
static FittedEntriesReader * getFittedEntriesReader()
Definition: Model.h:254
static ALIint Ncmslinkrange
*************** FOR RANGE STUDIES
Definition: Model.h:222
static void setSDFName(const ALIstring &name)
Definition: Model.h:151
static std::vector< OpticalAlignInfo > getOpticalAlignments()
Definition: Model.h:137
static void copyMeasurements(const std::vector< ALIstring > &wl)
Definition: Model.cc:1419
static ALIdouble getParamFittedSigmaVectorItem(const ALIuint position)
Definition: Model.cc:1275
bool ALIbool
Definition: CocoaGlobals.h:19
static void addMeasurementToList(Measurement *measadd)
Definition: Model.h:145
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:601
static void readSystemDescription()
-------— Read the different sections of the SDF and act accordingly
Definition: Model.cc:99
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:216
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
static Model & getInstance()
-------— Gets the only instance of this class
Definition: Model.cc:82
static struct tm & MeasurementsTime()
Definition: Model.h:135
static void SetValueDisplacementsFromReportOut()
Definition: Model.cc:1489
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:218
static struct tm theMeasurementsTime
Definition: Model.h:278
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194
Model()
Definition: Model.cc:92
void BuildSystemDescriptionFromOA(OpticalAlignments &optAlig)
Definition: Model.cc:1536
Definition: Model.h:54
static ALIbool createCopyComponentList(const ALIstring &optoname)
**************** FOR COPYING AN OPTO
Definition: Model.cc:750
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:770
ii
Definition: cuy.py:590
static void setMatricesFName(const ALIstring &name)
Definition: Model.h:155
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:199
static void cleanParamFittedSigmaVector()
Definition: Model.h:257
static void setReportFName(const ALIstring &name)
Definition: Model.h:153
static ALIstring theReportFName
the name of the report File
Definition: Model.h:201
static ALIbool getComponentOptOTypes(const ALIstring &opto_type, std::vector< ALIstring > &vcomponents)
--— Get from theOptODictionary the list of component OptO types
Definition: Model.cc:674
static int getParameterValue(const ALIstring &sstr, ALIdouble &val)
************ ACCESS INFO FROM STATIC DATA
Definition: Model.cc:560
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:191
sectionType
Definition: Model.h:32
static void addEntryToList(Entry *entry)
***************** SET DATA MEMBERS
Definition: Model.h:140
static std::vector< ALIdouble > CMSLinkRangeDetValue
Definition: Model.h:223
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:280
static void recoverParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name, const ALIuint position)
Definition: Model.cc:1256
static Measurement * getMeasurementByName(const ALIstring &name, ALIbool exists=true)
Definition: Model.cc:641
static void CMSLinkRecoverParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1084
static void cleanParamFittedValueDisplacementMap()
Definition: Model.h:264
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:274
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::string ALIstring
Definition: CocoaGlobals.h:9
static cocoaStatus theCocoaStatus
Definition: Model.h:272
static void saveParamFittedCorrelation(const ALIstring &opto_name1, const ALIstring &entry_name1, const ALIstring &opto_name2, const ALIstring &entry_name2)
Definition: Model.cc:1219
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:512
static ALIbool readMeasurementsFromFile(ALIstring only1Date=ALIstring(""), ALIstring only1Time=ALIstring(""))
Definition: Model.cc:1289
static ALIstring & MatricesFName()
the name of the File for storing the matrices
Definition: Model.h:102
static void CMSLinkDeleteOptOs()
Definition: Model.cc:876
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88
void CMSLinkFit(ALIint cmslink)
*************** FOR CMS LINK SYSTEM (to fit it part by part)
Definition: Model.cc:808
static void CMSLinkRecoverParamFittedSigma(ALIint cmslink)
Definition: Model.cc:1025
static void CMSLinkSaveParamFittedSigma(ALIint cmslink)
Definition: Model.cc:937
static std::vector< Entry * > & EntryList()
Definition: Model.h:86
unsigned int ALIuint
Definition: CocoaGlobals.h:17
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82