CMS 3D CMS Logo

Public Member Functions | Private Attributes

MeasurementDiffEntry Class Reference

#include <MeasurementDiffEntry.h>

Inheritance diagram for MeasurementDiffEntry:
Measurement

List of all members.

Public Member Functions

virtual void buildOptONamesList (const std::vector< ALIstring > &wl)
virtual void calculateSimulatedValue (ALIbool firstTime)
 MeasurementDiffEntry ()
 MeasurementDiffEntry (const ALIint measdim, ALIstring &type, ALIstring &name)
 ~MeasurementDiffEntry ()

Private Attributes

ALIstring theEntryNameFirst
ALIstring theEntryNameSecond

Detailed Description

Definition at line 18 of file MeasurementDiffEntry.h.


Constructor & Destructor Documentation

MeasurementDiffEntry::MeasurementDiffEntry ( const ALIint  measdim,
ALIstring type,
ALIstring name 
) [inline]

Definition at line 21 of file MeasurementDiffEntry.h.

    : Measurement( measdim, type, name ){};
MeasurementDiffEntry::MeasurementDiffEntry ( ) [inline]

Definition at line 23 of file MeasurementDiffEntry.h.

{ };   
MeasurementDiffEntry::~MeasurementDiffEntry ( ) [inline]

Definition at line 24 of file MeasurementDiffEntry.h.

{ };

Member Function Documentation

void MeasurementDiffEntry::buildOptONamesList ( const std::vector< ALIstring > &  wl) [virtual]

Reimplemented from Measurement.

Definition at line 25 of file MeasurementDiffEntry.cc.

References Measurement::AddOptONameListItem(), dtNoiseDBValidation_cfg::cerr, ALIFileIn::ErrorInLine(), cmsRelvalreport::exit, ALIFileIn::getInstance(), Model::SDFName(), theEntryNameFirst, and theEntryNameSecond.

{

  int NPairs = (wl.size()+1)/2;   // Number of OptO names ( pair of name and '&' )

  //--------- Fill list with names 
  for ( int ii=0; ii<NPairs; ii++ ) {
    //--- take out Entry names from object names
    int isl = wl[ii*2].rfind("/");
    AddOptONameListItem( wl[ii*2].substr(0,isl) );
    // Check for separating '&'
    if (ii != NPairs-1 && wl[2*ii+1] != ALIstring("&") ) {
      ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();
      std::cerr << "!!! Measured Optical Objects should be separated by '&', not by" 
                << wl[2*ii+1] << std::endl; 
      exit(2);
    }
    //---- Fill entry names
    if( ii == 0 ){
      theEntryNameFirst = wl[ii*2].substr(isl+1,999);
    }else if( ii == 1 ){
      theEntryNameSecond = wl[ii*2].substr(isl+1,999);
    }

  }
 
}
void MeasurementDiffEntry::calculateSimulatedValue ( ALIbool  firstTime) [virtual]

Reimplemented from Measurement.

Definition at line 56 of file MeasurementDiffEntry.cc.

References begin, dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ALIUtils::debug, Measurement::DumpBadOrderOptOs(), alignCSCRings::e, exception, Model::getEntryByName(), ALIUtils::getFirstTime(), GlobalOptionMgr::getInstance(), GlobalOptionMgr::GlobalOptions(), Entry::name(), Measurement::name(), Measurement::OptOList(), Measurement::printStartCalculateSimulatedValue(), Measurement::setValueSimulated(), findQualityFiles::size, theEntryNameFirst, theEntryNameSecond, Measurement::value(), Entry::valueDisplaced(), and Measurement::valueSimulated().

{
 
  if( ALIUtils::debug >= 2) printStartCalculateSimulatedValue( this ); // important for Examples/FakeMeas

  //---------- Loop list of OptO that take part in measurement
  std::vector<OpticalObject*>::const_iterator vocite =  OptOList().begin();
  if( ALIUtils::debug >= 5) std::cout  << "OptOList size" <<OptOList().size() << std::endl;

  //----- Check that there are only two objects
  if( OptOList().size() == !2 ) {
    std::cerr << "!!! ERROR in MeasurementDiffEntry: " << name() << " There should only be two objects " << std::endl;
    std::cerr << " 1st " << (*vocite)->name() << " 2nd " << (*vocite+1)->name()  << std::endl;
    DumpBadOrderOptOs();
    std::exception();
  }     

#ifdef COCOA_VIS
  ALIVisLightPath* vispath = 0;
  if( ALIUtils::getFirstTime() ) {
    GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
    if(gomgr->GlobalOptions()["VisWriteIguana"] > 1) {
      vispath = IgCocoaFileMgr::getInstance().newLightPath( name() );
    } 
  }
#endif

  //--- This is a special 'measurement': it represents the fact that you have measured two entries one relative to the other (e.g. relative angle of two objects)
  Entry* entry1 = Model::getEntryByName( (*(OptOList().begin()))->longName(), theEntryNameFirst );
  Entry* entry2 = Model::getEntryByName( (*(OptOList().begin()+1))->longName(), theEntryNameSecond );
  if( ALIUtils::debug >= 5) std::cout << "  entry1 " << (*(OptOList().begin()))->longName() << "/" << entry1->name() << " ->valueDisplaced() " << entry1->valueDisplaced() << " entry2 " <<  (*(OptOList().begin()+1))->longName() << "/" << entry2->name() << " ->valueDisplaced() " << entry2->valueDisplaced() << std::endl;
  setValueSimulated( 0, entry1->valueDisplaced() - entry2->valueDisplaced() );

  if (ALIUtils::debug >= 2) {
    ALIdouble detD = 1000*valueSimulated(0); if(fabs(detD) <= 1.e-9 ) detD = 0.;
    std::cout << "REAL value: " <<"D: " << 1000.*value()[0] << " (mm)  " << (this)->name() 
              << "   DIFF= " << detD-1000*value()[0] << std::endl;
    std::cout << "SIMU value: " << "D: " << detD << " (mm)  " << (this)->name() << std::endl;
  }
  
  if(ALIUtils::debug >= 5) std::cout << "end calculateSimulatedValue" <<std::endl;
  
}

Member Data Documentation

Definition at line 33 of file MeasurementDiffEntry.h.

Referenced by buildOptONamesList(), and calculateSimulatedValue().

Definition at line 34 of file MeasurementDiffEntry.h.

Referenced by buildOptONamesList(), and calculateSimulatedValue().