CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Public Attributes
PPSAlignmentWorker::SectorData Struct Reference

Classes

struct  SlicePlots
 

Public Member Functions

void init (DQMStore::IBooker &iBooker, const PPSAlignmentConfiguration &cfg, const PPSAlignmentConfiguration::SectorConfig &scfg, const std::string &folder, bool debug)
 
unsigned int process (const CTPPSLocalTrackLiteCollection &tracks, const PPSAlignmentConfiguration &cfg, bool debug)
 

Public Attributes

MonitorElementh2_cut_h_aft
 
MonitorElementh2_cut_h_bef
 
MonitorElementh2_cut_v_aft
 
MonitorElementh2_cut_v_bef
 
MonitorElementh_q_cut_h_aft
 
MonitorElementh_q_cut_h_bef
 
MonitorElementh_q_cut_v_aft
 
MonitorElementh_q_cut_v_bef
 
std::map< unsigned int,
MonitorElement * > 
m_h2_y_vs_x_aft_sel
 
std::map< unsigned int,
MonitorElement * > 
m_h2_y_vs_x_bef_sel
 
std::map< unsigned int,
MonitorElement * > 
m_h2_y_vs_x_mlt_sel
 
MonitorElementp_x_diffFN_vs_x_N
 
MonitorElementp_y_diffFN_vs_y_F
 
PPSAlignmentConfiguration::SectorConfig scfg_
 
std::map< unsigned int,
SlicePlots
x_slice_plots_F
 
std::map< unsigned int,
SlicePlots
x_slice_plots_N
 

Detailed Description

Definition at line 46 of file PPSAlignmentWorker.cc.

Member Function Documentation

void PPSAlignmentWorker::SectorData::init ( DQMStore::IBooker iBooker,
const PPSAlignmentConfiguration cfg,
const PPSAlignmentConfiguration::SectorConfig scfg,
const std::string &  folder,
bool  debug 
)

Definition at line 176 of file PPSAlignmentWorker.cc.

References PPSAlignmentConfiguration::Binning::bin_size_x_, PPSAlignmentConfiguration::binning(), dqm::implementation::IBooker::book1DD(), dqm::implementation::IBooker::book2DD(), dqm::implementation::IBooker::bookProfile(), visDQMUpload::buf, PPSAlignmentConfiguration::Binning::diffFN_n_bins_x_, PPSAlignmentConfiguration::Binning::diffFN_x_max_, PPSAlignmentConfiguration::Binning::diffFN_x_min_, h2_cut_h_aft, h2_cut_h_bef, h2_cut_v_aft, h2_cut_v_bef, h_q_cut_h_aft, h_q_cut_h_bef, h_q_cut_v_aft, h_q_cut_v_bef, mps_fire::i, PPSAlignmentConfiguration::RPConfig::id_, m_h2_y_vs_x_aft_sel, m_h2_y_vs_x_bef_sel, m_h2_y_vs_x_mlt_sel, PPSAlignmentConfiguration::Binning::n_bins_x_, PPSAlignmentConfiguration::Binning::n_bins_y_, PPSAlignmentConfiguration::RPConfig::name_, PPSAlignmentConfiguration::SectorConfig::name_, p_x_diffFN_vs_x_N, PPSAlignmentConfiguration::Binning::pixel_x_offset_, PPSAlignmentConfiguration::SectorConfig::rp_F_, PPSAlignmentConfiguration::SectorConfig::rp_N_, scfg_, dqm::implementation::NavigatorBase::setCurrentFolder(), PPSAlignmentConfiguration::RPConfig::x_slice_min_, PPSAlignmentConfiguration::RPConfig::x_slice_n_, x_slice_plots_F, x_slice_plots_N, PPSAlignmentConfiguration::RPConfig::x_slice_w_, PPSAlignmentConfiguration::Binning::y_max_, and PPSAlignmentConfiguration::Binning::y_min_.

Referenced by PPSAlignmentWorker::bookHistograms().

