Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-08 23:57:42

0001 /****************************************************************************

0002  *

0003  *  This class is obsolete! Use PPSAlignmentConfiguration instead.

0004  *

0005  *  Authors:

0006  *  - Jan Kašpar

0007  *  - Mateusz Kocot

0008  *

0009  ****************************************************************************/
0010 
0011 #include "CondFormats/PPSObjects/interface/PPSAlignmentConfig.h"
0012 
0013 #include <iostream>
0014 #include <cmath>
0015 #include <iomanip>
0016 
0017 // -------------------------------- PPSAlignmentConfig getters --------------------------------

0018 
0019 const std::vector<std::string> &PPSAlignmentConfig::sequence() const { return sequence_; }
0020 const std::string &PPSAlignmentConfig::resultsDir() const { return resultsDir_; }
0021 
0022 const SectorConfig &PPSAlignmentConfig::sectorConfig45() const { return sectorConfig45_; }
0023 const SectorConfig &PPSAlignmentConfig::sectorConfig56() const { return sectorConfig56_; }
0024 
0025 double PPSAlignmentConfig::x_ali_sh_step() const { return x_ali_sh_step_; }
0026 
0027 double PPSAlignmentConfig::y_mode_sys_unc() const { return y_mode_sys_unc_; }
0028 double PPSAlignmentConfig::chiSqThreshold() const { return chiSqThreshold_; }
0029 double PPSAlignmentConfig::y_mode_unc_max_valid() const { return y_mode_unc_max_valid_; }
0030 double PPSAlignmentConfig::y_mode_max_valid() const { return y_mode_max_valid_; }
0031 
0032 double PPSAlignmentConfig::maxRPTracksSize() const { return maxRPTracksSize_; }
0033 double PPSAlignmentConfig::n_si() const { return n_si_; }
0034 
0035 const std::map<unsigned int, std::vector<PointErrors>> &PPSAlignmentConfig::matchingReferencePoints() const {
0036   return matchingReferencePoints_;
0037 }
0038 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::matchingShiftRanges() const {
0039   return matchingShiftRanges_;
0040 }
0041 
0042 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_x_meth_o_ranges() const {
0043   return alignment_x_meth_o_ranges_;
0044 }
0045 unsigned int PPSAlignmentConfig::fitProfileMinBinEntries() const { return fitProfileMinBinEntries_; }
0046 unsigned int PPSAlignmentConfig::fitProfileMinNReasonable() const { return fitProfileMinNReasonable_; }
0047 unsigned int PPSAlignmentConfig::methOGraphMinN() const { return methOGraphMinN_; }
0048 double PPSAlignmentConfig::methOUncFitRange() const { return methOUncFitRange_; }
0049 
0050 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_x_relative_ranges() const {
0051   return alignment_x_relative_ranges_;
0052 }
0053 unsigned int PPSAlignmentConfig::nearFarMinEntries() const { return nearFarMinEntries_; }
0054 
0055 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_y_ranges() const {
0056   return alignment_y_ranges_;
0057 }
0058 unsigned int PPSAlignmentConfig::modeGraphMinN() const { return modeGraphMinN_; }
0059 unsigned int PPSAlignmentConfig::multSelProjYMinEntries() const { return multSelProjYMinEntries_; }
0060 
0061 const Binning &PPSAlignmentConfig::binning() const { return binning_; }
0062 
0063 // -------------------------------- PPSAlignmentConfig setters --------------------------------

