CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FittedEntry.cc
Go to the documentation of this file.
1 // COCOA class implementation file
2 //Id: FittedEntry.cc
3 //CAT: Model
4 //
5 // History: v1.0
6 // Pedro Arce
7 
13 #include <iostream>
14 #include <iomanip>
15 #include <cstdlib>
16 
17 
18 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
20 {
21  theEntry = entry;
22  theOrder = order;
23  theOptOName = entry->OptOCurrent()->longName();
24  if(ALIUtils::debug >= 5) std::cout << " creating FittedEntry " << theOptOName << std::endl;
25  theEntryName = entry->name();
26  BuildName();
27 
28  //------ store values and sigmas in dimensions indicated by global options
29  ALIdouble dimv = entry->OutputValueDimensionFactor();
30  ALIdouble dims = entry->OutputSigmaDimensionFactor();
31  theValue = ( entry->value() + entry->valueDisplacementByFitting() ) / dimv;
32  theSigma = sigma / dims;
33  theOrigValue = entry->value() / dimv;
34  theOrigSigma = entry->sigma() / dims;
35  theQuality = entry->quality();
36 
37  //-std::cout << this << " FE value" << this->theValue << "sigma" << this->theSigma << std::endl;
38 }
39 
40 
41 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
42 FittedEntry::FittedEntry( ALIstring name, float value, float sigma)
43 {
44  //ar.lass1.laser.centre_X
45  theOrder = 0;
46  theOptOName = "s";
47  ALIint point = -1;
48  ALIint pointold = 0;
49  for( ;; ){
50  point = name.find( ".", point+1 );
51  if( point == -1 ) break;
52  theOptOName += "/" + name.substr( pointold, point-pointold);
53  pointold = point+1;
54  }
55  theEntryName = name.substr( pointold, name.size() );
56 
57  // std::cout << " building theEntryName " << theEntryName << " " << pointold << " " << name << std::endl;
59 
60  theEntry = 0;
61 
62  //------ store values and sigmas in dimensions indicated by global options
63  ALIdouble dimv = entry->OutputValueDimensionFactor();
64  ALIdouble dims = entry->OutputSigmaDimensionFactor();
65  theValue = value * dimv;
66  theSigma = sigma * dims;
67  theOrigValue = value * dimv;
68  theOrigSigma = sigma * dims;
69  theQuality = 2;
70 
71  //-std::cout << this << " FE value" << this->theValue << "sigma" << this->theSigma << std::endl;
72 }
73 
74 
75 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
76 FittedEntry::FittedEntry( std::vector<FittedEntry*> vFEntry )
77 {
78  //----- Average the entries
79 
80  std::vector<FittedEntry*>::iterator ite;
81  //--- First check that all entries are from the same OptO and Entry
82  theOptOName = (vFEntry[0]->getOptOName() );
83  theEntryName = (vFEntry[0]->getEntryName() );
84  theOrder = (vFEntry[0]->getOrder() );
85  theEntry = (vFEntry[0]->getEntry() );
86  theQuality = (vFEntry[0]->getQuality() );
87 
88  theValue = 0.;
89  theSigma = 0.;
90  theOrigValue = 0.;
91  theOrigSigma = 0.;
92  for( ite = vFEntry.begin(); ite != vFEntry.end(); ite++) {
93  if( (*ite)->getOptOName() != theOptOName || (*ite)->getEntryName() != theEntryName ){
94  std::cerr << "!!! FATAL ERROR FittedEntry::FittedEntry one entry in list has different opto or entry names : " << (*ite)->getOptOName() << " != " << theOptOName << " " << (*ite)->getEntryName() << " != " << theEntryName << std::endl;
95  exit(1);
96  }
97 
98  theValue += (*ite)->getValue();
99  theSigma += (*ite)->getSigma();
100  theOrigValue += (*ite)->getOrigValue();
101  theOrigSigma += (*ite)->getOrigSigma();
102  }
103 
104  ALIint siz = vFEntry.size();
105  theValue /= siz;
106  theSigma /= siz;
107  theOrigValue /= siz;
108  theOrigSigma /= siz;
109 
110 }
111 
112 
113 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
115 {
116  //----- substitute '/' by '.' in opto name
117  theName = theOptOName.substr( 2, theOptOName.size() ); // skip the first 's/'
118  ALIint slash = -1;
119  for(;;){
120  slash = theName.find('/', slash+1);
121  if( slash == -1 ) break;
122  theName[slash] = '.';
123  }
124 
125  //----- Check if there is a ' ' in entry (should not happen now)
126  ALIint space = theEntryName.rfind(' ');
127  theName.append(".");
128  ALIstring en = theEntryName;
129  if( space != -1) en[space] = '_';
130 
131  //----- Merge opto and entry names
132  // now it is not used as theName theName.append( en + ".out");
133  theName.append( en);
134 
135 }
136 
long double ALIdouble
Definition: CocoaGlobals.h:11
virtual ALIdouble OutputValueDimensionFactor() const
Definition: Entry.h:39
ALIdouble theOrigValue
Definition: FittedEntry.h:70
ALIint theOrder
Definition: FittedEntry.h:65
ALIdouble theOrigSigma
Definition: FittedEntry.h:71
Definition: Entry.h:18
ALIdouble valueDisplacementByFitting() const
Definition: Entry.h:63
virtual ALIdouble OutputSigmaDimensionFactor() const
Definition: Entry.h:40
ALIint theQuality
Definition: FittedEntry.h:72
ALIdouble value() const
Definition: Entry.h:55
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:35
static Entry * getEntryByName(const ALIstring &opto_name, const ALIstring &entry_name)
--— Search an Entry name in the Entry* list and return a pointer to it
Definition: Model.cc:633
Entry * theEntry
Definition: FittedEntry.h:64
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
void BuildName()
Definition: FittedEntry.cc:114
const ALIstring longName() const
const ALIstring & name() const
Definition: Entry.h:52
ALIdouble theValue
Definition: FittedEntry.h:63
ALIstring theEntryName
Definition: FittedEntry.h:68
ALIint quality() const
Definition: Entry.h:59
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIstring theName
Definition: FittedEntry.h:66
tuple cout
Definition: gather_cfg.py:41
ALIdouble theSigma
Definition: FittedEntry.h:69
OpticalObject * OptOCurrent() const
Definition: Entry.h:61
ALIstring theOptOName
Definition: FittedEntry.h:67
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
ALIdouble sigma() const
Definition: Entry.h:57