6 #include "TDecompSVD.h" 19 for (
int i(0);
i < input.GetNrows();
i++) {
20 for (
int j(0); j < input.GetNcols(); j++) {
21 s << input[
i][j]<<
", \t";
23 if (
i != (input.GetNrows() - 1)) {
33 for (
int i(0);
i < input.GetNrows();
i++) {
35 if (
i != (input.GetNrows() - 1)) {
93 TMatrixD hessInv = lu.Invert();
96 TVectorD calibsSolved(eij.GetNcols());
99 calibsSolved = lu.Solve(proj, ok);
104 std::cout <<
"\tWARNING: LU reports NOT ok.\n";
112 <<
"\tDid you forget to add a dummy offset deposition to each particle?\n";
113 std::cout <<
"\tThrowing an exception!"<< std::endl;
115 me(
"TDecompLU did not converge successfully when finding calibrations. Did you forget to add a dummy offset deposition to each particle?");
122 std::map<DetectorElementPtr, double> answers;
123 for (std::map<DetectorElementPtr, unsigned>::iterator it =
126 answers[de] = calibsSolved[(*it).second];
147 for (std::vector<ParticleDepositPtr>::const_iterator cit =
152 for (std::vector<DetectorElementPtr>::const_iterator detElIt =
158 truthE[
index] = p->getTruthEnergy();
165 const TVectorD& truthE)
const {
167 proj.ResizeTo(eij.GetNcols());
170 for (
int j(0); j < eij.GetNcols(); ++j) {
171 for (
int i(0);
i < eij.GetNrows(); ++
i) {
172 proj[j] += eij[
i][j] / truthE[
i];
180 const TVectorD& truthE)
const {
182 unsigned nCalibs(eij.GetNcols());
183 hess.ResizeTo(nCalibs, nCalibs);
186 for (
unsigned i(0);
i < nCalibs; ++
i) {
187 for (
unsigned j(0); j < nCalibs; ++j) {
188 for (
int n(0);
n < eij.GetNrows(); ++
n) {
189 hess[
i][j] += eij[
n][
i] * eij[
n][j]/
pow(truthE[
n], 2.0);
203 for (std::vector<DetectorElementPtr>::const_iterator cit =
static std::string const input
void printVec(std::ostream &s, const TVectorD &input)
void printMat(std::ostream &s, const TMatrixD &input)
Power< A, B >::type pow(const A &a, const B &b)