CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

FittedEntriesSet Class Reference

#include <FittedEntriesSet.h>

List of all members.

Public Member Functions

void CreateCorrelationMatrix (const ALIuint nent)
void CreateCorrelationMatrix (const ALIuint nent)
void Fill ()
void Fill ()
void FillCorrelations ()
void FillCorrelations ()
void FillEntries ()
void FillEntries ()
void FillEntriesAveragingSets (std::vector< FittedEntriesSet * > vSets)
void FillEntriesAveragingSets (std::vector< FittedEntriesSet * > vSets)
void FillEntriesFromFile (std::vector< ALIstring > wl)
void FillEntriesFromFile (std::vector< ALIstring > wl)
std::vector< FittedEntry * > & FittedEntries ()
std::vector< FittedEntry * > & FittedEntries ()
 FittedEntriesSet (std::vector< ALIstring > wl)
 FittedEntriesSet (std::vector< FittedEntriesSet * > vSets)
 FittedEntriesSet (MatrixMeschach *AtWAMatrix)
 FittedEntriesSet (std::vector< ALIstring > wl)
 FittedEntriesSet (std::vector< FittedEntriesSet * > vSets)
 FittedEntriesSet (MatrixMeschach *AtWAMatrix)
ALIstringgetDate ()
ALIstringgetDate ()
ALIstringgetTime ()
ALIstringgetTime ()
void SetOptOEntries ()
void SetOptOEntries ()
 ~FittedEntriesSet ()
 ~FittedEntriesSet ()

Public Attributes

std::vector< FittedEntry * > theFittedEntries

Private Attributes

std::vector< std::vector
< ALIdouble > > 
theCorrelationMatrix
ALIstring theDate
MatrixMeschachtheEntriesErrorMatrix
ALIint theMinEntryQuality
ALIstring theTime

Detailed Description

Definition at line 22 of file FittedEntriesSet.h.


Constructor & Destructor Documentation

FittedEntriesSet::FittedEntriesSet ( MatrixMeschach AtWAMatrix)
FittedEntriesSet::FittedEntriesSet ( std::vector< ALIstring wl)

Definition at line 36 of file FittedEntriesSet.cc.

References FillEntriesFromFile(), theDate, theEntriesErrorMatrix, theMinEntryQuality, and theTime.

{
  //- theTime = Model::MeasurementsTime();
  theDate = wl[0];
  theTime = "99:99";
  
  theMinEntryQuality = 2;
  theEntriesErrorMatrix = (MatrixMeschach*)0;
  
  FillEntriesFromFile( wl );

}
FittedEntriesSet::FittedEntriesSet ( std::vector< FittedEntriesSet * >  vSets)
FittedEntriesSet::~FittedEntriesSet ( ) [inline]

Definition at line 31 of file FittedEntriesSet.h.

{ };
FittedEntriesSet::FittedEntriesSet ( MatrixMeschach AtWAMatrix)
FittedEntriesSet::FittedEntriesSet ( std::vector< ALIstring wl)
FittedEntriesSet::FittedEntriesSet ( std::vector< FittedEntriesSet * >  vSets)
FittedEntriesSet::~FittedEntriesSet ( ) [inline]

Definition at line 31 of file FittedEntriesSet.h.

{ };

Member Function Documentation

void FittedEntriesSet::CreateCorrelationMatrix ( const ALIuint  nent)

Definition at line 126 of file FittedEntriesSet.cc.

References theCorrelationMatrix.

Referenced by FillCorrelations().

{

  std::vector<ALIdouble> vd( nent, 0.);
  std::vector< std::vector<ALIdouble> > vvd( nent, vd);
  theCorrelationMatrix = vvd;

}
void FittedEntriesSet::CreateCorrelationMatrix ( const ALIuint  nent)
void FittedEntriesSet::Fill ( )

Definition at line 64 of file FittedEntriesSet.cc.

References FillCorrelations(), and FillEntries().

Referenced by FittedEntriesSet().

void FittedEntriesSet::Fill ( )
void FittedEntriesSet::FillCorrelations ( )
void FittedEntriesSet::FillCorrelations ( )

Definition at line 96 of file FittedEntriesSet.cc.

