File indexing completed on 2024-09-07 04:34:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef _MEASUREMENT_HH
0014 #define _MEASUREMENT_HH
0015
0016 #include <vector>
0017 #include <cstdlib>
0018
0019 #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
0020 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0021 class OpticalObject;
0022 class Entry;
0023 class EntryLength;
0024 class OpticalAlignMeasurementInfo;
0025 class OpticalAlignParam;
0026
0027 class Measurement {
0028 public:
0029
0030 Measurement(const ALIint measdim, ALIstring& type, ALIstring& name);
0031 Measurement() {}
0032 virtual ~Measurement();
0033
0034
0035 void construct();
0036 void postConstruct();
0037
0038 virtual void buildOptONamesList(const std::vector<ALIstring>& wl);
0039
0040 void fillData(ALIuint coor, const std::vector<ALIstring>& wl);
0041 void fillData(ALIuint coor, OpticalAlignParam* oaParam);
0042
0043
0044 void buildOptOList();
0045
0046 void buildAffectingEntryList();
0047 void addAffectingEntriesFromOptO(const OpticalObject* optoP);
0048
0049
0050 virtual void calculateSimulatedValue(ALIbool firstTime) {}
0051
0052 void calculateOriginalSimulatedValue();
0053
0054
0055 void DumpBadOrderOptOs();
0056
0057
0058 std::vector<ALIdouble> DerivativeRespectEntry(Entry* entry);
0059
0060
0061 ALIstring getMeasuringBehaviour(const std::vector<OpticalObject*>::const_iterator vocite);
0062
0063
0064 const OpticalObject* getPreviousOptO(const OpticalObject* Popto) const;
0065
0066 virtual void correctValueAndSigma() {}
0067
0068
0069 virtual void setConversionFactor(const std::vector<ALIstring>& wordlist) {
0070 std::cerr << " Measurement::setConversionFactor should never be called " << std::endl;
0071 exit(1);
0072 };
0073
0074
0075 static void setCurrentDate(const std::vector<ALIstring>& wl);
0076
0077 void copyMeas(Measurement* meas, const std::string& subsstr1, const std::string& subsstr2);
0078
0079 void constructFromOA(OpticalAlignMeasurementInfo& measInfo);
0080
0081
0082 const ALIuint dim() const { return theDim; }
0083
0084 const ALIstring& type() const { return theType; }
0085
0086 const ALIstring& name() const { return theName; }
0087
0088 const ALIstring& sensorName() {
0089 ALIstring sensName = theName;
0090 ALIint colon = theName.find(':');
0091 theName = theName.substr(colon + 1, theName.length() - colon);
0092 return theName;
0093 }
0094
0095
0096
0097
0098
0099 const std::vector<ALIstring>& OptONameList() const { return _OptONameList; }
0100
0101 const std::vector<OpticalObject*>& OptOList() const { return _OptOList; }
0102
0103 const std::vector<Entry*>& affectingEntryList() const { return theAffectingEntryList; }
0104
0105 const ALIdouble valueSimulated(ALIuint ii) const { return theValueSimulated[ii]; }
0106
0107 const ALIdouble valueSimulated_orig(ALIuint ii) const { return theValueSimulated_orig[ii]; }
0108
0109 const ALIdouble* value() const { return theValue; }
0110 const ALIdouble value(ALIuint ii) const { return theValue[ii]; }
0111
0112 const ALIdouble* sigma() const { return theSigma; }
0113
0114 const ALIdouble sigma(ALIuint ii) const { return theSigma[ii]; }
0115
0116 const ALIstring valueType(ALIuint ii) const { return theValueType[ii]; }
0117
0118 virtual const ALIdouble valueDimensionFactor() const { return ALIUtils::LengthValueDimensionFactor(); }
0119
0120 virtual const ALIdouble sigmaDimensionFactor() const { return ALIUtils::LengthSigmaDimensionFactor(); }
0121
0122 static ALIstring getCurrentDate() { return theCurrentDate; }
0123 static ALIstring getCurrentTime() { return theCurrentTime; }
0124
0125 const CLHEP::Hep3Vector& getLightRayPosition() const { return theLightRayPosition; }
0126 const CLHEP::Hep3Vector& getLightRayDirection() const { return theLightRayDirection; }
0127
0128
0129 void setValue(ALIint coor, ALIdouble val) { theValue[coor] = val; }
0130
0131 void setSigma(ALIint coor, ALIdouble val) {
0132 theSigma[coor] = val;
0133
0134 }
0135
0136 void setType(ALIstring type) { theType = type; }
0137
0138 void SetDimension(ALIuint dim) { theDim = dim; }
0139
0140 void AddOptONameListItem(ALIstring optos) { _OptONameList.push_back(optos); }
0141
0142 void AddOptOListItem(OpticalObject* opto) { _OptOList.push_back(opto); }
0143
0144 void setValueSimulated_orig(ALIint coor, ALIdouble value) { theValueSimulated_orig[coor] = value; }
0145
0146 void setValueSimulated(ALIint coor, ALIdouble value) { theValueSimulated[coor] = value; }
0147 virtual int xlaserLine(ALIuint ii) {
0148 std::cerr << "!!!! Measurement::xlaserLine is not returning anything " << std::endl;
0149 abort();
0150 };
0151
0152
0153 void setName();
0154
0155
0156 bool valueIsSimulated(ALIint coor) { return theValueIsSimulated[coor]; }
0157
0158 virtual void setXlaserLine(ALIuint ii, int val) {}
0159
0160 static ALIdouble cameraScaleFactor;
0161
0162 static ALIstring& measurementsFileName() { return theMeasurementsFileName; }
0163 static void setMeasurementsFileName(const ALIstring& filename) {
0164
0165 theMeasurementsFileName = filename;
0166
0167 }
0168
0169 void setLightRayPosition(const CLHEP::Hep3Vector& lightRayPosition) { theLightRayPosition = lightRayPosition; }
0170 void setLightRayDirection(const CLHEP::Hep3Vector& lightRayDirection) { theLightRayDirection = lightRayDirection; }
0171
0172 protected:
0173
0174 void Substitute2p(ALIstring& ref, const ALIstring& firstref, int NtwoPoints);
0175 void printStartCalculateSimulatedValue(const Measurement* meas);
0176
0177
0178 private:
0179 ALIuint theDim;
0180 ALIstring theType;
0181 ALIdouble* theValue;
0182 ALIdouble* theSigma;
0183 ALIstring theName;
0184 ALIstring* theValueType;
0185
0186
0187 ALIdouble* theValueSimulated;
0188
0189 ALIdouble* theValueSimulated_orig;
0190
0191
0192
0193
0194
0195 ALIbool* theValueIsSimulated;
0196
0197
0198 std::vector<ALIstring> _OptONameList;
0199
0200 std::vector<OpticalObject*> _OptOList;
0201
0202 std::vector<Entry*> theAffectingEntryList;
0203
0204 CLHEP::Hep3Vector theLightRayPosition;
0205 CLHEP::Hep3Vector theLightRayDirection;
0206 static ALIstring theMeasurementsFileName;
0207
0208 static ALIstring theCurrentDate;
0209 static ALIstring theCurrentTime;
0210
0211 public:
0212 static ALIbool only1;
0213 static ALIstring only1Date;
0214 static ALIstring only1Time;
0215 };
0216
0217 #endif