CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes
Measurement Class Reference

#include <Measurement.h>

Inheritance diagram for Measurement:
MeasurementCOPS MeasurementDiffEntry MeasurementDistancemeter MeasurementDistancemeter3dim MeasurementSensor2D MeasurementTiltmeter

Public Member Functions

void addAffectingEntriesFromOptO (const OpticalObject *optoP)
 
void AddOptOListItem (OpticalObject *opto)
 
void AddOptONameListItem (ALIstring optos)
 
const std::vector< Entry * > & affectingEntryList () const
 
void buildAffectingEntryList ()
 
void buildOptOList ()
 
virtual void buildOptONamesList (const std::vector< ALIstring > &wl)
 
void calculateOriginalSimulatedValue ()
 
virtual void calculateSimulatedValue (ALIbool firstTime)
 
void construct ()
 
void constructFromOA (OpticalAlignMeasurementInfo &measInfo)
 
void copyMeas (Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
 
virtual void correctValueAndSigma ()
 
std::vector< ALIdoubleDerivativeRespectEntry (Entry *entry)
 
const ALIuint dim () const
 
void DumpBadOrderOptOs ()
 
void fillData (ALIuint coor, const std::vector< ALIstring > &wl)
 
void fillData (ALIuint coor, OpticalAlignParam *oaParam)
 
const CLHEP::Hep3Vector & getLightRayDirection () const
 
const CLHEP::Hep3Vector & getLightRayPosition () const
 
ALIstring getMeasuringBehaviour (const std::vector< OpticalObject *>::const_iterator vocite)
 
const OpticalObjectgetPreviousOptO (const OpticalObject *Popto) const
 
 Measurement (const ALIint measdim, ALIstring &type, ALIstring &name)
 
 Measurement ()
 
const ALIstringname () const
 
const std::vector< OpticalObject * > & OptOList () const
 
const std::vector< ALIstring > & OptONameList () const
 
void postConstruct ()
 
const ALIstringsensorName ()
 
virtual void setConversionFactor (const std::vector< ALIstring > &wordlist)
 
void SetDimension (ALIuint dim)
 
void setLightRayDirection (const CLHEP::Hep3Vector &lightRayDirection)
 
void setLightRayPosition (const CLHEP::Hep3Vector &lightRayPosition)
 
void setName ()
 
void setSigma (ALIint coor, ALIdouble val)
 
void setType (ALIstring type)
 
void setValue (ALIint coor, ALIdouble val)
 
void setValueSimulated (ALIint coor, ALIdouble value)
 
void setValueSimulated_orig (ALIint coor, ALIdouble value)
 
virtual void setXlaserLine (ALIuint ii, int val)
 
const ALIdoublesigma () const
 
const ALIdouble sigma (ALIuint ii) const
 
virtual const ALIdouble sigmaDimensionFactor () const
 
const ALIstringtype () const
 
const ALIdoublevalue () const
 
const ALIdouble value (ALIuint ii) const
 
virtual const ALIdouble valueDimensionFactor () const
 
bool valueIsSimulated (ALIint coor)
 
const ALIdouble valueSimulated (ALIuint ii) const
 
const ALIdouble valueSimulated_orig (ALIuint ii) const
 
const ALIstring valueType (ALIuint ii) const
 
virtual int xlaserLine (ALIuint ii)
 
virtual ~Measurement ()
 

Static Public Member Functions

static ALIstring getCurrentDate ()
 
static ALIstring getCurrentTime ()
 
static ALIstringmeasurementsFileName ()
 
static void setCurrentDate (const std::vector< ALIstring > &wl)
 set the date of the current measurement More...
 
static void setMeasurementsFileName (const ALIstring &filename)
 

Static Public Attributes

static ALIdouble cameraScaleFactor = 1.
 
static ALIbool only1 = false
 
static ALIstring only1Date = ""
 
static ALIstring only1Time = ""
 

Protected Member Functions

void printStartCalculateSimulatedValue (const Measurement *meas)
 
void Substitute2p (ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
 

Private Attributes

std::vector< OpticalObject * > _OptOList
 
std::vector< ALIstring_OptONameList
 
std::vector< Entry * > theAffectingEntryList
 
ALIuint theDim
 
CLHEP::Hep3Vector theLightRayDirection
 
CLHEP::Hep3Vector theLightRayPosition
 
ALIstring theName
 
ALIdoubletheSigma
 
ALIstring theType
 
ALIdoubletheValue
 
ALIbooltheValueIsSimulated
 
ALIdoubletheValueSimulated
 
ALIdoubletheValueSimulated_orig
 
ALIstringtheValueType
 

Static Private Attributes

static ALIstring theCurrentDate = "99/99/99"
 
static ALIstring theCurrentTime = "99:99"
 
static ALIstring theMeasurementsFileName = ""
 

Detailed Description

Definition at line 27 of file Measurement.h.

Constructor & Destructor Documentation

◆ Measurement() [1/2]

Measurement::Measurement ( const ALIint  measdim,
ALIstring type,
ALIstring name 
)

Definition at line 44 of file Measurement.cc.

References theDim, theSigma, theValue, theValueIsSimulated, theValueSimulated, theValueSimulated_orig, and theValueType.

45  : theDim(measdim), theType(type), theName(name) {
46  // _OptOnames = new ALIstring[theDim];
47  theValue = new ALIdouble[theDim];
48  theSigma = new ALIdouble[theDim];
50 
54 }
ALIdouble * theValueSimulated
Definition: Measurement.h:187
long double ALIdouble
Definition: CocoaGlobals.h:11
bool ALIbool
Definition: CocoaGlobals.h:19
ALIstring theName
Definition: Measurement.h:183
ALIdouble * theSigma
Definition: Measurement.h:182
ALIstring theType
Definition: Measurement.h:180
ALIuint theDim
Definition: Measurement.h:179
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
ALIstring * theValueType
Definition: Measurement.h:184
const ALIstring & name() const
Definition: Measurement.h:86
ALIdouble * theValue
Definition: Measurement.h:181

◆ Measurement() [2/2]

Measurement::Measurement ( )
inline

Definition at line 31 of file Measurement.h.

31 {};

◆ ~Measurement()

Measurement::~Measurement ( )
virtual

Definition at line 559 of file Measurement.cc.

References theSigma, and theValue.

559  {
560  // delete[] _name;
561  delete[] theValue;
562  delete[] theSigma;
563 }
ALIdouble * theSigma
Definition: Measurement.h:182
ALIdouble * theValue
Definition: Measurement.h:181

Member Function Documentation

◆ addAffectingEntriesFromOptO()

void Measurement::addAffectingEntriesFromOptO ( const OpticalObject optoP)

Definition at line 372 of file Measurement.cc.

References OpticalObject::CoordinateEntryList(), gather_cfg::cout, ALIUtils::debug, OpticalObject::ExtraEntryList(), spr::find(), OpticalObject::name(), OpticalObject::parent(), and theAffectingEntryList.

Referenced by buildAffectingEntryList().

372  {
373  if (ALIUtils::debug >= 3)
374  std::cout << "Measurement::addAffectingEntriesFromOptO: OptO taking part in Measurement: " << optoP->name()
375  << std::endl;
376  //---------- Loop entries in this OptO
377  std::vector<Entry*>::const_iterator vecite;
378  std::vector<Entry*>::const_iterator fvecite;
379  for (vecite = optoP->CoordinateEntryList().begin(); vecite != optoP->CoordinateEntryList().end(); ++vecite) {
380  //T if( find( theAffectingEntryList.begin(), theAffectingEntryList.end(), (*vecite) ) == theAffectingEntryList.end() ){
381  //t theAffectingEntryList.push_back(*vecite);
382  //T }
383  fvecite = find(theAffectingEntryList.begin(), theAffectingEntryList.end(), (*vecite));
384  if (fvecite == theAffectingEntryList.end()) {
385  theAffectingEntryList.push_back(*vecite);
386  if (ALIUtils::debug >= 4)
387  std::cout << "Entry that may affect Measurement: " << (*vecite)->name() << std::endl;
388  }
389  }
390  for (vecite = optoP->ExtraEntryList().begin(); vecite != optoP->ExtraEntryList().end(); ++vecite) {
391  fvecite = find(theAffectingEntryList.begin(), theAffectingEntryList.end(), (*vecite));
392  if (fvecite == theAffectingEntryList.end()) {
393  theAffectingEntryList.push_back(*vecite);
394  if (ALIUtils::debug >= 4)
395  std::cout << "Entry that may affect Measurement: " << (*vecite)->name() << std::endl;
396  }
397  }
398  if (optoP->parent() != nullptr) {
400  }
401 }
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< Entry * > & ExtraEntryList() const
Definition: OpticalObject.h:65
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
Definition: Measurement.cc:372
const std::vector< Entry * > & CoordinateEntryList() const
Definition: OpticalObject.h:63
std::vector< Entry * > theAffectingEntryList
Definition: Measurement.h:202
const OpticalObject * parent() const
Definition: OpticalObject.h:60

◆ AddOptOListItem()

void Measurement::AddOptOListItem ( OpticalObject opto)
inline

Definition at line 142 of file Measurement.h.

References _OptOList.

142 { _OptOList.push_back(opto); }
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200

◆ AddOptONameListItem()

void Measurement::AddOptONameListItem ( ALIstring  optos)
inline

Definition at line 140 of file Measurement.h.

References _OptONameList.

Referenced by MeasurementDiffEntry::buildOptONamesList().

140 { _OptONameList.push_back(optos); }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198

◆ affectingEntryList()

const std::vector<Entry*>& Measurement::affectingEntryList ( ) const
inline

Definition at line 103 of file Measurement.h.

References theAffectingEntryList.

103 { return theAffectingEntryList; }
std::vector< Entry * > theAffectingEntryList
Definition: Measurement.h:202

◆ buildAffectingEntryList()

void Measurement::buildAffectingEntryList ( )

Definition at line 360 of file Measurement.cc.

References _OptOList, and addAffectingEntriesFromOptO().

Referenced by postConstruct().

360  {
361  //---------- Loop OptO MeasuredList
362  std::vector<OpticalObject*>::const_iterator vocite;
363  for (vocite = _OptOList.begin(); vocite != _OptOList.end(); ++vocite) {
365  }
366 }
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
Definition: Measurement.cc:372

◆ buildOptOList()

void Measurement::buildOptOList ( )

Definition at line 305 of file Measurement.cc.

References _OptOList, _OptONameList, DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, beamvalidation::exit(), Model::getOptOByName(), cuy::ii, OpticalObject::name(), and Substitute2p().

Referenced by postConstruct().

305  {
306  //- if ( ALIUtils::debug >= 3 ) std::cout << std::endl << " MEASUREMENT: " << " " << this->name() << std::endl;
307  ALIstring twopoints(".."); // .. goes one level up in the tree fo OptOs
308 
309  //---------------------------------------- Loop OptONameList
310  std::vector<ALIstring>::iterator vsite;
311  for (vsite = _OptONameList.begin(); vsite != _OptONameList.end(); ++vsite) {
312  //----------------------------------- Count how many '..' there are in the name
313  ALIuint ii = 0;
314  // ALIuint slen = (*vsite).length();
315  ALIuint Ntwopoints = 0; //---- No '..' in ALIstring
316  for (;;) {
317  int i2p = (*vsite).find_first_of(twopoints, 3 * ii); // if it is ., it also finds it!!!
318  if (i2p < 0)
319  break;
320  if (i2p != ALIint(3 * ii)) {
321  std::cerr << i2p << "!!! Bad position of '..' in reference ALIstring: " << (*vsite).c_str() << std::endl;
322  exit(2);
323  } else {
324  Ntwopoints++;
325  if (ALIUtils::debug >= 9)
326  std::cout << "N2p" << Ntwopoints;
327  }
328  ii++;
329  }
330  //------ Substitute '..' by reference (the last OptO in list)
331  if (Ntwopoints != 0) {
332  Substitute2p((*vsite), *(_OptONameList.end() - 1), Ntwopoints);
333  }
334  //----- Get OpticalObject* that correspond to ALIstring and fill list
335  ALIstring referenceOptO = (*vsite);
336  //--- a ':' is used in OptOs that have several possible behavious
337  ALIint colon = referenceOptO.find(':');
338  if (colon != -1) {
339  if (ALIUtils::debug >= 99) {
340  std::cout << "colon in reference OptO name " << colon << referenceOptO.c_str() << std::endl;
341  }
342  referenceOptO = referenceOptO.substr(0, colon);
343  }
344  OpticalObject* OptOitem = Model::getOptOByName(referenceOptO);
345  if (ALIUtils::debug >= 3)
346  std::cout << "Measurement::buildOptOList: OptO in Measurement: " << OptOitem->name() << std::endl;
347  if (OptOitem != (OpticalObject*)nullptr) {
348  _OptOList.push_back(OptOitem);
349  } else {
350  std::cerr << "!!! Error in Measurement: can't find Optical Object " << (*vsite).c_str() << std::endl;
351  exit(2);
352  }
353  }
354 }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
void Substitute2p(ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
Definition: Measurement.cc:406
int ALIint
Definition: CocoaGlobals.h:15
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
Definition: Model.cc:562
static ALIint debug
Definition: ALIUtils.h:34
const ALIstring & name() const
Definition: OpticalObject.h:58
ii
Definition: cuy.py:589
std::string ALIstring
Definition: CocoaGlobals.h:9
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ buildOptONamesList()

void Measurement::buildOptONamesList ( const std::vector< ALIstring > &  wl)
virtual

Reimplemented in MeasurementDiffEntry.

Definition at line 174 of file Measurement.cc.

References _OptONameList, DMR_cfg::cerr, beamvalidation::exit(), cuy::ii, and LaserClient_cfi::wl.

Referenced by construct(), constructFromOA(), and copyMeas().

174  {
175  int NPairs = (wl.size() + 1) / 2; // Number of OptO names ( pair of name and '&' )
176 
177  //--------- Fill list with names
178  for (int ii = 0; ii < NPairs; ii++) {
179  _OptONameList.push_back(wl[ii * 2]);
180  // Check for separating '&'
181  if (ii != NPairs - 1 && wl[2 * ii + 1] != ALIstring("&")) {
182  // ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
183  std::cerr << "!!! Measured Optical Objects should be separated by '&', not by" << wl[2 * ii + 1] << std::endl;
184  exit(2);
185  }
186  }
187 }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
ii
Definition: cuy.py:589
std::string ALIstring
Definition: CocoaGlobals.h:9
def exit(msg="")

◆ calculateOriginalSimulatedValue()

void Measurement::calculateOriginalSimulatedValue ( )

Definition at line 436 of file Measurement.cc.

References calculateSimulatedValue(), gather_cfg::cout, ALIUtils::debug, dim(), ALIUtils::getFirstTime(), GlobalOptionMgr::getInstance(), GlobalOptionMgr::GlobalOptions(), cuy::ii, setValue(), setValueSimulated_orig(), valueIsSimulated(), and valueSimulated().

436  {
437  //---------- Calculate the simulated value of the Measurement
439 
440 #ifdef COCOA_VIS
441  if (ALIUtils::getFirstTime()) {
443  if (gomgr->GlobalOptions()["VisWriteVRML"] > 1) {
444  ALIVRMLMgr::getInstance().newLightRay();
445  }
446  /*- if(Model::GlobalOptions()["VisWriteIguana"] > 1) {
447  IgCocoaFileMgr::getInstance().newLightPath( theName );
448  } */
449  }
450 #endif
451 
452  //---------- Set original simulated values to it
453  //- if(ALIUtils::debug >= 5) std::cout << "MEAS DIMENSION" << dim() << std::endl;
454  for (ALIuint ii = 0; ii < dim(); ii++) {
456  if (ALIUtils::debug >= 4)
457  std::cout << "SETsimuvalOriginal" << valueSimulated(ii) << std::endl;
458  //----- If Measurement has as value 'simulated_value', set the value to the simulated one
459  if (valueIsSimulated(ii) == 1) {
461  //- std::cout << ii << " setting value as simulated " << valueSimulated(ii) << " " << value(ii) << this << std::endl;
462  }
463  }
464 }
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:156
const ALIuint dim() const
Definition: Measurement.h:82
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:129
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
virtual void calculateSimulatedValue(ALIbool firstTime)
Definition: Measurement.h:50
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:105
ii
Definition: cuy.py:589
static ALIbool getFirstTime()
Definition: ALIUtils.h:87
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
void setValueSimulated_orig(ALIint coor, ALIdouble value)
Definition: Measurement.h:144
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ calculateSimulatedValue()

virtual void Measurement::calculateSimulatedValue ( ALIbool  firstTime)
inlinevirtual

◆ construct()

void Measurement::construct ( )

Definition at line 59 of file Measurement.cc.

References buildOptONamesList(), filterCSVwithJSON::copy, correctValueAndSigma(), gather_cfg::cout, ALIUtils::debug, dim(), fillData(), ALIFileIn::getInstance(), ALIFileIn::getWordsInLine(), cuy::ii, name(), postConstruct(), Model::SDFName(), type(), and valueIsSimulated().

Referenced by Model::readSystemDescription().

59  {
61 
62  //---------- Read OptOs that take part in this Measurement
63  std::vector<ALIstring> wordlist;
64  filein.getWordsInLine(wordlist);
65 
66  //--------- Fill the list of names of OptOs that take part in this measurement ( names only )
67  buildOptONamesList(wordlist);
68 
69  if (ALIUtils::debug >= 3) {
70  std::cout << "@@@@ Reading Measurement " << name() << " TYPE= " << type() << std::endl << " MEASURED OPTO NAMES: ";
71  std::ostream_iterator<ALIstring> outs(std::cout, " ");
72  copy(wordlist.begin(), wordlist.end(), outs);
73  std::cout << std::endl;
74  }
75 
76  //---------- Read the data
77  for (unsigned int ii = 0; ii < dim(); ii++) {
78  filein.getWordsInLine(wordlist);
79  fillData(ii, wordlist);
80  }
81 
82  if (!valueIsSimulated(0))
84 
85  postConstruct();
86 }
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:21
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:156
const ALIuint dim() const
Definition: Measurement.h:82
void postConstruct()
Definition: Measurement.cc:153
static ALIint debug
Definition: ALIUtils.h:34
static ALIstring & SDFName()
the name of the System Description File
Definition: Model.h:93
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
ii
Definition: cuy.py:589
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:73
const ALIstring & type() const
Definition: Measurement.h:84
virtual void correctValueAndSigma()
Definition: Measurement.h:66
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:174
const ALIstring & name() const
Definition: Measurement.h:86

◆ constructFromOA()

void Measurement::constructFromOA ( OpticalAlignMeasurementInfo measInfo)

Definition at line 89 of file Measurement.cc.

References _OptONameList, buildOptONamesList(), gather_cfg::cout, ALIUtils::debug, dim(), ALIUtils::dumpVS(), submitPVResolutionJobs::err, fillData(), cuy::ii, OpticalAlignMeasurementInfo::isSimulatedValue_, OpticalAlignMeasurementInfo::measObjectNames_, name(), postConstruct(), sigmaDimensionFactor(), type(), heppy_batch::val, valueDimensionFactor(), and OpticalAlignMeasurementInfo::values_.

Referenced by Model::BuildMeasurementsFromOA().

89  {
90  //---- Build wordlist to build object name list
91  std::vector<std::string> objNames = measInfo.measObjectNames_;
92  std::vector<std::string>::const_iterator site;
93  std::vector<ALIstring> wordlist;
94  //--- Fill the list of names of OptOs that take part in this measurement ( names only )
95  for (site = objNames.begin(); site != objNames.end(); ++site) {
96  if (site != objNames.begin())
97  wordlist.push_back("&");
98  wordlist.push_back(*site);
99  }
100  buildOptONamesList(wordlist);
101 
102  if (ALIUtils::debug >= 3) {
103  std::cout << "@@@@ Reading Measurement " << name() << " TYPE= " << type() << " " << measInfo << std::endl
104  << " MEASURED OPTO NAMES: ";
105  for (size_t ii = 0; ii < _OptONameList.size(); ii++) {
106  std::cout << _OptONameList[ii] << " ";
107  }
108  std::cout << std::endl;
109  }
110 
111  //---------- No data, set to simulated_value
112  for (unsigned int ii = 0; ii < dim(); ii++) {
113  wordlist.clear();
114  wordlist.push_back((measInfo.values_)[ii].name_);
115  char ctmp[20];
116  if (measInfo.isSimulatedValue_[ii]) {
117  if (ALIUtils::debug >= 5) {
118  std::cout << "Measurement::constructFromOA: meas value " << ii << " " << dim() << " = simulated_value"
119  << std::endl;
120  }
121  wordlist.push_back("simulated_value");
122  } else {
123  if (ALIUtils::debug >= 5) {
124  std::cout << "Measurement::constructFromOA: meas value " << ii << " " << dim() << " = "
125  << measInfo.values_.size() << std::endl;
126  }
127  ALIdouble val =
128  (measInfo.values_)[ii].value_ /
129  valueDimensionFactor(); //in XML values are without dimensions, so neutralize multiplying by valueDimensionFactor() in fillData
130  gcvt(val, 10, ctmp);
131  wordlist.push_back(ctmp);
132  }
133  ALIdouble err =
134  (measInfo.values_)[ii].error_ /
135  sigmaDimensionFactor(); //in XML values are without dimensions, so neutralize multiplying by valueDimensionFactor() in fillData
136  gcvt(err, 10, ctmp);
137  wordlist.push_back(ctmp);
138  std::cout << " sigma " << err << " = " << ctmp << " " << (measInfo.values_)[ii].error_ << std::endl;
139  //- wordlist.push_back( "simulated_value" );
140  //- wordlist.push_back( "1." );
141  if (ALIUtils::debug >= 5)
142  ALIUtils::dumpVS(wordlist, " Measurement: calling fillData ");
143  //- std::cout << " MEAS INFO " << measInfo << std::endl;
144  //- std::cout << ii << " MEAS INFO PARAM " << (measInfo.values_)[ii] << std::endl;
145  //- std::cout << ii << " MEAS INFO PARAM VALUE " << (measInfo.values_)[ii].value_ << std::endl;
146  fillData(ii, wordlist);
147  }
148 
149  postConstruct();
150 }
long double ALIdouble
Definition: CocoaGlobals.h:11
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
const ALIuint dim() const
Definition: Measurement.h:82
void postConstruct()
Definition: Measurement.cc:153
std::vector< std::string > measObjectNames_
static ALIint debug
Definition: ALIUtils.h:34
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
Definition: Measurement.cc:192
ii
Definition: cuy.py:589
const ALIstring & type() const
Definition: Measurement.h:84
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:465
std::vector< OpticalAlignParam > values_
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:174
const ALIstring & name() const
Definition: Measurement.h:86
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120

◆ copyMeas()

void Measurement::copyMeas ( Measurement meas,
const std::string &  subsstr1,
const std::string &  subsstr2 
)

Definition at line 621 of file Measurement.cc.

References buildOptONamesList(), ALIUtils::changeName(), filterCSVwithJSON::copy, gather_cfg::cout, ALIUtils::debug, dim(), cuy::ii, name(), OptOList(), postConstruct(), sigma(), theDim, theName, theSigma, theType, theValue, theValueIsSimulated, theValueSimulated, theValueSimulated_orig, type(), value(), valueIsSimulated(), valueSimulated(), and valueSimulated_orig().

Referenced by Model::copyMeasurements().

621  {
622  theDim = meas->dim();
623  theType = meas->type();
624  theName = ALIUtils::changeName(meas->name(), subsstr1, subsstr2);
625 
626  // _OptOnames = new ALIstring[theDim];
630  theValue = const_cast<ALIdouble*>(meas->value());
631  theSigma = const_cast<ALIdouble*>(meas->sigma());
632 
633  unsigned int ii;
634  for (ii = 0; ii < theDim; ii++) {
638  }
639 
640  //--------- Fill the list of names of OptOs that take part in this measurement ( names only )
641 
642  std::vector<std::string> wordlist;
643  auto& optolist = meas->OptOList();
644  ALIuint nOptos = optolist.size();
645  for (ALIuint ii = 0; ii < nOptos; ii++) {
646  wordlist.push_back(ALIUtils::changeName(optolist[ii]->longName(), subsstr1, subsstr2));
647  std::cout << " copymeas " << ALIUtils::changeName(optolist[ii]->longName(), subsstr1, subsstr2) << std::endl;
648  if (ii != nOptos - 1)
649  wordlist.push_back("&");
650  }
651 
652  buildOptONamesList(wordlist);
653 
654  if (ALIUtils::debug >= 3) {
655  std::cout << "@@@@ Reading Measurement " << name() << " TYPE= " << type() << std::endl << " MEASURED OPTO NAMES: ";
656  std::ostream_iterator<ALIstring> outs(std::cout, " ");
657  copy(wordlist.begin(), wordlist.end(), outs);
658  std::cout << std::endl;
659  }
660 
661  postConstruct();
662 }
ALIdouble * theValueSimulated
Definition: Measurement.h:187
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble valueSimulated_orig(ALIuint ii) const
Definition: Measurement.h:107
bool valueIsSimulated(ALIint coor)
Definition: Measurement.h:156
const ALIdouble * value() const
Definition: Measurement.h:109
const ALIuint dim() const
Definition: Measurement.h:82
void postConstruct()
Definition: Measurement.cc:153
static ALIint debug
Definition: ALIUtils.h:34
bool ALIbool
Definition: CocoaGlobals.h:19
ALIstring theName
Definition: Measurement.h:183
ALIdouble * theSigma
Definition: Measurement.h:182
const ALIdouble valueSimulated(ALIuint ii) const
Definition: Measurement.h:105
ALIstring theType
Definition: Measurement.h:180
ii
Definition: cuy.py:589
ALIuint theDim
Definition: Measurement.h:179
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:535
const ALIdouble * sigma() const
Definition: Measurement.h:112
const ALIstring & type() const
Definition: Measurement.h:84
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
Definition: Measurement.cc:174
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:101
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
const ALIstring & name() const
Definition: Measurement.h:86
ALIdouble * theValue
Definition: Measurement.h:181
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ correctValueAndSigma()

virtual void Measurement::correctValueAndSigma ( )
inlinevirtual

◆ DerivativeRespectEntry()

std::vector< ALIdouble > Measurement::DerivativeRespectEntry ( Entry entry)

Definition at line 489 of file Measurement.cc.

References funct::abs(), calculateSimulatedValue(), DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, mps_splice::entry, beamvalidation::exit(), ALIUtils::getMaximumDeviationDerivative(), cuy::ii, name(), theDim, theValueSimulated, and theValueSimulated_orig.

489  {
490  //---------- std::vector of derivatives to return
491  std::vector<ALIdouble> deriv;
492  ALIdouble sumderiv;
493 
494  //---------- displacement to start with
495  ALIdouble displacement = entry->startingDisplacement();
496  //----- all angles are in radians, so, if displace is not, rescale it before making the displacement
497  //- displacement *= entry->SigmaDimensionFactor();
498  if (ALIUtils::debug >= 3)
499  std::cout << std::endl
500  << "%%% Derivative w.r.t. entry " << entry->name() << ": displacement = " << displacement << std::endl;
501 
502  ALIint count_itera = 0;
503 
504  //---------- Loop decreasing the displacement a factor 2, until the precision set is reached
505  do {
506  count_itera++;
507  entry->displace(displacement);
508 
509  if (ALIUtils::debug >= 5)
510  std::cout << "Get simulated value for displacement " << displacement << std::endl;
512 
513  //---------- Get sum of derivatives
514  sumderiv = 0;
515  for (ALIuint ii = 0; ii < theDim; ii++) {
517  if (ALIUtils::debug >= 4) {
518  std::cout << "iteration " << count_itera << " COOR " << ii << " difference ="
520  //- << " " << theValueSimulated[ii] << " " << theValueSimulated_orig[ii]
521  << " derivative = " << (theValueSimulated[ii] - theValueSimulated_orig[ii]) / displacement << " disp "
522  << displacement << " sum derivatives = " << sumderiv << std::endl;
523  }
524  if (ALIUtils::debug >= 5) {
525  std::cout << " new simu value= " << theValueSimulated[ii] << " orig simu value " << theValueSimulated_orig[ii]
526  << std::endl;
527  }
528  }
529  if (count_itera >= 100) {
530  std::cerr << "EXITING: too many iterations in derivative, displacement is " << displacement
531  << " sum of derivatives is " << sumderiv << std::endl;
532  exit(3);
533  }
534  displacement /= 2.;
535  //- std::cout << "sumderiv " << sumderiv << " maximu " << Fit::maximum_deviation_derivative << std::endl;
536  } while (sumderiv > ALIUtils::getMaximumDeviationDerivative());
537  displacement *= 2;
538 
539  //---------- Enough precision reached: pass result
540  for (ALIuint ii = 0; ii < theDim; ii++) {
541  deriv.push_back((theValueSimulated[ii] - theValueSimulated_orig[ii]) / displacement);
542  //----- change it to entry sigma dimensions
543  // deriv[ii] /= entry->SigmaDimensionFactor();
544  if (ALIUtils::debug >= 1)
545  std::cout << name() << ": " << entry->OptOCurrent()->name() << " " << entry->name() << " " << ii
546  << "### DERIVATIVE: " << deriv[ii] << std::endl;
547  }
548  //- if(ALIUtils::debug >= 5) std::cout << "END derivative: " << deriv << "disp" << displacement << std::endl;
549 
550  //--------------------- Reset _centreGlob and _rmGlob of OptO entry belongs to (and component OptOs)
551  entry->OptOCurrent()->resetGlobalCoordinates();
552 
553  return deriv;
554 }
ALIdouble * theValueSimulated
Definition: Measurement.h:187
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble getMaximumDeviationDerivative()
Definition: ALIUtils.h:89
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
virtual void calculateSimulatedValue(ALIbool firstTime)
Definition: Measurement.h:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ii
Definition: cuy.py:589
ALIuint theDim
Definition: Measurement.h:179
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189
const ALIstring & name() const
Definition: Measurement.h:86
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ dim()

const ALIuint Measurement::dim ( ) const
inline

◆ DumpBadOrderOptOs()

void Measurement::DumpBadOrderOptOs ( )

Definition at line 469 of file Measurement.cc.

References DMR_cfg::cerr, ALIUtils::debug, beamvalidation::exit(), and OptONameList().

Referenced by MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementDiffEntry::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), and MeasurementTiltmeter::calculateSimulatedValue().

469  {
470  std::cerr << " Detector can not make measurement with these optical objects " << std::endl;
471  if (ALIUtils::debug >= 1) {
472  // std::vector<OpticalObject*>::iterator voite;
473  // for ( voite = _OptOList.begin();
474  // voite != _OptOList.end(); voite++) {
475  // std::cout << (*voite)->type() << " : " << (*voite)->name() << std::endl;
476  // }
477  std::vector<ALIstring>::const_iterator vsite;
478  for (vsite = OptONameList().begin(); vsite != OptONameList().end(); ++vsite) {
479  std::cerr << (*vsite) << " : ";
480  }
481  std::cerr << std::endl;
482  }
483  exit(2);
484 }
const std::vector< ALIstring > & OptONameList() const
Definition: Measurement.h:99
static ALIint debug
Definition: ALIUtils.h:34
def exit(msg="")

◆ fillData() [1/2]

void Measurement::fillData ( ALIuint  coor,
const std::vector< ALIstring > &  wl 
)

Definition at line 192 of file Measurement.cc.

References DMR_cfg::cerr, filterCSVwithJSON::copy, gather_cfg::cout, ALIUtils::debug, beamvalidation::exit(), ParameterMgr::getInstance(), ParameterMgr::getParameterValue(), ALIUtils::IsNumber(), sigmaDimensionFactor(), theDim, theSigma, theValue, theValueIsSimulated, theValueType, heppy_batch::val, and valueDimensionFactor().

Referenced by construct(), constructFromOA(), Model::readMeasurementsFromFile(), and CocoaDaqReaderText::ReadNextEvent().

192  {
193  if (ALIUtils::debug >= 3) {
194  std::cout << "@@ Filling coordinate " << coor << std::endl;
195  //- ostream_iterator<ALIstring> outs(std::cout," ");
196  //- copy(wordlist.begin(), wordlist.end(), outs);
197  }
198 
200 
201  //---------- Check that there are 3 attributes: name, value, error
202  if (wordlist.size() != 3) {
203  // ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
204  std::cerr << " Incorrect format for Measurement value:" << std::endl;
205  std::ostream_iterator<ALIstring> outs(std::cout, " ");
206  copy(wordlist.begin(), wordlist.end(), outs);
207  std::cout << std::endl << "There should be three words: name value sigma " << std::endl;
208  exit(2);
209  }
210 
211  //---------- check coor value
212  if (coor >= theDim) {
213  // ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
214  std::cerr << "Trying to fill Measurement coordinate No " << coor << " but the dimension is " << theDim << std::endl;
215  exit(2);
216  }
217 
218  //---------- set data members
219  //----- Set valueType
220  theValueType[coor] = wordlist[0];
221 
222  //----- Set value (translate it if a PARAMETER is used)
223  ALIdouble val = 0.;
224  theValueIsSimulated[coor] = false;
225  if (!ALIUtils::IsNumber(wordlist[1])) {
226  if (parmgr->getParameterValue(wordlist[1], val) == 0) {
227  if (wordlist[1] == ALIstring("simulated_value")) {
228  theValueIsSimulated[coor] = true;
229  } else {
230  // ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
231  std::cerr << "!!! parameter for value not found: " << wordlist[1].c_str() << std::endl;
232  exit(2);
233  }
234  }
235  //d val *= valueDimensionFactor();
236  } else {
237  //d val = DimensionMgr()::getInstance()->extractValue( wordlist[1], ValueDimensionFactor() );
238  val = atof(wordlist[1].c_str());
239  }
241  if (ALIUtils::debug >= 3)
242  std::cout << "Meas VALUE= " << val << " (ValueDimensionFactor= " << valueDimensionFactor() << std::endl;
243 
244  //----- Set sigma (translate it if a PARAMETER is used)
245  ALIdouble sig = 0.;
246  if (!ALIUtils::IsNumber(wordlist[2])) {
247  if (parmgr->getParameterValue(wordlist[2], sig) == 0) {
248  // ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
249  std::cerr << "!!! parameter for sigma not found: " << wordlist[2].c_str() << std::endl;
250  exit(2);
251  }
252  //d sig *= sigmaDimensionFactor();
253  } else {
254  // sig = DimensionMgr()::getInstance()->extractValue( wordlist[2], ValueDimensionFactor() );
255  sig = atof(wordlist[2].c_str());
256  }
257  sig *= sigmaDimensionFactor();
258  if (ALIUtils::debug >= 3)
259  std::cout << "SIGMA= " << sig << " (SigmaDimensionFactor= " << sigmaDimensionFactor() << std::endl;
260 
261  //----- set theValue & theSigma
262  theValue[coor] = val;
263  theSigma[coor] = sig;
264 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ParameterMgr * getInstance()
Definition: ParameterMgr.cc:18
static ALIint debug
Definition: ALIUtils.h:34
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
ALIint getParameterValue(const ALIstring &name, ALIdouble &val)
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
ALIdouble * theSigma
Definition: Measurement.h:182
ALIuint theDim
Definition: Measurement.h:179
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
ALIstring * theValueType
Definition: Measurement.h:184
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120
ALIdouble * theValue
Definition: Measurement.h:181
def exit(msg="")

◆ fillData() [2/2]

void Measurement::fillData ( ALIuint  coor,
OpticalAlignParam oaParam 
)

Definition at line 267 of file Measurement.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, beamvalidation::exit(), GlobalOptionMgr::getInstance(), GlobalOptionMgr::GlobalOptions(), OpticalAlignParam::sigma(), sigmaDimensionFactor(), theDim, theSigma, theValue, theValueIsSimulated, heppy_batch::val, OpticalAlignParam::value(), and valueDimensionFactor().

267  {
268  if (ALIUtils::debug >= 3) {
269  std::cout << "@@ Filling coordinate " << coor << std::endl;
270  }
271 
272  // ParameterMgr* parmgr = ParameterMgr::getInstance();
273 
274  //---------- check coor value
275  if (coor >= theDim) {
276  std::cerr << "Trying to fill Measurement coordinate No " << coor << " but the dimension is " << theDim << std::endl;
277  exit(2);
278  }
279 
280  //---------- set data members
281  //----- Set value (translate it if a PARAMETER is used)
282  ALIdouble val = 0.;
283  theValueIsSimulated[coor] = false;
284  val = oaParam->value();
286  theValue[coor] = val;
287  if (ALIUtils::debug >= 3)
288  std::cout << "Meas VALUE= " << val << " (ValueDimensionFactor= " << valueDimensionFactor() << std::endl;
289 
290  ALIbool sigmaFF = GlobalOptionMgr::getInstance()->GlobalOptions()["measurementErrorFromFile"];
291  if (sigmaFF) {
292  //----- Set sigma (translate it if a PARAMETER is used)
293  ALIdouble sig = 0.;
294  sig = oaParam->sigma(); // it is in mm always
295  sig *= sigmaDimensionFactor();
296  theSigma[coor] = sig;
297  if (ALIUtils::debug >= 3)
298  std::cout << "SIGMA= " << sig << " (SigmaDimensionFactor= " << sigmaDimensionFactor() << std::endl;
299  }
300 }
long double ALIdouble
Definition: CocoaGlobals.h:11
double value() const
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
bool ALIbool
Definition: CocoaGlobals.h:19
ALIdouble * theSigma
Definition: Measurement.h:182
ALIuint theDim
Definition: Measurement.h:179
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
ALIbool * theValueIsSimulated
Definition: Measurement.h:195
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120
ALIdouble * theValue
Definition: Measurement.h:181
def exit(msg="")
double sigma() const

◆ getCurrentDate()

static ALIstring Measurement::getCurrentDate ( )
inlinestatic

Definition at line 122 of file Measurement.h.

References theCurrentDate.

Referenced by FittedEntriesSet::FittedEntriesSet().

122 { return theCurrentDate; }
static ALIstring theCurrentDate
Definition: Measurement.h:208

◆ getCurrentTime()

static ALIstring Measurement::getCurrentTime ( )
inlinestatic

Definition at line 123 of file Measurement.h.

References theCurrentTime.

Referenced by FittedEntriesSet::FittedEntriesSet().

123 { return theCurrentTime; }
static ALIstring theCurrentTime
Definition: Measurement.h:209

◆ getLightRayDirection()

const CLHEP::Hep3Vector& Measurement::getLightRayDirection ( ) const
inline

Definition at line 126 of file Measurement.h.

References theLightRayDirection.

126 { return theLightRayDirection; }
CLHEP::Hep3Vector theLightRayDirection
Definition: Measurement.h:205

◆ getLightRayPosition()

const CLHEP::Hep3Vector& Measurement::getLightRayPosition ( ) const
inline

Definition at line 125 of file Measurement.h.

References theLightRayPosition.

125 { return theLightRayPosition; }
CLHEP::Hep3Vector theLightRayPosition
Definition: Measurement.h:204

◆ getMeasuringBehaviour()

ALIstring Measurement::getMeasuringBehaviour ( const std::vector< OpticalObject *>::const_iterator  vocite)

Definition at line 568 of file Measurement.cc.

References _OptOList, and _OptONameList.

Referenced by MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), and MeasurementTiltmeter::calculateSimulatedValue().

568  {
569  std::vector<ALIstring>::const_iterator vscite =
570  _OptONameList.begin() + (vocite - _OptOList.begin()); // point to corresponding name of this OptO
571  ALIint colon = (*vscite).find(':');
572  ALIstring behav;
573  if (colon != -1) {
574  behav = (*vscite).substr(colon + 1, (*vscite).size());
575  } else {
576  behav = " ";
577  }
578  return behav;
579 }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
int ALIint
Definition: CocoaGlobals.h:15
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ getPreviousOptO()

const OpticalObject * Measurement::getPreviousOptO ( const OpticalObject Popto) const

Definition at line 584 of file Measurement.cc.

References _OptOList, DMR_cfg::cerr, beamvalidation::exit(), OpticalObject::name(), and name().

Referenced by OptODistancemeter::makeMeasurement(), and OptODistancemeter3dim::makeMeasurement().

584  {
585  //--------- Loop OptOs that take part in this measurement
586  std::vector<OpticalObject*>::const_iterator vocite;
587  for (vocite = _OptOList.begin(); vocite != _OptOList.end(); ++vocite) {
588  if (*vocite == Popto) {
589  if (vocite == _OptOList.begin()) {
590  std::cerr << " ERROR in getPreviousOptO of measurement " << name() << std::endl;
591  std::cerr << " OptO " << Popto->name() << " is the first one " << std::endl;
592  exit(1);
593  } else {
594  return *(vocite - 1);
595  }
596  }
597  }
598 
599  std::cerr << " ERROR in getPreviousOptO of measurement " << name() << std::endl;
600  std::cerr << " OptO " << Popto->name() << " not found " << std::endl;
601  exit(1);
602 }
std::vector< OpticalObject * > _OptOList
Definition: Measurement.h:200
const ALIstring & name() const
Definition: OpticalObject.h:58
const ALIstring & name() const
Definition: Measurement.h:86
def exit(msg="")

◆ measurementsFileName()

static ALIstring& Measurement::measurementsFileName ( )
inlinestatic

Definition at line 162 of file Measurement.h.

References theMeasurementsFileName.

Referenced by Model::readMeasurementsFromFile().

162 { return theMeasurementsFileName; }
static ALIstring theMeasurementsFileName
Definition: Measurement.h:206

◆ name()

const ALIstring& Measurement::name ( ) const
inline

◆ OptOList()

const std::vector<OpticalObject*>& Measurement::OptOList ( ) const
inline

◆ OptONameList()

const std::vector<ALIstring>& Measurement::OptONameList ( ) const
inline

Definition at line 99 of file Measurement.h.

References _OptONameList.

Referenced by DumpBadOrderOptOs(), and CocoaToDDLMgr::measurementsAsSpecPars().

99 { return _OptONameList; }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198

◆ postConstruct()

void Measurement::postConstruct ( )

Definition at line 153 of file Measurement.cc.

References Model::addMeasurementToList(), buildAffectingEntryList(), buildOptOList(), gather_cfg::cout, ALIUtils::debug, Model::MeasurementList(), and setName().

Referenced by construct(), constructFromOA(), and copyMeas().

153  {
154  //---------- Set name as name of last OptO
155  setName();
156 
157  //---------- Transform for each Measurement the Measured OptO names to Measured OptO pointers
158  buildOptOList();
159 
160  //---------- Build list of Entries that affect a Measurement
162 
163  //---------- add this measurement to the global list of measurements
165 
166  if (ALIUtils::debug >= 10) {
167  std::cout << Model::MeasurementList().size() << std::endl;
168  }
169 }
void setName()
Definition: Measurement.cc:665
void buildAffectingEntryList()
Definition: Measurement.cc:360
static ALIint debug
Definition: ALIUtils.h:34
static void addMeasurementToList(Measurement *measadd)
Definition: Model.h:145
void buildOptOList()
Definition: Measurement.cc:305
static std::vector< Measurement * > & MeasurementList()
Definition: Model.h:88

◆ printStartCalculateSimulatedValue()

void Measurement::printStartCalculateSimulatedValue ( const Measurement meas)
protected

Definition at line 427 of file Measurement.cc.

References gather_cfg::cout, name(), and type().

Referenced by MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementDiffEntry::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), and MeasurementTiltmeter::calculateSimulatedValue().

427  {
428  std::cout << std::endl
429  << "@@@ Start calculation of simulated value of " << meas->type() << " Measurement " << meas->name()
430  << std::endl;
431 }
const ALIstring & type() const
Definition: Measurement.h:84
const ALIstring & name() const
Definition: Measurement.h:86

◆ sensorName()

const ALIstring& Measurement::sensorName ( )
inline

Definition at line 88 of file Measurement.h.

References theName.

88  {
89  ALIstring sensName = theName;
90  ALIint colon = theName.find(':');
91  theName = theName.substr(colon + 1, theName.length() - colon);
92  return theName;
93  }
int ALIint
Definition: CocoaGlobals.h:15
ALIstring theName
Definition: Measurement.h:183
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ setConversionFactor()

virtual void Measurement::setConversionFactor ( const std::vector< ALIstring > &  wordlist)
inlinevirtual

Reimplemented in MeasurementTiltmeter, MeasurementCOPS, MeasurementSensor2D, MeasurementDistancemeter, and MeasurementDistancemeter3dim.

Definition at line 69 of file Measurement.h.

References DMR_cfg::cerr, and beamvalidation::exit().

Referenced by Model::readSystemDescription().

69  {
70  std::cerr << " Measurement::setConversionFactor should never be called " << std::endl;
71  exit(1);
72  };
def exit(msg="")

◆ setCurrentDate()

void Measurement::setCurrentDate ( const std::vector< ALIstring > &  wl)
static

set the date of the current measurement

Definition at line 605 of file Measurement.cc.

References DMR_cfg::cerr, ALIUtils::dumpVS(), beamvalidation::exit(), theCurrentDate, theCurrentTime, and LaserClient_cfi::wl.

Referenced by Model::readMeasurementsFromFile(), and CocoaDaqReaderText::ReadNextEvent().

605  {
606  if (wl.size() != 3) {
607  std::cerr << "!!!EXITING: reading DATE of measurements set: it must have three words, it is though " << std::endl;
608  ALIUtils::dumpVS(wl, " ");
609  exit(1);
610  } else if (wl[0] != "DATE:") {
611  std::cerr << "!!!EXITING: reading DATE of measurements set: first word must be 'DATE:', it is though " << std::endl;
612  ALIUtils::dumpVS(wl, " ");
613  exit(1);
614  } else {
615  theCurrentDate = wl[1];
616  theCurrentTime = wl[2];
617  }
618 }
static ALIstring theCurrentTime
Definition: Measurement.h:209
static ALIstring theCurrentDate
Definition: Measurement.h:208
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:465
def exit(msg="")

◆ SetDimension()

void Measurement::SetDimension ( ALIuint  dim)
inline

Definition at line 138 of file Measurement.h.

References dim(), and theDim.

138 { theDim = dim; }
const ALIuint dim() const
Definition: Measurement.h:82
ALIuint theDim
Definition: Measurement.h:179

◆ setLightRayDirection()

void Measurement::setLightRayDirection ( const CLHEP::Hep3Vector &  lightRayDirection)
inline

Definition at line 170 of file Measurement.h.

References theLightRayDirection.

Referenced by OptOSensor2D::makeMeasurement().

170 { theLightRayDirection = lightRayDirection; }
CLHEP::Hep3Vector theLightRayDirection
Definition: Measurement.h:205

◆ setLightRayPosition()

void Measurement::setLightRayPosition ( const CLHEP::Hep3Vector &  lightRayPosition)
inline

Definition at line 169 of file Measurement.h.

References theLightRayPosition.

Referenced by OptOSensor2D::makeMeasurement().

169 { theLightRayPosition = lightRayPosition; }
CLHEP::Hep3Vector theLightRayPosition
Definition: Measurement.h:204

◆ setMeasurementsFileName()

static void Measurement::setMeasurementsFileName ( const ALIstring filename)
inlinestatic

Definition at line 163 of file Measurement.h.

References corrVsCorr::filename, and theMeasurementsFileName.

163  {
164  //- std::cout << " setting file name " << filename << std::endl;
166  //- std::cout << " dsetting file name " << filename << std::endl;
167  }
static ALIstring theMeasurementsFileName
Definition: Measurement.h:206

◆ setName()

void Measurement::setName ( )

Definition at line 665 of file Measurement.cc.

References _OptONameList, DMR_cfg::cerr, beamvalidation::exit(), theName, and type().

Referenced by postConstruct().

665  {
666  // name already set by passing one argument with sensor type
667  if (!theName.empty())
668  return;
669  if (_OptONameList.empty()) {
670  std::cerr
671  << " !!! Error in your code, you cannot ask for the name of the Measurement before the OptONameList is build "
672  << std::endl;
673  exit(9);
674  }
675  std::vector<ALIstring>::iterator vsite = (_OptONameList.end() - 1);
676  theName = type() + ":" + (*vsite);
677 }
std::vector< ALIstring > _OptONameList
Definition: Measurement.h:198
ALIstring theName
Definition: Measurement.h:183
const ALIstring & type() const
Definition: Measurement.h:84
def exit(msg="")

◆ setSigma()

void Measurement::setSigma ( ALIint  coor,
ALIdouble  val 
)
inline

Definition at line 131 of file Measurement.h.

References theSigma, and heppy_batch::val.

Referenced by MeasurementDistancemeter::correctValueAndSigma(), MeasurementDistancemeter3dim::correctValueAndSigma(), MeasurementTiltmeter::correctValueAndSigma(), Model::readMeasurementsFromFile(), and CocoaDaqReaderText::ReadNextEvent().

131  {
132  theSigma[coor] = val;
133  //- std::cout << coor << " setting sigma " << theSigma[coor] << std::endl;
134  }
ALIdouble * theSigma
Definition: Measurement.h:182

◆ setType()

void Measurement::setType ( ALIstring  type)
inline

Definition at line 136 of file Measurement.h.

References theType, and type().

136 { theType = type; }
ALIstring theType
Definition: Measurement.h:180
const ALIstring & type() const
Definition: Measurement.h:84

◆ setValue()

void Measurement::setValue ( ALIint  coor,
ALIdouble  val 
)
inline

◆ setValueSimulated()

void Measurement::setValueSimulated ( ALIint  coor,
ALIdouble  value 
)
inline

◆ setValueSimulated_orig()

void Measurement::setValueSimulated_orig ( ALIint  coor,
ALIdouble  value 
)
inline

Definition at line 144 of file Measurement.h.

References theValueSimulated_orig, and value().

Referenced by calculateOriginalSimulatedValue().

144 { theValueSimulated_orig[coor] = value; }
const ALIdouble * value() const
Definition: Measurement.h:109
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189

◆ setXlaserLine()

virtual void Measurement::setXlaserLine ( ALIuint  ii,
int  val 
)
inlinevirtual

Reimplemented in MeasurementCOPS.

Definition at line 158 of file Measurement.h.

Referenced by OptOCOPS::makeMeasurement().

158 {};

◆ sigma() [1/2]

const ALIdouble* Measurement::sigma ( ) const
inline

◆ sigma() [2/2]

const ALIdouble Measurement::sigma ( ALIuint  ii) const
inline

Definition at line 114 of file Measurement.h.

References cuy::ii, and theSigma.

114 { return theSigma[ii]; }
ALIdouble * theSigma
Definition: Measurement.h:182
ii
Definition: cuy.py:589

◆ sigmaDimensionFactor()

virtual const ALIdouble Measurement::sigmaDimensionFactor ( ) const
inlinevirtual

Definition at line 120 of file Measurement.h.

References ALIUtils::LengthSigmaDimensionFactor().

Referenced by constructFromOA(), fillData(), and MeasurementTiltmeter::setConversionFactor().

static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:63

◆ Substitute2p()

void Measurement::Substitute2p ( ALIstring ref,
const ALIstring firstref,
int  NtwoPoints 
)
protected

Definition at line 406 of file Measurement.cc.

References gather_cfg::cout, ALIUtils::debug, cuy::ii, and pickleFileParser::slash.

Referenced by buildOptOList().

406  {
407  // '/' sets hierarchy of OptOs
408  ALIstring slash("/");
409 
410  int pos1st = firstref.length();
411  // Go back an '/' in firstref for each '..' in ref
412  for (int ii = 0; ii < Ntwopoints; ii++) {
413  pos1st = firstref.find_last_of(slash, pos1st - 1);
414  if (ALIUtils::debug >= 9)
415  std::cout << "pos1st=" << pos1st;
416  }
417 
418  if (ALIUtils::debug >= 9)
419  std::cout << "before change ref: " << ref << " 1ref " << firstref << std::endl;
420  // Substitute name
421  ref.replace(0, (Ntwopoints * 3) - 1, firstref, 0, pos1st);
422  if (ALIUtils::debug >= 9)
423  std::cout << "after change ref: " << ref << " 1ref " << firstref << std::endl;
424 }
static ALIint debug
Definition: ALIUtils.h:34
ii
Definition: cuy.py:589
std::string ALIstring
Definition: CocoaGlobals.h:9

◆ type()

const ALIstring& Measurement::type ( ) const
inline

◆ value() [1/2]

const ALIdouble* Measurement::value ( ) const
inline

Definition at line 109 of file Measurement.h.

References theValue.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), average.Average::average(), MeasurementDiffEntry::calculateSimulatedValue(), Types.string::configValue(), Types.FileInPath::configValue(), copyMeas(), MeasurementSensor2D::correctValueAndSigma(), MeasurementCOPS::correctValueAndSigma(), MeasurementDistancemeter::correctValueAndSigma(), MeasurementDistancemeter3dim::correctValueAndSigma(), MeasurementTiltmeter::correctValueAndSigma(), Mixins.UsingBlock::dumpPython(), OptOSensor2D::fastTraversesLightRay(), Mixins.UsingBlock::insertInto(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), OptOTiltmeter::makeMeasurement(), OptODistancemeter::makeMeasurement(), OptODistancemeter3dim::makeMeasurement(), OptOSensor2D::makeMeasurement(), OptOCOPS::makeMeasurement(), CocoaToDDLMgr::measurementsAsSpecPars(), setValueSimulated(), and setValueSimulated_orig().