References begin, corr, CreateCorrelationMatrix(), Model::EntryList(), findQualityFiles::jj, MatrixMeschach::Mat(), mathSSE::sqrt(), theCorrelationMatrix, theEntriesErrorMatrix, and theMinEntryQuality.

Referenced by Fill().

{
  //------ Count the number of entries that will be in the set
  ALIuint nent = 0;
  std::vector<Entry*>::const_iterator vecite;
  for ( vecite = Model::EntryList().begin();
                 vecite != Model::EntryList().end(); vecite++ ) {
    if((*vecite)->quality() > theMinEntryQuality ) {
      nent++;
    }
  }
      
  CreateCorrelationMatrix( nent );
  //---------- Store correlations
  ALIuint ii;
  for( ii = 0; ii < nent; ii++) {
    for(ALIuint jj = ii+1; jj < nent; jj++) {
      ALIdouble corr = theEntriesErrorMatrix->Mat()->me[ii][jj];
      if (corr != 0) {
        corr /= ( sqrt(theEntriesErrorMatrix->Mat()->me[ii][ii])
          / sqrt(theEntriesErrorMatrix->Mat()->me[jj][jj]) );
        theCorrelationMatrix[ii][jj] = corr;
      }
    }
  }

}
void FittedEntriesSet::FillEntries ( )

Definition at line 74 of file FittedEntriesSet.cc.

References begin, Model::EntryList(), MatrixMeschach::Mat(), mathSSE::sqrt(), theEntriesErrorMatrix, theFittedEntries, and theMinEntryQuality.

Referenced by Fill().

{
  //---------- Store Fitted Entries 
  //----- Iterate over entry list
  std::vector<Entry*>::const_iterator vecite; 
  for ( vecite = Model::EntryList().begin();
    vecite != Model::EntryList().end(); vecite++ ) {
    //--- Only for good quality parameters (='unk')
    if ( (*vecite)->quality() >= theMinEntryQuality ) {
      //      ALIdouble dimv =  (*vecite)->ValueDimensionFactor();
      //  ALIdouble dims =  (*vecite)->SigmaDimensionFactor();
      ALIint ipos = (*vecite)->fitPos();
      FittedEntry* fe = new FittedEntry( (*vecite), ipos, sqrt(theEntriesErrorMatrix->Mat()->me[ipos][ipos]));
      //-      std::cout << fe << "IN fit FE " << fe->theValue<< " " << fe->Sigma()<< " "  << sqrt(theEntriesErrorMatrix->Mat()->me[NoEnt][NoEnt]) / dims<< std::endl;
      theFittedEntries.push_back( fe );
    }
  }

}
void FittedEntriesSet::FillEntries ( )
void FittedEntriesSet::FillEntriesAveragingSets ( std::vector< FittedEntriesSet * >  vSets)
void FittedEntriesSet::FillEntriesAveragingSets ( std::vector< FittedEntriesSet * >  vSets)

Definition at line 150 of file FittedEntriesSet.cc.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ALIUtils::debug, cmsRelvalreport::exit, FittedEntries(), FittedEntry::getSigma(), FittedEntry::getValue(), findQualityFiles::jj, and theFittedEntries.

Referenced by FittedEntriesSet().

{

  std::vector<FittedEntry*> vFEntry;
  ALIuint nEntry = vSets[0]->FittedEntries().size();
  //  ALIuint setssiz = vSets.size();
  for( ALIuint ii = 0; ii < nEntry; ii++ ){  // loop to FittedEntry's
    if(ALIUtils::debug >= 5) std::cout << "FillEntriesAveragingSets entry " << ii << std::endl;
    vFEntry.clear();
    for( ALIuint jj = 0; jj < vSets.size(); jj++ ){  // look for FittedEntry ii in each Sets
     if(ALIUtils::debug >= 5) std::cout << "FillEntriesAveragingSets set " << jj << std::endl;
      //----- Check all have the same number of entries
      if( vSets[jj]->FittedEntries().size() != nEntry ){
        std::cerr << "!!! FATAL ERROR FittedEntriesSet::FillEntriesAveragingSets  set number " << jj 
                  << " has different number of entries = " 
                  << vSets[jj]->FittedEntries().size() 
                  << " than first set = " << nEntry << std::endl;
        exit(1);
      }
      
      vFEntry.push_back( vSets[jj]->FittedEntries()[ii] );
    }
   FittedEntry* fe = new FittedEntry( vFEntry );
   if(ALIUtils::debug >= 5) std::cout << "FillEntriesAveragingSets new fentry " << fe->getValue() << " " << fe->getSigma() << std::endl;
   theFittedEntries.push_back( fe );
  }


}
void FittedEntriesSet::FillEntriesFromFile ( std::vector< ALIstring wl)

