CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HGCGraphT< TILES > Class Template Reference

#include <HGCGraph.h>

Public Types

enum  VerbosityLevel {
  None = 0, Basic, Advanced, Expert,
  Guru
}
 

Public Member Functions

bool areTimeCompatible (int innerIdx, int outerIdx, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, float maxDeltaTime)
 
void clear ()
 
void findNtuplets (std::vector< HGCDoublet::HGCntuplet > &foundNtuplets, std::vector< int > &seedIndices, const unsigned int minClustersPerNtuplet, const bool outInDFS, const unsigned int maxOutInHops)
 
std::vector< HGCDoublet > & getAllDoublets ()
 
void makeAndConnectDoublets (const TILES &h, const std::vector< TICLSeedingRegion > &regions, int nEtaBins, int nPhiBins, const std::vector< reco::CaloCluster > &layerClusters, const std::vector< float > &mask, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, int deltaIEta, int deltaIPhi, float minCosThetai, float maxCosPointing, float root_doublet_max_distance_from_seed_squared, float etaLimitIncreaseWindow, int skip_layers, int maxNumberOfLayers, float maxDeltaTime)
 
void setVerbosity (int level)
 

Private Attributes

std::vector< HGCDoubletallDoublets_
 
std::vector< std::vector< int > > isOuterClusterOfDoublets_
 
std::vector< unsigned int > theRootDoublets_
 
int verbosity_
 

Detailed Description

template<typename TILES>
class HGCGraphT< TILES >

Definition at line 15 of file HGCGraph.h.

Member Enumeration Documentation

◆ VerbosityLevel

template<typename TILES >
enum HGCGraphT::VerbosityLevel
Enumerator
None 
Basic 
Advanced 
Expert 
Guru 

Definition at line 54 of file HGCGraph.h.

54 { None = 0, Basic, Advanced, Expert, Guru };

Member Function Documentation

◆ areTimeCompatible()

template<typename TILES >
bool HGCGraphT< TILES >::areTimeCompatible ( int  innerIdx,
int  outerIdx,
const edm::ValueMap< std::pair< float, float >> &  layerClustersTime,
float  maxDeltaTime 
)

Definition at line 210 of file HGCGraph.cc.

213  {
214  float timeIn = layerClustersTime.get(innerIdx).first;
215  float timeInE = layerClustersTime.get(innerIdx).second;
216  float timeOut = layerClustersTime.get(outerIdx).first;
217  float timeOutE = layerClustersTime.get(outerIdx).second;
218 
219  return (timeIn == -99. || timeOut == -99. ||
220  std::abs(timeIn - timeOut) < maxDeltaTime * sqrt(timeInE * timeInE + timeOutE * timeOutE));
221 }

References funct::abs(), and mathSSE::sqrt().

◆ clear()

template<typename TILES >
void HGCGraphT< TILES >::clear ( void  )
inline

Definition at line 45 of file HGCGraph.h.

45  {
46  allDoublets_.clear();
47  theRootDoublets_.clear();
49  allDoublets_.shrink_to_fit();
50  theRootDoublets_.shrink_to_fit();
51  isOuterClusterOfDoublets_.shrink_to_fit();
52  }

References HGCGraphT< TILES >::allDoublets_, HGCGraphT< TILES >::isOuterClusterOfDoublets_, and HGCGraphT< TILES >::theRootDoublets_.

◆ findNtuplets()

template<typename TILES >
void HGCGraphT< TILES >::findNtuplets ( std::vector< HGCDoublet::HGCntuplet > &  foundNtuplets,
std::vector< int > &  seedIndices,
const unsigned int  minClustersPerNtuplet,
const bool  outInDFS,
const unsigned int  maxOutInHops 
)

Definition at line 225 of file HGCGraph.cc.

