/** * \file CbmLitQaHTMLGenerator.cxx * * \author Andrey Lebedev * \date 2011 */ #include "qa/CbmLitQaHTMLGenerator.h" #include #include #include #include #include #include #include #include #include "utils/CbmLitUtils.h" #include void CbmLitQaHTMLGenerator::Create( std::ostream& out, const boost::property_tree::ptree* qa, const boost::property_tree::ptree* ideal, const boost::property_tree::ptree* check) { fQa = qa; fIdeal = ideal; fCheck = check; int row = 0; out.precision(3); out << "" << HtmlHeadString(); out << "

CbmLitReconstructionQa final statistics

" << std::endl; out << HtmlPrintValue("Number of events: ", "hEventNo", "p"); // Number of objects statistics out << "

Number of objects

"; out << ""; out << "" << std::endl; if (fIsMvd) out << PrintRowNofObjects(row++, "MVD", "Mvd"); if (fIsSts) out << PrintRowNofObjects(row++, "STS", "Sts"); if (fIsRich) out << PrintRowNofObjects(row++, "RICH", "Rich"); if (fIsTrd) out << PrintRowNofObjects(row++, "TRD", "Trd"); if (fIsMuch) out << PrintRowNofObjects(row++, "MUCH", "Much"); if (fIsTof) out << PrintRowNofObjects(row++, "TOF", "Tof"); out << PrintRowNofObjects(row++, "Global", "Global"); out << "
PointsDigisClustersHitsTracks
" << std::endl; // True and fake hits histograms (nof all, true, fake hits in track/ring) out << "

True and fake hits

"; out << ""; out << "" << std::endl; if (fIsMvd) out << PrintRowHits(row++, "MVD", "hMvdTrackHits"); if (fIsSts) out << PrintRowHits(row++, "STS", "hStsTrackHits"); if (fIsRich) out << PrintRowHits(row++, "RICH", "hRichRingHits"); if (fIsTrd) out << PrintRowHits(row++, "TRD", "hTrdTrackHits"); if (fIsMuch) out << PrintRowHits(row++, "MUCH", "hMuchTrackHits"); out << "
alltruefaketrue/allfake/all
" << std::endl; // Reconstruction efficiency without RICH out << "

Reconstruction efficiency w/o RICH

"; out << ""; out << "" << std::endl; out << PrintRowEfficiency(row++, "STS", "hStsMom"); out << PrintRowEfficiency(row++, "TRD(MUCH)", "hRecMom"); out << PrintRowEfficiency(row++, "TOF matching", "hTofMom"); out << ""; out << PrintRowEfficiency(row++, "STS", "hStsMomNormHalfGlobal"); out << PrintRowEfficiency(row++, "STS+TRD(MUCH)", "hHalfGlobalMom"); out << ""; out << PrintRowEfficiency(row++, "STS", "hStsMomNormGlobal"); out << PrintRowEfficiency(row++, "STS+TRD(MUCH)", "hHalfGlobalMomNormGlobal"); out << PrintRowEfficiency(row++, "STS+TRD(MUCH)+TOF", "hGlobalMom"); out << "
allreferenceprimarysecondaryelectronmuon
Normalization STS+TRD(MUCH)
Normalization STS+TRD(MUCH)+TOF
" << std::endl; // Reconstruction efficiency with RICH if (fIsRich) { out << "

Reconstruction efficiency with RICH

