CMS 3D CMS Logo

Measurement.h
Go to the documentation of this file.
1 // COCOA class header file
2 // Id: Measurement.h
3 // CAT: Model
4 //
5 // Class for measurements
6 //
7 // History: v1.0.0
8 // v1.1.0: add measurementsFileName
9 //
10 // Authors:
11 // Pedro Arce
12 
13 #ifndef _MEASUREMENT_HH
14 #define _MEASUREMENT_HH
15 
16 #include <vector>
17 #include <cstdlib>
18 
21 class OpticalObject;
22 class Entry;
23 class EntryLength;
25 class OpticalAlignParam;
26 
27 class Measurement {
28 public:
29  //----- Constructors / destructor
30  Measurement(const ALIint measdim, ALIstring& type, ALIstring& name);
32  virtual ~Measurement();
33 
34  // construct Measurement reading date from file
35  void construct();
36  void postConstruct();
37  // Fill the list of names of OptOs that take part in this measurement ( names only )
38  virtual void buildOptONamesList(const std::vector<ALIstring>& wl);
39  // Fill the data
40  void fillData(ALIuint coor, const std::vector<ALIstring>& wl);
41  void fillData(ALIuint coor, OpticalAlignParam* oaParam);
42 
43  // Convert OptOs names in OptOs pointers
44  void buildOptOList();
45  // Make list including every entry of every ancestor of each Measured OptO
47  void addAffectingEntriesFromOptO(const OpticalObject* optoP);
48 
49  // Get simulated value (called every time a parameter is displaced)
50  virtual void calculateSimulatedValue(ALIbool firstTime) {}
51  // Get simulated value original (called every time a parameter value is changed: after getting values from file and every non-linear fit iteration )
53 
54  // Dump the list of OptO names (used mainly when checking their order)
55  void DumpBadOrderOptOs();
56 
57  // Calculate derivative of this Measurement with respect to a parameter of an Entry
58  std::vector<ALIdouble> DerivativeRespectEntry(Entry* entry);
59 
60  // get the ':X' that determines how the behaviour of the OptO w.r.t. this Measurement
61  ALIstring getMeasuringBehaviour(const std::vector<OpticalObject*>::const_iterator vocite);
62 
63  // Get the previous OptOs in the list of OptO that take part in this measurement
64  const OpticalObject* getPreviousOptO(const OpticalObject* Popto) const;
65  //---------- Add any correction between the measurement data and the default format in COCOA
66  virtual void correctValueAndSigma() {}
67 
68  //---------- Convert from V to rad
69  virtual void setConversionFactor(const std::vector<ALIstring>& wordlist) {
70  std::cerr << " Measurement::setConversionFactor should never be called " << std::endl;
71  exit(1);
72  };
73 
75  static void setCurrentDate(const std::vector<ALIstring>& wl);
76 
77  void copyMeas(Measurement* meas, const std::string& subsstr1, const std::string& subsstr2);
78 
80 
81  // ACCESS DATA MEMBERS
82  const ALIuint dim() const { return theDim; }
83 
84  const ALIstring& type() const { return theType; }
85 
86  const ALIstring& name() const { return theName; }
87 
88  const ALIstring& sensorName() {
89  ALIstring sensName = theName;
90  ALIint colon = theName.find(':');
91  theName = theName.substr(colon + 1, theName.length() - colon);
92  return theName;
93  }
94 
95  // const OpticalObject* OptOCurrent() const {
96  // return _OptOCurrent;
97  // }
98 
99  const std::vector<ALIstring>& OptONameList() const { return _OptONameList; }
100 
101  const std::vector<OpticalObject*>& OptOList() const { return _OptOList; }
102 
103  const std::vector<Entry*>& affectingEntryList() const { return theAffectingEntryList; }
104 
106 
108 
109  const ALIdouble* value() const { return theValue; }
110  const ALIdouble value(ALIuint ii) const { return theValue[ii]; }
111 
112  const ALIdouble* sigma() const { return theSigma; }
113 
114  const ALIdouble sigma(ALIuint ii) const { return theSigma[ii]; }
115 
116  const ALIstring valueType(ALIuint ii) const { return theValueType[ii]; }
117 
119 
121 
124 
125  const CLHEP::Hep3Vector& getLightRayPosition() const { return theLightRayPosition; }
126  const CLHEP::Hep3Vector& getLightRayDirection() const { return theLightRayDirection; }
127 
128  // SET DATA MEMBERS
129  void setValue(ALIint coor, ALIdouble val) { theValue[coor] = val; }
130 
131  void setSigma(ALIint coor, ALIdouble val) {
132  theSigma[coor] = val;
133  //- std::cout << coor << " setting sigma " << theSigma[coor] << std::endl;
134  }
135 
137 
139 
140  void AddOptONameListItem(ALIstring optos) { _OptONameList.push_back(optos); }
141 
142  void AddOptOListItem(OpticalObject* opto) { _OptOList.push_back(opto); }
143 
145 
147  virtual int xlaserLine(ALIuint ii) {
148  std::cerr << "!!!! Measurement::xlaserLine is not returning anything " << std::endl;
149  abort();
150  };
151 
152  //----- Set name as type plus name of last OptO
153  void setName();
154 
155  // Check is value is simulated
156  bool valueIsSimulated(ALIint coor) { return theValueIsSimulated[coor]; }
157 
158  virtual void setXlaserLine(ALIuint ii, int val) {}
159 
161 
164  //- std::cout << " setting file name " << filename << std::endl;
166  //- std::cout << " dsetting file name " << filename << std::endl;
167  }
168 
169  void setLightRayPosition(const CLHEP::Hep3Vector& lightRayPosition) { theLightRayPosition = lightRayPosition; }
170  void setLightRayDirection(const CLHEP::Hep3Vector& lightRayDirection) { theLightRayDirection = lightRayDirection; }
171 
172 protected:
173  // Substitute '..' by parent OptO in name
174  void Substitute2p(ALIstring& ref, const ALIstring& firstref, int NtwoPoints);
176 
177  // private DATA MEMBERS
178 private:
183  ALIstring theName; //name of last OptO
184  ALIstring* theValueType; //type of each measurement value (e.g. H:, TA:)
185 
186  //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement
188  //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement, for original values of every entry
190 
191  //- ALIdouble* theSigmaErrorPropagation;
192  //- ALIdouble* theSigmaRegression;
193 
194  //----- Boolean to indicate if theValueSimulated_orig is set equal to the simulated values with original entries
196 
197  //----- List of OptOs that take part in this measurement ( names only )
198  std::vector<ALIstring> _OptONameList;
199  //----- List of OptOs that take part in this measurement ( pointers )
200  std::vector<OpticalObject*> _OptOList;
201  //----- List of OptOs Measured and their ancestors
202  std::vector<Entry*> theAffectingEntryList;
203 
204  CLHEP::Hep3Vector theLightRayPosition;
205  CLHEP::Hep3Vector theLightRayDirection;
207 
210 
211 public:
212  static ALIbool only1;
215 };
216 
217 #endif
static ALIstring theCurrentTime
Definition: Measurement.h:209
static ALIbool only1
Definition: Measurement.h:212
ALIdouble * theValueSimulated
Definition: Measurement.h:187
long double ALIdouble
Definition: CocoaGlobals.h:11
static void setMeasurementsFileName(const ALIstring &filename)
Definition: Measurement.h:163
const ALIdouble valueSimulated_orig(ALIuint ii) const
Definition: Measurement.h:107
std::vector< ALIdouble > DerivativeRespectEntry(Entry *entry)
Definition: Measurement.cc:489
const CLHEP::Hep3Vector & getLightRayPosition() const
Definition: Measurement.h:125
void setName()
Definition: Measurement.cc:665
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:156
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
const ALIdouble * value() const
Definition: Measurement.h:109
const OpticalObject * getPreviousOptO(const OpticalObject *Popto) const
Definition: Measurement.cc:584
Definition: Entry.h:18
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
static ALIstring getCurrentTime()
Definition: Measurement.h:123
const ALIuint dim() const
Definition: Measurement.h:82
void postConstruct()
Definition: Measurement.cc:153
void Substitute2p(ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
Definition: Measurement.cc:406
const std::vector< ALIstring > & OptONameList() const
Definition: Measurement.h:99
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:129
int ALIint
Definition: CocoaGlobals.h:15
void buildAffectingEntryList()
Definition: Measurement.cc:360
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject *>::const_iterator vocite)
Definition: Measurement.cc:568
void AddOptOListItem(OpticalObject *opto)
Definition: Measurement.h:142
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:63
static ALIstring only1Time
Definition: Measurement.h:214
static ALIstring getCurrentDate()
Definition: Measurement.h:122
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:116
virtual void calculateSimulatedValue(ALIbool firstTime)
Definition: Measurement.h:50
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
void AddOptONameListItem(ALIstring optos)
Definition: Measurement.h:140
void DumpBadOrderOptOs()
Definition: Measurement.cc:469
bool ALIbool
Definition: CocoaGlobals.h:19
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
ALIstring theName
Definition: Measurement.h:183
const ALIdouble value(ALIuint ii) const
Definition: Measurement.h:110
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:131
static ALIstring theCurrentDate
Definition: Measurement.h:208
ALIdouble * theSigma
Definition: Measurement.h:182
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:105
virtual void setXlaserLine(ALIuint ii, int val)
Definition: Measurement.h:158
void setLightRayPosition(const CLHEP::Hep3Vector &lightRayPosition)
Definition: Measurement.h:169
const ALIdouble sigma(ALIuint ii) const
Definition: Measurement.h:114
ALIstring theType
Definition: Measurement.h:180
virtual void setConversionFactor(const std::vector< ALIstring > &wordlist)
Definition: Measurement.h:69
void setValueSimulated(ALIint coor, ALIdouble value)
Definition: Measurement.h:146
virtual int xlaserLine(ALIuint ii)
Definition: Measurement.h:147
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
Definition: Measurement.cc:372
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
Definition: Measurement.h:170
Definition: value.py:1
ii
Definition: cuy.py:589
ALIuint theDim
Definition: Measurement.h:179
static ALIstring theMeasurementsFileName
Definition: Measurement.h:206
CLHEP::Hep3Vector theLightRayDirection
Definition: Measurement.h:205
static ALIstring & measurementsFileName()
Definition: Measurement.h:162
std::vector< Entry * > theAffectingEntryList
Definition: Measurement.h:202
const std::vector< Entry * > & affectingEntryList() const
Definition: Measurement.h:103
static ALIdouble cameraScaleFactor
Definition: Measurement.h:160
const ALIdouble * sigma() const
Definition: Measurement.h:112
void calculateOriginalSimulatedValue()
Definition: Measurement.cc:436
const ALIstring & type() const
Definition: Measurement.h:84
void SetDimension(ALIuint dim)
Definition: Measurement.h:138
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189
void buildOptOList()
Definition: Measurement.cc:305
const CLHEP::Hep3Vector & getLightRayDirection() const
Definition: Measurement.h:126
void setValueSimulated_orig(ALIint coor, ALIdouble value)
Definition: Measurement.h:144
std::string ALIstring
Definition: CocoaGlobals.h:9
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:427
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:89
virtual void correctValueAndSigma()
Definition: Measurement.h:66
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:174
CLHEP::Hep3Vector theLightRayPosition
Definition: Measurement.h:204
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:101
virtual ~Measurement()
Definition: Measurement.cc:559
static ALIstring only1Date
Definition: Measurement.h:213
const ALIstring & sensorName()
Definition: Measurement.h:88
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
void construct()
Definition: Measurement.cc:59
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:621
void setType(ALIstring type)
Definition: Measurement.h:136
ALIstring * theValueType
Definition: Measurement.h:184
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:605
const ALIstring & name() const
Definition: Measurement.h:86
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:62
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120
ALIdouble * theValue
Definition: Measurement.h:181
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")