CMS 3D CMS Logo

TotemRPClusterProducerAlgorithm.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Hubert Niewiadomski
6 * Jan Kašpar (jan.kaspar@gmail.com)
7 *
8 ****************************************************************************/
9 
11 
12 #include <iostream>
13 
14 //----------------------------------------------------------------------------------------------------
15 
17  verbosity_ = param_.getParameter<int>("verbosity");
18 }
19 
20 //----------------------------------------------------------------------------------------------------
21 
23 
24 //----------------------------------------------------------------------------------------------------
25 
27  const std::vector<TotemRPDigi> &digi,
28  std::vector<TotemRPCluster> &clusters) {
29  clusters.clear();
30 
31  strip_digi_set_.clear();
32  strip_digi_set_.insert(digi.begin(), digi.end());
33 
34  if (strip_digi_set_.empty())
35  return 0;
36 
37  bool iter_beg = true;
38  int cluster_beg = -16;
39  int cluster_end;
40  int prev_strip = -16;
41  int cur_strip;
42 
43  for (TotemRPDigiSet::const_iterator i = strip_digi_set_.begin(); i != strip_digi_set_.end(); ++i) {
44  cur_strip = i->stripNumber();
45  bool non_continuity = (cur_strip != prev_strip + 1);
46 
47  if (iter_beg) {
48  cluster_beg = cur_strip;
49  iter_beg = false;
50  } else if (non_continuity) {
51  cluster_end = prev_strip;
52  clusters.emplace_back((uint16_t)cluster_beg, (uint16_t)cluster_end);
53 
54  cluster_beg = cur_strip;
55  }
56 
57  prev_strip = cur_strip;
58  }
59 
60  if (!iter_beg) {
61  cluster_end = prev_strip;
62  clusters.emplace_back((uint16_t)cluster_beg, (uint16_t)cluster_end);
63  }
64 
65  return clusters.size();
66 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TotemRPClusterProducerAlgorithm(const edm::ParameterSet &param)
struct @712 param_
TotemRPDigiSet strip_digi_set_
input digi set, strip by strip
int buildClusters(unsigned int detId, const std::vector< TotemRPDigi > &digi, std::vector< TotemRPCluster > &clusters)