"; out << ""; out << "" << std::endl; out << PrintRowEfficiencyRich(row++, "RICH", "hRichMom"); out << ""; out << PrintRowEfficiencyRich(row++, "STS", "hStsMomNormStsRich"); out << PrintRowEfficiencyRich(row++, "STS+RICH", "hStsRichMom"); out << ""; out << PrintRowEfficiencyRich(row++, "STS", "hStsMomNormStsRichTrd"); out << PrintRowEfficiencyRich(row++, "STS+RICH", "hStsRichMomNormStsRichTrd"); out << PrintRowEfficiencyRich(row++, "STS+RICH+TRD", "hStsRichTrdMom"); out << ""; out << PrintRowEfficiencyRich(row++, "STS", "hStsMomNormStsRichTrdTof"); out << PrintRowEfficiencyRich(row++, "STS+RICH", "hStsRichMomNormStsRichTrdTof"); out << PrintRowEfficiencyRich(row++, "STS+RICH+TRD", "hStsRichTrdMomNormStsRichTrdTof"); out << PrintRowEfficiencyRich(row++, "STS+RICH+TRD+TOF", "hStsRichTrdTofMom"); out << "
allall refelectronelectron refpionpion ref
Normalization STS+RICH
Normalization STS+RICH+TRD
Normalization STS+RICH+TRD+TOF
" << std::endl; } if (fIsElectronSetup) { // Print electron identification statistics out << "

Electron identification

"; out << ""; out << ""; out << ""; out << PrintRowEfficiencyElId(row++, "STS+TRD", "hStsTrdMomElId"); out << ""; out << PrintRowEfficiencyElId(row++, "STS+TRD", "hStsTrdMomElIdNormStsTrdTof"); out << PrintRowEfficiencyElId(row++, "STS+TRD+TOF", "hStsTrdTofMomElId"); if (fIsRich) { out << ""; out << PrintRowEfficiencyElId(row++, "STS+RICH", "hStsRichMomElId"); out << ""; out << PrintRowEfficiencyElId(row++, "STS+RICH", "hStsRichMomElIdNormStsRichTrd"); out << PrintRowEfficiencyElId(row++, "STS+RICH+TRD", "hStsRichTrdMomElId"); out << ""; out << PrintRowEfficiencyElId(row++, "STS+RICH", "hStsRichMomElIdNormStsRichTrdTof"); out << PrintRowEfficiencyElId(row++, "STS+RICH+TRD", "hStsRichTrdMomElIdNormStsRichTrdTof"); out << PrintRowEfficiencyElId(row++, "STS+RICH+TRD+TOF", "hStsRichTrdTofMomElId"); } out << "
EfficiencyPion supp.
Normalization STS+TRD
Normalization STS+TRD+TOF
Normalization STS+RICH
Normalization STS+RICH+TRD
Normalization STS+RICH+TRD+TOF
" << std::endl; } if (fIsElectronSetup) { // Detector acceptance efficiency out << "

Detector acceptance for signal electrons

"; out << ""; out << ""; out << PrintRowDetAccEl(row++, "STS", "hStsDetAccEl"); out << PrintRowDetAccEl(row++, "STS-RICH","hStsRichDetAccEl"); out << PrintRowDetAccEl(row++, "STS-TRD", "hStsTrdDetAccEl"); out << PrintRowDetAccEl(row++, "STS-TOF", "hStsTofDetAccEl"); out << PrintRowDetAccEl(row++, "STS-RICH-TRD", "hStsRichTrdDetAccEl"); out << PrintRowDetAccEl(row++, "STS-RICH-TRD-TOF", "hStsRichTrdTofDetAccEl"); out << PrintRowDetAccEl(row++, "STS-TRD-TOF", "hStsTrdTofDetAccEl"); out << "
kAcc/MCkRec/MC
" << std::endl; } // Ghost statistics out << "

Ghosts per event

"; out << "
    "; if (fIsSts) out << "
  • " << HtmlPrintValue("STS=", "fhStsGhostNh", "b"); if (fIsTrd || fIsMuch) out << "
  • " << HtmlPrintValue("TRD(MUCH)=", "fhRecGhostNh", "b"); if (fIsRich) out << "
  • " << HtmlPrintValue("RICH=", "fhRichGhostNh", "b"); if (fIsRich) { out << "
  • after STS-RICH matching:"; out << "
      "; out << "
    • " << HtmlPrintValue("STS=", "fhStsGhostRichMatchingNh", "b"); out << "
    • " << HtmlPrintValue("RICH=", "fhRichGhostStsMatchingNh", "b"); out << "
    "; out << "
  • after STS-RICH matching and el identification: "; out << "
      "; out << "
    • " << HtmlPrintValue("RICH=", "fhRichGhostElIdNh", "b"); out << "
    "; } out << "
