CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
28 {
29 public:
30  //----- Constructors / destructor
31  Measurement( const ALIint measdim, ALIstring& type, ALIstring& name );
32  Measurement(){ };
33  virtual ~Measurement();
34 
35  // construct Measurement reading date from file
36  void construct();
37  void postConstruct();
38  // Fill the list of names of OptOs that take part in this measurement ( names only )
39  virtual void buildOptONamesList( const std::vector<ALIstring>& wl );
40  // Fill the data
41  void fillData(ALIuint coor, const std::vector<ALIstring>& wl );
42  void fillData( ALIuint coor, OpticalAlignParam* oaParam);
43 
44  // Convert OptOs names in OptOs pointers
45  void buildOptOList();
46  // Make list including every entry of every ancestor of each Measured OptO
48  void addAffectingEntriesFromOptO( const OpticalObject* optoP );
49 
50  // Get simulated value (called every time a parameter is displaced)
52  // Get simulated value original (called every time a parameter value is changed: after getting values from file and every non-linear fit iteration )
54 
55  // Dump the list of OptO names (used mainly when checking their order)
56  void DumpBadOrderOptOs();
57 
58  // Calculate derivative of this Measurement with respect to a parameter of an Entry
59  std::vector<ALIdouble> DerivativeRespectEntry( Entry* entry );
60 
61  // get the ':X' that determines how the behaviour of the OptO w.r.t. this Measurement
62  ALIstring getMeasuringBehaviour( const std::vector< OpticalObject* >::const_iterator vocite);
63 
64  // Get the previous OptOs in the list of OptO that take part in this measurement
65  const OpticalObject* getPreviousOptO( const OpticalObject* Popto ) const;
66  //---------- Add any correction between the measurement data and the default format in COCOA
67  virtual void correctValueAndSigma(){};
68 
69  //---------- Convert from V to rad
70  virtual void setConversionFactor( const std::vector<ALIstring>& wordlist ){
71  std::cerr << " Measurement::setConversionFactor should never be called " << std::endl;
72  exit(1); };
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 {
83  return theDim;
84  }
85 
86  const ALIstring& type() const {
87  return theType;
88  }
89 
90  const ALIstring& name() const {
91  return theName;
92  }
93 
94  const ALIstring& sensorName() {
95  ALIstring sensName = theName;
96  ALIint colon = theName.find(':');
97  theName = theName.substr(colon+1, theName.length()-colon);
98  return theName;
99  }
100 
101  // const OpticalObject* OptOCurrent() const {
102  // return _OptOCurrent;
103  // }
104 
105  const std::vector<ALIstring>& OptONameList() const {
106  return _OptONameList;
107  }
108 
109  const std::vector<OpticalObject*>& OptOList() const {
110  return _OptOList;
111  }
112 
113  const std::vector<Entry*>& affectingEntryList() const {
114  return theAffectingEntryList;
115  }
116 
118  return theValueSimulated[ii];
119  }
120 
122  return theValueSimulated_orig[ii];
123  }
124 
125  const ALIdouble* value() const {
126  return theValue;
127  }
128  const ALIdouble value( ALIuint ii ) const {
129  return theValue[ii];
130  }
131 
132  const ALIdouble* sigma() const {
133  return theSigma;
134  }
135 
136  const ALIdouble sigma( ALIuint ii) const {
137  return theSigma[ii];
138  }
139 
140  const ALIstring valueType( ALIuint ii) const {
141  return theValueType[ii];
142  }
143 
144  virtual const ALIdouble valueDimensionFactor() const{
146  }
147 
148  virtual const ALIdouble sigmaDimensionFactor() const{
150  }
151 
153  return theCurrentDate;
154  }
156  return theCurrentTime;
157  }
158 
159  const CLHEP::Hep3Vector& getLightRayPosition( ) const{
160  return theLightRayPosition;
161  }
162  const CLHEP::Hep3Vector& getLightRayDirection( ) const{
163  return theLightRayDirection;
164  }
165 
166  // SET DATA MEMBERS
167  void setValue( ALIint coor, ALIdouble val) {
168  theValue[coor] = val;
169  }
170 
171  void setSigma( ALIint coor, ALIdouble val) {
172  theSigma[coor] = val;
173  //- std::cout << coor << " setting sigma " << theSigma[coor] << std::endl;
174  }
175 
176  void setType( ALIstring type ) {
177  theType = type;
178  }
179 
181  theDim = dim;
182  }
183 
185  _OptONameList.push_back( optos );
186  }
187 
189  _OptOList.push_back( opto );
190  }
191 
194  }
195 
197  theValueSimulated[coor] = value;
198  }
199  virtual int xlaserLine( ALIuint ii) { std::cerr << "!!!! Measurement::xlaserLine is not returning anything " << std::endl; abort(); };
200 
201  //----- Set name as type plus name of last OptO
202  void setName();
203 
204  // Check is value is simulated
206  return theValueIsSimulated[coor];
207  }
208 
209  virtual void setXlaserLine( ALIuint ii, int val ) { };
210 
212 
215  }
216  static void setMeasurementsFileName( const ALIstring& filename ) {
217  //- std::cout << " setting file name " << filename << std::endl;
219  //- std::cout << " dsetting file name " << filename << std::endl;
220  }
221 
222  void setLightRayPosition( const CLHEP::Hep3Vector& lightRayPosition )
223  { theLightRayPosition = lightRayPosition; }
224  void setLightRayDirection( const CLHEP::Hep3Vector& lightRayDirection )
225  { theLightRayDirection = lightRayDirection; }
226 
227  protected:
228  // Substitute '..' by parent OptO in name
229  void Substitute2p( ALIstring& ref, const ALIstring& firstref, int NtwoPoints);
231 
232 
233  // private DATA MEMBERS
234 private:
239  ALIstring theName; //name of last OptO
240  ALIstring* theValueType; //type of each measurement value (e.g. H:, TA:)
241 
242  //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement
244  //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement, for original values of every entry
246 
247  //- ALIdouble* theSigmaErrorPropagation;
248  //- ALIdouble* theSigmaRegression;
249 
250  //----- Boolean to indicate if theValueSimulated_orig is set equal to the simulated values with original entries
252 
253  //----- List of OptOs that take part in this measurement ( names only )
254  std::vector<ALIstring> _OptONameList;
255  //----- List of OptOs that take part in this measurement ( pointers )
256  std::vector<OpticalObject*> _OptOList;
257  //----- List of OptOs Measured and their ancestors
258  std::vector<Entry*> theAffectingEntryList;
259 
260  CLHEP::Hep3Vector theLightRayPosition;
261  CLHEP::Hep3Vector theLightRayDirection;
263 
266  public:
267  static ALIbool only1;
270 
271 };
272 
273 #endif
static ALIstring theCurrentTime
Definition: Measurement.h:265
static ALIbool only1
Definition: Measurement.h:267
type
Definition: HCALResponse.h:21
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:148
ALIdouble * theValueSimulated
Definition: Measurement.h:243
long double ALIdouble
Definition: CocoaGlobals.h:11
static void setMeasurementsFileName(const ALIstring &filename)
Definition: Measurement.h:216
std::vector< ALIdouble > DerivativeRespectEntry(Entry *entry)
Definition: Measurement.cc:512
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:144
void setName()
Definition: Measurement.cc:698
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:205
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:254
const ALIuint dim() const
Definition: Measurement.h:82
Definition: Entry.h:18
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:256
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:140
static ALIstring getCurrentTime()
Definition: Measurement.h:155
void postConstruct()
Definition: Measurement.cc:155
void Substitute2p(ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
Definition: Measurement.cc:424
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:167
int ALIint
Definition: CocoaGlobals.h:15
void buildAffectingEntryList()
Definition: Measurement.cc:375
void AddOptOListItem(OpticalObject *opto)
Definition: Measurement.h:188
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:73
static ALIstring only1Time
Definition: Measurement.h:269
int ii
Definition: cuy.py:588
static ALIstring getCurrentDate()
Definition: Measurement.h:152
virtual void calculateSimulatedValue(ALIbool firstTime)
Definition: Measurement.h:51
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject * >::const_iterator vocite)
Definition: Measurement.cc:592
void AddOptONameListItem(ALIstring optos)
Definition: Measurement.h:184
void DumpBadOrderOptOs()
Definition: Measurement.cc:488
bool ALIbool
Definition: CocoaGlobals.h:19
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:201
ALIstring theName
Definition: Measurement.h:239
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:171
static ALIstring theCurrentDate
Definition: Measurement.h:264
bool firstTime
Definition: QTestHandle.cc:16
ALIdouble * theSigma
Definition: Measurement.h:238
const ALIdouble * sigma() const
Definition: Measurement.h:132
virtual void setXlaserLine(ALIuint ii, int val)
Definition: Measurement.h:209
void setLightRayPosition(const CLHEP::Hep3Vector &lightRayPosition)
Definition: Measurement.h:222
ALIstring theType
Definition: Measurement.h:236
const std::vector< ALIstring > & OptONameList() const
Definition: Measurement.h:105
virtual void setConversionFactor(const std::vector< ALIstring > &wordlist)
Definition: Measurement.h:70
void setValueSimulated(ALIint coor, ALIdouble value)
Definition: Measurement.h:196
const ALIdouble valueSimulated_orig(ALIuint ii) const
Definition: Measurement.h:121
virtual int xlaserLine(ALIuint ii)
Definition: Measurement.h:199
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
Definition: Measurement.cc:390
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
Definition: Measurement.h:224
const CLHEP::Hep3Vector & getLightRayPosition() const
Definition: Measurement.h:159
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:109
ALIuint theDim
Definition: Measurement.h:235
static ALIstring theMeasurementsFileName
Definition: Measurement.h:262
CLHEP::Hep3Vector theLightRayDirection
Definition: Measurement.h:261
static ALIstring & measurementsFileName()
Definition: Measurement.h:213
std::vector< Entry * > theAffectingEntryList
Definition: Measurement.h:258
const std::vector< Entry * > & affectingEntryList() const
Definition: Measurement.h:113
const OpticalObject * getPreviousOptO(const OpticalObject *Popto) const
Definition: Measurement.cc:609
static ALIdouble cameraScaleFactor
Definition: Measurement.h:209
void calculateOriginalSimulatedValue()
Definition: Measurement.cc:453
void SetDimension(ALIuint dim)
Definition: Measurement.h:180
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:245
const CLHEP::Hep3Vector & getLightRayDirection() const
Definition: Measurement.h:162
const ALIdouble value(ALIuint ii) const
Definition: Measurement.h:128
const ALIdouble * value() const
Definition: Measurement.h:125
const ALIdouble sigma(ALIuint ii) const
Definition: Measurement.h:136
void buildOptOList()
Definition: Measurement.cc:317
const ALIstring & type() const
Definition: Measurement.h:86
void setValueSimulated_orig(ALIint coor, ALIdouble value)
Definition: Measurement.h:192
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple filename
Definition: lut2db_cfg.py:20
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:445
list entry
Definition: mps_splice.py:62
const ALIstring & name() const
Definition: Measurement.h:90
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:117
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:96
virtual void correctValueAndSigma()
Definition: Measurement.h:67
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:178
CLHEP::Hep3Vector theLightRayPosition
Definition: Measurement.h:260
virtual ~Measurement()
Definition: Measurement.cc:580
static ALIstring only1Date
Definition: Measurement.h:268
const ALIstring & sensorName()
Definition: Measurement.h:94
ALIbool * theValueIsSimulated
Definition: Measurement.h:251
void construct()
Definition: Measurement.cc:63
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:650
void setType(ALIstring type)
Definition: Measurement.h:176
ALIstring * theValueType
Definition: Measurement.h:240
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:632
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:71
ALIdouble * theValue
Definition: Measurement.h:237
unsigned int ALIuint
Definition: CocoaGlobals.h:17