180  {
181  scfg_ = scfg;
182 
183  // binning
184  const double bin_size_x = cfg.binning().bin_size_x_;
185  const unsigned int n_bins_x = cfg.binning().n_bins_x_;
186 
187  const double pixel_x_offset = cfg.binning().pixel_x_offset_;
188 
189  const double x_min_pix = pixel_x_offset, x_max_pix = pixel_x_offset + n_bins_x * bin_size_x;
190  const double x_min_str = 0., x_max_str = n_bins_x * bin_size_x;
191 
192  const unsigned int n_bins_y = cfg.binning().n_bins_y_;
193  const double y_min = cfg.binning().y_min_, y_max = cfg.binning().y_max_;
194 
195  // hit distributions
196  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/before selection/" + scfg_.rp_N_.name_);
198  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max);
199  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/before selection/" + scfg_.rp_F_.name_);
201  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max);
202 
203  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/multiplicity selection/" + scfg_.rp_N_.name_);
205  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max);
206  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/multiplicity selection/" + scfg_.rp_F_.name_);
208  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max);
209 
210  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/after selection/" + scfg_.rp_N_.name_);
212  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_str, x_max_str, n_bins_y, y_min, y_max);
213  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/after selection/" + scfg_.rp_F_.name_);
215  iBooker.book2DD("h2_y_vs_x", ";x;y", n_bins_x, x_min_pix, x_max_pix, n_bins_y, y_min, y_max);
216 
217  // cut plots
218  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/cuts/cut_h");
219  h_q_cut_h_bef = iBooker.book1DD("h_q_cut_h_bef", ";cq_h", 400, -2., 2.);
220  h_q_cut_h_aft = iBooker.book1DD("h_q_cut_h_aft", ";cq_h", 400, -2., 2.);
221  h2_cut_h_bef =
222  iBooker.book2DD("h2_cut_h_bef", ";x_up;x_dw", n_bins_x, x_min_str, x_max_str, n_bins_x, x_min_pix, x_max_pix);
223  h2_cut_h_aft =
224  iBooker.book2DD("h2_cut_h_aft", ";x_up;x_dw", n_bins_x, x_min_str, x_max_str, n_bins_x, x_min_pix, x_max_pix);
225 
226  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/cuts/cut_v");
227  h_q_cut_v_bef = iBooker.book1DD("h_q_cut_v_bef", ";cq_v", 400, -2., 2.);
228  h_q_cut_v_aft = iBooker.book1DD("h_q_cut_v_aft", ";cq_v", 400, -2., 2.);
229  h2_cut_v_bef = iBooker.book2DD("h2_cut_v_bef", ";y_up;y_dw", n_bins_y, y_min, y_max, n_bins_y, y_min, y_max);
230  h2_cut_v_aft = iBooker.book2DD("h2_cut_v_aft", ";y_up;y_dw", n_bins_y, y_min, y_max, n_bins_y, y_min, y_max);
231 
232  // near-far plots
233  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far");
234 
235  auto profilePtr = std::make_unique<TProfile>("",
236  ";x_{N};x_{F} - x_{N}",
238  cfg.binning().diffFN_x_min_,
239  cfg.binning().diffFN_x_max_);
240  p_x_diffFN_vs_x_N = iBooker.bookProfile("p_x_diffFN_vs_x_N", profilePtr.get());
241 
242  for (int i = 0; i < scfg_.rp_N_.x_slice_n_; i++) {
243  const double x_min = scfg_.rp_N_.x_slice_min_ + i * scfg_.rp_N_.x_slice_w_;
244  const double x_max = scfg_.rp_N_.x_slice_min_ + (i + 1) * scfg_.rp_N_.x_slice_w_;
245 
246  char buf[100];
247  sprintf(buf, "%.1f-%.1f", x_min, x_max);
248 
249  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far/x slices, N/" + buf);
250  x_slice_plots_N.insert({i, SlicePlots(iBooker, cfg, debug)});
251  }
252 
253  for (int i = 0; i < scfg_.rp_F_.x_slice_n_; i++) {
254  const double x_min = scfg_.rp_F_.x_slice_min_ + i * scfg_.rp_F_.x_slice_w_;
255  const double x_max = scfg_.rp_F_.x_slice_min_ + (i + 1) * scfg_.rp_F_.x_slice_w_;
256 
257  char buf[100];
258  sprintf(buf, "%.1f-%.1f", x_min, x_max);
259 
260  iBooker.setCurrentFolder(folder + "/" + scfg_.name_ + "/near_far/x slices, F/" + buf);
261  x_slice_plots_F.insert({i, SlicePlots(iBooker, cfg, debug)});
262  }
263 }
std::map< unsigned int, SlicePlots > x_slice_plots_F
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_bef_sel
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_aft_sel
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
const Binning & binning() const
PPSAlignmentConfiguration::SectorConfig scfg_
#define debug
Definition: HDRShower.cc:19
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:261
std::map< unsigned int, SlicePlots > x_slice_plots_N
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_mlt_sel
unsigned int PPSAlignmentWorker::SectorData::process ( const CTPPSLocalTrackLiteCollection tracks,
const PPSAlignmentConfiguration cfg,
bool  debug 
)

Definition at line 265 of file PPSAlignmentWorker.cc.