229  {
230  HGCDoublet::HGCntuplet tmpNtuplet;
231  tmpNtuplet.reserve(minClustersPerNtuplet);
232  std::vector<std::pair<unsigned int, unsigned int>> outInToVisit;
233  for (auto rootDoublet : theRootDoublets_) {
234  tmpNtuplet.clear();
235  outInToVisit.clear();
236  int seedIndex = allDoublets_[rootDoublet].seedIndex();
237  int outInHops = 0;
238  allDoublets_[rootDoublet].findNtuplets(
239  allDoublets_, tmpNtuplet, seedIndex, outInDFS, outInHops, maxOutInHops, outInToVisit);
240  while (!outInToVisit.empty()) {
241  allDoublets_[outInToVisit.back().first].findNtuplets(
242  allDoublets_, tmpNtuplet, seedIndex, outInDFS, outInToVisit.back().second, maxOutInHops, outInToVisit);
243  outInToVisit.pop_back();
244  }
245 
246  if (tmpNtuplet.size() > minClustersPerNtuplet) {
247  foundNtuplets.push_back(tmpNtuplet);
248  seedIndices.push_back(seedIndex);
249  }
250  }
251 }

References foundNtuplets.

◆ getAllDoublets()

template<typename TILES >
std::vector<HGCDoublet>& HGCGraphT< TILES >::getAllDoublets ( )
inline

Definition at line 39 of file HGCGraph.h.

39 { return allDoublets_; }

References HGCGraphT< TILES >::allDoublets_.

◆ makeAndConnectDoublets()

template<typename TILES >
void HGCGraphT< TILES >::makeAndConnectDoublets ( const TILES &  h,
const std::vector< TICLSeedingRegion > &  regions,
int  nEtaBins,
int  nPhiBins,
const std::vector< reco::CaloCluster > &  layerClusters,
const std::vector< float > &  mask,
const edm::ValueMap< std::pair< float, float >> &  layerClustersTime,
int  deltaIEta,
int  deltaIPhi,
float  minCosThetai,
float  maxCosPointing,
float  root_doublet_max_distance_from_seed_squared,
float  etaLimitIncreaseWindow,
int  skip_layers,
int  maxNumberOfLayers,
float  maxDeltaTime 
)

Definition at line 11 of file HGCGraph.cc.

