CMS 3D CMS Logo

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

#include <MeasurementTiltmeter.h>

Inheritance diagram for MeasurementTiltmeter:
Measurement

Public Member Functions

void calculateSimulatedValue (ALIbool firstTime) override
 
void correctValueAndSigma () override
 
 MeasurementTiltmeter (const ALIint measdim, ALIstring &type, ALIstring &name)
 
 MeasurementTiltmeter ()
 
void setConversionFactor (const std::vector< ALIstring > &wordlist) override
 
 ~MeasurementTiltmeter () 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 theConstantTerm
 
ALIdouble theConstantTermSigma
 
ALIdouble theFactor
 
ALIdouble theFactorSigma
 
ALIdouble thePedestal
 
ALIdouble thePedestalSigma
 

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

Constructor & Destructor Documentation

◆ MeasurementTiltmeter() [1/2]

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

Definition at line 20 of file MeasurementTiltmeter.h.

21  : Measurement(measdim, type, name),
22  theFactor(1.),
23  theFactorSigma(0.),
24  theConstantTerm(0.),
26  thePedestal(0.),
27  thePedestalSigma(0.){};
const ALIstring & name() const
Definition: Measurement.h:86

◆ MeasurementTiltmeter() [2/2]

MeasurementTiltmeter::MeasurementTiltmeter ( )
inline

Definition at line 28 of file MeasurementTiltmeter.h.

28 {};

◆ ~MeasurementTiltmeter()

MeasurementTiltmeter::~MeasurementTiltmeter ( )
inlineoverride

Definition at line 29 of file MeasurementTiltmeter.h.

29 {};

Member Function Documentation

◆ calculateSimulatedValue()

void MeasurementTiltmeter::calculateSimulatedValue ( ALIbool  firstTime)
overridevirtual

Reimplemented from Measurement.

Definition at line 20 of file MeasurementTiltmeter.cc.

References DMR_cfg::cerr, gather_cfg::cout, ALIUtils::debug, Measurement::DumpBadOrderOptOs(), beamvalidation::exit(), Measurement::getMeasuringBehaviour(), Measurement::name(), Measurement::OptOList(), Measurement::printStartCalculateSimulatedValue(), and findQualityFiles::size.

20  {
21  if (ALIUtils::debug >= 2)
22  printStartCalculateSimulatedValue(this); // important for Examples/FakeMeas
23 
24  //--------- Check there is only one OptO of type 'tiltmeter'
25  std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin();
26  if (OptOList().size() != 1 || (*vocite)->type() == "distancemeter") {
27  std::cerr << "!!! ERROR in MeasurementTiltmeter: " << name()
28  << " There should only be one object of type 'tiltmeter' " << std::endl;
30  exit(1);
31  }
32 
33  //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...)
34  ALIstring behav = getMeasuringBehaviour(vocite);
35 
36  //---------- participate in Measurement
37  LightRay ll;
38  (*vocite)->participateInMeasurement(ll, *this, behav);
39 
40  if (ALIUtils::debug >= 5)
41  std::cout << "end calculateSimulatedValue" << std::endl;
42 }
size
Write out results.
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject *>::const_iterator vocite)
Definition: Measurement.cc:568
static ALIint debug
Definition: ALIUtils.h:34
void DumpBadOrderOptOs()
Definition: Measurement.cc:469
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 MeasurementTiltmeter::correctValueAndSigma ( )
overridevirtual

Reimplemented from Measurement.

Definition at line 97 of file MeasurementTiltmeter.cc.

References gather_cfg::cout, ALIUtils::debug, Measurement::setSigma(), Measurement::setValue(), Measurement::sigma(), mathSSE::sqrt(), theConstantTerm, theConstantTermSigma, theFactor, heppy_batch::val, and Measurement::value().

97  {
98  ALIdouble val = value()[0];
99  ALIdouble sig = sigma()[0];
100  if (ALIUtils::debug >= 4)
101  std::cout << "MeasurementTiltmeter::correctValueAndSigma: old value" << val << " +- " << sig << std::endl;
102  //---------- Substract pedestal
103  val -= theConstantTerm;
104  //- sig = sqrt(sig*sig + thePedestalSigma*thePedestalSigma );
105  //- std::cout << " sigma + pedestalSigma " << sig << " " << thePedestalSigma << std::endl;
106  //-if( thePedestal != 0. ) {
107  //- sig += sqrt( sig*sig + val*val*thePedestalSigma*thePedestalSigma/thePedestal/thePedestal );
108  //-}
109  //---------- Add error in constant term
110  sig = sqrt(sig * sig + theConstantTermSigma * theConstantTermSigma);
111  //- std::cout << " sigma + costantTermSigma " << sig << " " << theConstantTermSigma << std::endl;
112 
113  //---------- Convert to rad
114  //- std::cout << "FACTOR " << theFactor << "correct " << val << " " << thePedestal << std::endl;
115  val *= theFactor;
116  //-------- Do not correct the sigma!!!!
117  //- sig /= theFactor;
118  if (ALIUtils::debug >= 4)
119  std::cout << "MeasurementTiltmeter::correctValueAndSigma: new value " << val << " +- " << sig << std::endl;
120  setValue(0, val);
121  setSigma(0, sig);
122 }
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
void setSigma(ALIint coor, ALIdouble val)
Definition: Measurement.h:131
T sqrt(T t)
Definition: SSEVec.h:19
const ALIdouble * sigma() const
Definition: Measurement.h:112