"; // STS quality numbers out << "

STS quality numbers

"; out << "

Chi2 to primary vertex: "; out << HtmlPrintValue("mean = ", "fhStsChiprim.mean", "b"); out << HtmlPrintValue(" RMS = ", "fhStsChiprim.rms", "b") << "

"; out << "

Momentum resolution: "; out << HtmlPrintValue("mean = ", "fhStsMomresVsMom.mean", "b"); out << HtmlPrintValue(" RMS = ", "fhStsMomresVsMom.rms", "b") << "

"; // Tracking efficiency vs. polar angle out << "

Tracking efficiency in dependence on polar angle

"; out << ""; out << "" << std::endl; if (fIsSts) { out << ""; out << PrintPolarAngleEfficiency("hStsAngle"); } if (fIsTrd || fIsMuch) { out << ""; out << PrintPolarAngleEfficiency("hRecAngle"); } if (fIsTof) { out << ""; out << PrintPolarAngleEfficiency("hTofAngle"); } out << "
allreferenceprimarysecondaryelectronmuon
STS
TRD(MUCH)
TOF
" << std::endl; // Images out << "

rec_qa_global_efficiency_all

\"rec_qa_global_efficiency_all\""; out << "

rec_qa_global_efficiency_signal

\"rec_qa_global_efficiency_signal\""; out << "

rec_qa_sts_efficiency

\"rec_qa_sts_efficiency\""; out << "

rec_qa_rec_efficiency

\"rec_qa_rec_efficiency\""; out << "

rec_qa_tof_efficiency

