ATLAS Offline Software
Loading...
Searching...
No Matches
RpcHitClustering.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef RPCHITCLUSTERING_H
6#define RPCHITCLUSTERING_H
7
8#include <vector>
12
13#include "Identifier/Identifier.h"
15
16namespace Muon {
17
19
20 typedef std::vector< const RpcPrepData* > HitList;
21 typedef HitList::iterator HitIt;
22 typedef HitList::const_iterator HitCit;
24
25 void add( const RpcPrepData* prd, int gasgap ) {
26 if( gasgap == 1 ) ++ngasgap1;
27 else ++ngasgap2;
28 hitList.push_back(prd);
29 }
30
31 bool addSecond( const RpcPrepData* prd, int gasgap ) {
32
33 HitIt it = hitList.begin();
34 HitIt it_end = hitList.end();
35 for( ;it!=it_end;++it ){
36 if( (*it)->identify() != prd->identify() ) continue;
37 if( fabs( (*it)->time() - 12.5) > fabs( prd->time() - 12.5 ) ){
38 *it = prd;
39 }
40 return true;
41 }
42 add(prd,gasgap);
43 return false;
44 }
45
46 void merge( RpcClusterObj& cluster ) {
47 hitList.insert(hitList.end(),cluster.hitList.begin(),cluster.hitList.end());
48 ngasgap1 += cluster.ngasgap1;
49 ngasgap2 += cluster.ngasgap2;
50 cluster.ngasgap1 = 0;
51 cluster.ngasgap2 = 0;
52 cluster.hitList.clear();
53 }
54
55 bool active() const { return !hitList.empty(); }
56
57 int layers() const {
58 if( hitList.empty() ) return 0;
59 else if( ngasgap1 > 0 && ngasgap2 > 0 ) return 2;
60 return 1;
61 }
62
66 };
67
69 bool operator()(const RpcClusterObj& cl1,const RpcClusterObj& cl2 ) const {
70 if( cl1.layers() > cl2.layers() ) return true;
71 else if( cl1.layers() < cl2.layers() ) return false;
72 return cl1.hitList.size() < cl2.hitList.size();
73 }
74 };
75
77
78 struct Id {
79 Id( int g, int c ) : gp(g),ch(c) {}
80 int gp;
81 int ch;
82 };
83
84 struct Doublet {
85 Doublet() : first(-1),second(-1) {}
86 int first;
87 int second;
88 int sum() const { return first+second; }
89 };
90 typedef std::vector< Doublet > HitClustering;
91
92 RpcHitClusteringObj( const RpcIdHelper* rpcIdHelper ) :
93 m_rpcIdHelper(rpcIdHelper),debug(false),combinedGasGaps(true)
94 {}
95
96 bool cluster( const std::vector<const RpcPrepData*>& col );
97 bool cluster( const std::vector<const RpcPrepData*>& col, const Identifier& subid );
98
99 void dump() const;
100
102 if( clustersEta.empty() ) return 0;
103 return &clustersEta.front();
104 }
105
107 if( clustersPhi.empty() ) return 0;
108 return &clustersPhi.front();
109 }
110
111 void findBest();
112
114 std::vector<Doublet> channelsEta;
115 std::vector<Doublet> channelsPhi;
116 std::vector<RpcClusterObj> clustersEta;
117 std::vector<RpcClusterObj> clustersPhi;
118 std::vector<RpcClusterObj> clustersEtaTmp;
119 std::vector<RpcClusterObj> clustersPhiTmp;
120 bool debug;
122 };
123
124}
125#endif
Class to represent RPC measurements.
Definition RpcPrepData.h:35
float time() const
Returns the time.
Identifier identify() const
return the identifier
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
void add(const RpcPrepData *prd, int gasgap)
HitList::const_iterator HitCit
void merge(RpcClusterObj &cluster)
bool addSecond(const RpcPrepData *prd, int gasgap)
std::vector< const RpcPrepData * > HitList
HitList::iterator HitIt
std::vector< RpcClusterObj > clustersPhiTmp
std::vector< Doublet > channelsEta
const RpcClusterObj * bestPhiCluster() const
std::vector< RpcClusterObj > clustersEta
const RpcIdHelper * m_rpcIdHelper
std::vector< Doublet > channelsPhi
RpcHitClusteringObj(const RpcIdHelper *rpcIdHelper)
bool cluster(const std::vector< const RpcPrepData * > &col)
const RpcClusterObj * bestEtaCluster() const
std::vector< Doublet > HitClustering
std::vector< RpcClusterObj > clustersEtaTmp
std::vector< RpcClusterObj > clustersPhi
bool operator()(const RpcClusterObj &cl1, const RpcClusterObj &cl2) const