109 { return theValue; }
ALIdouble * theValue
Definition: Measurement.h:181

◆ value() [2/2]

const ALIdouble Measurement::value ( ALIuint  ii) const
inline

◆ valueDimensionFactor()

virtual const ALIdouble Measurement::valueDimensionFactor ( ) const
inlinevirtual

◆ valueIsSimulated()

bool Measurement::valueIsSimulated ( ALIint  coor)
inline

Definition at line 156 of file Measurement.h.

References theValueIsSimulated.

Referenced by calculateOriginalSimulatedValue(), construct(), copyMeas(), and CocoaToDDLMgr::measurementsAsSpecPars().

156 { return theValueIsSimulated[coor]; }
ALIbool * theValueIsSimulated
Definition: Measurement.h:195

◆ valueSimulated()

const ALIdouble Measurement::valueSimulated ( ALIuint  ii) const
inline

◆ valueSimulated_orig()

const ALIdouble Measurement::valueSimulated_orig ( ALIuint  ii) const
inline

Definition at line 107 of file Measurement.h.

References cuy::ii, and theValueSimulated_orig.

Referenced by copyMeas().

107 { return theValueSimulated_orig[ii]; }
ii
Definition: cuy.py:589
ALIdouble * theValueSimulated_orig
Definition: Measurement.h:189