26  {
29  allDoublets_.clear();
30  theRootDoublets_.clear();
31  bool checkDistanceRootDoubletVsSeed = root_doublet_max_distance_from_seed_squared < 9999;
32  float origin_eta;
33  float origin_phi;
34  for (const auto &r : regions) {
35  bool isGlobal = (r.index == -1);
36  auto zSide = r.zSide;
37  int startEtaBin, endEtaBin, startPhiBin, endPhiBin;
38 
39  if (isGlobal) {
40  startEtaBin = 0;
41  startPhiBin = 0;
42  endEtaBin = nEtaBins;
43  endPhiBin = nPhiBins;
44  origin_eta = 0;
45  origin_phi = 0;
46  } else {
47  auto firstLayerOnZSide = maxNumberOfLayers * zSide;
48  const auto &firstLayerHisto = histo[firstLayerOnZSide];
49  origin_eta = r.origin.eta();
50  origin_phi = r.origin.phi();
51  int entryEtaBin = firstLayerHisto.etaBin(origin_eta);
52  int entryPhiBin = firstLayerHisto.phiBin(origin_phi);
53  // For track-seeded iterations, if the impact point is below a certain
54  // eta-threshold, i.e., it has higher eta, make the initial search
55  // window bigger in both eta and phi by one bin, to contain better low
56  // energy showers.
57  auto etaWindow = deltaIEta;
58  auto phiWindow = deltaIPhi;
59  if (std::abs(origin_eta) > etaLimitIncreaseWindow) {
60  etaWindow++;
61  phiWindow++;
62  LogDebug("HGCGraph") << "Limit of Eta for increase: " << etaLimitIncreaseWindow
63  << " reached! Increasing inner search window" << std::endl;
64  }
65  startEtaBin = std::max(entryEtaBin - etaWindow, 0);
66  endEtaBin = std::min(entryEtaBin + etaWindow + 1, nEtaBins);
67  startPhiBin = entryPhiBin - phiWindow;
68  endPhiBin = entryPhiBin + phiWindow + 1;
69  if (verbosity_ > Guru) {
70  LogDebug("HGCGraph") << " Entrance eta, phi: " << origin_eta << ", " << origin_phi
71  << " entryEtaBin: " << entryEtaBin << " entryPhiBin: " << entryPhiBin
72  << " globalBin: " << firstLayerHisto.globalBin(origin_eta, origin_phi)
73  << " on layer: " << firstLayerOnZSide << " startEtaBin: " << startEtaBin
74  << " endEtaBin: " << endEtaBin << " startPhiBin: " << startPhiBin
75  << " endPhiBin: " << endPhiBin << " phiBin(0): " << firstLayerHisto.phiBin(0.)
76  << " phiBin(" << M_PI / 2. << "): " << firstLayerHisto.phiBin(M_PI / 2.) << " phiBin("
77  << M_PI << "): " << firstLayerHisto.phiBin(M_PI) << " phiBin(" << -M_PI / 2.
78  << "): " << firstLayerHisto.phiBin(-M_PI / 2.) << " phiBin(" << -M_PI
79  << "): " << firstLayerHisto.phiBin(-M_PI) << " phiBin(" << 2. * M_PI
80  << "): " << firstLayerHisto.phiBin(2. * M_PI) << std::endl;
81  }
82  }
83 
84  for (int il = 0; il < maxNumberOfLayers - 1; ++il) {
85  for (int outer_layer = 0; outer_layer < std::min(1 + skip_layers, maxNumberOfLayers - 1 - il); ++outer_layer) {
86  int currentInnerLayerId = il + maxNumberOfLayers * zSide;
87  int currentOuterLayerId = currentInnerLayerId + 1 + outer_layer;
88  auto const &outerLayerHisto = histo[currentOuterLayerId];
89  auto const &innerLayerHisto = histo[currentInnerLayerId];
90  const int etaLimitIncreaseWindowBin = innerLayerHisto.etaBin(etaLimitIncreaseWindow);
91  if (verbosity_ > Advanced) {
92  LogDebug("HGCGraph") << "Limit of Eta for increase: " << etaLimitIncreaseWindow
93  << " at etaBin: " << etaLimitIncreaseWindowBin << std::endl;
94  }
95 
96  for (int ieta = startEtaBin; ieta < endEtaBin; ++ieta) {
97  auto offset = ieta * nPhiBins;
98  for (int iphi_it = startPhiBin; iphi_it < endPhiBin; ++iphi_it) {
99  int iphi = ((iphi_it % nPhiBins + nPhiBins) % nPhiBins);
100  if (verbosity_ > Guru) {
101  LogDebug("HGCGraph") << "Inner Global Bin: " << (offset + iphi)
102  << " on layers I/O: " << currentInnerLayerId << "/" << currentOuterLayerId
103  << " with clusters: " << innerLayerHisto[offset + iphi].size() << std::endl;
104  }
105  for (auto innerClusterId : innerLayerHisto[offset + iphi]) {
106  // Skip masked clusters
107  if (mask[innerClusterId] == 0.) {
108  if (verbosity_ > Advanced)
109  LogDebug("HGCGraph") << "Skipping inner masked cluster " << innerClusterId << std::endl;
110  continue;
111  }
112 
113  // For global-seeded iterations, if the inner cluster is above a certain
114  // eta-threshold, i.e., it has higher eta, make the outer search
115  // window bigger in both eta and phi by one bin, to contain better low
116  // energy showers. Track-Seeded iterations are excluded since, in
117  // that case, the inner search window has already been enlarged.
118  auto etaWindow = deltaIEta;
119  auto phiWindow = deltaIPhi;
120  if (isGlobal && ieta > etaLimitIncreaseWindowBin) {
121  etaWindow++;
122  phiWindow++;
123  if (verbosity_ > Advanced) {
124  LogDebug("HGCGraph") << "Eta and Phi window increased by one" << std::endl;
125  }
126  }
127  const auto etaRangeMin = std::max(0, ieta - etaWindow);
128  const auto etaRangeMax = std::min(ieta + etaWindow + 1, nEtaBins);
129 
130  for (int oeta = etaRangeMin; oeta < etaRangeMax; ++oeta) {
131  // wrap phi bin
132  for (int phiRange = 0; phiRange < 2 * phiWindow + 1; ++phiRange) {
133  // The first wrapping is to take into account the
134  // cases in which we would have to seach in
135  // negative bins. The second wrap is mandatory to
136  // account for all other cases, since we add in
137  // between a full nPhiBins slot.
138  auto ophi = ((iphi + phiRange - phiWindow) % nPhiBins + nPhiBins) % nPhiBins;
139  if (verbosity_ > Guru) {
140  LogDebug("HGCGraph") << "Outer Global Bin: " << (oeta * nPhiBins + ophi)
141  << " on layers I/O: " << currentInnerLayerId << "/" << currentOuterLayerId
142  << " with clusters: " << innerLayerHisto[oeta * nPhiBins + ophi].size()
143  << std::endl;
144  }
145  for (auto outerClusterId : outerLayerHisto[oeta * nPhiBins + ophi]) {
146  // Skip masked clusters
147  if (mask[outerClusterId] == 0.) {
148  if (verbosity_ > Advanced)
149  LogDebug("HGCGraph") << "Skipping outer masked cluster " << outerClusterId << std::endl;
150  continue;
151  }
152  auto doubletId = allDoublets_.size();
153  if (maxDeltaTime != -1 &&
154  !areTimeCompatible(innerClusterId, outerClusterId, layerClustersTime, maxDeltaTime)) {
155  if (verbosity_ > Advanced)
156  LogDebug("HGCGraph") << "Rejecting doublets due to timing!" << std::endl;
157  continue;
158  }
159  allDoublets_.emplace_back(innerClusterId, outerClusterId, doubletId, &layerClusters, r.index);
160  if (verbosity_ > Advanced) {
161  LogDebug("HGCGraph")
162  << "Creating doubletsId: " << doubletId << " layerLink in-out: [" << currentInnerLayerId
163  << ", " << currentOuterLayerId << "] clusterLink in-out: [" << innerClusterId << ", "
164  << outerClusterId << "]" << std::endl;
165  }
166  isOuterClusterOfDoublets_[outerClusterId].push_back(doubletId);
167  auto &neigDoublets = isOuterClusterOfDoublets_[innerClusterId];
168  auto &thisDoublet = allDoublets_[doubletId];
169  if (verbosity_ > Expert) {
170  LogDebug("HGCGraph")
171  << "Checking compatibility of doubletId: " << doubletId
172  << " with all possible inners doublets link by the innerClusterId: " << innerClusterId
173  << std::endl;
174  }
175  bool isRootDoublet = thisDoublet.checkCompatibilityAndTag(allDoublets_,
176  neigDoublets,
177  r.directionAtOrigin,
178  minCosTheta,
179  minCosPointing,
180  verbosity_ > Advanced);
181  if (isRootDoublet and checkDistanceRootDoubletVsSeed) {
182  auto dEtaSquared = (layerClusters[innerClusterId].eta() - origin_eta);
183  dEtaSquared *= dEtaSquared;
184  auto dPhiSquared = (layerClusters[innerClusterId].phi() - origin_phi);
185  dPhiSquared *= dPhiSquared;
186  if (dEtaSquared + dPhiSquared > root_doublet_max_distance_from_seed_squared)
187  isRootDoublet = false;
188  }
189  if (isRootDoublet) {
190  theRootDoublets_.push_back(doubletId);
191  }
192  }
193  }
194  }
195  }
196  }
197  }
198  }
199  }
200  }
201  // #ifdef FP_DEBUG
202  if (verbosity_ > None) {
203  LogDebug("HGCGraph") << "number of Root doublets " << theRootDoublets_.size() << " over a total number of doublets "
204  << allDoublets_.size() << std::endl;
205  }
206  // #endif
207 }

