CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PPSAlignmentConfig.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CondFormats/PPSObjects/interface/PPSAlignmentConfig.cc
4  *
5  * Description : Class with alignment parameters
6  *
7  * Authors:
8  * - Jan Kašpar
9  * - Mateusz Kocot
10  *
11  ****************************************************************************/
12 
14 
15 #include <iostream>
16 #include <cmath>
17 #include <iomanip>
18 
19 // -------------------------------- PPSAlignmentConfig getters --------------------------------
20 
21 const std::vector<std::string> &PPSAlignmentConfig::sequence() const { return sequence_; }
23 
26 
28 
33 
35 double PPSAlignmentConfig::n_si() const { return n_si_; }
36 
37 const std::map<unsigned int, std::vector<PointErrors>> &PPSAlignmentConfig::matchingReferencePoints() const {
39 }
40 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::matchingShiftRanges() const {
41  return matchingShiftRanges_;
42 }
43 
44 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_x_meth_o_ranges() const {
46 }
49 unsigned int PPSAlignmentConfig::methOGraphMinN() const { return methOGraphMinN_; }
51 
52 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_x_relative_ranges() const {
54 }
56 
57 const std::map<unsigned int, SelectionRange> &PPSAlignmentConfig::alignment_y_ranges() const {
58  return alignment_y_ranges_;
59 }
60 unsigned int PPSAlignmentConfig::modeGraphMinN() const { return modeGraphMinN_; }
62 
63 const Binning &PPSAlignmentConfig::binning() const { return binning_; }
64 
65 // -------------------------------- PPSAlignmentConfig setters --------------------------------
66 
67 void PPSAlignmentConfig::setSequence(std::vector<std::string> &sequence) { sequence_ = sequence; }
69 
72 
74 
77 void PPSAlignmentConfig::setY_mode_unc_max_valid(double y_mode_unc_max_valid) {
79 }
81 
83 void PPSAlignmentConfig::setN_si(double n_si) { n_si_ = n_si; }
84 
86  std::map<unsigned int, std::vector<PointErrors>> &matchingReferencePoints) {
88 }
89 void PPSAlignmentConfig::setMatchingShiftRanges(std::map<unsigned int, SelectionRange> &matchingShiftRanges) {
91 }
92 
94  std::map<unsigned int, SelectionRange> &alignment_x_meth_o_ranges) {
96 }
97 void PPSAlignmentConfig::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) {
99 }
100 void PPSAlignmentConfig::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) {
102 }
105 
107  std::map<unsigned int, SelectionRange> &alignment_x_relative_ranges) {
109 }
110 void PPSAlignmentConfig::setNearFarMinEntries(unsigned int nearFarMinEntries) {
112 }
113 
114 void PPSAlignmentConfig::setAlignment_y_ranges(std::map<unsigned int, SelectionRange> &alignment_y_ranges) {
116 }
118 void PPSAlignmentConfig::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) {
120 }
121 
123 
124 // -------------------------------- << operators --------------------------------
125 
126 std::ostream &operator<<(std::ostream &os, RPConfig &rc) {
127  os << std::fixed << std::setprecision(3);
128  os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n";
129  os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n";
130  os << " x_min_fit_mode = " << rc.x_min_fit_mode_ << ", x_max_fit_mode = " << rc.x_max_fit_mode_ << "\n";
131  os << " y_max_fit_mode = " << rc.y_max_fit_mode_ << "\n";
132  os << " y_cen_add = " << rc.y_cen_add_ << ", y_width_mult = " << rc.y_width_mult_ << "\n";
133  os << std::setprecision(2);
134  os << " x slices: min = " << rc.x_slice_min_ << ", w = " << rc.x_slice_w_ << ", n = " << rc.x_slice_n_;
135 
136  return os;
137 }
138 
139 std::ostream &operator<<(std::ostream &os, SectorConfig &sc) {
140  os << std::fixed << std::setprecision(3);
141  os << sc.name_ << ":\n";
142  os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n";
143  os << std::setprecision(3);
144  os << " slope = " << sc.slope_ << "\n";
145  os << " cut_h: apply = " << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_
146  << ", si = " << sc.cut_h_si_ << "\n";
147  os << " cut_v: apply = " << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_
148  << ", si = " << sc.cut_v_si_ << "\n";
149 
150  return os;
151 }
152 
153 std::ostream &operator<<(std::ostream &os, Binning &b) {
154  os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n";
155  os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n";
156  os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_;
157 
158  return os;
159 }
160 
161 std::ostream &operator<<(std::ostream &os, PPSAlignmentConfig c) {
162  os << "* sequence\n";
163  for (unsigned int i = 0; i < c.sequence_.size(); i++) {
164  os << " " << i + 1 << ": " << c.sequence_[i] << "\n";
165  }
166  os << "\n";
167 
168  if (c.resultsDir_.empty()) {
169  os << "* no results file\n\n";
170  } else {
171  os << "* results file directory:\n";
172  os << " " << c.resultsDir_ << "\n\n";
173  }
174 
175  os << "* " << c.sectorConfig45_ << "\n\n";
176  os << "* " << c.sectorConfig56_ << "\n\n";
177 
178  std::map<unsigned int, std::string> rpTags = {{c.sectorConfig45_.rp_F_.id_, c.sectorConfig45_.rp_F_.name_},
182 
183  os << "* x alignment shift step\n";
184  os << " x_ali_sh_step = " << c.x_ali_sh_step_ << "\n\n";
185 
186  os << "* mode graph parameters\n";
187  os << " y_mode_sys_unc = " << c.y_mode_sys_unc_ << "\n";
188  os << " chiSqThreshold = " << c.chiSqThreshold_ << "\n";
189  os << " y_mode_unc_max_valid = " << c.y_mode_unc_max_valid_ << "\n";
190  os << " y_mode_max_valid = " << c.y_mode_max_valid_ << "\n\n";
191 
192  os << "* selection\n";
193  os << " max_RP_tracks_size = " << c.maxRPTracksSize_ << "\n\n";
194 
195  os << "* cuts\n";
196  os << " n_si = " << c.n_si_ << "\n\n";
197 
198  os << "* matching\n" << std::setprecision(3);
199 
200  os << " shift ranges:\n";
201  for (const auto &p : c.matchingShiftRanges_)
202  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
203  << ", sh_max = " << p.second.x_max_ << "\n";
204 
205  os << " reference points:\n";
206  for (const auto &pm : c.matchingReferencePoints_) {
207  os << " " << std::setw(3) << pm.first << ": ";
208  for (unsigned int i = 0; i < pm.second.size(); i++) {
209  const auto &p = pm.second[i];
210  if (i % 5 == 0 && i > 0)
211  os << "\n ";
212  os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), ";
213  }
214  os << "\n";
215  }
216 
217  os << "\n"
218  << "* alignment_x_meth_o\n";
219  for (const auto &p : c.alignment_x_meth_o_ranges_)
220  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
221  << ", sh_max = " << p.second.x_max_ << "\n";
222  os << " fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n";
223  os << " fit_profile_min_N_reasonable = " << c.fitProfileMinNReasonable_ << "\n";
224  os << " meth_o_graph_min_N = " << c.methOGraphMinN_ << "\n";
225  os << " meth_o_unc_fit_range = " << c.methOUncFitRange_ << "\n";
226 
227  os << "\n"
228  << "* alignment_x_relative\n";
229  for (const auto &p : c.alignment_x_relative_ranges_)
230  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
231  << ", sh_max = " << p.second.x_max_ << "\n";
232  os << " near_far_min_entries = " << c.nearFarMinEntries_ << "\n";
233 
234  os << "\n"
235  << "* alignment_y\n";
236  for (const auto &p : c.alignment_y_ranges_)
237  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
238  << ", sh_max = " << p.second.x_max_ << "\n";
239  os << " mode_graph_min_N = " << c.modeGraphMinN_ << "\n";
240  os << " mult_sel_proj_y_min_entries = " << c.multSelProjYMinEntries_ << "\n";
241 
242  os << "\n"
243  << "* binning\n";
244  os << c.binning_ << "\n";
245 
246  return os;
247 }
void setBinning(Binning &binning)
unsigned int fitProfileMinNReasonable() const
SectorConfig sectorConfig45_
const edm::EventSetup & c
double bin_size_x_
double n_si() const
void setMaxRPTracksSize(unsigned int maxRPTracksSize)
double x_min_fit_mode_
unsigned int fitProfileMinBinEntries() const
unsigned int multSelProjYMinEntries() const
const Binning & binning() const
double methOUncFitRange() const
const std::string & resultsDir() const
std::map< unsigned int, SelectionRange > alignment_x_meth_o_ranges_
const std::map< unsigned int, SelectionRange > & matchingShiftRanges() const
const std::map< unsigned int, SelectionRange > & alignment_y_ranges() const
std::string name_
double y_width_mult_
void setSequence(std::vector< std::string > &sequence)
double chiSqThreshold() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
unsigned int n_bins_x_
unsigned int nearFarMinEntries() const
std::map< unsigned int, SelectionRange > alignment_x_relative_ranges_
void setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries)
SectorConfig sectorConfig56_
std::vector< std::string > sequence_
const std::map< unsigned int, std::vector< PointErrors > > & matchingReferencePoints() const
unsigned int fitProfileMinBinEntries_
std::map< unsigned int, SelectionRange > alignment_y_ranges_
void setY_mode_unc_max_valid(double y_mode_unc_max_valid)
unsigned int methOGraphMinN_
double y_mode_sys_unc() const
double x_max_fit_mode_
unsigned int fitProfileMinNReasonable_
void setChiSqThreshold(double chiSqThreshold)
void setAlignment_x_relative_ranges(std::map< unsigned int, SelectionRange > &alignment_x_relative_ranges)
void setAlignment_y_ranges(std::map< unsigned int, SelectionRange > &alignment_y_ranges)
void setNearFarMinEntries(unsigned int nearFarMinEntries)
void setMatchingReferencePoints(std::map< unsigned int, std::vector< PointErrors >> &matchingReferencePoints)
const SectorConfig & sectorConfig56() const
std::map< unsigned int, std::vector< PointErrors > > matchingReferencePoints_
void setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable)
std::string name_
unsigned int id_
const std::map< unsigned int, SelectionRange > & alignment_x_meth_o_ranges() const
double y_max_fit_mode_
void setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries)
void setResultsDir(std::string &resultsDir)
double x_slice_min_
void setAlignment_x_meth_o_ranges(std::map< unsigned int, SelectionRange > &alignment_x_meth_o_ranges)
void setMatchingShiftRanges(std::map< unsigned int, SelectionRange > &matchingShiftRanges)
void setY_mode_sys_unc(double y_mode_sys_unc)
void setY_mode_max_valid(double y_mode_max_valid)
std::map< unsigned int, SelectionRange > matchingShiftRanges_
void setMethOGraphMinN(unsigned int methOGraphMinN)
unsigned int nearFarMinEntries_
double y_cen_add_
void setMethOUncFitRange(double methOUncFitRange)
const std::vector< std::string > & sequence() const
void setSectorConfig45(SectorConfig &sectorConfig45)
void setX_ali_sh_step(double x_ali_sh_step)
std::string position_
double x_slice_w_
double b
Definition: hdecay.h:118
unsigned int modeGraphMinN() const
unsigned int maxRPTracksSize_
tuple binning
Definition: pileupCalc.py:163
unsigned int n_bins_y_
void setModeGraphMinN(unsigned int modeGraphMinN)
const SectorConfig & sectorConfig45() const
unsigned int methOGraphMinN() const
const std::map< unsigned int, SelectionRange > & alignment_x_relative_ranges() const
unsigned int multSelProjYMinEntries_
double y_mode_unc_max_valid() const
double y_mode_max_valid() const
double x_ali_sh_step() const
void setN_si(double n_si)
double pixel_x_offset_
double maxRPTracksSize() const
unsigned int modeGraphMinN_
void setSectorConfig56(SectorConfig &sectorConfig56)