CMS 3D CMS Logo

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::MeasurementCOPS ( const ALIint  measdim,
ALIstring type,
ALIstring name 
)
inline

Definition at line 21 of file MeasurementCOPS.h.

References cuy::ii, and theXlaserLine.

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

Definition at line 25 of file MeasurementCOPS.h.

25 { };
MeasurementCOPS::~MeasurementCOPS ( )
inlineoverride

Definition at line 26 of file MeasurementCOPS.h.

References calculateSimulatedValue(), correctValueAndSigma(), and setConversionFactor().

26 { };

Member Function Documentation

void MeasurementCOPS::calculateSimulatedValue ( ALIbool  firstTime)
overridevirtual

Reimplemented from Measurement.

Definition at line 25 of file MeasurementCOPS.cc.

References MessageLogger_cfi::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(), findQualityFiles::size, and Measurement::type().

Referenced by ~MeasurementCOPS().

26 {
27 
28  if( ALIUtils::debug >= 2) printStartCalculateSimulatedValue( this ); // important for Examples/FakeMeas
29 
30  //---------- Create light ray
31  LightRay* lightray = new LightRay;
32 
33  //---------- Define types of OptO that may take part in the Measurement
34  ALIuint isec = 0; //security variable to check OptOList().size()
35 
36  //---------- Loop list of OptO that take part in measurement
37  std::vector<OpticalObject*>::const_iterator vocite = OptOList().begin();
38  if( ALIUtils::debug >= 5) 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) std::cout << std::endl << "@@@@ LR:OBJECT " << (*vocite)->name() << std::endl;
66  isec ++;
67 
68  //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...)
69  ALIstring behav = getMeasuringBehaviour(vocite);
70 
71  if( lightray ) {
72  (*vocite)->participateInMeasurement( *lightray, *this, behav );
73 #ifdef COCOA_VIS
74  if( ALIUtils::getFirstTime() ) {
76  if(gomgr->GlobalOptions()["VisWriteVRML"] > 1) {
77  ALIVRMLMgr::getInstance().addLightPoint( lightray->point());
78  // std::cout << "ALIVRMLMg addLightPoint " << lightray->point() << (*vocite)->name() << std::endl;
79  }
80  if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
81  vispath->addLightPoint( lightray->point(), *vocite );
82  }
83  }
84 #endif
85  } else {
86  std::cerr << "!! Last object is not Sensor 2D in measurement " << name() << std::endl;
88  exit(1);
89  }
90 
91  ++vocite;
92  if ( isec > OptOList().size() ) {
93  std::cerr << "ERROR DE PROGRAMACION EN GetSimulatedValue" << std::endl;
94  exit(5);
95  }
96  }
97 
98 
99  if(ALIUtils::debug >= 9) std::cout << "end calculateSimulatedValue" <<std::endl;
100 
101  delete lightray;
102 }
size
Write out results.
static ALIint debug
Definition: ALIUtils.h:36
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:101
const ALIstring & type() const
Definition: Measurement.h:86
std::string ALIstring
Definition: CocoaGlobals.h:9
void printStartCalculateSimulatedValue(const Measurement *meas)
Definition: Measurement.cc:445
const ALIstring & name() const
Definition: Measurement.h:90
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
unsigned int ALIuint
Definition: CocoaGlobals.h:17
void MeasurementCOPS::correctValueAndSigma ( )
overridevirtual

Reimplemented from Measurement.

Definition at line 139 of file MeasurementCOPS.cc.

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

Referenced by ~MeasurementCOPS().

140 {
141  //---------- Make displacement
142  ALIuint ii;
143  for( ii = 0; ii < dim(); ii++) {
144  ALIdouble val = value()[ii];
145  val += theDisplace[ii];
146  if(ALIUtils::debug >= 9) std::cout << "MeasurementCOPS::correctValueAndSigma: old value X " << value()[ii] << " new " << val << " +- " << std::endl;
147  setValue( ii, val );
148  }
149 
150 }
long double ALIdouble
Definition: CocoaGlobals.h:11
const ALIuint dim() const
Definition: Measurement.h:82
void setValue(ALIint coor, ALIdouble val)
Definition: Measurement.h:167
static ALIint debug
Definition: ALIUtils.h:36
ii
Definition: cuy.py:588
ALIdouble theDisplace[4]
const ALIdouble * value() const
Definition: Measurement.h:125
unsigned int ALIuint
Definition: CocoaGlobals.h:17
void MeasurementCOPS::setConversionFactor ( const std::vector< ALIstring > &  wordlist)
overridevirtual

Reimplemented from Measurement.

Definition at line 111 of file MeasurementCOPS.cc.

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

Referenced by ~MeasurementCOPS().

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

Reimplemented from Measurement.

Definition at line 39 of file MeasurementCOPS.h.

39  {
40  theXlaserLine[ii] = val;};
ii
Definition: cuy.py:588
ALIint theXlaserLine[4]
int MeasurementCOPS::xlaserLine ( unsigned int  ii)
inlineoverridevirtual

Reimplemented from Measurement.

Definition at line 36 of file MeasurementCOPS.h.

References cuy::ii, and theXlaserLine.

36  {
37  return theXlaserLine[ii];
38  }
ii
Definition: cuy.py:588
ALIint theXlaserLine[4]

Member Data Documentation

ALIdouble MeasurementCOPS::theDisplace[4]
private

Definition at line 40 of file MeasurementCOPS.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

ALIint MeasurementCOPS::theXlaserLine[4]
private

Definition at line 45 of file MeasurementCOPS.h.

Referenced by MeasurementCOPS(), and xlaserLine().