12 squareMode(squareMode_),
36 const std::vector<int>& VmaxCeta,
37 const std::vector<int>& VmaxCphi,
38 const std::vector<float>& energyVector,
40 const bool& normalizeFlag) {
41 int Nevents = eventMatrix.size();
43 std::vector<float> totalSolution(
Nchannels, 1.);
44 std::vector<float> iterSolution;
45 std::vector<std::vector<float> > myEventMatrix(eventMatrix);
46 std::vector<float> myEnergyVector(energyVector);
51 for (
int iter = 1; iter <= nIter; iter++) {
57 for (
i = 0;
i < Nevents;
i++) {
60 sumOverEnergy += myEventMatrix[
i][
j];
62 sumOverEnergy /= myEnergyVector[
i];
63 scale += sumOverEnergy;
67 for (
i = 0;
i < Nevents;
i++) {
68 myEnergyVector[
i] *=
scale;
73 for (
int iEvt = 0; iEvt < Nevents; iEvt++) {
74 addEvent(myEventMatrix[iEvt], VmaxCeta[iEvt], VmaxCphi[iEvt], myEnergyVector[iEvt]);
77 if (iterSolution.empty())
81 for (
int ievent = 0; ievent < Nevents; ievent++) {
82 myEventMatrix[ievent] =
recalibrateEvent(myEventMatrix[ievent], VmaxCeta[ievent], VmaxCphi[ievent], iterSolution);
87 totalSolution[
i] *= iterSolution[
i];
101 float w, invsumXmatrix;
105 float sumXmatrix = 0.;
108 sumXmatrix += eventSquare[
i];
112 eventw = 1 - fabs(1 - sumXmatrix /
energy);
115 if (sumXmatrix != 0.) {
116 invsumXmatrix = 1 / sumXmatrix;
119 w = eventSquare[
i] * invsumXmatrix;
124 wsum[iFull] +=
w * eventw;
135 std::vector<float> solution(
Nchannels, 1.);
159 const std::vector<float>& recalibrateVector) {
160 std::vector<float> newEventSquare(eventSquare);
166 newEventSquare[
i] *= recalibrateVector[iFull];
168 return newEventSquare;
176 if (curr_eta * maxCeta <= 0) {
195 if ((!negPhiDirection && (curr_phi >=
minphi && curr_phi <=
maxphi)) ||
196 (negPhiDirection && !(curr_phi >=
minphi && curr_phi <=
maxphi))) {
197 iFullphi = curr_phi -
minphi;
200 regionIndex = (curr_eta -
mineta) * (
maxphi -
minphi + 1 + 360 * negPhiDirection) + iFullphi;