CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
MeasurementCOPS Class Reference

#include <MeasurementCOPS.h>

Inheritance diagram for MeasurementCOPS:
Measurement

Public Member Functions

void calculateSimulatedValue (ALIbool firstTime) override
 
void correctValueAndSigma () override
 
 MeasurementCOPS (const ALIint measdim, ALIstring &type, ALIstring &name)
 
 MeasurementCOPS ()
 
void setConversionFactor (const std::vector< ALIstring > &wordlist) override
 
void setXlaserLine (unsigned int ii, int val) override
 
int xlaserLine (unsigned int ii) override
 
 ~MeasurementCOPS () 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)
 
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 ~Measurement ()
 

Private Attributes

ALIdouble theDisplace [4]
 
ALIint theXlaserLine [4]
 

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 MeasurementCOPS.h.

Constructor & Destructor Documentation

◆ MeasurementCOPS() [1/2]

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

Definition at line 20 of file MeasurementCOPS.h.

References cuy::ii, and theXlaserLine.

20  : Measurement(measdim, type, name) {
21  for (unsigned int ii = 0; ii < 4; ii++)
22  theXlaserLine[ii] = -1;
23  };
ii
Definition: cuy.py:589
ALIint theXlaserLine[4]
const ALIstring & name() const
Definition: Measurement.h:86

◆ MeasurementCOPS() [2/2]

MeasurementCOPS::MeasurementCOPS ( )
inline

Definition at line 24 of file MeasurementCOPS.h.

24 {};

◆ ~MeasurementCOPS()

MeasurementCOPS::~MeasurementCOPS ( )
inlineoverride

Definition at line 25 of file MeasurementCOPS.h.

25 {};

Member Function Documentation

◆ calculateSimulatedValue()

void MeasurementCOPS::calculateSimulatedValue ( ALIbool  firstTime)
overridevirtual

Reimplemented from Measurement.

Definition at line 25 of file MeasurementCOPS.cc.

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

25  {
26  if (ALIUtils::debug >= 2)
27  printStartCalculateSimulatedValue(this); // important for Examples/FakeMeas
28 
29  //---------- Create light ray
30  LightRay* lightray = new LightRay;
31 
32  //---------- Define types of OptO that may take part in the Measurement
33  ALIuint isec = 0; //security variable to check OptOList().size()
34 
35  //---------- Loop list of OptO that take part in measurement
36  std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin();
37  if (ALIUtils::debug >= 5)
38  std::cout << "OptOList size" << OptOList().size() << std::endl;
39 
40  //----- Check that first object is 'Xlaser'
41  if ((*vocite)->type() != "Xlaser") {
42  std::cerr << "!!ERROR MeasurementCOPS: first Optical object should be 'Xlaser'" << std::endl;
44  exit(1);
45  }
46 
47  //---------- Check that last object is a COPS Sensor (that makes measuremnt and kill the lightray)
48  if ((*(OptOList().end() - 1))->type() != "COPS") {
49  std::cerr << "!!ERROR MeasurementCOPS: last Optical object should be 'COPS'" << std::endl;
51  exit(1);
52  }
53 
54 #ifdef COCOA_VIS
55  ALIVisLightPath* vispath = 0;
56  if (ALIUtils::getFirstTime()) {
58  if (gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
59  vispath = IgCocoaFileMgr::getInstance().newLightPath(name());
60  }
61  }
62 #endif
63  std::cout << (vocite == OptOList().end()) << " vocite " << (*vocite)->name() << std::endl;
64  while (vocite != OptOList().end()) {
65  if (ALIUtils::debug >= -2)
66  std::cout << std::endl << "@@@@ LR:OBJECT " << (*vocite)->name() << std::endl;
67  isec++;
68 
69  //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...)
70  ALIstring behav = getMeasuringBehaviour(vocite);
71 
72  if (lightray) {
73  (*vocite)->participateInMeasurement(*lightray, *this, behav);
74 #ifdef COCOA_VIS
75  if (ALIUtils::getFirstTime()) {
77  if (gomgr->GlobalOptions()["VisWriteVRML"] > 1) {
78  ALIVRMLMgr::getInstance().addLightPoint(lightray->point());
79  // std::cout << "ALIVRMLMg addLightPoint " << lightray->point() << (*vocite)->name() << std::endl;
80  }
81  if (gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
82  vispath->addLightPoint(lightray->point(), *vocite);
83  }
84  }
85 #endif
86  } else {
87  std::cerr << "!! Last object is not Sensor 2D in measurement " << name() << std::endl;
89  exit(1);
90  }
91 
92  ++vocite;
93  if (isec > OptOList().size()) {
94  std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl;
95  exit(5);
96  }
97  }
98 
99  if (ALIUtils::debug >= 9)
100  std::cout << "end calculateSimulatedValue" << std::endl;
101 
102  delete lightray;
103 }
size
Write out results.
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
const ALIstring & type() const
Definition: Measurement.h:84
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
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ correctValueAndSigma()

