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
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
Model::CMSLinkRecoverParamFittedValueDisplacement
static void CMSLinkRecoverParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1084
Model::theOptODictionary
static std::vector< std::vector< ALIstring > > theOptODictionary
parameters
Definition: Model.h:182
Model::cleanParamFittedValueDisplacementMap
static void cleanParamFittedValueDisplacementMap()
Definition: Model.h:264
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
Model::buildMeasurementsLinksToOptOs
static void buildMeasurementsLinksToOptOs()
Read Measurements (to be implemented for reading from an external file the DATA of the measurements)
Definition: Model.cc:545
Model::CMSLinkCleanModel
void CMSLinkCleanModel()
Definition: Model.cc:864
Model::CMSLinkRecoverParamFittedSigma
static void CMSLinkRecoverParamFittedSigma(ALIint cmslink)
Definition: Model.cc:1025
Model::EntryList
static std::vector< Entry * > & EntryList()
Definition: Model.h:86
Model::readMeasurementsFromFile
static ALIbool readMeasurementsFromFile(ALIstring only1Date=ALIstring(""), ALIstring only1Time=ALIstring(""))
Definition: Model.cc:1289
Model::nextOptOToCopy
static OpticalObject * nextOptOToCopy()
Definition: Model.cc:796
cocoaStatus
cocoaStatus
Definition: Model.h:41
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
Model::copyMeasurements
static void copyMeasurements(const std::vector< ALIstring > &wl)
Definition: Model.cc:1419
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
Model::theInstance
static Model * theInstance
Definition: Model.h:176
mps_splice.entry
entry
Definition: mps_splice.py:68
Model::MeasurementList
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88
Model::theMatricesFName
static ALIstring theMatricesFName
the name of the File for storing the matrices
Definition: Model.h:203
sectMeasurements
Definition: Model.h:37
Model::addMeasurementToList
static void addMeasurementToList(Measurement *measadd)
Definition: Model.h:145
Model::getEntryByName
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
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
Model::BuildMeasurementsFromOA
void BuildMeasurementsFromOA(OpticalAlignMeasurements &measList)
Definition: Model.cc:1577
OpticalAlignInfo
Definition: OpticalAlignInfo.h:71
Model::Ncmslinkrange
static ALIint Ncmslinkrange
*************** FOR RANGE STUDIES
Definition: Model.h:222
Model::setSDFName
static void setSDFName(const ALIstring &name)
Definition: Model.h:151
Model::getOpticalAlignments
static std::vector< OpticalAlignInfo > getOpticalAlignments()
Definition: Model.h:137
Model::theOptOsToCopyList
static std::vector< OpticalObject * > theOptOsToCopyList
Definition: Model.h:216
Model::CMSLinkSaveParamFittedValueDisplacement
static void CMSLinkSaveParamFittedValueDisplacement(ALIint cmslink)
Definition: Model.cc:1000
Model::getParamFittedSigmaVectorItem
static ALIdouble getParamFittedSigmaVectorItem(const ALIuint position)
Definition: Model.cc:1275
COCOA_ReadingModel
Definition: Model.h:43
Model::theOpticalAlignments
static std::vector< OpticalAlignInfo > theOpticalAlignments
Definition: Model.h:282
OpticalObject
Definition: OpticalObject.h:35
Model::setMeasurementsTime
static void setMeasurementsTime(struct tm &tim)
Definition: Model.h:157
OpticalAlignMeasurements
Definition: OpticalAlignMeasurements.h:22
Model::getComponentOptOs
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
Model::getOptOByType
static OpticalObject * getOptOByType(const ALIstring &type)
--— Find the first OptO of type 'opto_type' in theOptOList and return a pointer to it
Definition: Model.cc:601
Model::saveParamFittedSigma
static void saveParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name)
Definition: Model.cc:1200
Model::setCocoaStatus
static void setCocoaStatus(const cocoaStatus cs)
Definition: Model.h:64
sectSystemTreeDescription
Definition: Model.h:35
Model::theMeasurementVector
static std::vector< Measurement * > theMeasurementVector
std::vector of all Measurements
Definition: Model.h:194
Model::Model
Model()
Definition: Model.cc:92
sectParameters
Definition: Model.h:34
Model::getOptOByName
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:570
Model::SDFName
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:93
Model::ReportFName
static ALIstring & ReportFName()
the name of the report File
Definition: Model.h:99
COCOA_FitCannotImprove
Definition: Model.h:49
Model::~Model
~Model()
Definition: Model.h:58
Model::BuildSystemDescriptionFromOA
void BuildSystemDescriptionFromOA(OpticalAlignments &optAlig)
Definition: Model.cc:1536
Model::OptOList
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
Measurement
Definition: Measurement.h:27
Model::theSDFName
static ALIstring theSDFName
the name of the System Description File
Definition: Model.h:197
OpticalAlignInfo.h
Model::CMSLinkRangeDetValue
static std::vector< ALIdouble > CMSLinkRangeDetValue
Definition: Model.h:223
Model::theFittedEntriesReader
static FittedEntriesReader * theFittedEntriesReader
Definition: Model.h:280
Model::recoverParamFittedSigma
static void recoverParamFittedSigma(const ALIstring &opto_name, const ALIstring &entry_name, const ALIuint position)
Definition: Model.cc:1256
COCOA_FitOK
Definition: Model.h:47
Model::getFittedEntriesReader
static FittedEntriesReader * getFittedEntriesReader()
Definition: Model.h:254
Model::getMeasurementByName
static Measurement * getMeasurementByName(const ALIstring &name, ALIbool exists=true)
Definition: Model.cc:641
Model::cleanParamFittedSigmaVector
static void cleanParamFittedSigmaVector()
Definition: Model.h:257
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Model::setReportFName
static void setReportFName(const ALIstring &name)
Definition: Model.h:153
Model::theReportFName
static ALIstring theReportFName
the name of the report File
Definition: Model.h:201
Model::getEntryByName
static Entry * getEntryByName(const ALIstring &opto_entry_name)
Definition: Model.h:120
Model::theEntryVector
static std::vector< Entry * > theEntryVector
std::vector of all Entries
Definition: Model.h:191
Model::theCocoaStatus
static cocoaStatus theCocoaStatus
Definition: Model.h:272
Model::reorderOptODictionary
static void reorderOptODictionary(const ALIstring &ssearch, std::vector< std::vector< ALIstring > > &OptODictionary2)
********** private METHODS
Definition: Model.cc:512
COCOA_InitFit
Definition: Model.h:44
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
Model::MatricesFName
static ALIstring & MatricesFName()
the name of the File for storing the matrices
Definition: Model.h:102
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
Model::CMSLinkDeleteOptOs
static void CMSLinkDeleteOptOs()
Definition: Model.cc:876
ALIuint
unsigned int ALIuint
Definition: CocoaGlobals.h:17
Model::theOptOList
static std::vector< OpticalObject * > theOptOList
map of OptO*‍/type of parent OptO, for navigation down the tree structure
Definition: Model.h:188
Entry
Definition: Entry.h:18
Model::CMSLinkSaveParamFittedSigma
static void CMSLinkSaveParamFittedSigma(ALIint cmslink)
Definition: Model.cc:937
COCOA_FitChi2Worsened
Definition: Model.h:50
COCOA_FitMatrixNonInversable
Definition: Model.h:51
Model::SetValueDisplacementsFromReportOut
static void SetValueDisplacementsFromReportOut()
Definition: Model.cc:1489
Model::theOptOsToCopyListIterator
static std::vector< OpticalObject * >::const_iterator theOptOsToCopyListIterator
Definition: Model.h:218
COCOA_NextIterationInEvent
Definition: Model.h:46
Model::theMeasurementsTime
static struct tm theMeasurementsTime
Definition: Model.h:278
Model
Definition: Model.h:54
Model::readSystemDescription
static void readSystemDescription()
-------— Read the different sections of the SDF and act accordingly
Definition: Model.cc:99
type
type
Definition: HCALResponse.h:21
heppy_batch.val
val
Definition: heppy_batch.py:351
Model::CMSLinkFit
void CMSLinkFit(ALIint cmslink)
*************** FOR CMS LINK SYSTEM (to fit it part by part)
Definition: Model.cc:808
Model::createCopyComponentList
static ALIbool createCopyComponentList(const ALIstring &optoname)
**************** FOR COPYING AN OPTO
Definition: Model.cc:750
Model::getInstance
static Model & getInstance()
-------— Gets the only instance of this class
Definition: Model.cc:82
Model::setMatricesFName
static void setMatricesFName(const ALIstring &name)
Definition: Model.h:155
COCOA_FirstIterationInEvent
Definition: Model.h:45
Model::MeasurementsTime
static struct tm & MeasurementsTime()
Definition: Model.h:135
sectionType
sectionType
Definition: Model.h:32
sectGlobalOptions
Definition: Model.h:33
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Model::getParameterValue
static int getParameterValue(const ALIstring &sstr, ALIdouble &val)
************ ACCESS INFO FROM STATIC DATA
Definition: Model.cc:560
Model::getComponentOptOTypes
static ALIbool getComponentOptOTypes(const ALIstring &opto_type, std::vector< ALIstring > &vcomponents)
--— Get from theOptODictionary the list of component OptO types
Definition: Model.cc:674
Model::OptODictionary
static std::vector< std::vector< ALIstring > > & OptODictionary()
ACCESS STATIC DATA MEMBERS.
Definition: Model.h:82
COCOA_Init
Definition: Model.h:42
Model::addEntryToList
static void addEntryToList(Entry *entry)
***************** SET DATA MEMBERS
Definition: Model.h:140
Model::fillCopyComponentList
static ALIbool fillCopyComponentList(const OpticalObject *opto)
Definition: Model.cc:770
ALIint
int ALIint
Definition: CocoaGlobals.h:15
OpticalAlignments
Definition: OpticalAlignments.h:22
Model::CMSLinkIteration
static ALIint CMSLinkIteration
Definition: Model.h:237
Model::theMeasFName
static ALIstring theMeasFName
the name of the Measurements File
Definition: Model.h:199
CocoaGlobals.h
COCOA_FitImproving
Definition: Model.h:48
Model::printCocoaStatus
static std::string printCocoaStatus(const cocoaStatus cs)
Definition: Model.cc:1511
Model::FindOptAlignInfoByType
OpticalAlignInfo FindOptAlignInfoByType(const ALIstring &type)
Definition: Model.cc:1551
Model::MeasFName
static ALIstring & MeasFName()
the name of the Measurements File
Definition: Model.h:96
sectReportOut
Definition: Model.h:38
Model::theParamFittedSigmaVector
static std::vector< ALIdouble > theParamFittedSigmaVector
Definition: Model.h:274
sectSystemTreeData
Definition: Model.h:36
Model::deleteOptO
static void deleteOptO(const ALIstring &opto_name)
Definition: Model.cc:1110
cuy.ii
ii
Definition: cuy.py:590
Model::getCocoaStatus
static cocoaStatus getCocoaStatus()
Definition: Model.h:63
Model::theParamFittedValueDisplacementMap
static std::map< ALIstring, ALIdouble, std::less< ALIstring > > theParamFittedValueDisplacementMap
Definition: Model.h:276
Model::saveParamFittedCorrelation
static void saveParamFittedCorrelation(const ALIstring &opto_name1, const ALIstring &entry_name1, const ALIstring &opto_name2, const ALIstring &entry_name2)
Definition: Model.cc:1219
FittedEntriesReader
Definition: FittedEntriesReader.h:14
ALIFileIn
Definition: ALIFileIn.h:20