CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18 
20 class Entry;
21 //#include "Alignment/CocoaModel/interface/Entry.h" //temporal
22 class OpticalObject;
23 //#include "Alignment/CocoaModel/interface/OpticalObject.h"
24 class Measurement;
25 class ALIFileIn;
27 
28 class OpticalAlignments;
30 
32 
33 
35 
37 
38 class Model
39 {
40 public:
41  //---------- Constructor / destructor
42  Model();
43  ~Model(){};
44 
46  static Model& getInstance();
47 
49  static void setCocoaStatus(const cocoaStatus cs ){ theCocoaStatus = cs; }
50  static std::string printCocoaStatus(const cocoaStatus cs);
51 
53  static void readSystemDescription();
54 
55  //----------- Build OpticalObjects's from info in XML file
58  //----------- Build Measurements's from info in XML file
60 
62 
63  // static std::map< ALIstring, ALIdouble, std::less<ALIstring> >& Parameters() {
64  // return theParameters;
65  // }
66 
67  static std::vector< std::vector<ALIstring> >& OptODictionary() {
68  return theOptODictionary;
69  }
70 
71  static std::vector< OpticalObject* >& OptOList(){
72  return theOptOList;
73  }
74 
75  static std::vector< Entry* >& EntryList() {
76  return theEntryVector;
77  }
78 
79  static std::vector< Measurement* >& MeasurementList() {
80  return theMeasurementVector;
81  }
82 
83  static Measurement* getMeasurementByName( const ALIstring& name, ALIbool exists = 1);
84 
86  static ALIstring& SDFName(){
87  return theSDFName;
88  }
89 
91  static ALIstring& MeasFName(){
92  return theMeasFName;
93  }
94 
97  return theReportFName;
98  }
99 
102  return theMatricesFName;
103  }
104 
106 
107 
109  static int getParameterValue( const ALIstring& sstr, ALIdouble& val );
110 
112  static OpticalObject* getOptOByName( const ALIstring& opto_name );
113 
115  static OpticalObject* getOptOByType( const ALIstring& type );
116 
118  static Entry* getEntryByName( const ALIstring& opto_name, const ALIstring& entry_name );
119 
122  static Entry* getEntryByName( const ALIstring& opto_entry_name) {
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  }
130 
132  static ALIbool getComponentOptOTypes( const ALIstring& opto_type, std::vector<ALIstring>& vcomponents );
133 
135  static ALIbool getComponentOptOs( const ALIstring& opto_name, std::vector<OpticalObject*>& vcomponents);
136 
137  static struct tm& MeasurementsTime() {
138  return theMeasurementsTime;
139  }
140 
141  static std::vector<OpticalAlignInfo> getOpticalAlignments() { return theOpticalAlignments; }
142 
143 
145  static void addEntryToList( Entry* entry ) {
146  theEntryVector.push_back( entry );
147  //- std::cout << entry << entry->OptOCurrent()->name() << "ADDENTRY " << entry->name() << " " << EntryList().size() << std::endl;
148  }
149 
150  static void addMeasurementToList( Measurement* measadd ) {
151  theMeasurementVector.push_back( measadd);
152  // std::cout << "ADD MEASUREMENT" << theMeasurementVector.size() << std::endl ;
153  }
154 
155  //----- Set the name of the System Description File
156  static void setSDFName( const ALIstring& name ) {
157  theSDFName = name;
158  }
159  //----- Set the name of the report File
160  static void setReportFName( const ALIstring& name ) {
162  }
163  //----- Set the name of the matrices File
164  static void setMatricesFName( const ALIstring& name ) {
166  }
167 
168  static void setMeasurementsTime( struct tm& tim ) {
169  theMeasurementsTime = tim;
170  }
171 
172 
173  static ALIbool readMeasurementsFromFile( ALIstring only1Date = ALIstring(""), ALIstring only1Time = ALIstring("") );
174 
175 
177 private:
179  static void reorderOptODictionary( const ALIstring& ssearch, std::vector< std::vector<ALIstring> >& OptODictionary2);
180 
182  // static void readMeasurements( ALIFileIn& filein );
183 
185  static void buildMeasurementsLinksToOptOs();
186 
188 
192 
194  //- static std::map< ALIstring, ALIdouble, std::less<ALIstring> > theParameters;
195 
197  static std::vector< std::vector<ALIstring> > theOptODictionary;
198 
200  //- static multimap< ALIstring, OpticalObject*, std::less<ALIstring> > theOptOtree;
202  // static map< ALIstring, OpticalObject*, std::less<ALIstring> > theOptOList;
203  static std::vector< OpticalObject* > theOptOList;
204 
206  static std::vector< Entry* > theEntryVector;
207 
209  static std::vector< Measurement* > theMeasurementVector;
210 
219 
221  public:
222  //----- Steers the storing of the components of OptO named 'optoname'
223  static ALIbool createCopyComponentList( const ALIstring& optoname );
224  //----- Get next object to copy from the stored list of components and copy it
225  static OpticalObject* nextOptOToCopy();
226  private:
227  //----- Stores the components of opto
228  static ALIbool fillCopyComponentList( const OpticalObject* opto );
229  //----- List of components of an OptO to copy
230  static std::vector<OpticalObject*> theOptOsToCopyList;
231  //----- Iterator of the list of components of an OptO to copy
232  static std::vector<OpticalObject*>::const_iterator theOptOsToCopyListIterator;
233 
234 
235 
237  public:
239  static std::vector<ALIdouble> CMSLinkRangeDetValue;
240 
241 
243 public:
244  void CMSLinkFit( ALIint cmslink);
245 private:
246  void CMSLinkCleanModel();
247  static void CMSLinkDeleteOptOs();
248  static void CMSLinkSaveParamFittedSigma( ALIint cmslink );
249  static void CMSLinkSaveParamFittedValueDisplacement( ALIint cmslink );
250  static void CMSLinkRecoverParamFittedSigma(ALIint cmslink);
252 
254 
255  //----- METHODS FOR FITTING IN SEVERAL STEPS
256  static void deleteOptO( const ALIstring& opto_name );
257  static void deleteOptO( OpticalObject* opto );
258 
259  static void saveParamFittedSigma( const ALIstring& opto_name, const ALIstring& entry_name);
260 
261  static void saveParamFittedCorrelation( const ALIstring& opto_name1, const ALIstring& entry_name1, const ALIstring& opto_name2, const ALIstring& entry_name2);
262 
263  static void recoverParamFittedSigma( const ALIstring& opto_name, const ALIstring& entry_name, const ALIuint position );
264 
265  public:
268  return theFittedEntriesReader; }
269 
270  private:
272  ALIuint pfsv_size = theParamFittedSigmaVector.size();
273  for( ALIuint ii = 0; ii < pfsv_size; ii++) {
274  theParamFittedSigmaVector.pop_back();
275  }
276  }
277 
280  }
281 
282  static void copyMeasurements( const std::vector<ALIstring>& wl );
283 
284  private:
285 
287 
288  static std::vector<ALIdouble> theParamFittedSigmaVector;
289 
290  static std::map<ALIstring, ALIdouble, std::less<ALIstring> > theParamFittedValueDisplacementMap;
291 
292  static struct tm theMeasurementsTime;
293 
295 
296  static std::vector<OpticalAlignInfo> theOpticalAlignments;
297 };
298 
299 #endif
cocoaStatus
Definition: Model.h:36
type
Definition: HCALResponse.h:22
void BuildMeasurementsFromOA(OpticalAlignMeasurements &measList)
Definition: Model.cc:1626
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 CMSLinkIteration
Definition: Model.h:253
long double ALIdouble
Definition: CocoaGlobals.h:11
static void saveParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name)
Definition: Model.cc:1241
auto_ptr< ClusterSequence > cs
static void CMSLinkSaveParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1031
static void setMeasurementsTime(struct tm &tim)
Definition: Model.h:168
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:296
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1597
static ALIstring & MeasFName()
the name of the Measurements File
Definition: Model.h:91
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1147
static cocoaStatus getCocoaStatus()
Definition: Model.h:48
~Model()
Definition: Model.h:43
Definition: Entry.h:18
static void setCocoaStatus(const cocoaStatus cs)
Definition: Model.h:49
static std::string printCocoaStatus(const cocoaStatus cs)
Definition: Model.cc:1553
static void buildMeasurementsLinksToOptOs()
Read Measurements (to be implemented for reading from an external file the DATA of the measurements) ...
Definition: Model.cc:546
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:290
void CMSLinkCleanModel()
Definition: Model.cc:887
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:578
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:86
static OpticalObject * nextOptOToCopy()
Definition: Model.cc:816
static ALIstring & ReportFName()
the name of the report File
Definition: Model.h:96
static Model * theInstance
Only instance of Model.
Definition: Model.h:191
static Entry * getEntryByName(const ALIstring &opto_entry_name)
Definition: Model.h:122
static std::vector< Entry * > & EntryList()
Definition: Model.h:75
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:218
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:212
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
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:67
static FittedEntriesReader * getFittedEntriesReader()
Definition: Model.h:267
static ALIint Ncmslinkrange
*************** FOR RANGE STUDIES
Definition: Model.h:238
static void setSDFName(const ALIstring &name)
Definition: Model.h:156
static std::vector< OpticalAlignInfo > getOpticalAlignments()
Definition: Model.h:141
static void copyMeasurements(const std::vector< ALIstring > &wl)
Definition: Model.cc:1458
static ALIdouble getParamFittedSigmaVectorItem(const ALIuint position)
Definition: Model.cc:1319
bool ALIbool
Definition: CocoaGlobals.h:19
static void addMeasurementToList(Measurement *measadd)
Definition: Model.h:150
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 void readSystemDescription()
-------— Read the different sections of the SDF and act accordingly
Definition: Model.cc:101
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:230
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
static std::vector< OpticalObject * > theOptOList
map of OptO*/type of parent OptO, for navigation down the tree structure
Definition: Model.h:203
static Model & getInstance()
-------— Gets the only instance of this class
Definition: Model.cc:81
static struct tm & MeasurementsTime()
Definition: Model.h:137
static void SetValueDisplacementsFromReportOut()
Definition: Model.cc:1530
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:232
static struct tm theMeasurementsTime
Definition: Model.h:292
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:209
Model()
Definition: Model.cc:93
void BuildSystemDescriptionFromOA(OpticalAlignments &optAlig)
Definition: Model.cc:1580
Definition: Model.h:38
static ALIbool createCopyComponentList(const ALIstring &optoname)
**************** FOR COPYING AN OPTO
Definition: Model.cc:769
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:790
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:71
static void setMatricesFName(const ALIstring &name)
Definition: Model.h:164
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:214
static void cleanParamFittedSigmaVector()
Definition: Model.h:271
static void setReportFName(const ALIstring &name)
Definition: Model.h:160
static ALIstring theReportFName
the name of the report File
Definition: Model.h:216
static ALIbool getComponentOptOTypes(const ALIstring &opto_type, std::vector< ALIstring > &vcomponents)
--— Get from theOptODictionary the list of component OptO types
Definition: Model.cc:690
static int getParameterValue(const ALIstring &sstr, ALIdouble &val)
************ ACCESS INFO FROM STATIC DATA
Definition: Model.cc:565
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:206
static Measurement * getMeasurementByName(const ALIstring &name, ALIbool exists=1)
Definition: Model.cc:653
sectionType
Definition: Model.h:34
static void addEntryToList(Entry *entry)
***************** SET DATA MEMBERS
Definition: Model.h:145
static std::vector< ALIdouble > CMSLinkRangeDetValue
Definition: Model.h:239
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:294
static void recoverParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name, const ALIuint position)
Definition: Model.cc:1298
static void CMSLinkRecoverParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1119
static void cleanParamFittedValueDisplacementMap()
Definition: Model.h:278
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:288
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::string ALIstring
Definition: CocoaGlobals.h:9
static cocoaStatus theCocoaStatus
Definition: Model.h:286
static void saveParamFittedCorrelation(const ALIstring &opto_name1, const ALIstring &entry_name1, const ALIstring &opto_name2, const ALIstring &entry_name2)
Definition: Model.cc:1262
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:511
static ALIbool readMeasurementsFromFile(ALIstring only1Date=ALIstring(""), ALIstring only1Time=ALIstring(""))
Definition: Model.cc:1336
static ALIstring & MatricesFName()
the name of the File for storing the matrices
Definition: Model.h:101
static void CMSLinkDeleteOptOs()
Definition: Model.cc:902
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:197
void CMSLinkFit(ALIint cmslink)
*************** FOR CMS LINK SYSTEM (to fit it part by part)
Definition: Model.cc:829
static void CMSLinkRecoverParamFittedSigma(ALIint cmslink)
Definition: Model.cc:1058
static void CMSLinkSaveParamFittedSigma(ALIint cmslink)
Definition: Model.cc:966
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:79
unsigned int ALIuint
Definition: CocoaGlobals.h:17