CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MeasurementSensor2D Class Reference

#include <MeasurementSensor2D.h>

Inheritance diagram for MeasurementSensor2D:
Measurement

Public Member Functions

void calculateSimulatedValue (ALIbool firstTime) override
 
void correctValueAndSigma () override
 
 MeasurementSensor2D (const ALIint measdim, ALIstring &type, ALIstring &name)
 
 MeasurementSensor2D ()
 
void setConversionFactor (const std::vector< ALIstring > &wordlist) override
 
 ~MeasurementSensor2D () override
 
- Public Member Functions inherited from Measurement
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 ()
 
void construct ()
 
void constructFromOA (OpticalAlignMeasurementInfo &measInfo)
 
void copyMeas (Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
 
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 ()
 
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 ()
 

Private Attributes

ALIdouble theDisplaceX
 
ALIdouble theDisplaceY
 
ALIdouble theMultiplyX
 
ALIdouble theMultiplyY
 

Additional Inherited Members

- Static Public Member Functions inherited from Measurement
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 inherited from Measurement
static ALIdouble cameraScaleFactor = 1.
 
static ALIbool only1 = false
 
static ALIstring only1Date = ""
 
static ALIstring only1Time = ""
 
- Protected Member Functions inherited from Measurement
void printStartCalculateSimulatedValue (const Measurement *meas)
 
void Substitute2p (ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
 

Detailed Description

Definition at line 18 of file MeasurementSensor2D.h.

Constructor & Destructor Documentation

◆ MeasurementSensor2D() [1/2]

MeasurementSensor2D::MeasurementSensor2D ( const ALIint  measdim,
ALIstring type,
ALIstring name 
)
inline

Definition at line 20 of file MeasurementSensor2D.h.

20 : Measurement(measdim, type, name){};
const ALIstring & name() const
Definition: Measurement.h:86

◆ MeasurementSensor2D() [2/2]

MeasurementSensor2D::MeasurementSensor2D ( )
inline

Definition at line 21 of file MeasurementSensor2D.h.

21 {};

◆ ~MeasurementSensor2D()

MeasurementSensor2D::~MeasurementSensor2D ( )
inlineoverride

Definition at line 22 of file MeasurementSensor2D.h.

22 {};

Member Function Documentation

◆ calculateSimulatedValue()

void MeasurementSensor2D::calculateSimulatedValue ( ALIbool  firstTime)
overridevirtual

Reimplemented from Measurement.

Definition at line 25 of file MeasurementSensor2D.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, ALIUtils::debug, Measurement::DumpBadOrderOptOs(), mps_fire::end, beamvalidation::exit(), ALIUtils::getFirstTime(), GlobalOptionMgr::getInstance(), Measurement::getMeasuringBehaviour(), GlobalOptionMgr::GlobalOptions(), Measurement::name(), Measurement::OptOList(), LightRay::point(), Measurement::printStartCalculateSimulatedValue(), and findQualityFiles::size.

25  {
26  if (ALIUtils::debug >= 2)
27  printStartCalculateSimulatedValue(this); // important
28  //---------- Create light ray
29  LightRay* lightray = new LightRay;
30 
31  int isec = 0; //security variable to check OptOList().size()
32 
33  //---------- Loop list of OptO that take part in measurement
34  std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin();
35  //- if( ALIUtils::debug >= 5) std::cout << "OptOList size" <<OptOList().size() << std::endl;
36 
37  //----- Check that first object is 'laser' or 'source'
38  if ((*vocite)->type() != "laser" && (*vocite)->type() != "source") {
39  std::cerr << " first Optical object should be 'laser' or 'source'" << std::endl;
41  exit(1);
42  }
43 #ifdef COCOA_VIS
44  ALIVisLightPath* vispath = 0;
45  if (ALIUtils::getFirstTime()) {
47  if (gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
48  vispath = IgCocoaFileMgr::getInstance().newLightPath(name());
49  }
50  }
51 #endif
52 
53  //- while( (*vocite) != *(OptOList().end()) ) {
54  while ((vocite) != (OptOList().end())) {
55  if (ALIUtils::debug >= 2)
56  std::cout << std::endl << "@@@@ LR:OBJECT " << (*vocite)->name() << std::endl;
57  isec++;
58 
59  //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...)
60  ALIstring behav = getMeasuringBehaviour(vocite);
61 
62  //---------- Check that last object is a Sensor (that makes measuremnt and kill the lightray)
63  if (lightray) {
64  (*vocite)->participateInMeasurement(*lightray, *this, behav);
65 
66 #ifdef COCOA_VIS
67  if (ALIUtils::getFirstTime()) {
69  if (gomgr->GlobalOptions()["VisWriteVRML"] > 1) {
70  ALIVRMLMgr::getInstance().addLightPoint(lightray->point());
71  if (ALIUtils::debug >= 5)
72  std::cout << "ALIVRMLMg addLightPoint " << lightray->point() << (*vocite)->name() << std::endl;
73  }
74  if (gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
75  vispath->addLightPoint(lightray->point(), (*vocite));
76  }
77  }
78 #endif
79 
80  } else {
81  std::cerr << "!! Last object is not Sensor 2D in measurement " << name() << std::endl;
83  exit(1);
84  }
85 
86  ++vocite;
87  if (isec > ALIint(OptOList().size())) {
88  std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl;
89  exit(5);
90  }
91  //- lightray.normalizeDirection();
92  }
93 
94  delete lightray;
95 
96  if (ALIUtils::debug >= 9)
97  std::cout << "end calculateSimulatedValue" << std::endl;
98 }
size
Write out results.
int ALIint
Definition: CocoaGlobals.h:15
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject *>::const_iterator vocite)
Definition: Measurement.cc:568
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
void DumpBadOrderOptOs()
Definition: Measurement.cc:469
const CLHEP::Hep3Vector & point() const
Definition: LightRay.h:57
static ALIbool getFirstTime()
Definition: ALIUtils.h:87
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:427
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:101
const ALIstring & name() const
Definition: Measurement.h:86
def exit(msg="")

◆ correctValueAndSigma()

void MeasurementSensor2D::correctValueAndSigma ( )
overridevirtual

Reimplemented from Measurement.

Definition at line 137 of file MeasurementSensor2D.cc.

References gather_cfg::cout, ALIUtils::debug, Measurement::setValue(), theDisplaceX, theDisplaceY, theMultiplyX, theMultiplyY, heppy_batch::val, and Measurement::value().

137  {
138  //---------- Make displacement
139  ALIdouble val = value()[0];
140  val += theDisplaceX;
141  val *= theMultiplyX;
142  //- std::cout << " theDisplaceX " << theDisplaceX << " theMultiplyX " << theMultiplyX << std::endl;
143  if (ALIUtils::debug >= 4)
144  std::cout << "MeasurementSensor2D::correctValueAndSigma: "
145  << " old value X " << value()[0] << " new " << val << std::endl;
146  setValue(0, val);
147 
148  val = value()[1];
149  val += theDisplaceY;
150  val *= theMultiplyY;
151  if (ALIUtils::debug >= 4)
152  std::cout << "MeasurementSensor2D::correctValueAndSigma: old value Y " << value()[1] << " new " << val << std::endl;
153  setValue(1, val);
154 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble * value() const
Definition: Measurement.h:109
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:129
static ALIint debug
Definition: ALIUtils.h:34

◆ setConversionFactor()

void MeasurementSensor2D::setConversionFactor ( const std::vector< ALIstring > &  wordlist)
overridevirtual

Reimplemented from Measurement.

Definition at line 105 of file MeasurementSensor2D.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, ALIUtils::dumpVS(), beamvalidation::exit(), ALIUtils::IsNumber(), theDisplaceX, theDisplaceY, theMultiplyX, theMultiplyY, and Measurement::valueDimensionFactor().

105  {
106  //--------- Check that the format is OK
107  theDisplaceX = 0;
108  theDisplaceY = 0;
109  theMultiplyX = 1.;
110  theMultiplyY = 1.;
111  //- std::cout << " 0 factors for correction X = " << theDisplaceX << " Y " << theDisplaceY << std::endl;
112 
113  if (wordlist.size() == 1)
114  return;
115  if ((wordlist.size() != 3 && wordlist.size() != 5) || !ALIUtils::IsNumber(wordlist[1]) ||
116  !ALIUtils::IsNumber(wordlist[2])) {
117  std::cerr << "!! Sensor2D Measurement setConversionFactor: WRONG FORMAT " << std::endl
118  << "It should be: SENSOR2D displace_X displace_Y " << std::endl
119  << "It is: ";
120  ALIUtils::dumpVS(wordlist, " ", std::cerr);
121  exit(1);
122  }
123  theDisplaceX = atof(wordlist[1].c_str()) * valueDimensionFactor();
124  theDisplaceY = atof(wordlist[2].c_str()) * valueDimensionFactor();
125  //- std::cout << " factors for correction X = " << theDisplaceX << " Y " << theDisplaceY << std::endl;
126 
127  if (wordlist.size() == 5) {
128  theMultiplyX = atof(wordlist[3].c_str());
129  theMultiplyY = atof(wordlist[4].c_str());
130  } else {
131  theMultiplyX = 1.;
132  theMultiplyY = 1.;
133  }
134 }
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
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="")

Member Data Documentation

◆ theDisplaceX

ALIdouble MeasurementSensor2D::theDisplaceX
private

Definition at line 34 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theDisplaceY

ALIdouble MeasurementSensor2D::theDisplaceY
private

Definition at line 34 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theMultiplyX

ALIdouble MeasurementSensor2D::theMultiplyX
private

Definition at line 35 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theMultiplyY

ALIdouble MeasurementSensor2D::theMultiplyY
private

Definition at line 35 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().