CMS 3D CMS Logo

Public Member Functions | Private Attributes

MeasurementTiltmeter Class Reference

#include <MeasurementTiltmeter.h>

Inheritance diagram for MeasurementTiltmeter:
Measurement

List of all members.

Public Member Functions

virtual void calculateSimulatedValue (ALIbool firstTime)
virtual void correctValueAndSigma ()
 MeasurementTiltmeter (const ALIint measdim, ALIstring &type, ALIstring &name)
 MeasurementTiltmeter ()
virtual void setConversionFactor (const std::vector< ALIstring > &wordlist)
 ~MeasurementTiltmeter ()

Private Attributes

ALIdouble theConstantTerm
ALIdouble theConstantTermSigma
ALIdouble theFactor
ALIdouble theFactorSigma
ALIdouble thePedestal
ALIdouble thePedestalSigma

Detailed Description

Definition at line 18 of file MeasurementTiltmeter.h.


Constructor & Destructor Documentation

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

Definition at line 21 of file MeasurementTiltmeter.h.

MeasurementTiltmeter::MeasurementTiltmeter ( ) [inline]

Definition at line 23 of file MeasurementTiltmeter.h.

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

Definition at line 24 of file MeasurementTiltmeter.h.

{ };

Member Function Documentation

void MeasurementTiltmeter::calculateSimulatedValue ( ALIbool  firstTime) [virtual]

Reimplemented from Measurement.

Definition at line 20 of file MeasurementTiltmeter.cc.

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

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

  //--------- Check there is only one OptO of type 'tiltmeter'
  std::vector<OpticalObject*>::const_iterator vocite =  OptOList().begin();
  if( OptOList().size() != 1 ||
      (*vocite)->type() == "distancemeter") {
    std::cerr << "!!! ERROR in MeasurementTiltmeter: " << name() << " There should only be one object of type 'tiltmeter' " << std::endl;
    DumpBadOrderOptOs();
    exit(1);
  }     
  
  //---------- Get the behaviour of the object w.r.t the measurement (if it reflects the light, let it traverse it, ...)
  ALIstring behav = getMeasuringBehaviour(vocite);
  
  //---------- participate in Measurement
  LightRay ll;
  (*vocite)->participateInMeasurement( ll, *this, behav );

  if(ALIUtils::debug >= 5) std::cout << "end calculateSimulatedValue" <<std::endl;
  
}
void MeasurementTiltmeter::correctValueAndSigma ( ) [virtual]

Reimplemented from Measurement.

Definition at line 100 of file MeasurementTiltmeter.cc.

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

{
  ALIdouble val = value()[0];
  ALIdouble sig = sigma()[0];
  if(ALIUtils::debug >= 4) std::cout << "MeasurementTiltmeter::correctValueAndSigma: old value" << val << " +- " << sig << std::endl;
   //---------- Substract pedestal
  val -= theConstantTerm;
  //-  sig = sqrt(sig*sig  + thePedestalSigma*thePedestalSigma );
  //-  std::cout << " sigma + pedestalSigma " << sig << " " << thePedestalSigma << std::endl;
  //-if( thePedestal != 0. ) {
    //-    sig += sqrt( sig*sig + val*val*thePedestalSigma*thePedestalSigma/thePedestal/thePedestal );
  //-}
  //---------- Add error in constant term
  sig = sqrt( sig*sig + theConstantTermSigma*theConstantTermSigma );
  //- std::cout << " sigma + costantTermSigma " << sig << " " << theConstantTermSigma << std::endl;

  //---------- Convert to rad 
  //- std::cout << "FACTOR " << theFactor << "correct " << val << " "  << thePedestal << std::endl; 
  val *= theFactor; 
  //-------- Do not correct the sigma!!!!
  //-  sig /= theFactor; 
  if(ALIUtils::debug >= 4) std::cout << "MeasurementTiltmeter::correctValueAndSigma: new value " << val << " +- " << sig << std::endl;
  setValue( 0, val );
  setSigma( 0, sig );

}
void MeasurementTiltmeter::setConversionFactor ( const std::vector< ALIstring > &  wordlist) [virtual]

Reimplemented from Measurement.

Definition at line 52 of file MeasurementTiltmeter.cc.

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

{
  //--------- Check that the format is OK
  if(wordlist.size() == 1) return; 
  if( wordlist.size() != 7
    || !ALIUtils::IsNumber(wordlist[1]) || !ALIUtils::IsNumber(wordlist[3]) 
    || !ALIUtils::IsNumber(wordlist[4]) || !ALIUtils::IsNumber(wordlist[6])
    || wordlist[2] != ALIstring("+-")|| wordlist[5] != ALIstring("+-") ){  
    std::cerr << "!! Tiltmeter Measurement setConversionFactor: WRONG FORMAT "<<  std::endl 
         << "It should be: TILTEMETER factor +- error constant_term +- error"
         << (wordlist.size() != 7)
         <<  !ALIUtils::IsNumber(wordlist[1])  << !ALIUtils::IsNumber(wordlist[3]) 
         << !ALIUtils::IsNumber(wordlist[4]) << !ALIUtils::IsNumber(wordlist[6])
      //         << (wordlist[2] != ALIstring("+-")) << (wordlist[5] != ALIstring("+-")) 
<<  std::endl 
         << "It is: ";
    ALIUtils::dumpVS( wordlist, " ", std::cerr );
    exit(1);
  }
  theFactor = atof(wordlist[1].c_str());

  //------ correct by dimension of value of tiltmeter
  GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
  ALIint dimfac = ALIint( gomgr->GlobalOptions()[ ALIstring("tiltmeter_meas_value_dimension") ] );
  if( dimfac == 0 ) {
    theFactor *= 1.;
  } else if( dimfac == 1 ) {
    theFactor *= 1.E-3;
  } else if( dimfac == 2 ) {
    theFactor *= 1.E-6;
  } else {
    std::cerr << " !!!EXITING: error in global option tiltmeter_meas_value_dimension, it can only take values 0,1,2, not " << dimfac;
  }
  theFactorSigma = atof(wordlist[3].c_str());
  theConstantTerm = atof(wordlist[4].c_str()) * valueDimensionFactor();
  theConstantTermSigma = atof(wordlist[6].c_str()) * sigmaDimensionFactor();
  //-  std::cout << "correctVal  theConstantTerm" <<  theConstantTerm <<  valueDimensionFactor() << std::endl; 
  //----- Change value and sigma to dimensions used in SDF, because constant term and pedestal are in dimensions of SDF
  //-  thePedestal = atof(wordlist[7].c_str()) * valueDimensionFactor();
  //-thePedestalSigma = atof(wordlist[9].c_str()) * sigmaDimensionFactor();
  //  std::cout << "reading thePedestalSigma " << thePedestalSigma  << "= " << wordlist[9] << std::endl;
  //  TILTMETER 458.84 +- 1.58  0. +- 0. 1 +- 0
}

Member Data Documentation

Definition at line 38 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

Definition at line 39 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

Definition at line 36 of file MeasurementTiltmeter.h.

Referenced by correctValueAndSigma(), and setConversionFactor().

Definition at line 37 of file MeasurementTiltmeter.h.

Referenced by setConversionFactor().

Definition at line 40 of file MeasurementTiltmeter.h.

Definition at line 41 of file MeasurementTiltmeter.h.