CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
CACut Class Reference

#include <CACut.h>

Classes

struct  CAValueByLayerIds
 
struct  CAValueByTripletName
 
struct  CAValuesByInnerLayerIds
 

Public Member Functions

 CACut (const double defaultCut, const std::vector< edm::ParameterSet > &tripletCuts)
 
CAValuesByInnerLayerIds getCutsByInnerLayer (int layerIds1, int layerIds2) const
 
void setCutValuesByInnerLayerIds ()
 
void setCutValuesByLayerIds (CAGraph &caLayers)
 
void setCutValuesByTripletNames (const std::vector< edm::ParameterSet > &tripletCuts)
 

Private Attributes

const float defaultCut_
 
bool foundAllLayerIds_
 
bool useCACuts_
 
std::vector< CAValuesByInnerLayerIdsvaluesByInnerLayerIds_
 
std::vector< CAValueByLayerIdsvaluesByLayerIds_
 
std::vector< CAValueByTripletNamevaluesByTripletNames_
 

Detailed Description

Definition at line 16 of file CACut.h.

Constructor & Destructor Documentation

◆ CACut()

CACut::CACut ( const double  defaultCut,
const std::vector< edm::ParameterSet > &  tripletCuts 
)
inlineexplicit

Definition at line 18 of file CACut.h.

19  : useCACuts_(true), foundAllLayerIds_(false), defaultCut_(defaultCut) {
20  if (tripletCuts.size() == 1 && tripletCuts[0].getParameter<double>("cut") == -1.) {
21  useCACuts_ = false;
22  LogDebug("Configuration") << "No CACut VPSet. Using default cut value of " << defaultCut
23  << " for all layer triplets";
24  return;
25  }
26 
27  valuesByTripletNames_.reserve(tripletCuts.size());
28  valuesByLayerIds_.reserve(tripletCuts.size());
29 
30  setCutValuesByTripletNames(tripletCuts);
31  }

References LogDebug, setCutValuesByTripletNames(), useCACuts_, valuesByLayerIds_, and valuesByTripletNames_.

Member Function Documentation

◆ getCutsByInnerLayer()

CAValuesByInnerLayerIds CACut::getCutsByInnerLayer ( int  layerIds1,
int  layerIds2 
) const
inline

Definition at line 139 of file CACut.h.

139  {
140  for (const auto &thisCut : valuesByInnerLayerIds_) {
141  if (thisCut.outerDoubletIds_[0] == layerIds1 && thisCut.outerDoubletIds_[1] == layerIds2) {
142  return thisCut;
143  }
144  }
145 
146  CAValuesByInnerLayerIds emptyCutsByInnerLayer(defaultCut_);
147  return emptyCutsByInnerLayer;
148  }

References defaultCut_, and valuesByInnerLayerIds_.

Referenced by CellularAutomaton::createAndConnectCells(), and CellularAutomaton::findTriplets().

◆ setCutValuesByInnerLayerIds()

void CACut::setCutValuesByInnerLayerIds ( )
inline

Definition at line 85 of file CACut.h.

85  {
86  for (auto &thisTriplet : valuesByLayerIds_) {
87  if (thisTriplet.hasValueByInnerLayerId_)
88  continue;
89  auto it = std::find(thisTriplet.layerIds_.begin(), thisTriplet.layerIds_.end(), -1);
90  if (it != thisTriplet.layerIds_.end())
91  continue;
92 
93  bool foundOuterDoublet = false;
94 
95  for (auto &thisOuterDoublet : valuesByInnerLayerIds_) {
96  if (thisOuterDoublet.outerDoubletIds_[0] == thisTriplet.layerIds_[1] &&
97  thisOuterDoublet.outerDoubletIds_[1] == thisTriplet.layerIds_[2]) {
98  thisOuterDoublet.innerLayerIds_.emplace_back(thisTriplet.layerIds_[0]);
99  thisOuterDoublet.cutValues_.emplace_back(thisTriplet.cutValue_);
100  foundOuterDoublet = true;
101  break;
102  }
103  }
104 
105  if (!foundOuterDoublet) {
106  valuesByInnerLayerIds_.emplace_back(defaultCut_);
107  auto &newOuterDoublet = valuesByInnerLayerIds_.back();
108 
109  newOuterDoublet.outerDoubletIds_.emplace_back(thisTriplet.layerIds_[1]);
110  newOuterDoublet.outerDoubletIds_.emplace_back(thisTriplet.layerIds_[2]);
111  newOuterDoublet.innerLayerIds_.emplace_back(thisTriplet.layerIds_[0]);
112  newOuterDoublet.cutValues_.emplace_back(thisTriplet.cutValue_);
113  }
114 
115  thisTriplet.hasValueByInnerLayerId_ = true;
116  }
117  }

References defaultCut_, spr::find(), valuesByInnerLayerIds_, and valuesByLayerIds_.

Referenced by setCutValuesByLayerIds().

◆ setCutValuesByLayerIds()

void CACut::setCutValuesByLayerIds ( CAGraph caLayers)
inline

Definition at line 43 of file CACut.h.

