26 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h" 27 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h" 46 : theDim(measdim), theType(type), theName( name )
69 std::vector<ALIstring> wordlist;
76 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() << std::endl
77 <<
" MEASURED OPTO NAMES: ";
78 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
79 copy(wordlist.begin(), wordlist.end(), outs);
100 std::vector<std::string>::const_iterator site;
101 std::vector<ALIstring> wordlist;
103 for( site = objNames.begin(); site != objNames.end(); ++site) {
104 if( site != objNames.begin() ) wordlist.push_back(
"&");
105 wordlist.push_back(*site);
110 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() <<
" " << measInfo << std::endl
111 <<
" MEASURED OPTO NAMES: ";
119 for (
unsigned int ii=0;
ii<
dim();
ii++){
121 wordlist.push_back( (measInfo.
values_)[
ii].name_ );
125 std::cout <<
"Measurement::constructFromOA: meas value " <<
ii <<
" " <<
dim() <<
" = simulated_value" << std::endl;
127 wordlist.push_back(
"simulated_value");
130 std::cout <<
"Measurement::constructFromOA: meas value " <<
ii <<
" " <<
dim() <<
" = " << measInfo.
values_.size() << std::endl;
133 gcvt( val, 10, ctmp );
134 wordlist.push_back( ctmp );
137 gcvt( err, 10, ctmp );
138 wordlist.push_back( ctmp );
139 std::cout <<
" sigma " << err <<
" = " << ctmp <<
" " << (measInfo.
values_)[
ii].error_ << std::endl;
181 int NPairs = (wl.size()+1)/2;
184 for (
int ii=0;
ii<NPairs;
ii++ ) {
187 if (ii != NPairs-1 && wl[2*ii+1] !=
ALIstring(
"&") ) {
189 std::cerr <<
"!!! Measured Optical Objects should be separated by '&', not by" 190 << wl[2*ii+1] << std::endl;
204 std::cout <<
"@@ Filling coordinate " << coor << std::endl ;
212 if( wordlist.size() != 3 ) {
214 std::cerr <<
" Incorrect format for Measurement value:" << std::endl;
215 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
216 copy(wordlist.begin(), wordlist.end(), outs);
217 std::cout << std::endl <<
"There should be three words: name value sigma " << std::endl;
224 std::cerr <<
"Trying to fill Measurement coordinate No " 225 << coor <<
" but the dimension is " <<
theDim << std::endl;
238 if( wordlist[1] ==
ALIstring(
"simulated_value") ) {
242 std::cerr <<
"!!! parameter for value not found: " << wordlist[1].c_str() << std::endl;
249 val = atof( wordlist[1].c_str() );
259 std::cerr <<
"!!! parameter for sigma not found: " << wordlist[2].c_str() << std::endl;
265 sig = atof( wordlist[2].c_str() );
281 std::cout <<
"@@ Filling coordinate " << coor << std::endl ;
288 std::cerr <<
"Trying to fill Measurement coordinate No " 289 << coor <<
" but the dimension is " <<
theDim << std::endl;
297 val = oaParam->
value();
306 sig = oaParam->
sigma();
323 std::vector<ALIstring>::iterator vsite;
331 int i2p = (*vsite).find_first_of( twopoints, 3*ii );
332 if ( i2p < 0 )
break;
333 if ( i2p !=
ALIint(3*ii)) {
334 std::cerr << i2p <<
"!!! Bad position of '..' in reference ALIstring: " 335 << (*vsite).c_str() << std::endl;
344 if (Ntwopoints != 0) {
350 ALIint colon = referenceOptO.find(
':');
353 std::cout <<
"colon in reference OptO name " << colon <<
354 referenceOptO.c_str() << std::endl;
356 referenceOptO = referenceOptO.substr( 0, colon );
363 std::cerr <<
"!!! Error in Measurement: can't find Optical Object " <<
364 (*vsite).c_str() << std::endl;
378 std::vector< OpticalObject* >::const_iterator vocite;
392 if(
ALIUtils::debug >= 3)
std::cout <<
"Measurement::addAffectingEntriesFromOptO: OptO taking part in Measurement: " << optoP->
name() << std::endl;
394 std::vector< Entry* >::const_iterator vecite;
395 std::vector< Entry* >::const_iterator fvecite;
415 if(optoP->
parent() != 0) {
429 int pos1st = firstref.length();
431 for (
int ii=0;
ii < Ntwopoints;
ii++) {
432 pos1st = firstref.find_last_of( slash, pos1st-1);
438 ref.replace( 0, (Ntwopoints*3)-1, firstref, 0, pos1st);
447 std::cout << std::endl <<
"@@@ Start calculation of simulated value of " << meas->
type() <<
" Measurement " << meas->
name() << std::endl;
462 ALIVRMLMgr::getInstance().newLightRay();
490 std::cerr <<
" Detector can not make measurement with these optical objects " << std::endl;
497 std::vector<ALIstring>::const_iterator vsite;
515 std::vector<ALIdouble> deriv;
522 if(
ALIUtils::debug >= 3)
std::cout << std::endl <<
"%%% Derivative w.r.t. entry " << entry->
name() <<
": displacement = " << displacement << std::endl;
539 std::cout <<
"iteration " << count_itera <<
" COOR " << ii
543 <<
" sum derivatives = " << sumderiv << std::endl;
549 if (count_itera >= 100) {
550 std::cerr <<
"EXITING: too many iterations in derivative, displacement is " <<
551 displacement <<
" sum of derivatives is " << sumderiv << std::endl;
593 std::vector<ALIstring>::const_iterator vscite =
_OptONameList.begin() +
595 ALIint colon = (*vscite).find(
':');
598 behav = (*vscite).substr(colon+1,(*vscite).size());
612 std::vector<OpticalObject*>::const_iterator vocite;
614 if( *vocite == Popto ) {
616 std::cerr <<
" ERROR in getPreviousOptO of measurement " <<
name() << std::endl;
617 std::cerr <<
" OptO " << Popto->
name() <<
" is the first one " << std::endl;
625 std::cerr <<
" ERROR in getPreviousOptO of measurement " <<
name() << std::endl;
626 std::cerr <<
" OptO " << Popto->
name() <<
" not found " << std::endl;
635 if( wl.size() != 3 ){
636 std::cerr <<
"!!!EXITING: reading DATE of measurements set: it must have three words, it is though " << std::endl;
639 }
else if(wl[0] !=
"DATE:" ){
640 std::cerr <<
"!!!EXITING: reading DATE of measurements set: first word must be 'DATE:', it is though " << std::endl;
664 for(ii = 0; ii <
theDim; ii++) {
672 std::vector<std::string> wordlist;
674 ALIuint nOptos = optolist.size();
675 for (
ALIuint ii = 0; ii < nOptos; ii++ ) {
678 if( ii != nOptos -1 ) wordlist.push_back(
"&");
684 std::cout <<
"@@@@ Reading Measurement " <<
name() <<
" TYPE= " <<
type() << std::endl
685 <<
" MEASURED OPTO NAMES: ";
686 std::ostream_iterator<ALIstring> outs(
std::cout,
" ");
687 copy(wordlist.begin(), wordlist.end(), outs);
703 std::cerr <<
" !!! Error in your code, you cannot ask for the name of the Measurement before the OptONameList is build " << std::endl;
706 std::vector<ALIstring>::iterator vsite = (
_OptONameList.end()-1);
static ALIstring theCurrentTime
virtual const ALIdouble sigmaDimensionFactor() const
ALIdouble * theValueSimulated
void resetGlobalCoordinates()
std::vector< ALIdouble > DerivativeRespectEntry(Entry *entry)
virtual const ALIdouble valueDimensionFactor() const
static ALIFileIn & getInstance(const ALIstring &name)
bool valueIsSimulated(ALIint coor)
std::vector< ALIstring > _OptONameList
const ALIuint dim() const
std::vector< OpticalObject * > _OptOList
const std::vector< Entry * > & ExtraEntryList() const
void Substitute2p(ALIstring &ref, const ALIstring &firstref, int NtwoPoints)
void setValue(ALIint coor, ALIdouble val)
static ALIdouble getMaximumDeviationDerivative()
static ParameterMgr * getInstance()
const std::vector< Entry * > & CoordinateEntryList() const
std::vector< std::string > measObjectNames_
void buildAffectingEntryList()
static OpticalObject * getOptOByName(const ALIstring &opto_name)
--— Find an OptO name in theOptOList and return a pointer to it
static ALIstring & SDFName()
the name of the System Description File
static ALIstring only1Time
static GlobalOptionMgr * getInstance()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual void calculateSimulatedValue(ALIbool firstTime)
ALIstring getMeasuringBehaviour(const std::vector< OpticalObject * >::const_iterator vocite)
ALIint getParameterValue(const ALIstring &name, ALIdouble &val)
void fillData(ALIuint coor, const std::vector< ALIstring > &wl)
static void addMeasurementToList(Measurement *measadd)
static int IsNumber(const ALIstring &str)
static ALIstring theCurrentDate
const ALIdouble * sigma() const
const OpticalObject * parent() const
const std::vector< ALIstring > & OptONameList() const
Abs< T >::type abs(const T &t)
const ALIdouble valueSimulated_orig(ALIuint ii) const
void addAffectingEntriesFromOptO(const OpticalObject *optoP)
const ALIstring & name() const
const std::vector< OpticalObject * > & OptOList() const
static ALIstring theMeasurementsFileName
ALIint getWordsInLine(std::vector< ALIstring > &wl)
std::vector< Entry * > theAffectingEntryList
const OpticalObject * getPreviousOptO(const OpticalObject *Popto) const
static ALIdouble cameraScaleFactor
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
static ALIbool getFirstTime()
void calculateOriginalSimulatedValue()
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
ALIdouble * theValueSimulated_orig
const ALIdouble * value() const
const ALIstring & type() const
void setValueSimulated_orig(ALIint coor, ALIdouble value)
virtual ALIdouble startingDisplacement()
void printStartCalculateSimulatedValue(const Measurement *meas)
std::vector< OpticalAlignParam > values_
const ALIstring & name() const
const ALIdouble valueSimulated(ALIuint ii) const
const ALIstring & name() const
void constructFromOA(OpticalAlignMeasurementInfo &measInfo)
virtual void correctValueAndSigma()
virtual void buildOptONamesList(const std::vector< ALIstring > &wl)
OpticalObject * OptOCurrent() const
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::vector< bool > isSimulatedValue_
static ALIstring only1Date
ALIbool * theValueIsSimulated
void copyMeas(Measurement *meas, const std::string &subsstr1, const std::string &subsstr2)
static std::vector< Measurement * > & MeasurementList()
virtual void displace(ALIdouble disp)
static void setCurrentDate(const std::vector< ALIstring > &wl)
set the date of the current measurement