Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:01

0001 //   COCOA class implementation file

0002 //Id:  EntryData.cc

0003 //CAT: Model

0004 //

0005 //   History: v1.0

0006 //   Pedro Arce

0007 
0008 #include "Alignment/CocoaModel/interface/EntryData.h"
0009 #include "Alignment/CocoaModel/interface/EntryMgr.h"
0010 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0011 #include <cstdlib>
0012 
0013 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0014 //@@ Constructor

0015 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0016 EntryData::EntryData() {}
0017 
0018 void EntryData::fill(const std::vector<ALIstring>& wordlist) {
0019   if (ALIUtils::debug >= 4)
0020     std::cout << "Filling entry data:" << std::endl;
0021   //----------- Check there are > 10 words

0022   if (wordlist.size() < 10) {
0023     //t    ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();

0024     ALIUtils::dumpVS(wordlist, " !!! Incorrect format for EntryData:", std::cerr);
0025     std::cerr << std::endl << " There should be at least 10 words" << std::endl;
0026     abort();
0027   }
0028 
0029   EntryMgr* entryMgr = EntryMgr::getInstance();
0030   //----- set name and type

0031   fLongOptOName = wordlist[2];
0032   fShortOptOName = entryMgr->extractShortName(wordlist[2]);
0033   fEntryName = wordlist[3];
0034 
0035   //----- set value

0036   fValueOriginal = ALIUtils::getFloat(wordlist[4]);
0037   fValueDisplacement = 0.;
0038   //  fValueOriginal = ALIUtils::getFloat( wordlist[7] );

0039   //  fValueDisplacement = ALIUtils::getFloat( wordlist[12] );

0040   /* done in Entry.cc

0041   if( wordlist[3].substr(0,6) == "centre" ) {

0042     fValue *= entryMgr->getDimOutLengthVal();

0043     if(ALIUtils::debug >= 5) std::cout << "value " << fValue << " " << entryMgr->getDimOutLengthVal() << std::endl;

0044   } else if( wordlist[3].substr(0,6) == "angles" ) {

0045     fValue *= entryMgr->getDimOutAngleVal();

0046   } else { 

0047     std::cerr << "!!!FATAL ERROR: reading from 'report.out' only supports centre or angles, NOT " << wordlist[3] << std::endl;

0048     abort();

0049   }

0050   */
0051 
0052   //----- set sigma

0053   fSigma = ALIUtils::getFloat(wordlist[6]);
0054   /* done in Entry.cc

0055   if( wordlist[3].substr(0,6) == "centre" ) {

0056     fSigma *= entryMgr->getDimOutLengthSig();

0057   }else if( wordlist[3].substr(0,6) == "angles" ) {

0058     fSigma *= entryMgr->getDimOutAngleSig();

0059   }  

0060   */
0061 
0062   //----- set quality

0063   if (wordlist[0] == ALIstring("UNK:")) {
0064     fQuality = 2;
0065   } else if (wordlist[0] == ALIstring("CAL:")) {
0066     fQuality = 1;
0067   } else if (wordlist[0] == ALIstring("FIX:")) {
0068     fQuality = 0;
0069   } else {
0070     //-    ALIFileIn::getInstance( Model::SDFName() ).ErrorInLine();

0071     std::cerr << " quality should be 'UNK:' or 'CAL:' or 'FIX:', instead of " << wordlist[0] << std::endl;
0072     abort();
0073   }
0074 
0075   if (ALIUtils::debug >= 4) {
0076     //t    std::cout << *this << std::endl;

0077   }
0078 }
0079 
0080 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0081 //@@ Destructor

0082 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0083 EntryData::~EntryData() {}
0084 
0085 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0086 std::ostream& operator<<(std::ostream& os, const EntryData& ent) {
0087   os << "ENTRY: " << ent.longOptOName() << " : " << ent.entryName() << " valueOriginal " << ent.valueOriginal()
0088      << " valueDisplacement " << ent.valueDisplacement() << " sigma " << ent.sigma() << " quality " << ent.quality()
0089      << std::endl;
0090 
0091   return os;
0092 }