◆ valueType()

const ALIstring Measurement::valueType ( ALIuint  ii) const
inline

◆ xlaserLine()

virtual int Measurement::xlaserLine ( ALIuint  ii)
inlinevirtual

Reimplemented in MeasurementCOPS.

Definition at line 147 of file Measurement.h.

References DMR_cfg::cerr.

Referenced by OptOCOPS::makeMeasurement().

147  {
148  std::cerr << "!!!! Measurement::xlaserLine is not returning anything " << std::endl;
149  abort();
150  };

Member Data Documentation

◆ _OptOList

std::vector<OpticalObject*> Measurement::_OptOList
private

◆ _OptONameList

std::vector<ALIstring> Measurement::_OptONameList
private

◆ cameraScaleFactor

ALIdouble Measurement::cameraScaleFactor = 1.
static

Definition at line 158 of file Measurement.h.

Referenced by Fit::FillMatricesWithMeasurements().

◆ only1

ALIbool Measurement::only1 = false
static

◆ only1Date

ALIstring Measurement::only1Date = ""
static

Definition at line 213 of file Measurement.h.

Referenced by Model::readMeasurementsFromFile(), and Model::readSystemDescription().

◆ only1Time

ALIstring Measurement::only1Time = ""
static

Definition at line 214 of file Measurement.h.