References funct::abs(), HLTEgPhaseIITestSequence_cff::etaLimitIncreaseWindow, timingPdfMaker::histo, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, muons_cff::isGlobal, HLTEgPhaseIITestSequence_cff::layerClusters, LogDebug, M_PI, SiStripPI::max, caConstants::maxNumberOfLayers, min(), L1TMuonDQMOffline_cfi::nEtaBins, None, ecaldqm::binning::nPhiBins, hltrates_dqm_sourceclient-live_cfg::offset, trackingPOGFilters_cfi::phiWindow, alignCSCRings::r, HLTEgPhaseIITestSequence_cff::root_doublet_max_distance_from_seed_squared, findQualityFiles::size, and HLTEgPhaseIITestSequence_cff::skip_layers.

◆ setVerbosity()

template<typename TILES >
void HGCGraphT< TILES >::setVerbosity ( int  level)
inline

Definition at line 53 of file HGCGraph.h.

53 { verbosity_ = level; }

References personalPlayback::level, and HGCGraphT< TILES >::verbosity_.

Member Data Documentation

◆ allDoublets_

template<typename TILES >
std::vector<HGCDoublet> HGCGraphT< TILES >::allDoublets_
private

Definition at line 57 of file HGCGraph.h.

Referenced by HGCGraphT< TILES >::clear(), and HGCGraphT< TILES >::getAllDoublets().

