CMS 3D CMS Logo

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

#include <MeasurementSensor2D.h>

Inheritance diagram for MeasurementSensor2D:
Measurement

Public Member Functions

virtual void calculateSimulatedValue (ALIbool firstTime)
 
virtual void correctValueAndSigma ()
 
 MeasurementSensor2D (const ALIint measdim, ALIstring &type, ALIstring &name)
 
 MeasurementSensor2D ()
 
virtual void setConversionFactor (const std::vector< ALIstring > &wordlist)
 
 ~MeasurementSensor2D ()
 
- 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 = 0
 
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::MeasurementSensor2D ( const ALIint  measdim,
ALIstring type,
ALIstring name 
)
inline

Definition at line 21 of file MeasurementSensor2D.h.

21 : Measurement( measdim, type, name ){ };
type
Definition: HCALResponse.h:21
const ALIstring & name() const
Definition: Measurement.h:90
MeasurementSensor2D::MeasurementSensor2D ( )
inline

Definition at line 22 of file MeasurementSensor2D.h.

22 { };
MeasurementSensor2D::~MeasurementSensor2D ( )
inline

Definition at line 23 of file MeasurementSensor2D.h.

23 { };

Member Function Documentation

void MeasurementSensor2D::calculateSimulatedValue ( ALIbool  firstTime)
virtual

Reimplemented from Measurement.

Definition at line 25 of file MeasurementSensor2D.cc.

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

26 {
27 
28  if( ALIUtils::debug >= 2) printStartCalculateSimulatedValue( this ); // important
29  //---------- Create light ray
30  LightRay* lightray = new LightRay;
31 
32  int isec = 0; //security variable to check OptOList().size()
33 
34  //---------- Loop list of OptO that take part in measurement
35  std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin();
36  //- if( ALIUtils::debug >= 5) std::cout << "OptOList size" <<OptOList().size() << std::endl;
37 
38  //----- Check that first object is 'laser' or 'source'
39  if( (*vocite)->type() != "laser" && (*vocite)->type() != "source" ) {
40  std::cerr << " first Optical object should be 'laser' or 'source'" << std::endl;
42  exit(1);
43  }
44 #ifdef COCOA_VIS
45  ALIVisLightPath* vispath = 0;
46  if( ALIUtils::getFirstTime() ) {
48  if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
49  vispath = IgCocoaFileMgr::getInstance().newLightPath( name() );
50  }
51  }
52 #endif
53 
54  //- while( (*vocite) != *(OptOList().end()) ) {
55  while( (vocite) != (OptOList().end()) ) {
56  if( ALIUtils::debug >= 2) 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)std::cout << "ALIVRMLMg addLightPoint " << lightray->point() << (*vocite)->name() << std::endl;
72  }
73  if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
74  vispath->addLightPoint( lightray->point(), (*vocite) );
75  }
76  }
77 #endif
78 
79  } else {
80  std::cerr << "!! Last object is not Sensor 2D in measurement " << name() << std::endl;
82  exit(1);
83  }
84 
85  ++vocite;
86  if ( isec > ALIint(OptOList().size()) ) {
87  std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl;
88  exit(5);
89  }
90  //- lightray.normalizeDirection();
91  }
92 
93  delete lightray;
94 
95  if(ALIUtils::debug >= 9) std::cout << "end calculateSimulatedValue" <<std::endl;
96 
97 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:35
static GlobalOptionMgr * getInstance()
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject * >::const_iterator vocite)
Definition: Measurement.cc:592
void DumpBadOrderOptOs()
Definition: Measurement.cc:488
const CLHEP::Hep3Vector & point() const
Definition: LightRay.h:52
#define end
Definition: vmac.h:37
const std::vector< OpticalObject * > & OptOList() const
Definition: Measurement.h:109
static ALIbool getFirstTime()
Definition: ALIUtils.h:100
std::string ALIstring
Definition: CocoaGlobals.h:9
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:445
const ALIstring & name() const
Definition: Measurement.h:90
tuple cout
Definition: gather_cfg.py:145
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
tuple size
Write out results.
void MeasurementSensor2D::correctValueAndSigma ( )
virtual

Reimplemented from Measurement.

Definition at line 139 of file MeasurementSensor2D.cc.

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

140 {
141  //---------- Make displacement
142  ALIdouble val = value()[0];
143  val += theDisplaceX;
144  val *= theMultiplyX;
145  //- std::cout << " theDisplaceX " << theDisplaceX << " theMultiplyX " << theMultiplyX << std::endl;
146  if(ALIUtils::debug >= 4) std::cout << "MeasurementSensor2D::correctValueAndSigma: " << " old value X " << value()[0] << " new " << val << std::endl;
147  setValue( 0, val );
148 
149  val = value()[1];
150  val += theDisplaceY;
151  val *= theMultiplyY;
152  if(ALIUtils::debug >= 4) std::cout << "MeasurementSensor2D::correctValueAndSigma: old value Y " << value()[1] << " new " << val << std::endl;
153  setValue( 1, val );
154 
155 }
long double ALIdouble
Definition: CocoaGlobals.h:11
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:167
static ALIint debug
Definition: ALIUtils.h:35
const ALIdouble * value() const
Definition: Measurement.h:125
tuple cout
Definition: gather_cfg.py:145
void MeasurementSensor2D::setConversionFactor ( const std::vector< ALIstring > &  wordlist)
virtual

Reimplemented from Measurement.

Definition at line 106 of file MeasurementSensor2D.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, ALIUtils::dumpVS(), cmsRelvalreport::exit, ALIUtils::IsNumber(), theDisplaceX, theDisplaceY, theMultiplyX, theMultiplyY, and Measurement::valueDimensionFactor().

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

Member Data Documentation

ALIdouble MeasurementSensor2D::theDisplaceX
private

Definition at line 36 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

ALIdouble MeasurementSensor2D::theDisplaceY
private

Definition at line 36 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

ALIdouble MeasurementSensor2D::theMultiplyX
private

Definition at line 37 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

ALIdouble MeasurementSensor2D::theMultiplyY
private

Definition at line 37 of file MeasurementSensor2D.h.

Referenced by correctValueAndSigma(), and setConversionFactor().