References CTPPSDetId::arm(), PPSAlignmentConfiguration::SectorConfig::cut_h_a_, PPSAlignmentConfiguration::SectorConfig::cut_h_apply_, PPSAlignmentConfiguration::SectorConfig::cut_h_c_, PPSAlignmentConfiguration::SectorConfig::cut_h_si_, PPSAlignmentConfiguration::SectorConfig::cut_v_a_, PPSAlignmentConfiguration::SectorConfig::cut_v_apply_, PPSAlignmentConfiguration::SectorConfig::cut_v_c_, PPSAlignmentConfiguration::SectorConfig::cut_v_si_, dqm::impl::MonitorElement::Fill(), h2_cut_h_aft, h2_cut_h_bef, h2_cut_v_aft, h2_cut_v_bef, h_q_cut_h_aft, h_q_cut_h_bef, h_q_cut_v_aft, h_q_cut_v_bef, PPSAlignmentConfiguration::RPConfig::id_, if(), m_h2_y_vs_x_aft_sel, m_h2_y_vs_x_bef_sel, m_h2_y_vs_x_mlt_sel, PPSAlignmentConfiguration::maxRPTracksSize(), PPSAlignmentConfiguration::minRPTracksSize(), PPSAlignmentConfiguration::n_si(), p_x_diffFN_vs_x_N, PPSAlignmentConfiguration::SectorConfig::rp_F_, PPSAlignmentConfiguration::SectorConfig::rp_N_, scfg_, PPSAlignmentConfiguration::RPConfig::x_slice_min_, PPSAlignmentConfiguration::RPConfig::x_slice_n_, x_slice_plots_F, x_slice_plots_N, and PPSAlignmentConfiguration::RPConfig::x_slice_w_.

Referenced by PPSAlignmentWorker::analyze().