0064 
0065 void PPSAlignmentConfig::setSequence(std::vector<std::string> &sequence) { sequence_ = sequence; }
0066 void PPSAlignmentConfig::setResultsDir(std::string &resultsDir) { resultsDir_ = resultsDir; }
0067 
0068 void PPSAlignmentConfig::setSectorConfig45(SectorConfig &sectorConfig45) { sectorConfig45_ = sectorConfig45; }
0069 void PPSAlignmentConfig::setSectorConfig56(SectorConfig &sectorConfig56) { sectorConfig56_ = sectorConfig56; }
0070 
0071 void PPSAlignmentConfig::setX_ali_sh_step(double x_ali_sh_step) { x_ali_sh_step_ = x_ali_sh_step; }
0072 
0073 void PPSAlignmentConfig::setY_mode_sys_unc(double y_mode_sys_unc) { y_mode_sys_unc_ = y_mode_sys_unc; }
0074 void PPSAlignmentConfig::setChiSqThreshold(double chiSqThreshold) { chiSqThreshold_ = chiSqThreshold; }
0075 void PPSAlignmentConfig::setY_mode_unc_max_valid(double y_mode_unc_max_valid) {
0076   y_mode_unc_max_valid_ = y_mode_unc_max_valid;
0077 }
0078 void PPSAlignmentConfig::setY_mode_max_valid(double y_mode_max_valid) { y_mode_max_valid_ = y_mode_max_valid; }
0079 
0080 void PPSAlignmentConfig::setMaxRPTracksSize(unsigned int maxRPTracksSize) { maxRPTracksSize_ = maxRPTracksSize; }
0081 void PPSAlignmentConfig::setN_si(double n_si) { n_si_ = n_si; }
0082 
0083 void PPSAlignmentConfig::setMatchingReferencePoints(
0084     std::map<unsigned int, std::vector<PointErrors>> &matchingReferencePoints) {
0085   matchingReferencePoints_ = matchingReferencePoints;
0086 }
0087 void PPSAlignmentConfig::setMatchingShiftRanges(std::map<unsigned int, SelectionRange> &matchingShiftRanges) {
0088   matchingShiftRanges_ = matchingShiftRanges;
0089 }
0090 
0091 void PPSAlignmentConfig::setAlignment_x_meth_o_ranges(
0092     std::map<unsigned int, SelectionRange> &alignment_x_meth_o_ranges) {
0093   alignment_x_meth_o_ranges_ = alignment_x_meth_o_ranges;
0094 }
0095 void PPSAlignmentConfig::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) {
0096   fitProfileMinBinEntries_ = fitProfileMinBinEntries;
0097 }
0098 void PPSAlignmentConfig::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) {
0099   fitProfileMinNReasonable_ = fitProfileMinNReasonable;
0100 }
0101 void PPSAlignmentConfig::setMethOGraphMinN(unsigned int methOGraphMinN) { methOGraphMinN_ = methOGraphMinN; }
0102 void PPSAlignmentConfig::setMethOUncFitRange(double methOUncFitRange) { methOUncFitRange_ = methOUncFitRange; }
0103 
0104 void PPSAlignmentConfig::setAlignment_x_relative_ranges(
0105     std::map<unsigned int, SelectionRange> &alignment_x_relative_ranges) {
0106   alignment_x_relative_ranges_ = alignment_x_relative_ranges;
0107 }
0108 void PPSAlignmentConfig::setNearFarMinEntries(unsigned int nearFarMinEntries) {
0109   nearFarMinEntries_ = nearFarMinEntries;
0110 }
0111 
0112 void PPSAlignmentConfig::setAlignment_y_ranges(std::map<unsigned int, SelectionRange> &alignment_y_ranges) {
0113   alignment_y_ranges_ = alignment_y_ranges;
0114 }
0115 void PPSAlignmentConfig::setModeGraphMinN(unsigned int modeGraphMinN) { modeGraphMinN_ = modeGraphMinN; }
0116 void PPSAlignmentConfig::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) {
0117   multSelProjYMinEntries_ = multSelProjYMinEntries;
0118 }
0119 
0120 void PPSAlignmentConfig::setBinning(Binning &binning) { binning_ = binning; }
0121 
0122 // -------------------------------- << operators --------------------------------