Referenced by Model::readMeasurementsFromFile(), and Model::readSystemDescription().

◆ theAffectingEntryList

std::vector<Entry*> Measurement::theAffectingEntryList
private

Definition at line 202 of file Measurement.h.

Referenced by addAffectingEntriesFromOptO(), and affectingEntryList().

◆ theCurrentDate

ALIstring Measurement::theCurrentDate = "99/99/99"
staticprivate

Definition at line 208 of file Measurement.h.

Referenced by getCurrentDate(), and setCurrentDate().

◆ theCurrentTime

ALIstring Measurement::theCurrentTime = "99:99"
staticprivate

Definition at line 209 of file Measurement.h.

Referenced by getCurrentTime(), and setCurrentDate().

◆ theDim

ALIuint Measurement::theDim
private

◆ theLightRayDirection

CLHEP::Hep3Vector Measurement::theLightRayDirection
private

Definition at line 205 of file Measurement.h.

Referenced by getLightRayDirection(), and setLightRayDirection().

◆ theLightRayPosition

CLHEP::Hep3Vector Measurement::theLightRayPosition
private

Definition at line 204 of file Measurement.h.

Referenced by getLightRayPosition(), and setLightRayPosition().

◆ theMeasurementsFileName

ALIstring Measurement::theMeasurementsFileName = ""
staticprivate

