7 #include "CoralBase/Attribute.h"
8 #include "CoralBase/Blob.h"
9 #include "CoolKernel/StorageType.h"
16 static_assert (__FLOAT_WORD_ORDER == __LITTLE_ENDIAN,
17 "OnlineLumiCalibrator assumes little-endian byte ordering.");
30 : m_nPar (
other.m_nPar),
31 m_fType (std::move (
other.m_fType)),
32 m_muToLumi (
other.m_muToLumi),
33 m_parVec (std::move (
other.m_parVec))
55 if (attrList[
"NumOfParameters"].isNull())
return false;
58 if (attrList[
"Function"].isNull())
return false;
59 m_fType = attrList[
"Function"].data<std::string>();
61 if (attrList[
"MuToLumi"].isNull())
return false;
62 m_muToLumi = attrList[
"MuToLumi"].data<
float>();
64 if (attrList[
"Parameters"].isNull())
return false;
72 const float*
p =
static_cast<const float*
>(
blob.startingAddress());
92 for (
float val : rawLumi) {
96 calLumi.push_back(0.);
98 calLumi.push_back(calValue);
111 for (
float val : rawLumi) {
117 calMu.push_back(calValue);
143 if (
m_parVec.size() < 1)
return false;
148 if (
m_parVec.size() < (8*nrange + 1))
return false;
150 for (
unsigned int i=0;
i<nrange;
i++) {
153 if (rawLumi < rmax and rawLumi >= rmin) {
169 if (
m_parVec.size() != 1)
return false;
172 if ((1.-rawLumi) <= 0.)
return false;
175 if (rawLumi < 0.)
return false;
181 if (
m_fType ==
"HitLogarithm") {
184 if (
m_parVec.size() != 4)
return false;
187 if (
m_parVec[1] <= 0.)
return false;
190 if ((1.-rawLumi/
m_parVec[1]) <= 0.)
return false;
193 if (rawLumi < 0.)
return false;
199 if (
m_fType ==
"LookupTable_EventAND_Lin") {
202 if (
m_parVec.size() != 6)
return false;
204 if (rawLumi < 0.)
return false;
222 if (
m_fType ==
"LookupTable_EventAND_Log") {
225 if (
m_parVec.size() != 8)
return false;
227 if (rawLumi < 0.)
return false;
258 float a = (sigo/siga + 1) / 2.;
262 for (
int i=0;
i<30;
i++) {
272 if (munew <= 0.)
return -1.;
273 if (fabs(munew-
mu)/munew < 1.
E-5)
break;
296 if (rawPerBX < rbxl || rawPerBX > rbxu)
return -1.;
300 if (rbxl<rawPerBX && rbxm>rawPerBX) {
303 muvm=0.5*(muvu+muvl);
307 muvm=0.5*(muvu+muvl);
313 if ((muvu-muvl)/muvl < 1
e-5)
return muvm;