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 86 of file RpcClusterization.cc.

Referenced by getClusters().

86  {
87  return timing; //TODO implement
88 }
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, RPCDigi::strip(), and digitizers_cfi::strip.

Referenced by RpcDigiToStubsConverter::makeStubs().

16  {
17  std::vector<RpcCluster> allClusters;
18 
20  //with the 2018 firmware the agreement is better with this sort
21  std::sort(digis.begin(), digis.end(), [](const RPCDigi& a, const RPCDigi& b) { return a.strip() < b.strip(); });
22  } else {
23  //with the fixed RPC clusterization (Nov 2021 firmware) the data to emulator agreement is better if this reverse is used here,
24  //with the 2018 firmware the agreement is worse with this reverse,
25  std::reverse(digis.begin(), digis.end());
26  }
27 
28  typedef std::pair<unsigned int, unsigned int> Cluster;
29 
30  //This implementation of clusterization emulation gives the cluster in the same order as the order of digis,
31  //and the order of unpacked digis should be the same as the order of the LB channels on which the clustrization
32  //in the firmware is performed.
33  //This cluster order plays role in some rare cases for the OMTF algorithm
34  //when two hits has the same abs(minDistPhi), and then the phi of the resulting candidate
35  //depends on the order of these hits.
36  for (unsigned int iDigi = 0; iDigi < digis.size(); iDigi++) {
37  //edm::LogVerbatim("l1tOmtfEventPrint")<< __FUNCTION__ << ":" << __LINE__<<" "<<roll<<" iDigi "<<iDigi<<" digi "<<digis[iDigi];
38 
39  //removing duplicated digis
40  //the digis might be duplicated, because the same data might be received by two OMTF boards (as the same link goes to two neighboring boards)
41  //and the unpacker is not cleaning them
42  bool duplicatedDigi = false;
43  for (unsigned int iDigi2 = 0; iDigi2 < iDigi; iDigi2++) {
44  if (digis[iDigi].strip() == digis[iDigi2].strip()) {
45  duplicatedDigi = true;
46  //edm::LogVerbatim("l1tOmtfEventPrint")<<"duplicatedDigi";
47  break;
48  }
49  }
50 
51  if (duplicatedDigi)
52  continue;
53 
54  bool addNewCluster = true;
55 
56  for (auto& cluster : allClusters) {
57  if (digis[iDigi].strip() - cluster.lastStrip == 1) {
58  cluster.lastStrip = digis[iDigi].strip();
59  addNewCluster = false;
60  } else if (digis[iDigi].strip() - cluster.firstStrip == -1) {
61  cluster.firstStrip = digis[iDigi].strip();
62  addNewCluster = false;
63  } else if (digis[iDigi].strip() >= cluster.firstStrip && digis[iDigi].strip() <= cluster.lastStrip) {
64  addNewCluster = false;
65  }
66  }
67 
68  if (addNewCluster) {
69  allClusters.emplace_back(digis[iDigi].strip(), digis[iDigi].strip());
70  allClusters.back().bx = digis[iDigi].bx();
71  allClusters.back().timing = convertTiming(digis[iDigi].time());
72  }
73  }
74 
75  /* Debug only
76  if(allClusters.size())
77  edm::LogVerbatim("l1tOmtfEventPrint")<< __FUNCTION__ <<" "<<roll<<" allClusters.size() "<<allClusters.size();
78  for (auto& cluster : allClusters)
79  edm::LogVerbatim("l1tOmtfEventPrint")
80  << __FUNCTION__ << " cluster: firstStrip " << cluster.firstStrip
81  << " lastStrip " << cluster.lastStrip << " halfStrip " << cluster.halfStrip() << std::endl;*/
82 
83  return allClusters;
84 }
virtual int convertTiming(double timing) const
int strip() const
Definition: RPCDigi.h:27
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

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().

unsigned int RpcClusterization::maxClusterSize = 3
private

Definition at line 52 of file RpcClusterization.h.

Referenced by configure().