◆ setConversionFactor()

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

Reimplemented from Measurement.

Definition at line 49 of file MeasurementTiltmeter.cc.

References DMR_cfg::cerr, ALIUtils::dumpVS(), beamvalidation::exit(), GlobalOptionMgr::getInstance(), GlobalOptionMgr::GlobalOptions(), ALIUtils::IsNumber(), Measurement::sigmaDimensionFactor(), theConstantTerm, theConstantTermSigma, theFactor, theFactorSigma, and Measurement::valueDimensionFactor().

49  {
50  //--------- Check that the format is OK
51  if (wordlist.size() == 1)
52  return;
53  if (wordlist.size() != 7 || !ALIUtils::IsNumber(wordlist[1]) || !ALIUtils::IsNumber(wordlist[3]) ||
54  !ALIUtils::IsNumber(wordlist[4]) || !ALIUtils::IsNumber(wordlist[6]) || wordlist[2] != ALIstring("+-") ||
55  wordlist[5] != ALIstring("+-")) {
56  std::cerr << "!! Tiltmeter Measurement setConversionFactor: WRONG FORMAT " << std::endl
57  << "It should be: TILTEMETER factor +- error constant_term +- error" << (wordlist.size() != 7)
58  << !ALIUtils::IsNumber(wordlist[1]) << !ALIUtils::IsNumber(wordlist[3])
59  << !ALIUtils::IsNumber(wordlist[4])
60  << !ALIUtils::IsNumber(wordlist[6])
61  // << (wordlist[2] != ALIstring("+-")) << (wordlist[5] != ALIstring("+-"))
62  << std::endl
63  << "It is: ";
64  ALIUtils::dumpVS(wordlist, " ", std::cerr);
65  exit(1);
66  }
67  theFactor = atof(wordlist[1].c_str());
68 
69  //------ correct by dimension of value of tiltmeter
71  ALIint dimfac = ALIint(gomgr->GlobalOptions()[ALIstring("tiltmeter_meas_value_dimension")]);
72  if (dimfac == 0) {
73  theFactor *= 1.;
74  } else if (dimfac == 1) {
75  theFactor *= 1.E-3;
76  } else if (dimfac == 2) {
77  theFactor *= 1.E-6;
78  } else {
79  std::cerr
80  << " !!!EXITING: error in global option tiltmeter_meas_value_dimension, it can only take values 0,1,2, not "
81  << dimfac;
82  }
83  theFactorSigma = atof(wordlist[3].c_str());
84  theConstantTerm = atof(wordlist[4].c_str()) * valueDimensionFactor();
85  theConstantTermSigma = atof(wordlist[6].c_str()) * sigmaDimensionFactor();
86  //- std::cout << "correctVal theConstantTerm" << theConstantTerm << valueDimensionFactor() << std::endl;
87  //----- Change value and sigma to dimensions used in SDF, because constant term and pedestal are in dimensions of SDF
88  //- thePedestal = atof(wordlist[7].c_str()) * valueDimensionFactor();
89  //-thePedestalSigma = atof(wordlist[9].c_str()) * sigmaDimensionFactor();
90  // std::cout << "reading thePedestalSigma " << thePedestalSigma << "= " << wordlist[9] << std::endl;
91  // TILTMETER 458.84 +- 1.58 0. +- 0. 1 +- 0
92 }
int ALIint
Definition: CocoaGlobals.h:15
static GlobalOptionMgr * getInstance()
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
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
virtual const ALIdouble sigmaDimensionFactor() const
Definition: Measurement.h:120
def exit(msg="")

Member Data Documentation

◆ theConstantTerm

ALIdouble MeasurementTiltmeter::theConstantTerm
private

Definition at line 43 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theConstantTermSigma

ALIdouble MeasurementTiltmeter::theConstantTermSigma
private

Definition at line 44 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theFactor

ALIdouble MeasurementTiltmeter::theFactor
private

Definition at line 41 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

◆ theFactorSigma

ALIdouble MeasurementTiltmeter::theFactorSigma
private

Definition at line 42 of file MeasurementTiltmeter.h.

Referenced by setConversionFactor().

◆ thePedestal

ALIdouble MeasurementTiltmeter::thePedestal
private

Definition at line 45 of file MeasurementTiltmeter.h.

◆ thePedestalSigma

ALIdouble MeasurementTiltmeter::thePedestalSigma
private

Definition at line 46 of file MeasurementTiltmeter.h.