267  {
268  CTPPSLocalTrackLiteCollection tracksUp, tracksDw;
269 
270  for (const auto& tr : tracks) {
271  CTPPSDetId rpId(tr.rpId());
272  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
273 
274  if (rpDecId != scfg_.rp_N_.id_ && rpDecId != scfg_.rp_F_.id_)
275  continue;
276 
277  // store the track in the right collection
278  if (rpDecId == scfg_.rp_N_.id_)
279  tracksUp.push_back(tr);
280  if (rpDecId == scfg_.rp_F_.id_)
281  tracksDw.push_back(tr);
282  }
283 
284  // update plots before selection
285  for (const auto& tr : tracksUp)
286  m_h2_y_vs_x_bef_sel[scfg_.rp_N_.id_]->Fill(tr.x(), tr.y());
287 
288  for (const auto& tr : tracksDw)
289  m_h2_y_vs_x_bef_sel[scfg_.rp_F_.id_]->Fill(tr.x(), tr.y());
290 
291  // skip crowded events (multiplicity selection)
292  if (tracksUp.size() < cfg.minRPTracksSize() || tracksUp.size() > cfg.maxRPTracksSize())
293  return 0;
294 
295  if (tracksDw.size() < cfg.minRPTracksSize() || tracksDw.size() > cfg.maxRPTracksSize())
296  return 0;
297 
298  // update plots with multiplicity selection
299  for (const auto& tr : tracksUp)
300  m_h2_y_vs_x_mlt_sel[scfg_.rp_N_.id_]->Fill(tr.x(), tr.y());
301 
302  for (const auto& tr : tracksDw)
303  m_h2_y_vs_x_mlt_sel[scfg_.rp_F_.id_]->Fill(tr.x(), tr.y());
304 
305  // do the selection
306  unsigned int pairsSelected = 0;
307 
308  for (const auto& trUp : tracksUp) {
309  for (const auto& trDw : tracksDw) {
310  h2_cut_h_bef->Fill(trUp.x(), trDw.x());
311  h2_cut_v_bef->Fill(trUp.y(), trDw.y());
312 
313  const double cq_h = trDw.x() + scfg_.cut_h_a_ * trUp.x() + scfg_.cut_h_c_;
314  h_q_cut_h_bef->Fill(cq_h);
315  const bool cv_h = (std::fabs(cq_h) < cfg.n_si() * scfg_.cut_h_si_);
316 
317  const double cq_v = trDw.y() + scfg_.cut_v_a_ * trUp.y() + scfg_.cut_v_c_;
318  h_q_cut_v_bef->Fill(cq_v);
319  const bool cv_v = (std::fabs(cq_v) < cfg.n_si() * scfg_.cut_v_si_);
320 
321  bool cutsPassed = true;
322  if (scfg_.cut_h_apply_)
323  cutsPassed &= cv_h;
324  if (scfg_.cut_v_apply_)
325  cutsPassed &= cv_v;
326 
327  if (cutsPassed) {
328  pairsSelected++;
329 
330  h_q_cut_h_aft->Fill(cq_h);
331  h_q_cut_v_aft->Fill(cq_v);
332 
333  h2_cut_h_aft->Fill(trUp.x(), trDw.x());
334  h2_cut_v_aft->Fill(trUp.y(), trDw.y());
335 
336  m_h2_y_vs_x_aft_sel[scfg_.rp_N_.id_]->Fill(trUp.x(), trUp.y());
337  m_h2_y_vs_x_aft_sel[scfg_.rp_F_.id_]->Fill(trDw.x(), trDw.y());
338 
339  p_x_diffFN_vs_x_N->Fill(trUp.x(), trDw.x() - trUp.x());
340 
341  int idx = (trUp.x() - scfg_.rp_N_.x_slice_min_) / scfg_.rp_N_.x_slice_w_;
342  if (idx >= 0 && idx < scfg_.rp_N_.x_slice_n_) {
343  x_slice_plots_N[idx].h_y->Fill(trUp.y());
344  x_slice_plots_N[idx].p_y_diffFN_vs_y->Fill(trUp.y(), trDw.y() - trUp.y());
345  if (debug)
346  x_slice_plots_N[idx].h2_y_diffFN_vs_y->Fill(trUp.y(), trDw.y() - trUp.y());
347  }
348 
349  idx = (trDw.x() - scfg_.rp_F_.x_slice_min_) / scfg_.rp_F_.x_slice_w_;
350  if (idx >= 0 && idx < scfg_.rp_F_.x_slice_n_) {
351  x_slice_plots_F[idx].h_y->Fill(trDw.y());
352  x_slice_plots_F[idx].p_y_diffFN_vs_y->Fill(trDw.y(), trDw.y() - trUp.y());
353  if (debug)
354  x_slice_plots_F[idx].h2_y_diffFN_vs_y->Fill(trDw.y(), trDw.y() - trUp.y());
355  }
356  }
357  }
358  }
359 
360  return pairsSelected;
361 }
std::map< unsigned int, SlicePlots > x_slice_plots_F
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_bef_sel
auto const & tracks
cannot be loose
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_aft_sel
void Fill(long long x)
if(conf_.getParameter< bool >("UseStripCablingDB"))
PPSAlignmentConfiguration::SectorConfig scfg_
uint32_t arm() const
Definition: CTPPSDetId.h:51
#define debug
Definition: HDRShower.cc:19
std::vector< CTPPSLocalTrackLite > CTPPSLocalTrackLiteCollection
Collection of CTPPSLocalTrackLite objects.
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
std::map< unsigned int, SlicePlots > x_slice_plots_N
std::map< unsigned int, MonitorElement * > m_h2_y_vs_x_mlt_sel

Member Data Documentation

MonitorElement* PPSAlignmentWorker::SectorData::h2_cut_h_aft

Definition at line 60 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h2_cut_h_bef

Definition at line 59 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h2_cut_v_aft

Definition at line 65 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h2_cut_v_bef

Definition at line 64 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h_q_cut_h_aft

Definition at line 58 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h_q_cut_h_bef

Definition at line 57 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h_q_cut_v_aft

Definition at line 63 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::h_q_cut_v_bef

Definition at line 62 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

std::map<unsigned int, MonitorElement*> PPSAlignmentWorker::SectorData::m_h2_y_vs_x_aft_sel

Definition at line 54 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

std::map<unsigned int, MonitorElement*> PPSAlignmentWorker::SectorData::m_h2_y_vs_x_bef_sel

Definition at line 50 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

std::map<unsigned int, MonitorElement*> PPSAlignmentWorker::SectorData::m_h2_y_vs_x_mlt_sel

Definition at line 52 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::p_x_diffFN_vs_x_N

Definition at line 68 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

MonitorElement* PPSAlignmentWorker::SectorData::p_y_diffFN_vs_y_F

Definition at line 69 of file PPSAlignmentWorker.cc.

PPSAlignmentConfiguration::SectorConfig PPSAlignmentWorker::SectorData::scfg_

Definition at line 47 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

std::map<unsigned int, SlicePlots> PPSAlignmentWorker::SectorData::x_slice_plots_F

Definition at line 80 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().

std::map<unsigned int, SlicePlots> PPSAlignmentWorker::SectorData::x_slice_plots_N

Definition at line 80 of file PPSAlignmentWorker.cc.

Referenced by init(), and process().