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  :param_(param)
18 {
19  verbosity_ = param_.getParameter<int>("verbosity");
20 }
21 
22 //----------------------------------------------------------------------------------------------------
23 
25 {
26 }
27 
28 //----------------------------------------------------------------------------------------------------
29 
30 int TotemRPClusterProducerAlgorithm::buildClusters(unsigned int detId, const std::vector<TotemRPDigi> &digi, std::vector<TotemRPCluster> &clusters)
31 {
32  clusters.clear();
33 
34  strip_digi_set_.clear();
35  strip_digi_set_.insert(digi.begin(), digi.end());
36 
37  if (strip_digi_set_.size() == 0)
38  return 0;
39 
40  bool iter_beg=true;
41  int cluster_beg=-16;
42  int cluster_end;
43  int prev_strip=-16;
44  int cur_strip;
45 
46  for (TotemRPDigiSet::const_iterator i=strip_digi_set_.begin(); i!=strip_digi_set_.end(); ++i)
47  {
48  cur_strip = i->getStripNumber();
49  bool non_continuity = (cur_strip!=prev_strip+1);
50 
51  if (iter_beg)
52  {
53  cluster_beg=cur_strip;
54  iter_beg=false;
55  }
56  else if (non_continuity)
57  {
58  cluster_end=prev_strip;
59  clusters.push_back(TotemRPCluster((uint16_t)cluster_beg, (uint16_t) cluster_end));
60 
61  cluster_beg=cur_strip;
62  }
63 
64  prev_strip=cur_strip;
65  }
66 
67  if (!iter_beg)
68  {
69  cluster_end=prev_strip;
70  clusters.push_back(TotemRPCluster((uint16_t)cluster_beg, (uint16_t) cluster_end));
71  }
72 
73  return clusters.size();
74 }
T getParameter(std::string const &) const
TotemRPClusterProducerAlgorithm(const edm::ParameterSet &param)
Cluster of TOTEM RP strip hits.
TotemRPDigiSet strip_digi_set_
input digi set, strip by strip
int buildClusters(unsigned int detId, const std::vector< TotemRPDigi > &digi, std::vector< TotemRPCluster > &clusters)
struct @539 param_