CMS 3D CMS Logo

Measurement.h

Go to the documentation of this file.
00001 // COCOA class header file
00002 // Id:  Measurement.h
00003 // CAT: Model
00004 //
00005 // Class for measurements
00006 // 
00007 // History: v1.0.0
00008 // v1.1.0: add measurementsFileName
00009 // 
00010 // Authors:
00011 //   Pedro Arce
00012 
00013 #ifndef _MEASUREMENT_HH
00014 #define _MEASUREMENT_HH
00015 
00016 #include <vector>
00017 
00018 #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
00019 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
00020 class OpticalObject;
00021 class Entry;
00022 class EntryLength;
00023 class OpticalAlignMeasurementInfo;
00024 
00025 
00026 class Measurement
00027 { 
00028 public:
00029   //----- Constructors / destructor
00030   Measurement( const ALIint measdim, ALIstring& type, ALIstring& name );
00031   Measurement(){ };   
00032   virtual ~Measurement();
00033     
00034   // construct Measurement reading date from file
00035   void construct();
00036   void postConstruct();
00037   // Fill the list of names of OptOs that take part in this measurement ( names only )
00038   virtual void buildOptONamesList( const std::vector<ALIstring>& wl );
00039   // Fill the data 
00040   void fillData(ALIuint coor, const std::vector<ALIstring>& wl );
00041   // Convert OptOs names in OptOs pointers
00042   void buildOptOList();
00043   // Make list including every entry of every ancestor of each Measured OptO
00044   void buildAffectingEntryList();
00045   void addAffectingEntriesFromOptO( const OpticalObject* optoP );
00046 
00047   // Get simulated value (called every time a parameter is displaced)
00048   virtual void calculateSimulatedValue( ALIbool firstTime ) {};
00049   // Get simulated value original (called every time a parameter value is changed: after getting values from file and every non-linear fit iteration )
00050   void calculateOriginalSimulatedValue();
00051 
00052   // Dump the list of OptO names (used mainly when checking their order)
00053   void DumpBadOrderOptOs();
00054 
00055   // Calculate derivative of this Measurement with respect to a parameter of an Entry
00056   ALIdouble* DerivativeRespectEntry( Entry* entry );
00057 
00058   // get the ':X' that determines how the behaviour of the OptO w.r.t. this Measurement
00059   ALIstring getMeasuringBehaviour( const std::vector< OpticalObject* >::const_iterator vocite);
00060 
00061  // Get the previous OptOs in the list of OptO that take part in this measurement
00062   const OpticalObject* getPreviousOptO( const OpticalObject* Popto ) const;
00063   //---------- Add any correction between the measurement data and the default format in COCOA
00064   virtual void correctValueAndSigma(){};
00065 
00066   //---------- Convert from V to rad
00067   virtual void setConversionFactor( const std::vector<ALIstring>& wordlist ){
00068     std::cerr << " Measurement::setConversionFactor should never be called " << std::endl;
00069     exit(1); };
00070 
00072   static void setCurrentDate( const std::vector<ALIstring>& wl );
00073 
00074   void copyMeas( Measurement* meas, const std::string& subsstr1, const std::string& subsstr2 );
00075 
00076   void constructFromOA( OpticalAlignMeasurementInfo&  measInfo ) ;
00077 
00078  // ACCESS DATA MEMBERS
00079   const ALIuint dim() const { 
00080     return theDim;
00081   }
00082  
00083   const ALIstring& type() const {
00084     return theType;
00085   }
00086   
00087   const ALIstring& name() const {
00088     return theName;
00089   }
00090 
00091   const ALIstring& sensorName() {
00092     ALIstring sensName = theName;
00093     ALIint colon = theName.find(':');
00094     theName = theName.substr(colon+1, theName.length()-colon);
00095     return theName;
00096   }
00097   
00098   //  const OpticalObject* OptOCurrent() const {
00099   //  return _OptOCurrent;
00100   // }
00101   
00102   const std::vector<ALIstring>& OptONameList() const {
00103     return _OptONameList;
00104   }
00105   
00106   std::vector<OpticalObject*>& OptOList() {
00107     return _OptOList;
00108   }
00109   
00110   const std::vector<Entry*>& affectingEntryList() const {
00111     return theAffectingEntryList;
00112   }
00113   
00114   const  ALIdouble valueSimulated( ALIuint ii ) const {
00115     return theValueSimulated[ii];
00116   }
00117 
00118   const ALIdouble valueSimulated_orig( ALIuint ii ) const {
00119     return theValueSimulated_orig[ii];
00120   }
00121 
00122   const ALIdouble* value() const {
00123     return theValue;
00124   } 
00125   const ALIdouble value( uint ii ) const {
00126     return theValue[ii];
00127   } 
00128 
00129   const ALIdouble* sigma() const {
00130     return theSigma;
00131   } 
00132 
00133   const ALIdouble sigma( uint ii) const {
00134     return theSigma[ii];
00135   } 
00136 
00137   const ALIstring valueType( uint ii) const {
00138     return theValueType[ii];
00139   } 
00140 
00141   virtual const ALIdouble valueDimensionFactor() const{
00142     return ALIUtils::LengthValueDimensionFactor();
00143   }
00144 
00145   virtual const ALIdouble sigmaDimensionFactor() const{
00146     return ALIUtils::LengthSigmaDimensionFactor();
00147   }
00148 
00149   static ALIstring getCurrentDate(){
00150     return theCurrentDate;
00151   }
00152   static ALIstring getCurrentTime(){
00153     return theCurrentTime;
00154   }
00155 
00156   const Hep3Vector& getLightRayPosition( ) const{
00157     return theLightRayPosition; 
00158   }
00159   const Hep3Vector& getLightRayDirection( ) const{ 
00160     return theLightRayDirection; 
00161   }
00162 
00163  // SET DATA MEMBERS
00164   void setValue( ALIint coor, ALIdouble val) {
00165     theValue[coor] = val;
00166   }
00167   
00168   void setSigma( ALIint coor, ALIdouble val) {
00169     theSigma[coor] = val;
00170     //-    std::cout << coor << " setting sigma " << theSigma[coor] << std::endl;
00171   }
00172 
00173   void setType( ALIstring type ) {
00174     theType = type;
00175   }
00176 
00177   void SetDimension(ALIuint dim) {
00178     theDim = dim;
00179   }    
00180 
00181   void AddOptONameListItem(ALIstring optos) {
00182       _OptONameList.push_back( optos );
00183   }
00184 
00185   void AddOptOListItem(OpticalObject* opto) {
00186       _OptOList.push_back( opto );
00187   }
00188 
00189   void setValueSimulated_orig( ALIint coor, ALIdouble value) {
00190       theValueSimulated_orig[coor] = value;
00191   }
00192 
00193   void setValueSimulated( ALIint coor, ALIdouble value) {
00194       theValueSimulated[coor] = value;
00195   }
00196   virtual int xlaserLine( uint ii) { std::cerr << "!!!! Measurement::xlaserLine is not returning anything " << std::endl; abort(); };
00197  
00198   //----- Set name as type plus name of last OptO 
00199   void setName();
00200 
00201   // Check is value is simulated
00202   bool valueIsSimulated(ALIint coor) {
00203       return theValueIsSimulated[coor];
00204   }
00205 
00206   virtual void setXlaserLine( uint ii, int val ) { };
00207 
00208  static ALIdouble cameraScaleFactor;
00209 
00210  static ALIstring& measurementsFileName() { 
00211    return theMeasurementsFileName;
00212  }
00213  static void setMeasurementsFileName( const ALIstring& filename ) { 
00214    //-   std::cout << " setting file name " << filename << std::endl;
00215    theMeasurementsFileName = filename;
00216    //-   std::cout << " dsetting file name " << filename << std::endl;
00217  }
00218 
00219  void setLightRayPosition( const Hep3Vector& lightRayPosition )
00220    { theLightRayPosition = lightRayPosition; }
00221  void setLightRayDirection( const Hep3Vector& lightRayDirection )
00222    { theLightRayDirection = lightRayDirection; }
00223 
00224  protected:  
00225   // Substitute '..' by parent OptO in name 
00226   void Substitute2p( ALIstring& ref, const ALIstring& firstref, int NtwoPoints);
00227   void printStartCalculateSimulatedValue( const Measurement* meas);
00228 
00229 
00230  // private DATA MEMBERS
00231 private:
00232   ALIuint theDim;
00233   ALIstring theType;
00234   ALIdouble* theValue;  
00235   ALIdouble* theSigma;
00236   ALIstring theName;  //name of last OptO
00237   ALIstring* theValueType;  //type of each measurement value (e.g. H:, TA:)
00238 
00239   //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement
00240   ALIdouble* theValueSimulated;
00241   //----- values of measurement obtained simulating the light ray through all the OptO that take part in the measurement, for original values of every entry
00242   ALIdouble* theValueSimulated_orig;
00243 
00244   //-  ALIdouble* theSigmaErrorPropagation;
00245   //-  ALIdouble* theSigmaRegression;
00246 
00247   //----- Boolean to indicate if theValueSimulated_orig is set equal to the simulated values with original entries
00248   ALIbool* theValueIsSimulated;
00249 
00250   //----- List of OptOs that take part in this measurement ( names only )
00251   std::vector<ALIstring> _OptONameList;
00252   //----- List of OptOs that take part in this measurement ( pointers )
00253   std::vector<OpticalObject*> _OptOList;
00254   //----- List of OptOs Measured and their ancestors
00255   std::vector<Entry*> theAffectingEntryList;
00256 
00257   Hep3Vector theLightRayPosition;
00258   Hep3Vector theLightRayDirection;
00259   static ALIstring theMeasurementsFileName;
00260 
00261   static ALIstring theCurrentDate;  
00262   static ALIstring theCurrentTime;  
00263  public:
00264   static ALIbool only1;
00265   static ALIstring only1Date;
00266   static ALIstring only1Time;
00267 
00268 };
00269 
00270 #endif

Generated on Tue Jun 9 17:23:36 2009 for CMSSW by  doxygen 1.5.4