◆ isOuterClusterOfDoublets_

template<typename TILES >
std::vector<std::vector<int> > HGCGraphT< TILES >::isOuterClusterOfDoublets_
private

Definition at line 59 of file HGCGraph.h.

Referenced by HGCGraphT< TILES >::clear().

◆ theRootDoublets_

template<typename TILES >
std::vector<unsigned int> HGCGraphT< TILES >::theRootDoublets_
private

Definition at line 58 of file HGCGraph.h.

Referenced by HGCGraphT< TILES >::clear().

◆ verbosity_

template<typename TILES >
int HGCGraphT< TILES >::verbosity_
private

Definition at line 60 of file HGCGraph.h.

Referenced by HGCGraphT< TILES >::setVerbosity().

personalPlayback.level
level
Definition: personalPlayback.py:22
HGCGraphT::Basic
Definition: HGCGraph.h:54
HGCGraphT::verbosity_
int verbosity_
Definition: HGCGraph.h:60
min
T min(T a, T b)
Definition: MathUtil.h:58
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:278
HGCGraphT::theRootDoublets_
std::vector< unsigned int > theRootDoublets_
Definition: HGCGraph.h:58
HGCGraphT::Advanced
Definition: HGCGraph.h:54
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HGCDoublet::HGCntuplet
std::vector< unsigned int > HGCntuplet
Definition: HGCDoublet.h:16
HGCGraphT::None
Definition: HGCGraph.h:54
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLTEgPhaseIITestSequence_cff.etaLimitIncreaseWindow
etaLimitIncreaseWindow
Definition: HLTEgPhaseIITestSequence_cff.py:2197
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
trackingPOGFilters_cfi.phiWindow
phiWindow
Definition: trackingPOGFilters_cfi.py:109
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HGCGraphT::areTimeCompatible
bool areTimeCompatible(int innerIdx, int outerIdx, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, float maxDeltaTime)
Definition: HGCGraph.cc:210
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HLTEgPhaseIITestSequence_cff.root_doublet_max_distance_from_seed_squared
root_doublet_max_distance_from_seed_squared
Definition: HLTEgPhaseIITestSequence_cff.py:2217
caConstants::maxNumberOfLayers
constexpr uint32_t maxNumberOfLayers
Definition: CAConstants.h:44
foundNtuplets
const uint32_t *__restrict__ HitContainer * foundNtuplets
Definition: CAHitNtupletGeneratorKernelsImpl.h:139
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
HGCGraphT::Expert
Definition: HGCGraph.h:54
HGCGraphT::isOuterClusterOfDoublets_
std::vector< std::vector< int > > isOuterClusterOfDoublets_
Definition: HGCGraph.h:59
muons_cff.isGlobal
isGlobal
Definition: muons_cff.py:149
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::ValueMap::get
const_reference_type get(ProductID id, size_t idx) const
Definition: ValueMap.h:144
HLTEgPhaseIITestSequence_cff.skip_layers
skip_layers
Definition: HLTEgPhaseIITestSequence_cff.py:2220
HGCGraphT::allDoublets_
std::vector< HGCDoublet > allDoublets_
Definition: HGCGraph.h:57
L1TMuonDQMOffline_cfi.nEtaBins
nEtaBins
Definition: L1TMuonDQMOffline_cfi.py:21
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:78
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ecaldqm::binning::nPhiBins
Definition: MESetBinningUtils.h:70
HGCGraphT::Guru
Definition: HGCGraph.h:54
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443