Definition at line 206 of file Measurement.h.

Referenced by measurementsFileName(), and setMeasurementsFileName().

◆ theName

ALIstring Measurement::theName
private

Definition at line 183 of file Measurement.h.

Referenced by copyMeas(), name(), sensorName(), and setName().

◆ theSigma

ALIdouble* Measurement::theSigma
private

Definition at line 182 of file Measurement.h.

Referenced by copyMeas(), fillData(), Measurement(), setSigma(), sigma(), and ~Measurement().

◆ theType

ALIstring Measurement::theType
private

Definition at line 180 of file Measurement.h.

Referenced by copyMeas(), setType(), and type().

◆ theValue

ALIdouble* Measurement::theValue
private

Definition at line 181 of file Measurement.h.

Referenced by copyMeas(), fillData(), Measurement(), setValue(), value(), and ~Measurement().

◆ theValueIsSimulated

ALIbool* Measurement::theValueIsSimulated
private

Definition at line 195 of file Measurement.h.

Referenced by copyMeas(), fillData(), Measurement(), and valueIsSimulated().

◆ theValueSimulated

ALIdouble* Measurement::theValueSimulated
private

◆ theValueSimulated_orig

ALIdouble* Measurement::theValueSimulated_orig
private

◆ theValueType

ALIstring* Measurement::theValueType
private

Definition at line 184 of file Measurement.h.

Referenced by fillData(), Measurement(), and valueType().