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.

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

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  }
std::vector< CAValueByLayerIds > valuesByLayerIds_
Definition: CACut.h:164
bool useCACuts_
Definition: CACut.h:166
bool foundAllLayerIds_
Definition: CACut.h:167
const float defaultCut_
Definition: CACut.h:168
std::vector< CAValueByTripletName > valuesByTripletNames_
Definition: CACut.h:163
void setCutValuesByTripletNames(const std::vector< edm::ParameterSet > &tripletCuts)
Definition: CACut.h:33
#define LogDebug(id)

Member Function Documentation

◆ getCutsByInnerLayer()

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

Definition at line 139 of file CACut.h.

References defaultCut_, and valuesByInnerLayerIds_.

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

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  }
const float defaultCut_
Definition: CACut.h:168
std::vector< CAValuesByInnerLayerIds > valuesByInnerLayerIds_
Definition: CACut.h:165

◆ setCutValuesByInnerLayerIds()

void CACut::setCutValuesByInnerLayerIds ( )
inline

Definition at line 85 of file CACut.h.

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

Referenced by setCutValuesByLayerIds().

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  }
std::vector< CAValueByLayerIds > valuesByLayerIds_
Definition: CACut.h:164
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const float defaultCut_
Definition: CACut.h:168
std::vector< CAValuesByInnerLayerIds > valuesByInnerLayerIds_
Definition: CACut.h:165

◆ setCutValuesByLayerIds()

void CACut::setCutValuesByLayerIds ( CAGraph caLayers)
inline

Definition at line 43 of file CACut.h.

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

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

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  }
std::vector< CAValueByLayerIds > valuesByLayerIds_
Definition: CACut.h:164
constexpr char const * layerName[numberOfLayers]
bool useCACuts_
Definition: CACut.h:166
bool foundAllLayerIds_
Definition: CACut.h:167
int getLayerId(const std::string &layerName)
Definition: CAGraph.h:51
void setCutValuesByInnerLayerIds()
Definition: CACut.h:85
std::vector< CAValueByTripletName > valuesByTripletNames_
Definition: CACut.h:163
Log< level::Warning, false > LogWarning

◆ setCutValuesByTripletNames()

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

Definition at line 33 of file CACut.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and valuesByTripletNames_.

Referenced by CACut().

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  }
std::vector< CAValueByTripletName > valuesByTripletNames_
Definition: CACut.h:163

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