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
Measurement::affectingEntryList
const std::vector< Entry * > & affectingEntryList() const
Definition: Measurement.h:103
Measurement::only1Time
static ALIstring only1Time
Definition: Measurement.h:214
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
Measurement::AddOptOListItem
void AddOptOListItem(OpticalObject *opto)
Definition: Measurement.h:142
Measurement::theValueIsSimulated
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
Measurement::printStartCalculateSimulatedValue
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:427
Measurement::copyMeas
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
Definition: Measurement.cc:621
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
Measurement::fillData
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
Measurement::value
const ALIdouble value(ALIuint ii) const
Definition: Measurement.h:110
Measurement::getMeasuringBehaviour
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject * >::const_iterator vocite)
Definition: Measurement.cc:568
Measurement::theName
ALIstring theName
Definition: Measurement.h:183
mps_splice.entry
entry
Definition: mps_splice.py:68
Measurement::theValue
ALIdouble * theValue
Definition: Measurement.h:181
Measurement::AddOptONameListItem
void AddOptONameListItem(ALIstring optos)
Definition: Measurement.h:140
Measurement::constructFromOA
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
Definition: Measurement.cc:89
Measurement::valueDimensionFactor
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
Measurement::valueSimulated_orig
const ALIdouble valueSimulated_orig(ALIuint ii) const
Definition: Measurement.h:107
Measurement::theLightRayPosition
CLHEP::Hep3Vector theLightRayPosition
Definition: Measurement.h:204
Measurement::calculateSimulatedValue
virtual void calculateSimulatedValue(ALIbool firstTime)
Definition: Measurement.h:50
ALIUtils::LengthSigmaDimensionFactor
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:63
Measurement::getLightRayPosition
const CLHEP::Hep3Vector & getLightRayPosition() const
Definition: Measurement.h:125
Measurement::theValueSimulated
ALIdouble * theValueSimulated
Definition: Measurement.h:187
Measurement::setType
void setType(ALIstring type)
Definition: Measurement.h:136
OpticalObject
Definition: OpticalObject.h:35
Measurement::setXlaserLine
virtual void setXlaserLine(ALIuint ii, int val)
Definition: Measurement.h:158
Measurement::setValueSimulated
void setValueSimulated(ALIint coor, ALIdouble value)
Definition: Measurement.h:146
Measurement::sigma
const ALIdouble sigma(ALIuint ii) const
Definition: Measurement.h:114
Measurement::postConstruct
void postConstruct()
Definition: Measurement.cc:153
Measurement::valueIsSimulated
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:156
Measurement::dim
const ALIuint dim() const
Definition: Measurement.h:82
Measurement::setMeasurementsFileName
static void setMeasurementsFileName(const ALIstring &filename)
Definition: Measurement.h:163
EntryLength
Definition: EntryLength.h:16
Measurement::_OptONameList
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
Measurement::Substitute2p
void Substitute2p(ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
Definition: Measurement.cc:406
Measurement::setName
void setName()
Definition: Measurement.cc:665
Measurement::Measurement
Measurement()
Definition: Measurement.h:31
Measurement::getCurrentTime
static ALIstring getCurrentTime()
Definition: Measurement.h:123
Measurement::measurementsFileName
static ALIstring & measurementsFileName()
Definition: Measurement.h:162
Measurement::addAffectingEntriesFromOptO
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
Definition: Measurement.cc:372
Measurement::_OptOList
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
Measurement
Definition: Measurement.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
OpticalAlignParam
Definition: OpticalAlignInfo.h:34
Measurement::theValueSimulated_orig
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189
Measurement::calculateOriginalSimulatedValue
void calculateOriginalSimulatedValue()
Definition: Measurement.cc:436
ALIUtils.h
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
Measurement::getCurrentDate
static ALIstring getCurrentDate()
Definition: Measurement.h:122
Measurement::valueType
const ALIstring valueType(ALIuint ii) const
Definition: Measurement.h:116
ALIuint
unsigned int ALIuint
Definition: CocoaGlobals.h:17
Measurement::OptOList
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:101
Measurement::type
const ALIstring & type() const
Definition: Measurement.h:84
value
Definition: value.py:1
Measurement::sensorName
const ALIstring & sensorName()
Definition: Measurement.h:88
Measurement::theType
ALIstring theType
Definition: Measurement.h:180
Entry
Definition: Entry.h:18
Measurement::setValueSimulated_orig
void setValueSimulated_orig(ALIint coor, ALIdouble value)
Definition: Measurement.h:144
Measurement::theCurrentDate
static ALIstring theCurrentDate
Definition: Measurement.h:208
Measurement::DumpBadOrderOptOs
void DumpBadOrderOptOs()
Definition: Measurement.cc:469
Measurement::getLightRayDirection
const CLHEP::Hep3Vector & getLightRayDirection() const
Definition: Measurement.h:126
Measurement::only1Date
static ALIstring only1Date
Definition: Measurement.h:213
Measurement::setSigma
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:131
Measurement::setCurrentDate
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement
Definition: Measurement.cc:605
Measurement::setConversionFactor
virtual void setConversionFactor(const std::vector< ALIstring > &wordlist)
Definition: Measurement.h:69
Measurement::construct
void construct()
Definition: Measurement.cc:59
Measurement::only1
static ALIbool only1
Definition: Measurement.h:212
Measurement::buildOptONamesList
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:174
Measurement::correctValueAndSigma
virtual void correctValueAndSigma()
Definition: Measurement.h:66
Measurement::theSigma
ALIdouble * theSigma
Definition: Measurement.h:182
Measurement::valueSimulated
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:105
type
type
Definition: HCALResponse.h:21
heppy_batch.val
val
Definition: heppy_batch.py:351
Measurement::~Measurement
virtual ~Measurement()
Definition: Measurement.cc:559
Measurement::name
const ALIstring & name() const
Definition: Measurement.h:86
Measurement::theValueType
ALIstring * theValueType
Definition: Measurement.h:184
Measurement::theDim
ALIuint theDim
Definition: Measurement.h:179
OpticalAlignMeasurementInfo
Definition: OpticalAlignMeasurementInfo.h:28
Measurement::setLightRayPosition
void setLightRayPosition(const CLHEP::Hep3Vector &lightRayPosition)
Definition: Measurement.h:169
Measurement::xlaserLine
virtual int xlaserLine(ALIuint ii)
Definition: Measurement.h:147
Measurement::theCurrentTime
static ALIstring theCurrentTime
Definition: Measurement.h:209
Measurement::theAffectingEntryList
std::vector< Entry * > theAffectingEntryList
Definition: Measurement.h:202
Measurement::theLightRayDirection
CLHEP::Hep3Vector theLightRayDirection
Definition: Measurement.h:205
Measurement::sigmaDimensionFactor
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120
Measurement::setLightRayDirection
void setLightRayDirection(const CLHEP::Hep3Vector &lightRayDirection)
Definition: Measurement.h:170
Measurement::theMeasurementsFileName
static ALIstring theMeasurementsFileName
Definition: Measurement.h:206
ALIint
int ALIint
Definition: CocoaGlobals.h:15
Measurement::value
const ALIdouble * value() const
Definition: Measurement.h:109
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
ALIUtils::LengthValueDimensionFactor
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:62
CocoaGlobals.h
Measurement::SetDimension
void SetDimension(ALIuint dim)
Definition: Measurement.h:138
Measurement::getPreviousOptO
const OpticalObject * getPreviousOptO(const OpticalObject *Popto) const
Definition: Measurement.cc:584
Measurement::DerivativeRespectEntry
std::vector< ALIdouble > DerivativeRespectEntry(Entry *entry)
Definition: Measurement.cc:489
Measurement::cameraScaleFactor
static ALIdouble cameraScaleFactor
Definition: Measurement.h:158
Measurement::OptONameList
const std::vector< ALIstring > & OptONameList() const
Definition: Measurement.h:99
Measurement::buildOptOList
void buildOptOList()
Definition: Measurement.cc:305
cuy.ii
ii
Definition: cuy.py:590
Measurement::buildAffectingEntryList
void buildAffectingEntryList()
Definition: Measurement.cc:360
Measurement::setValue
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:129
Measurement::sigma
const ALIdouble * sigma() const
Definition: Measurement.h:112