void MeasurementCOPS::correctValueAndSigma ( )
overridevirtual

Reimplemented from Measurement.

Definition at line 134 of file MeasurementCOPS.cc.

References gather_cfg::cout, ALIUtils::debug, Measurement::dim(), cuy::ii, Measurement::setValue(), theDisplace, heppy_batch::val, and Measurement::value().

134  {
135  //---------- Make displacement
136  ALIuint ii;
137  for (ii = 0; ii < dim(); ii++) {
138  ALIdouble val = value()[ii];
139  val += theDisplace[ii];
140  if (ALIUtils::debug >= 9)
141  std::cout << "MeasurementCOPS::correctValueAndSigma: old value X " << value()[ii] << " new " << val << " +- "
142  << std::endl;
143  setValue(ii, val);
144  }
145 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIdouble * value() const
Definition: Measurement.h:109
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
ii
Definition: cuy.py:589
ALIdouble theDisplace[4]
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ setConversionFactor()

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

Reimplemented from Measurement.

Definition at line 110 of file MeasurementCOPS.cc.

References DMR_cfg::cerr, Measurement::dim(), ALIUtils::dumpVS(), beamvalidation::exit(), cuy::ii, ALIUtils::IsNumber(), theDisplace, and Measurement::valueDimensionFactor().

110  {
111  //--------- Set it to 0
112  ALIuint ii;
113  for (ii = 0; ii < dim(); ii++) {
114  theDisplace[ii] = 0.;
115  }
116 
117  //--------- Check that the format is OK
118  if (wordlist.size() == 1)
119  return;
120  if (wordlist.size() != 3 || !ALIUtils::IsNumber(wordlist[1]) || !ALIUtils::IsNumber(wordlist[2]) ||
121  !ALIUtils::IsNumber(wordlist[3]) || !ALIUtils::IsNumber(wordlist[4])) {
122  std::cerr << "!! SensorCOPS Measurement setConversionFactor: WRONG FORMAT " << std::endl
123  << "It should be: SENSOR2D displace_U displace_D displace_L displace_R " << std::endl
124  << "It is: ";
125  ALIUtils::dumpVS(wordlist, " ", std::cerr);
126  exit(1);
127  }
128 
129  for (ii = 0; ii < dim(); ii++) {
130  theDisplace[ii] = atof(wordlist[ii + 1].c_str()) * valueDimensionFactor();
131  }
132 }
const ALIuint dim() const
Definition: Measurement.h:82
virtual const ALIdouble valueDimensionFactor() const
Definition: Measurement.h:118
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
ii
Definition: cuy.py:589
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
ALIdouble theDisplace[4]
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ setXlaserLine()

void MeasurementCOPS::setXlaserLine ( unsigned int  ii,
int  val 
)
inlineoverridevirtual

Reimplemented from Measurement.

Definition at line 36 of file MeasurementCOPS.h.

36 { theXlaserLine[ii] = val; };
ii
Definition: cuy.py:589
ALIint theXlaserLine[4]

◆ xlaserLine()

int MeasurementCOPS::xlaserLine ( unsigned int  ii)
inlineoverridevirtual

Reimplemented from Measurement.

Definition at line 35 of file MeasurementCOPS.h.

References cuy::ii, and theXlaserLine.

35 { return theXlaserLine[ii]; }
ii
Definition: cuy.py:589
ALIint theXlaserLine[4]

Member Data Documentation

◆ theDisplace

ALIdouble MeasurementCOPS::theDisplace[4]
private

Definition at line 36 of file MeasurementCOPS.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theXlaserLine

ALIint MeasurementCOPS::theXlaserLine[4]
private

Definition at line 41 of file MeasurementCOPS.h.

Referenced by MeasurementCOPS(), and xlaserLine().