CMS 3D CMS Logo

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 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
19  theEntry = entry;
20  theOrder = order;
21  theOptOName = entry->OptOCurrent()->longName();
22  if (ALIUtils::debug >= 5)
23  std::cout << " creating FittedEntry " << theOptOName << std::endl;
24  theEntryName = entry->name();
25  BuildName();
26 
27  //------ store values and sigmas in dimensions indicated by global options
28  ALIdouble dimv = entry->OutputValueDimensionFactor();
29  ALIdouble dims = entry->OutputSigmaDimensionFactor();
30  theValue = (entry->value() + entry->valueDisplacementByFitting()) / dimv;
31  theSigma = sigma / dims;
32  theOrigValue = entry->value() / dimv;
33  theOrigSigma = entry->sigma() / dims;
34  theQuality = entry->quality();
35 
36  //-std::cout << this << " FE value" << this->theValue << "sigma" << this->theSigma << std::endl;
37 }
38 
39 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
41  //ar.lass1.laser.centre_X
42  theOrder = 0;
43  theOptOName = "s";
44  ALIint point = -1;
45  ALIint pointold = 0;
46  for (;;) {
47  point = name.find('.', point + 1);
48  if (point == -1)
49  break;
50  theOptOName += "/" + name.substr(pointold, point - pointold);
51  pointold = point + 1;
52  }
53  theEntryName = name.substr(pointold, name.size());
54 
55  // std::cout << " building theEntryName " << theEntryName << " " << pointold << " " << name << std::endl;
57 
58  theEntry = nullptr;
59 
60  //------ store values and sigmas in dimensions indicated by global options
61  ALIdouble dimv = entry->OutputValueDimensionFactor();
62  ALIdouble dims = entry->OutputSigmaDimensionFactor();
63  theValue = value * dimv;
64  theSigma = sigma * dims;
65  theOrigValue = value * dimv;
66  theOrigSigma = sigma * dims;
67  theQuality = 2;
68 
69  //-std::cout << this << " FE value" << this->theValue << "sigma" << this->theSigma << std::endl;
70 }
71 
72 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
73 FittedEntry::FittedEntry(const std::vector<FittedEntry*>& _vFEntry) {
74  //----- Average the entries
75  std::vector<FittedEntry*> vFEntry = _vFEntry;
76  std::vector<FittedEntry*>::iterator ite;
77  //--- First check that all entries are from the same OptO and Entry
78  theOptOName = (vFEntry[0]->getOptOName());
79  theEntryName = (vFEntry[0]->getEntryName());
80  theOrder = (vFEntry[0]->getOrder());
81  theEntry = (vFEntry[0]->getEntry());
82  theQuality = (vFEntry[0]->getQuality());
83 
84  theValue = 0.;
85  theSigma = 0.;
86  theOrigValue = 0.;
87  theOrigSigma = 0.;
88  for (ite = vFEntry.begin(); ite != vFEntry.end(); ++ite) {
89  if ((*ite)->getOptOName() != theOptOName || (*ite)->getEntryName() != theEntryName) {
90  std::cerr << "!!! FATAL ERROR FittedEntry::FittedEntry one entry in list has different opto or entry names : "
91  << (*ite)->getOptOName() << " != " << theOptOName << " " << (*ite)->getEntryName()
92  << " != " << theEntryName << std::endl;
93  exit(1);
94  }
95 
96  theValue += (*ite)->getValue();
97  theSigma += (*ite)->getSigma();
98  theOrigValue += (*ite)->getOrigValue();
99  theOrigSigma += (*ite)->getOrigSigma();
100  }
101 
102  ALIint siz = vFEntry.size();
103  theValue /= siz;
104  theSigma /= siz;
105  theOrigValue /= siz;
106  theOrigSigma /= siz;
107 }
108 
109 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
111  //----- substitute '/' by '.' in opto name
112  theName = theOptOName.substr(2, theOptOName.size()); // skip the first 's/'
113  ALIint slash = -1;
114  for (;;) {
115  slash = theName.find('/', slash + 1);
116  if (slash == -1)
117  break;
118  theName[slash] = '.';
119  }
120 
121  //----- Check if there is a ' ' in entry (should not happen now)
122  ALIint space = theEntryName.rfind(' ');
123  theName.append(".");
124  ALIstring en = theEntryName;
125  if (space != -1)
126  en[space] = '_';
127 
128  //----- Merge opto and entry names
129  // now it is not used as theName theName.append( en + ".out");
130  theName.append(en);
131 }
FittedEntry::theQuality
ALIint theQuality
Definition: FittedEntry.h:49
OpticalObject.h
FittedEntry.h
FittedEntry::theOrder
ALIint theOrder
Definition: FittedEntry.h:42
Model.h
FittedEntry::theOrigSigma
ALIdouble theOrigSigma
Definition: FittedEntry.h:48
mps_splice.entry
entry
Definition: mps_splice.py:68
FittedEntry::theEntry
Entry * theEntry
Definition: FittedEntry.h:41
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Model::getEntryByName
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:623
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
Entry.h
ALIUtils.h
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
eventshapeDQM_cfi.order
order
Definition: eventshapeDQM_cfi.py:8
value
Definition: value.py:1
Entry
Definition: Entry.h:18
FittedEntry::BuildName
void BuildName()
Definition: FittedEntry.cc:110
FittedEntry::theName
ALIstring theName
Definition: FittedEntry.h:43
pickleFileParser.slash
slash
Definition: pickleFileParser.py:12
FittedEntry::theSigma
ALIdouble theSigma
Definition: FittedEntry.h:46
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ALIint
int ALIint
Definition: CocoaGlobals.h:15
FittedEntry::theValue
ALIdouble theValue
Definition: FittedEntry.h:40
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
FittedEntry::theOrigValue
ALIdouble theOrigValue
Definition: FittedEntry.h:47
point
*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
FittedEntry::theEntryName
ALIstring theEntryName
Definition: FittedEntry.h:45
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
FittedEntry::theOptOName
ALIstring theOptOName
Definition: FittedEntry.h:44
FittedEntry::FittedEntry
FittedEntry()
Definition: FittedEntry.h:20