0123 
0124 std::ostream &operator<<(std::ostream &os, RPConfig &rc) {
0125   os << std::fixed << std::setprecision(3);
0126   os << "    " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n";
0127   os << "        slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n";
0128   os << "        x_min_fit_mode = " << rc.x_min_fit_mode_ << ", x_max_fit_mode = " << rc.x_max_fit_mode_ << "\n";
0129   os << "        y_max_fit_mode = " << rc.y_max_fit_mode_ << "\n";
0130   os << "        y_cen_add = " << rc.y_cen_add_ << ", y_width_mult = " << rc.y_width_mult_ << "\n";
0131   os << std::setprecision(2);
0132   os << "        x slices: min = " << rc.x_slice_min_ << ", w = " << rc.x_slice_w_ << ", n = " << rc.x_slice_n_;
0133 
0134   return os;
0135 }
0136 
0137 std::ostream &operator<<(std::ostream &os, SectorConfig &sc) {
0138   os << std::fixed << std::setprecision(3);
0139   os << sc.name_ << ":\n";
0140   os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n";
0141   os << std::setprecision(3);
0142   os << "    slope = " << sc.slope_ << "\n";
0143   os << "    cut_h: apply = " << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_
0144      << ", si = " << sc.cut_h_si_ << "\n";
0145   os << "    cut_v: apply = " << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_
0146      << ", si = " << sc.cut_v_si_ << "\n";
0147 
0148   return os;
0149 }
0150 
0151 std::ostream &operator<<(std::ostream &os, Binning &b) {
0152   os << "    bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n";
0153   os << "    pixel_x_offset = " << b.pixel_x_offset_ << "\n";
0154   os << "    n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_;
0155 
0156   return os;
0157 }
0158 
0159 std::ostream &operator<<(std::ostream &os, PPSAlignmentConfig c) {
0160   os << "* sequence\n";
0161   for (unsigned int i = 0; i < c.sequence_.size(); i++) {
0162     os << "    " << i + 1 << ": " << c.sequence_[i] << "\n";
0163   }
0164   os << "\n";
0165 
0166   if (c.resultsDir_.empty()) {
0167     os << "* no results file\n\n";
0168   } else {
0169     os << "* results file directory:\n";
0170     os << "    " << c.resultsDir_ << "\n\n";
0171   }
0172 
0173   os << "* " << c.sectorConfig45_ << "\n\n";
0174   os << "* " << c.sectorConfig56_ << "\n\n";
0175 
0176   std::map<unsigned int, std::string> rpTags = {{c.sectorConfig45_.rp_F_.id_, c.sectorConfig45_.rp_F_.name_},
0177                                                 {c.sectorConfig45_.rp_N_.id_, c.sectorConfig45_.rp_N_.name_},
0178                                                 {c.sectorConfig56_.rp_N_.id_, c.sectorConfig56_.rp_N_.name_},
0179                                                 {c.sectorConfig56_.rp_F_.id_, c.sectorConfig56_.rp_F_.name_}};
0180 
0181   os << "* x alignment shift step\n";
0182   os << "    x_ali_sh_step = " << c.x_ali_sh_step_ << "\n\n";
0183 
0184   os << "* mode graph parameters\n";
0185   os << "    y_mode_sys_unc = " << c.y_mode_sys_unc_ << "\n";
0186   os << "    chiSqThreshold = " << c.chiSqThreshold_ << "\n";
0187   os << "    y_mode_unc_max_valid = " << c.y_mode_unc_max_valid_ << "\n";
0188   os << "    y_mode_max_valid = " << c.y_mode_max_valid_ << "\n\n";
0189 
0190   os << "* selection\n";
0191   os << "    max_RP_tracks_size = " << c.maxRPTracksSize_ << "\n\n";
0192 
0193   os << "* cuts\n";
0194   os << "    n_si = " << c.n_si_ << "\n\n";
0195 
0196   os << "* matching\n" << std::setprecision(3);
0197 
0198   os << "    shift ranges:\n";
0199   for (const auto &p : c.matchingShiftRanges_)
0200     os << "        RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
0201        << ", sh_max = " << p.second.x_max_ << "\n";
0202 
0203   os << "    reference points:\n";
0204   for (const auto &pm : c.matchingReferencePoints_) {
0205     os << "        " << std::setw(3) << pm.first << ": ";
0206     for (unsigned int i = 0; i < pm.second.size(); i++) {
0207       const auto &p = pm.second[i];
0208       if (i % 5 == 0 && i > 0)
0209         os << "\n             ";
0210       os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), ";
0211     }
0212     os << "\n";
0213   }
0214 
0215   os << "\n"
0216      << "* alignment_x_meth_o\n";
0217   for (const auto &p : c.alignment_x_meth_o_ranges_)
0218     os << "    RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
0219        << ", sh_max = " << p.second.x_max_ << "\n";
0220   os << "    fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n";
0221   os << "    fit_profile_min_N_reasonable = " << c.fitProfileMinNReasonable_ << "\n";
0222   os << "    meth_o_graph_min_N = " << c.methOGraphMinN_ << "\n";
0223   os << "    meth_o_unc_fit_range = " << c.methOUncFitRange_ << "\n";
0224 
0225   os << "\n"
0226      << "* alignment_x_relative\n";
0227   for (const auto &p : c.alignment_x_relative_ranges_)
0228     os << "    RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
0229        << ", sh_max = " << p.second.x_max_ << "\n";
0230   os << "    near_far_min_entries = " << c.nearFarMinEntries_ << "\n";
0231 
0232   os << "\n"
0233      << "* alignment_y\n";
0234   for (const auto &p : c.alignment_y_ranges_)
0235     os << "    RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
0236        << ", sh_max = " << p.second.x_max_ << "\n";
0237   os << "    mode_graph_min_N = " << c.modeGraphMinN_ << "\n";
0238   os << "    mult_sel_proj_y_min_entries = " << c.multSelProjYMinEntries_ << "\n";
0239 
0240   os << "\n"
0241      << "* binning\n";
0242   os << c.binning_ << "\n";
0243 
0244   return os;
0245 }