Definition at line 137 of file FittedEntriesSet.cc.

References ALIUtils::getFloat(), and theFittedEntries.

Referenced by FittedEntriesSet().

{

  ALIuint siz = wl.size();
  for( ALIuint ii = 1; ii< siz; ii+=3 ) {
    FittedEntry* fe = new FittedEntry( wl[ii], ALIUtils::getFloat(wl[ii+1]), ALIUtils::getFloat(wl[ii+2]));
    theFittedEntries.push_back( fe );
  }

}
void FittedEntriesSet::FillEntriesFromFile ( std::vector< ALIstring wl)
std::vector< FittedEntry* >& FittedEntriesSet::FittedEntries ( ) [inline]
std::vector< FittedEntry* >& FittedEntriesSet::FittedEntries ( ) [inline]

Definition at line 42 of file FittedEntriesSet.h.

References theFittedEntries.

                                            {
    return theFittedEntries;
  }
ALIstring& FittedEntriesSet::getDate ( ) [inline]

Definition at line 47 of file FittedEntriesSet.h.

References theDate.

                       {
    return theDate;
  }
ALIstring& FittedEntriesSet::getDate ( ) [inline]

Definition at line 47 of file FittedEntriesSet.h.

References theDate.

                       {
    return theDate;
  }
ALIstring& FittedEntriesSet::getTime ( ) [inline]

Definition at line 50 of file FittedEntriesSet.h.

References theTime.

                       {
    return theTime;
  }
ALIstring& FittedEntriesSet::getTime ( ) [inline]

Definition at line 50 of file FittedEntriesSet.h.

References theTime.

                       {
    return theTime;
  }
void FittedEntriesSet::SetOptOEntries ( )

Definition at line 182 of file FittedEntriesSet.cc.

References gather_cfg::cout, ALIUtils::debug, Model::getEntryByName(), FittedEntry::getEntryName(), Model::getOptOByName(), FittedEntry::getOptOName(), FittedEntry::getSigma(), FittedEntry::getValue(), OpticalObject::name(), OpticalObject::setGlobalCoordinates(), OpticalObject::setOriginalEntryValues(), Entry::setValue(), and theFittedEntries.

{
  if(ALIUtils::debug >= 5) std::cout << "  FittedEntriesSet::SetOptOEntries " << theFittedEntries.size() << std::endl;

  std::vector< FittedEntry* >::const_iterator ite;
  for( ite = theFittedEntries.begin();ite != theFittedEntries.end();ite++){
    FittedEntry* fe = (*ite);
    OpticalObject * opto = Model::getOptOByName( fe->getOptOName() );
    Entry* entry = Model::getEntryByName( fe->getOptOName(), fe->getEntryName() );
    entry->setValue( fe->getValue() );
    entry->setSigma( fe->getSigma() );

   if(ALIUtils::debug >= 5) std::cout << "  FittedEntriesSet::SetOptOEntries() " << opto->name() << " " << entry->name() << std::endl;
    opto->setGlobalCoordinates();
    opto->setOriginalEntryValues();
 }
}
void FittedEntriesSet::SetOptOEntries ( )

Member Data Documentation

std::vector< std::vector< ALIdouble > > FittedEntriesSet::theCorrelationMatrix [private]

Definition at line 61 of file FittedEntriesSet.h.

Referenced by CreateCorrelationMatrix(), and FillCorrelations().

Definition at line 59 of file FittedEntriesSet.h.

Referenced by FittedEntriesSet(), and getDate().

Definition at line 63 of file FittedEntriesSet.h.

Referenced by FillCorrelations(), FillEntries(), and FittedEntriesSet().

Definition at line 62 of file FittedEntriesSet.h.

Referenced by FillCorrelations(), FillEntries(), and FittedEntriesSet().

Definition at line 60 of file FittedEntriesSet.h.

Referenced by FittedEntriesSet(), and getTime().