CMS 3D CMS Logo

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::RpcClusterization ( )
inline

Definition at line 35 of file RpcClusterization.h.

35 {}

◆ ~RpcClusterization()

RpcClusterization::~RpcClusterization ( )
virtual

Definition at line 14 of file RpcClusterization.cc.

14 {}

Member Function Documentation

◆ configure()

void RpcClusterization::configure ( int  maxClusterSize,
int  maxClusterCnt,
bool  dropAllClustersIfMoreThanMax 
)
inline

◆ convertTiming()

int RpcClusterization::convertTiming ( double  timing) const
virtual

Definition at line 79 of file RpcClusterization.cc.

References ecalMatacq_cfi::timing.

Referenced by getClusters().

79  {
80  return timing; //TODO implement
81 }

◆ getClusters()

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(), jetUpdater_cfi::sort, nano_mu_digi_cff::strip, and hcalRecHitTable_cff::time.

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  //This implementation of clusterization emulation gives the cluster in the same order as the order of digis,
24  //and the order of unpacked digis should be the same as the order of the LB channels on which the clustrization
25  //in the firmware is performed.
26  //This cluster order plays role in some rare cases for the OMTF algorithm
27  //when two hits has the same abs(minDistPhi), and then the phi of the resulting candidate
28  //depends on the order of these hits.
29  for (unsigned int iDigi = 0; iDigi < digis.size(); iDigi++) {
30  //edm::LogVerbatim("l1tOmtfEventPrint")<< __FUNCTION__ << ":" << __LINE__<<" "<<roll<<" iDigi "<<iDigi<<" digi "<<digis[iDigi];
31 
32  //removing duplicated digis
33  //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)
34  //and the unpacker is not cleaning them
35  bool duplicatedDigi = false;
36  for (unsigned int iDigi2 = 0; iDigi2 < iDigi; iDigi2++) {
37  if (digis[iDigi].strip() == digis[iDigi2].strip()) {
38  duplicatedDigi = true;
39  //edm::LogVerbatim("l1tOmtfEventPrint")<<"duplicatedDigi";
40  break;
41  }
42  }
43 
44  if (duplicatedDigi)
45  continue;
46 
47  bool addNewCluster = true;
48 
49  for (auto& cluster : allClusters) {
50  if (digis[iDigi].strip() - cluster.lastStrip == 1) {
51  cluster.lastStrip = digis[iDigi].strip();
52  addNewCluster = false;
53  } else if (digis[iDigi].strip() - cluster.firstStrip == -1) {
54  cluster.firstStrip = digis[iDigi].strip();
55  addNewCluster = false;
56  } else if (digis[iDigi].strip() >= cluster.firstStrip && digis[iDigi].strip() <= cluster.lastStrip) {
57  addNewCluster = false;
58  }
59  }
60 
61  if (addNewCluster) {
62  allClusters.emplace_back(digis[iDigi].strip(), digis[iDigi].strip());
63  allClusters.back().bx = digis[iDigi].bx();
64  allClusters.back().timing = convertTiming(digis[iDigi].time());
65  }
66  }
67 
68  /* Debug only
69  if(allClusters.size())
70  edm::LogVerbatim("l1tOmtfEventPrint")<< __FUNCTION__ <<" "<<roll<<" allClusters.size() "<<allClusters.size();
71  for (auto& cluster : allClusters)
72  edm::LogVerbatim("l1tOmtfEventPrint")
73  << __FUNCTION__ << " cluster: firstStrip " << cluster.firstStrip
74  << " lastStrip " << cluster.lastStrip << " halfStrip " << cluster.halfStrip() << std::endl;*/
75 
76  return allClusters;
77 }
virtual int convertTiming(double timing) const
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

Member Data Documentation

◆ dropAllClustersIfMoreThanMax

bool RpcClusterization::dropAllClustersIfMoreThanMax = true
private

Definition at line 56 of file RpcClusterization.h.

Referenced by configure().

◆ maxClusterCnt

unsigned int RpcClusterization::maxClusterCnt = 2
private

Definition at line 53 of file RpcClusterization.h.

Referenced by configure().

◆ maxClusterSize

unsigned int RpcClusterization::maxClusterSize = 3
private

Definition at line 52 of file RpcClusterization.h.

Referenced by configure().