CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PPSAlignmentConfiguration.cc
Go to the documentation of this file.
1 /****************************************************************************
2 * Authors:
3 * Jan Kašpar (jan.kaspar@gmail.com)
4 * Mateusz Kocot (mateuszkocot99@gmail.com)
5 ****************************************************************************/
6 
8 
9 #include <iostream>
10 #include <cmath>
11 #include <iomanip>
12 
13 // -------------------------------- PPSAlignmentConfiguration getters --------------------------------
14 
16  return sectorConfig45_;
17 }
19  return sectorConfig56_;
20 }
21 
23 
28 
31 double PPSAlignmentConfiguration::n_si() const { return n_si_; }
32 
33 const std::map<unsigned int, std::vector<PPSAlignmentConfiguration::PointErrors>>&
36 }
37 const std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>&
39  return matchingShiftRanges_;
40 }
41 
42 const std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>&
45 }
50 
51 const std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>&
54 }
56 
57 const std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>& PPSAlignmentConfiguration::alignment_y_ranges()
58  const {
59  return alignment_y_ranges_;
60 }
63 
65 
66 const std::vector<double>& PPSAlignmentConfiguration::extraParams() const { return extraParams_; }
67 
68 // -------------------------------- PPSAlignmentConfiguration setters --------------------------------
69 
72 }
75 }
76 
78 
81 void PPSAlignmentConfiguration::setY_mode_unc_max_valid(double y_mode_unc_max_valid) {
83 }
85 
89 
91  std::map<unsigned int, std::vector<PPSAlignmentConfiguration::PointErrors>>& matchingReferencePoints) {
93 }
95  std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>& matchingShiftRanges) {
97 }
98 
100  std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>& alignment_x_meth_o_ranges) {
102 }
103 void PPSAlignmentConfiguration::setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries) {
105 }
106 void PPSAlignmentConfiguration::setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable) {
108 }
111 
113  std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>& alignment_x_relative_ranges) {
115 }
116 void PPSAlignmentConfiguration::setNearFarMinEntries(unsigned int nearFarMinEntries) {
118 }
119 
121  std::map<unsigned int, PPSAlignmentConfiguration::SelectionRange>& alignment_y_ranges) {
123 }
125 void PPSAlignmentConfiguration::setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries) {
127 }
128 
130 
131 void PPSAlignmentConfiguration::setExtraParams(std::vector<double>& extraParams) { extraParams_ = extraParams; }
132 
133 // -------------------------------- << operators --------------------------------
134 
135 std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::RPConfig& rc) {
136  os << std::fixed << std::setprecision(3);
137  os << " " << rc.name_ << ", id = " << rc.id_ << ", position = " << rc.position_ << ":\n";
138  os << " slope = " << rc.slope_ << ", sh_x = " << rc.sh_x_ << "\n";
139  os << " x_min_fit_mode = " << rc.x_min_fit_mode_ << ", x_max_fit_mode = " << rc.x_max_fit_mode_ << "\n";
140  os << " y_max_fit_mode = " << rc.y_max_fit_mode_ << "\n";
141  os << " y_cen_add = " << rc.y_cen_add_ << ", y_width_mult = " << rc.y_width_mult_ << "\n";
142  os << std::setprecision(2);
143  os << " x slices: min = " << rc.x_slice_min_ << ", w = " << rc.x_slice_w_ << ", n = " << rc.x_slice_n_;
144 
145  return os;
146 }
147 
148 std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::SectorConfig& sc) {
149  os << std::fixed << std::setprecision(3);
150  os << sc.name_ << ":\n";
151  os << sc.rp_N_ << "\n" << sc.rp_F_ << "\n";
152  os << std::setprecision(3);
153  os << " slope = " << sc.slope_ << "\n";
154  os << " cut_h: apply = " << std::boolalpha << sc.cut_h_apply_ << ", a = " << sc.cut_h_a_ << ", c = " << sc.cut_h_c_
155  << ", si = " << sc.cut_h_si_ << "\n";
156  os << " cut_v: apply = " << std::boolalpha << sc.cut_v_apply_ << ", a = " << sc.cut_v_a_ << ", c = " << sc.cut_v_c_
157  << ", si = " << sc.cut_v_si_ << "\n";
158 
159  return os;
160 }
161 
162 std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration::Binning& b) {
163  os << " bin_size_x = " << b.bin_size_x_ << ", n_bins_x = " << b.n_bins_x_ << "\n";
164  os << " pixel_x_offset = " << b.pixel_x_offset_ << "\n";
165  os << " n_bins_y = " << b.n_bins_y_ << ", y_min = " << b.y_min_ << ", y_max = " << b.y_max_ << "\n";
166  os << " diff far-near:"
167  << "\n";
168  os << " n_bins_x = " << b.diffFN_n_bins_x_ << ", x_min = " << b.diffFN_x_min_
169  << ", x_max = " << b.diffFN_x_max_ << "\n";
170  os << " slice plots:"
171  << "\n";
172  os << " n_bins_x = " << b.slice_n_bins_x_ << ", x_min = " << b.slice_x_min_ << ", x_max = " << b.slice_x_max_
173  << "\n";
174  os << " n_bins_y = " << b.slice_n_bins_y_ << ", y_min = " << b.slice_y_min_ << ", y_max = " << b.slice_y_max_;
175 
176  return os;
177 }
178 
179 std::ostream& operator<<(std::ostream& os, const PPSAlignmentConfiguration& c) {
180  os << "* " << c.sectorConfig45_ << "\n\n";
181  os << "* " << c.sectorConfig56_ << "\n\n";
182 
183  std::map<unsigned int, std::string> rpTags = {{c.sectorConfig45_.rp_F_.id_, c.sectorConfig45_.rp_F_.name_},
187 
188  os << "* x alignment shift step\n";
189  os << " x_ali_sh_step = " << c.x_ali_sh_step_ << "\n\n";
190 
191  os << "* mode graph parameters\n";
192  os << " y_mode_sys_unc = " << c.y_mode_sys_unc_ << "\n";
193  os << " chiSqThreshold = " << c.chiSqThreshold_ << "\n";
194  os << " y_mode_unc_max_valid = " << c.y_mode_unc_max_valid_ << "\n";
195  os << " y_mode_max_valid = " << c.y_mode_max_valid_ << "\n\n";
196 
197  os << "* selection\n";
198  os << " min_RP_tracks_size = " << c.minRPTracksSize_ << "\n";
199  os << " max_RP_tracks_size = " << c.maxRPTracksSize_ << "\n\n";
200 
201  os << "* cuts\n";
202  os << " n_si = " << c.n_si_ << "\n\n";
203 
204  os << "* matching\n" << std::setprecision(3);
205 
206  os << " shift ranges:\n";
207  for (const auto& p : c.matchingShiftRanges_)
208  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
209  << ", sh_max = " << p.second.x_max_ << "\n";
210 
211  os << " reference points:\n";
212  for (const auto& pm : c.matchingReferencePoints_) {
213  os << " " << std::setw(3) << pm.first << ": ";
214  for (unsigned int i = 0; i < pm.second.size(); i++) {
215  const auto& p = pm.second[i];
216  if (i % 5 == 0 && i > 0)
217  os << "\n ";
218  os << "(" << std::setw(6) << p.x_ << " +- " << p.ex_ << ", " << std::setw(6) << p.y_ << " +- " << p.ey_ << "), ";
219  }
220  os << "\n";
221  }
222 
223  os << "\n"
224  << "* alignment_x_meth_o\n";
225  for (const auto& p : c.alignment_x_meth_o_ranges_)
226  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
227  << ", sh_max = " << p.second.x_max_ << "\n";
228  os << " fit_profile_min_bin_entries = " << c.fitProfileMinBinEntries_ << "\n";
229  os << " fit_profile_min_N_reasonable = " << c.fitProfileMinNReasonable_ << "\n";
230  os << " meth_o_graph_min_N = " << c.methOGraphMinN_ << "\n";
231  os << " meth_o_unc_fit_range = " << c.methOUncFitRange_ << "\n";
232 
233  os << "\n"
234  << "* alignment_x_relative\n";
235  for (const auto& p : c.alignment_x_relative_ranges_)
236  if (p.first == c.sectorConfig45_.rp_N_.id_ || p.first == c.sectorConfig56_.rp_N_.id_) { // only near RPs
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  }
240  os << " near_far_min_entries = " << c.nearFarMinEntries_ << "\n";
241 
242  os << "\n"
243  << "* alignment_y\n";
244  for (const auto& p : c.alignment_y_ranges_)
245  os << " RP " << rpTags[p.first] << " (" << std::setw(3) << p.first << "): sh_min = " << p.second.x_min_
246  << ", sh_max = " << p.second.x_max_ << "\n";
247  os << " mode_graph_min_N = " << c.modeGraphMinN_ << "\n";
248  os << " mult_sel_proj_y_min_entries = " << c.multSelProjYMinEntries_ << "\n";
249 
250  os << "\n"
251  << "* binning\n";
252  os << c.binning_ << "\n";
253 
254  if (!c.extraParams_.empty()) {
255  os << "\n";
256  os << "extra_params:\n";
257  for (size_t i = 0; i < c.extraParams_.size(); i++) {
258  os << std::setw(5) << i << ": " << c.extraParams_[i] << "\n";
259  }
260  }
261 
262  return os;
263 }
const edm::EventSetup & c
void setSectorConfig56(SectorConfig &sectorConfig56)
void setMethOGraphMinN(unsigned int methOGraphMinN)
void setFitProfileMinNReasonable(unsigned int fitProfileMinNReasonable)
const std::vector< double > & extraParams() const
unsigned int fitProfileMinBinEntries() const
unsigned int multSelProjYMinEntries() const
unsigned int methOGraphMinN() const
std::map< unsigned int, SelectionRange > alignment_x_relative_ranges_
const std::map< unsigned int, std::vector< PointErrors > > & matchingReferencePoints() const
std::map< unsigned int, SelectionRange > matchingShiftRanges_
const SectorConfig & sectorConfig56() const
void setY_mode_unc_max_valid(double y_mode_unc_max_valid)
void setAlignment_x_relative_ranges(std::map< unsigned int, SelectionRange > &alignment_x_relative_ranges)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
const std::map< unsigned int, SelectionRange > & matchingShiftRanges() const
void setY_mode_max_valid(double y_mode_max_valid)
const std::map< unsigned int, SelectionRange > & alignment_y_ranges() const
void setAlignment_y_ranges(std::map< unsigned int, SelectionRange > &alignment_y_ranges)
void setMatchingReferencePoints(std::map< unsigned int, std::vector< PointErrors >> &matchingReferencePoints)
void setMatchingShiftRanges(std::map< unsigned int, SelectionRange > &matchingShiftRanges)
const Binning & binning() const
void setFitProfileMinBinEntries(unsigned int fitProfileMinBinEntries)
void setNearFarMinEntries(unsigned int nearFarMinEntries)
std::map< unsigned int, std::vector< PointErrors > > matchingReferencePoints_
void setAlignment_x_meth_o_ranges(std::map< unsigned int, SelectionRange > &alignment_x_meth_o_ranges)
void setMultSelProjYMinEntries(unsigned int multSelProjYMinEntries)
void setX_ali_sh_step(double x_ali_sh_step)
unsigned int nearFarMinEntries() const
unsigned int fitProfileMinNReasonable() const
std::map< unsigned int, SelectionRange > alignment_x_meth_o_ranges_
void setMethOUncFitRange(double methOUncFitRange)
void setY_mode_sys_unc(double y_mode_sys_unc)
void setChiSqThreshold(double chiSqThreshold)
double b
Definition: hdecay.h:118
tuple binning
Definition: pileupCalc.py:163
const SectorConfig & sectorConfig45() const
void setModeGraphMinN(unsigned int modeGraphMinN)
void setMinRPTracksSize(unsigned int minRPTracksSize)
const std::map< unsigned int, SelectionRange > & alignment_x_relative_ranges() const
const std::map< unsigned int, SelectionRange > & alignment_x_meth_o_ranges() const
void setSectorConfig45(SectorConfig &sectorConfig45)
void setExtraParams(std::vector< double > &extraParams)
std::map< unsigned int, SelectionRange > alignment_y_ranges_
void setMaxRPTracksSize(unsigned int maxRPTracksSize)