CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
RpcClusterization Class Reference

#include <RpcClusterization.h>

Public Member Functions

void configure (int maxClusterSize, int maxClusterCnt, bool dropAllClustersIfMoreThanMax)
 
virtual int convertTiming (double timing) const
 
virtual std::vector< RpcClustergetClusters (const RPCDetId &roll, std::vector< RPCDigi > &digis) const
 N.B. digis are sorted inside the function. More...
 
 RpcClusterization ()
 
virtual ~RpcClusterization ()
 

Private Attributes

bool dropAllClustersIfMoreThanMax = true
 
unsigned int maxClusterCnt = 2
 
unsigned int maxClusterSize = 3
 

Detailed Description

Definition at line 33 of file RpcClusterization.h.

Constructor & Destructor Documentation

RpcClusterization::RpcClusterization ( )
inline

Definition at line 35 of file RpcClusterization.h.

35 {};
RpcClusterization::~RpcClusterization ( )
virtual

Definition at line 14 of file RpcClusterization.cc.

14 {}

Member Function Documentation

void RpcClusterization::configure ( int  maxClusterSize,
int  maxClusterCnt,
bool  dropAllClustersIfMoreThanMax 
)
inline
int RpcClusterization::convertTiming ( double  timing) const
virtual

Definition at line 68 of file RpcClusterization.cc.

Referenced by getClusters().

68  {
69  return timing; //TODO implement
70 }
std::vector< RpcCluster > RpcClusterization::getClusters ( const RPCDetId roll,
std::vector< RPCDigi > &  digis 
) const
virtual

N.B. digis are sorted inside the function.

Definition at line 16 of file RpcClusterization.cc.

References a, b, convertTiming(), dropAllClustersIfMoreThanMax, LogTrace, maxClusterCnt, maxClusterSize, and RPCDigi::strip().

Referenced by RpcDigiToStubsConverter::makeStubs().

16  {
17  std::vector<RpcCluster> allClusters;
18 
19  std::sort(digis.begin(), digis.end(), [](const RPCDigi& a, const RPCDigi& b) { return a.strip() < b.strip(); });
20 
21  typedef std::pair<unsigned int, unsigned int> Cluster;
22 
23  for (auto& digi : digis) {
24  if (allClusters.empty()) {
25  allClusters.emplace_back(digi.strip(), digi.strip());
26  allClusters.back().bx = digi.bx();
27  allClusters.back().timing = convertTiming(digi.time());
28  } else if (digi.strip() - allClusters.back().lastStrip == 1) {
29  allClusters.back().lastStrip = digi.strip();
30  //TODO update bx and timing in some smart way
31  } else if (digi.strip() - allClusters.back().lastStrip > 1) {
32  allClusters.emplace_back(digi.strip(), digi.strip());
33  allClusters.back().bx = digi.bx();
34  allClusters.back().timing = convertTiming(digi.time());
35  }
36  }
37 
38  std::vector<RpcCluster> filteredClusters;
39 
41  if (allClusters.size() > maxClusterCnt)
42  return filteredClusters;
43 
44  //debug printout only
45  if (allClusters.size() > maxClusterCnt) {
46  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " allClusters.size() >= maxClusterCnt "
47  << std::endl;
48  for (auto& cluster : allClusters)
49  edm::LogVerbatim("l1tOmtfEventPrint")
50  << __FUNCTION__ << ":" << __LINE__ << " roll " << roll << " cluster: firstStrip " << cluster.firstStrip
51  << " lastStrip " << cluster.lastStrip << " halfStrip " << cluster.halfStrip() << std::endl;
52  }
53 
54  //TODO this is very simple filtering of the cluster,
55  //unfortunately the in firmware it is more complicated and cannot be easily emulated from digi
56  //(in principle would required raws, because in the firmware the clusterizaton is based on the 8-bit strip partitions
57  for (auto& cluster : allClusters) {
58  if (cluster.size() <= maxClusterSize)
59  filteredClusters.emplace_back(cluster);
60 
61  if (filteredClusters.size() >= maxClusterCnt)
62  break;
63  }
64 
65  return filteredClusters;
66 }
Log< level::Info, true > LogVerbatim
virtual int convertTiming(double timing) const
#define LogTrace(id)
int strip() const
Definition: RPCDigi.h:27
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
unsigned int maxClusterCnt
unsigned int maxClusterSize

Member Data Documentation

bool RpcClusterization::dropAllClustersIfMoreThanMax = true
private

Definition at line 56 of file RpcClusterization.h.

Referenced by configure(), and getClusters().

unsigned int RpcClusterization::maxClusterCnt = 2
private

Definition at line 53 of file RpcClusterization.h.

Referenced by configure(), and getClusters().

unsigned int RpcClusterization::maxClusterSize = 3
private

Definition at line 52 of file RpcClusterization.h.

Referenced by configure(), and getClusters().