43  {
45  return;
46 
47  foundAllLayerIds_ = true;
48  valuesByLayerIds_.clear();
49 
50  for (const auto &thisTriplet : valuesByTripletNames_) {
51  valuesByLayerIds_.emplace_back();
52  auto &thisCACut = valuesByLayerIds_.back();
53 
54  // Triplet name, e.g. 'BPix1+BPix2+BPix3'
55  std::string layersToSet = thisTriplet.tripletName_;
56  for (int thisLayer = 0; thisLayer < 3; thisLayer++) {
57  // Get layer name
58  std::size_t layerPos = layersToSet.find("+");
59  if ((thisLayer < 2 && layerPos == std::string::npos) || (thisLayer == 2 && layerPos != std::string::npos)) {
60  throw cms::Exception("Configuration")
61  << "Please enter a valid triplet name in the CACuts parameter set; e.g. 'BPix1+BPix2+BPix3'";
62  }
63 
64  std::string layerName = layersToSet.substr(0, layerPos);
65  layersToSet = layersToSet.substr(layerPos + 1);
66 
67  // Get layer ID
68  thisCACut.layerIds_.emplace_back(caLayers.getLayerId(layerName));
69  if (thisCACut.layerIds_.back() == -1) {
70  foundAllLayerIds_ = false;
71  edm::LogWarning("Configuration") << "Layer name '" << layerName
72  << "' not found in the CAGraph. Please check CACuts parameter set if this "
73  "warning is present for all events";
74  }
75  }
76 
77  // Cut
78  thisCACut.cutValue_ = thisTriplet.cutValue_;
79  thisCACut.hasValueByInnerLayerId_ = false;
80  }
81 
83  }

References Exception, foundAllLayerIds_, CAGraph::getLayerId(), setCutValuesByInnerLayerIds(), AlCaHLTBitMon_QueryRunRegistry::string, useCACuts_, valuesByLayerIds_, and valuesByTripletNames_.

Referenced by CAHitTripletGenerator::hitNtuplets(), and CAHitQuadrupletGenerator::hitNtuplets().

◆ setCutValuesByTripletNames()

void CACut::setCutValuesByTripletNames ( const std::vector< edm::ParameterSet > &  tripletCuts)
inline

Definition at line 33 of file CACut.h.

33  {
34  for (const auto &thisTriplet : tripletCuts) {
35  valuesByTripletNames_.emplace_back();
36  auto &thisCACut = valuesByTripletNames_.back();
37 
38  thisCACut.tripletName_ = thisTriplet.getParameter<std::string>("seedingLayers");
39  thisCACut.cutValue_ = thisTriplet.getParameter<double>("cut");
40  }
41  }

References AlCaHLTBitMon_QueryRunRegistry::string, and valuesByTripletNames_.

Referenced by CACut().

Member Data Documentation

◆ defaultCut_

const float CACut::defaultCut_
private

Definition at line 168 of file CACut.h.

Referenced by getCutsByInnerLayer(), and setCutValuesByInnerLayerIds().

◆ foundAllLayerIds_

bool CACut::foundAllLayerIds_
private

Definition at line 167 of file CACut.h.

Referenced by setCutValuesByLayerIds().

◆ useCACuts_

bool CACut::useCACuts_
private

Definition at line 166 of file CACut.h.

Referenced by CACut(), and setCutValuesByLayerIds().

◆ valuesByInnerLayerIds_

std::vector<CAValuesByInnerLayerIds> CACut::valuesByInnerLayerIds_
private

Definition at line 165 of file CACut.h.

Referenced by getCutsByInnerLayer(), and setCutValuesByInnerLayerIds().

◆ valuesByLayerIds_

std::vector<CAValueByLayerIds> CACut::valuesByLayerIds_
private

Definition at line 164 of file CACut.h.

Referenced by CACut(), setCutValuesByInnerLayerIds(), and setCutValuesByLayerIds().

◆ valuesByTripletNames_

std::vector<CAValueByTripletName> CACut::valuesByTripletNames_
private

Definition at line 163 of file CACut.h.

Referenced by CACut(), setCutValuesByLayerIds(), and setCutValuesByTripletNames().

CACut::foundAllLayerIds_
bool foundAllLayerIds_
Definition: CACut.h:167
CACut::valuesByLayerIds_
std::vector< CAValueByLayerIds > valuesByLayerIds_
Definition: CACut.h:164
CACut::useCACuts_
bool useCACuts_
Definition: CACut.h:166
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
CACut::setCutValuesByInnerLayerIds
void setCutValuesByInnerLayerIds()
Definition: CACut.h:85
CAGraph::getLayerId
int getLayerId(const std::string &layerName)
Definition: CAGraph.h:51
CACut::valuesByInnerLayerIds_
std::vector< CAValuesByInnerLayerIds > valuesByInnerLayerIds_
Definition: CACut.h:165
Exception
Definition: hltDiff.cc:246
CACut::setCutValuesByTripletNames
void setCutValuesByTripletNames(const std::vector< edm::ParameterSet > &tripletCuts)
Definition: CACut.h:33
CACut::valuesByTripletNames_
std::vector< CAValueByTripletName > valuesByTripletNames_
Definition: CACut.h:163
CACut::defaultCut_
const float defaultCut_
Definition: CACut.h:168