CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalConcentratorSuperTriggerCellImpl.cc
Go to the documentation of this file.
2 
4  : fixedDataSizePerHGCROC_(conf.getParameter<bool>("fixedDataSizePerHGCROC")),
5  coarsenTriggerCells_(conf.getParameter<bool>("coarsenTriggerCells")),
6  coarseTCmapping_(conf.getParameter<std::vector<unsigned>>("ctcSize")),
7  superTCmapping_(conf.getParameter<std::vector<unsigned>>("stcSize")),
8  calibration_(conf.getParameterSet("superTCCalibration")),
9  vfeCompression_(conf.getParameterSet("superTCCompression")) {
10  std::string energyType(conf.getParameter<string>("type_energy_division"));
11 
12  if (energyType == "superTriggerCell") {
14  } else if (energyType == "oneBitFraction") {
16 
17  oneBitFractionThreshold_ = conf.getParameter<double>("oneBitFractionThreshold");
18  oneBitFractionLowValue_ = conf.getParameter<double>("oneBitFractionLowValue");
19  oneBitFractionHighValue_ = conf.getParameter<double>("oneBitFractionHighValue");
20 
21  } else if (energyType == "equalShare") {
23 
24  } else {
26  }
27 }
28 
30  uint32_t code(0);
31  uint32_t compressed_value(0);
32  vfeCompression_.compressSingle(stc.getSumHwPt(), code, compressed_value);
33  return compressed_value;
34 }
35 
37  std::unordered_map<unsigned, SuperTriggerCell>& STCs, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) const {
38  for (auto& s : STCs) {
39  std::vector<uint32_t> output_ids = superTCmapping_.getConstituentTriggerCells(s.second.getSTCId());
40 
41  int thickness = (!output_ids.empty() ? triggerTools_.thicknessIndex(output_ids.at(0), true) : 0);
42 
43  for (const auto& id : output_ids) {
46  continue;
47  }
48 
50  continue;
51  }
52 
53  l1t::HGCalTriggerCell triggerCell;
54  triggerCell.setDetId(id);
55  if (energyDivisionType_ == superTriggerCell && id != s.second.getMaxId()) {
56  continue;
57  }
58 
59  DetId tc_Id(id);
60 
61  //To guard against the case in v8 geometry where
62  //there might be different thicknesses within a module
63  //This is a small effect, but in principle energy might
64  //be lost.
65  if (superTCmapping_.getCoarseTriggerCellId(id) != s.second.getSTCId()) {
67  throw cms::Exception("NonExistingCoarseTC")
68  << "The coarse trigger cell correponsing to the nominal trigger cell does not exist";
69  } else {
70  continue;
71  }
72  }
73 
74  trigCellVecOutput.push_back(triggerCell);
75 
76  if (energyDivisionType_ == oneBitFraction) { //Get the 1 bit fractions
77 
78  if (id != s.second.getMaxId()) {
79  float tc_fraction = getTriggerCellOneBitFraction(s.second.getTCpt(id), s.second.getSumPt());
80  s.second.addToFractionSum(tc_fraction);
81  }
82  }
83  }
84  }
85 
86  // assign energy
87  for (l1t::HGCalTriggerCell& tc : trigCellVecOutput) {
88  const auto& stc = STCs[superTCmapping_.getCoarseTriggerCellId(tc.detId())];
90  }
91 }
92 
94  const SuperTriggerCell& stc) const {
95  //Compress and recalibrate STC energy
96  uint32_t compressed_value = getCompressedSTCEnergy(stc);
97 
99 
103  } else {
104  point = triggerTools_.getTCPosition(c.detId());
105  }
106  c.setPosition(point);
107 
108  math::PtEtaPhiMLorentzVector p4(c.pt(), point.eta(), point.phi(), 0.);
109  c.setP4(p4);
110 
112  if (c.detId() == stc.getMaxId()) {
113  c.setHwPt(compressed_value);
115  } else {
116  throw cms::Exception("NonMaxIdSuperTriggerCell")
117  << "Trigger Cell with detId not equal to the maximum of the superTriggerCell found";
118  }
119  } else if (energyDivisionType_ == equalShare) {
120  double coarseTriggerCellSize =
122  ? double(
124  .size())
125  : 1.;
126 
127  double denominator =
129  ? double(kTriggerCellsForDivision_)
130  : double(superTCmapping_.getConstituentTriggerCells(stc.getSTCId()).size()) / coarseTriggerCellSize;
131 
132  c.setHwPt(std::round(compressed_value / denominator));
134 
135  } else if (energyDivisionType_ == oneBitFraction) {
136  double frac = 0;
137 
138  if (c.detId() != stc.getMaxId()) {
139  frac = getTriggerCellOneBitFraction(stc.getTCpt(c.detId()), stc.getSumPt());
140  } else {
141  frac = 1 - stc.getFractionSum();
142  }
143 
144  c.setHwPt(std::round(compressed_value * frac));
146  }
147 }
148 
150  double f = tcPt / sumPt;
151  double frac = 0;
152  if (f < oneBitFractionThreshold_) {
154  } else {
156  }
157 
158  return frac;
159 }
160 
161 void HGCalConcentratorSuperTriggerCellImpl::select(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
162  std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) {
163  std::unordered_map<unsigned, SuperTriggerCell> STCs;
164  // first pass, fill the "coarse" trigger cells
165  for (const l1t::HGCalTriggerCell& tc : trigCellVecInput) {
166  uint32_t stcid = superTCmapping_.getCoarseTriggerCellId(tc.detId());
167  STCs[stcid].add(tc, stcid);
168  }
169 
170  createAllTriggerCells(STCs, trigCellVecOutput);
171 }
size
Write out results.
T getParameter(std::string const &) const
float getTriggerCellOneBitFraction(float tcPt, float sumPt) const
ParameterSet const & getParameterSet(ParameterSetID const &id)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
double pt() const final
transverse momentum
const HGCalTriggerGeometryBase * getTriggerGeometry() const
uint32_t getCoarseTriggerCellId(uint32_t detid) const
void select(const std::vector< l1t::HGCalTriggerCell > &trigCellVecInput, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput)
HGCalConcentratorSuperTriggerCellImpl(const edm::ParameterSet &conf)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
uint32_t detId() const
void setDetId(uint32_t detid)
double p4[4]
Definition: TauolaWrapper.h:92
double f[11][100]
Definition: DetId.h:17
int thicknessIndex(const DetId &, bool tc=false) const
void calibrateInGeV(l1t::HGCalTriggerCell &) const
uint32_t getRepresentativeDetId(uint32_t tcid) const
virtual bool validTriggerCell(const unsigned trigger_cell_id) const =0
T eta() const
Definition: PV3DBase.h:73
void setHwPt(int pt)
Definition: L1Candidate.h:28
std::vector< uint32_t > getConstituentTriggerCells(uint32_t ctcId) const
uint32_t getCompressedSTCEnergy(const SuperTriggerCell &stc) const
GlobalPoint getTCPosition(const DetId &id) const
void compressSingle(const uint32_t value, uint32_t &compressedCode, uint32_t &compressedValue) const
GlobalPoint getCoarseTriggerCellPosition(uint32_t ctcId) const
void createAllTriggerCells(std::unordered_map< unsigned, SuperTriggerCell > &STCs, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput) const
void setPosition(const GlobalPoint &position)
void setP4(const LorentzVector &p4) final
set 4-momentum
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void assignSuperTriggerCellEnergyAndPosition(l1t::HGCalTriggerCell &c, const SuperTriggerCell &stc) const