\"rec_qa_tof_efficiency\""; if (fIsRich) { out << "

rec_qa_rich_efficiency_electrons

\"rec_qa_rich_efficiency_electrons\""; out << "

rec_qa_sts_rich_efficiency_electrons

\"rec_qa_sts_rich_efficiency_electrons\""; out << "

rec_qa_sts_rich_trd_efficiency_electrons

\"rec_qa_sts_rich_trd_efficiency_electrons\""; out << "

rec_qa_sts_rich_trd_tof_efficiency_electrons

\"rec_qa_sts_rich_trd_tof_efficiency_electrons\""; out << "

rec_qa_sts_rich_trd_tof_detector_acceptance

\"rec_qa_sts_rich_trd_tof_detector_acceptance\""; out << "

rec_qa_sts_rich_trd_tof_electron_identification

\"rec_qa_sts_rich_trd_tof_electron_identification\""; out << "

rec_qa_sts_rich_trd_tof_pion_suppression

\"rec_qa_sts_rich_trd_tof_pion_suppression\""; } out << ""; } std::string CbmLitQaHTMLGenerator::PrintRowNofObjects( int row, const std::string& rowName, const std::string& detName) { std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << HtmlPrintValue("", "hNof" + detName + "Points", "td"); if (detName == "Much") { ss << HtmlPrintValue("", "hNof" + detName + "Digis", "td"); ss << HtmlPrintValue("", "hNof" + detName + "Clusters", "td"); ss << "" << HtmlPrintValue("", "hNofMuchPixelHits", "small") << "/" << HtmlPrintValue("", "hNofMuchStrawHits", "small") << ""; } else { ss << HtmlPrintValue("", "hNof" + detName + "Digis", "td"); ss << HtmlPrintValue("", "hNof" + detName + "Clusters", "td"); ss << HtmlPrintValue("", "hNof" + detName + "Hits", "td"); } if (detName == "Rich") { ss << "" << HtmlPrintValue("", "hNofRichRings", "small") << "/" << HtmlPrintValue("", "hNofRichProjections", "small") << ""; } else { ss << HtmlPrintValue("", "hNof" + detName + "Tracks", "td"); } ss << "" << std::endl; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintRowHits( int row, const std::string& rowName, const std::string& histName) { std::string all = HtmlPrintValue("", histName + ".all", "td"); std::string trueh = HtmlPrintValue("", histName + ".true", "td"); std::string fakeh = HtmlPrintValue("", histName + ".fake", "td"); std::string toa = HtmlPrintValue("", histName + ".trueOverAll", "td"); std::string foa = HtmlPrintValue("", histName + ".fakeOverAll", "td"); std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << all << trueh << fakeh << toa << foa; ss << "" << std::endl; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintRowEfficiency( int row, const std::string& rowName, const std::string& histName) { std::string allRec = HtmlPrintValue("", histName + ".all.rec", "small"); std::string allAcc = HtmlPrintValue("", histName + ".all.acc", "small"); std::string allEff = HtmlPrintValue("", histName + ".all.eff", "b"); std::string refRec = HtmlPrintValue("", histName + ".ref.rec", "small"); std::string refAcc = HtmlPrintValue("", histName + ".ref.acc", "small"); std::string refEff = HtmlPrintValue("", histName + ".ref.eff", "b"); std::string primRec = HtmlPrintValue("", histName + ".prim.rec", "small"); std::string primAcc = HtmlPrintValue("", histName + ".prim.acc", "small"); std::string primEff = HtmlPrintValue("", histName + ".prim.eff", "b"); std::string secRec = HtmlPrintValue("", histName + ".sec.rec", "small"); std::string secAcc = HtmlPrintValue("", histName + ".sec.acc", "small"); std::string secEff = HtmlPrintValue("", histName + ".sec.eff", "b"); std::string muRec = HtmlPrintValue("", histName + ".mu.rec", "small"); std::string muAcc = HtmlPrintValue("", histName + ".mu.acc", "small"); std::string muEff = HtmlPrintValue("", histName + ".mu.eff", "b"); std::string elRec = HtmlPrintValue("", histName + ".el.rec", "small"); std::string elAcc = HtmlPrintValue("", histName + ".el.acc", "small"); std::string elEff = HtmlPrintValue("", histName + ".el.eff", "b"); std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << "" << allEff << "("<< allRec << "/" << allAcc << ")" << ""; ss << "" << refEff << "("<< refRec << "/" << refAcc << ")" << ""; ss << "" << primEff << "(" << primRec << "/" << primAcc << ")" << ""; ss << "" << secEff << "(" << secRec << "/" << secAcc << ")" << ""; ss << "" << elEff << "(" << elRec << "/" << elAcc << ")" << ""; ss << "" << muEff << "(" << muRec << "/" << muAcc << ")" << ""; ss << "" << std::endl; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintRowEfficiencyRich( int row, const std::string& rowName, const std::string& histName) { std::string allRec = HtmlPrintValue("", histName + ".richAll.rec", "small"); std::string allAcc = HtmlPrintValue("", histName + ".richAll.acc", "small"); std::string allEff = HtmlPrintValue("", histName + ".richAll.eff", "b"); std::string allRefRec = HtmlPrintValue("", histName + ".richAllRef.rec", "small"); std::string allRefAcc = HtmlPrintValue("", histName + ".richAllRef.acc", "small"); std::string allRefEff = HtmlPrintValue("", histName + ".richAllRef.eff", "b"); std::string elRec = HtmlPrintValue("", histName + ".richEl.rec", "small"); std::string elAcc = HtmlPrintValue("", histName + ".richEl.acc", "small"); std::string elEff = HtmlPrintValue("", histName + ".richEl.eff", "b"); std::string elRefRec = HtmlPrintValue("", histName + ".richElRef.rec", "small"); std::string elRefAcc = HtmlPrintValue("", histName + ".richElRef.acc", "small"); std::string elRefEff = HtmlPrintValue("", histName + ".richElRef.eff", "b"); std::string piRec = HtmlPrintValue("", histName + ".richPi.rec", "small"); std::string piAcc = HtmlPrintValue("", histName + ".richPi.acc", "small"); std::string piEff = HtmlPrintValue("", histName + ".richPi.eff", "b"); std::string piRefRec = HtmlPrintValue("", histName + ".richPiRef.rec", "small"); std::string piRefAcc = HtmlPrintValue("", histName + ".richPiRef.acc", "small"); std::string piRefEff = HtmlPrintValue("", histName + ".richPiRef.eff", "b"); std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << "" << allEff << "(" << allRec << "/" << allAcc << ")" << ""; ss << "" << allRefEff << "(" << allRefRec << "/" << allRefAcc << ")" << ""; ss << "" << elEff << "(" << elRec << "/" << elAcc << ")" << ""; ss << "" << elRefEff << "(" << elRefRec << "/" << elRefAcc << ")" << ""; ss << "" << piEff << "(" << piRec << "/" << piAcc << ")" << ""; ss << "" << piRefEff << "(" << piRefRec << "/" << piRefAcc << ")" << ""; ss << "" << std::endl; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintRowEfficiencyElId( int row, const std::string& rowName, const std::string& histName) { std::string elRec = HtmlPrintValue("", rowName + ".el.rec", "small"); std::string elAcc = HtmlPrintValue("", rowName + ".el.acc", "small"); std::string elEff = HtmlPrintValue("", rowName + ".el.eff", "b"); std::string piRec = HtmlPrintValue("", rowName + ".pi.rec", "small"); std::string piAcc = HtmlPrintValue("", rowName + ".pi.acc", "small"); std::string piSupp = HtmlPrintValue("", rowName + ".pi.supp", "b"); std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << "" << elEff << "("<< elRec << "/" << elAcc << ")" << ""; ss << "" << piSupp << "("<< piAcc << "/" << piRec << ")" << ""; ss << "" << std::endl; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintRowDetAccEl( int row, const std::string& rowName, const std::string& histName) { std::string acc = HtmlPrintValue("", histName + ".detAccAcc.acc", "small"); std::string mc = HtmlPrintValue("", histName + ".detAccAcc.mc", "small"); std::string effAcc = HtmlPrintValue("", histName + ".detAccAcc.eff", "b"); std::string rec = HtmlPrintValue("", histName + ".detAccRec.rec", "small"); std::string effRec = HtmlPrintValue("", histName + ".detAccRec.eff", "b"); std::stringstream ss; if ((row % 2) == 0) ss << ""; else ss << ""; ss << "" << rowName << ""; ss << "" << effAcc << "(" << acc << "/" << mc << ")" << ""; ss << "" << effRec << "(" << rec << "/" << mc << ")" << ""; ss << ""; return ss.str(); } std::string CbmLitQaHTMLGenerator::PrintPolarAngleEfficiency( const std::string& histName) { float maxAngle = fQa->get("MaxAngle", -1.); float minAngle = fQa->get("MinAngle", -1.); float nofBinsAngle = fQa->get("NofBinsAngle", -1.); float step = (maxAngle - minAngle) / nofBinsAngle; if (maxAngle == -1. || minAngle == -1. || nofBinsAngle == -1.){ return "ERROR PolarAngleEfficiencyToString"; } std::stringstream ss; for (int i = 0; i < nofBinsAngle; i++) { std::string angle0 = lit::ToString(i*step); std::string angle1 = lit::ToString(i*step + step); if ((i % 2) == 0) ss << ""; else ss << ""; ss << "(" << angle0 << "-" << angle1 << ")"; ss << "" << HtmlPrintValue("", histName + ".all.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".all.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".all.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << HtmlPrintValue("", histName + ".ref.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".ref.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".ref.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << HtmlPrintValue("", histName + ".prim.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".prim.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".prim.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << HtmlPrintValue("", histName + ".sec.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".sec.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".sec.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << HtmlPrintValue("", histName + ".el.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".el.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".el.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << HtmlPrintValue("", histName + ".mu.eff." + angle0 + "_" + angle1, "b") << "(" << HtmlPrintValue("", histName + ".mu.rec." + angle0 + "_" + angle1, "small") << "/" << HtmlPrintValue("", histName + ".mu.acc." + angle0 + "_" + angle1, "small") << ")" << ""; ss << "" << std::endl; } return ss.str(); }