55 #include "reportingUtils.hpp"
56 #include "reportingUtilsRoot.hpp"
71 const char specialChars[] = {
'^',
'$',
'.',
'[',
']',
'^',
'*',
'+',
'?'};
72 for (
unsigned int i = 0;
i <
sizeof(specialChars) /
sizeof(specialChars[0]); ++
i) {
73 TString escapedChar = TString(
"\\").Append(specialChars[
i]);
74 escapedS.ReplaceAll(specialChars[i], escapedChar);
85 const char specialChars[] = {
'^',
'$',
'.',
'[',
']',
'^',
'*',
'+',
'?'};
86 for (
unsigned int i = 0;
i <
sizeof(specialChars) /
sizeof(specialChars[0]); ++
i) {
87 TString escapedChar = TString(
"\\").Append(specialChars[
i]);
88 escapedS.ReplaceAll(escapedChar, specialChars[i]);
103 #ifdef USE_TFITRESULT
119 const std::vector<std::complex<double> >&
prodAmps,
122 const std::vector<std::pair<int, int> >& fitParCovMatrixIndices,
150 const unsigned int parIndexB)
const {
return _fitParCovMatrix[parIndexA][parIndexB]; }
154 std::complex<double>
prodAmp (
const unsigned int prodAmpIdx)
const
155 {
return std::complex<double>(
_prodAmps[prodAmpIdx].Re(),
_prodAmps[prodAmpIdx].Im()); }
156 inline TMatrixT<double>
prodAmpCov(
const unsigned int prodAmpIdx)
const;
158 TMatrixT<double>
prodAmpCov(
const std::vector<unsigned int>& prodAmpIndices)
const;
160 inline TMatrixT<double>
prodAmpCov(
const std::vector<std::pair<unsigned int, unsigned int> >& prodAmpIndexPairs)
const;
162 inline TMatrixT<double>
prodAmpCov(
const std::vector<unsigned int>& prodAmpIndicesA,
163 const std::vector<unsigned int>& prodAmpIndicesB)
const;
167 inline std::complex<double>
normIntegral(
const unsigned int waveIndexA,
168 const unsigned int waveIndexB)
const;
175 const unsigned int waveIndexB)
const;
178 const unsigned int waveIndexB)
const;
184 double intensity (
const char* waveNamePattern)
const;
189 double phase (
const unsigned int waveIndexA,
190 const unsigned int waveIndexB)
const;
191 double phaseErr (
const unsigned int waveIndexA,
192 const unsigned int waveIndexB)
const;
193 double phase (
const std::string waveNameA,
194 const std::string waveNameB)
const
197 const std::string waveNameB)
const
200 double coherence (
const unsigned int waveIndexA,
201 const unsigned int waveIndexB)
const;
203 const unsigned int waveIndexB)
const;
204 double overlap (
const unsigned int waveIndexA,
205 const unsigned int waveIndexB)
const;
206 double overlapErr (
const unsigned int waveIndexA,
207 const unsigned int waveIndexB)
const;
219 inline std::ostream&
printWaveNames (std::ostream& out = std::cout)
const;
220 inline std::ostream&
printProdAmps (std::ostream& out = std::cout)
const;
221 inline std::ostream&
printWaves (std::ostream& out = std::cout)
const;
222 inline std::ostream&
printAmpsGenPW (std::ostream& out = std::cout)
const;
224 virtual inline std::ostream&
print(std::ostream& out = std::cout)
const;
249 inline static TMatrixT<double>
matrixRepr(
const std::complex<double>& c);
254 const unsigned int prodAmpIndexB)
const;
261 (
const unsigned int waveIndexA,
262 const unsigned int waveIndexB)
const;
265 const unsigned int waveIndexB,
266 const TMatrixT<double>& jacobian)
const;
271 if (ampName.Contains(
"V_"))
272 return ampName(2, 1000);
274 return ampName(3, 1000);
290 unsigned int countPar = 0;
292 parArray[countPar++] =
prodAmp(
i).real();
295 parArray[countPar++] =
prodAmp(
i).imag();
307 TMatrixT<double> cov(2, 2);
327 std::vector<unsigned int> prodAmpIndices;
329 for (
unsigned int i = 0;
i < prodAmpIndexPairs.size(); ++
i)
330 prodAmpIndices.push_back(prodAmpIndexPairs[
i].first);
332 for (
unsigned int i = 0; i < prodAmpIndexPairs.size(); ++
i)
333 prodAmpIndices.push_back(prodAmpIndexPairs[i].second);
346 const std::vector<unsigned int>& prodAmpIndicesB)
const
348 std::vector<unsigned int> prodAmpIndices;
350 prodAmpIndices.assign(prodAmpIndicesA.begin(), prodAmpIndicesA.end());
352 prodAmpIndices.insert(prodAmpIndices.end(), prodAmpIndicesB.begin(), prodAmpIndicesB.end());
361 const unsigned int waveIndexB)
const
364 return std::complex<double>(norm.Re(), norm.Im());
373 out <<
" Production amplitude names:" << std::endl;
375 out <<
" " << std::setw(3) <<
i <<
" " <<
_prodAmpNames[
i] << std::endl;
385 out <<
" Wave names:" << std::endl;
387 out <<
" " << std::setw(3) <<
i <<
" " <<
_waveNames[
i] << std::endl;
397 out <<
"Production amplitudes:" << std::endl;
411 out <<
"Waves:" << std::endl;
439 out <<
"fitResult dump:" << std::endl
440 <<
" number of events .................... " <<
_nmbEvents << std::endl
441 <<
" number of events to normalize to .... " <<
_normNmbEvents << std::endl
442 <<
" center value of mass bin ............ " <<
_massBinCenter << std::endl
443 <<
" log(likelihood) at maximum .......... " <<
_logLikelihood << std::endl
444 <<
" rank of fit ......................... " <<
_rank << std::endl
445 <<
" bin has a valid covariance matrix ... " <<
_covMatrixValid << std::endl;
449 out <<
" covariance matrix indices:" << std::endl;
453 out <<
" normalization integral (w/o acceptance):" << std::endl <<
_normIntegral << std::endl;
454 out <<
" map of production amplitude indices to indices in normalization integral:" << std::endl;
456 out <<
" prod. amp [" << std::setw(3) <<
i->first <<
"] "
457 <<
"-> norm. int. [" << std::setw(3) <<
i->second <<
"]" << std::endl;
471 TMatrixT<double> m(2, 2);
472 m[0][0] = m[1][1] = c.real();
485 if (ampName.Contains(
"flat"))
489 return TString(ampName(1, 1)).Atoi();
495 std::vector<unsigned int>
499 TString Pattern(waveNamePattern);
500 Pattern.ReplaceAll(
"+",
"\\+");
501 Pattern.ReplaceAll(
"\\\\+",
"\\+");
502 std::vector<unsigned int> waveIndices;
503 for (
unsigned int waveIdx = 0; waveIdx <
nmbWaves(); ++waveIdx){
505 if (
waveName(waveIdx).Contains(TRegexp(Pattern)))
506 waveIndices.push_back(waveIdx);
514 std::vector<unsigned int>
518 TString Pattern(ampNamePattern);
519 Pattern.ReplaceAll(
"+",
"\\+");
520 Pattern.ReplaceAll(
"\\\\+",
"\\+");
521 std::vector<unsigned int> prodAmpIndices;
522 for (
unsigned int prodAmpIdx = 0; prodAmpIdx <
nmbProdAmps(); ++prodAmpIdx)
523 if (
prodAmpName(prodAmpIdx).Contains(TRegexp(Pattern)))
524 prodAmpIndices.push_back(prodAmpIdx);
525 return prodAmpIndices;
531 std::vector<std::pair<unsigned int, unsigned int> >
533 const unsigned int waveIndexB)
const
535 std::vector<std::pair<unsigned int, unsigned int> > prodAmpIndexPairs;
538 for (
unsigned int countAmpA = 0; countAmpA < prodAmpIndicesA.size(); ++countAmpA) {
539 const unsigned int ampIndexA = prodAmpIndicesA[countAmpA];
543 for (
unsigned int countAmpB = 0; countAmpB < prodAmpIndicesB.size(); ++countAmpB)
545 ampIndexB = prodAmpIndicesB[countAmpB];
549 prodAmpIndexPairs.push_back(std::make_pair(ampIndexA, (
unsigned int)ampIndexB));
551 return prodAmpIndexPairs;
559 const unsigned int waveIndexB,
560 const TMatrixT<double>& jacobian)
const
562 if (!_covMatrixValid)
564 const TMatrixT<double> spinDensCov = spinDensityMatrixElemCov(waveIndexA, waveIndexB);
565 const TMatrixT<double> jacobianT(TMatrixT<double>::kTransposed, jacobian);
566 const TMatrixT<double> spinDensCovJT = spinDensCov * jacobianT;
567 const TMatrixT<double> cov = jacobian * spinDensCovJT;
575 #endif // FITRESULT_H