CMS 3D CMS Logo

HGCalConcentratorSuperTriggerCellImpl.cc
Go to the documentation of this file.
3 
4 #include <unordered_map>
5 
7  : stcSize_(conf.getParameter<std::vector<unsigned> >("stcSize")) {
8  if (stcSize_.size() != kNLayers_) {
9  throw cms::Exception("HGCTriggerParameterError")
10  << "Inconsistent size of super trigger cell size vector" << stcSize_.size();
11  }
12  for (auto stc : stcSize_) {
13  if (stc != kSTCsizeFine_ && stc != kSTCsizeCoarse_) {
14  throw cms::Exception("HGCTriggerParameterError")
15  << "Super Trigger Cell should be of size " << kSTCsizeFine_ << " or " << kSTCsizeCoarse_;
16  }
17  }
18 }
19 
22 
24  DetId TC_id(detid);
25  if (TC_id.det() == DetId::Forward) { //V8
26 
27  HGCalDetId TC_idV8(detid);
28 
29  if (triggerTools_.isScintillator(detid)) {
30  return TC_idV8.cell(); //scintillator
31  } else {
32  int TC_wafer = TC_idV8.wafer();
33  int thickness = triggerTools_.thicknessIndex(detid, true);
34  int TC_split = (TC_idV8.cell() & kSplit_.at(stcSize_.at(thickness)));
35 
36  return TC_wafer << kWafer_offset_ | TC_split;
37  }
38 
39  }
40 
41  else if (TC_id.det() == DetId::HGCalTrigger) { //V9
42 
43  if (triggerTools_.isScintillator(detid)) {
44  HGCScintillatorDetId TC_idV9(detid);
45  return TC_idV9.ietaAbs() << HGCScintillatorDetId::kHGCalPhiOffset | TC_idV9.iphi(); //scintillator
46  } else {
47  HGCalTriggerDetId TC_idV9(detid);
48 
49  int TC_wafer = TC_idV9.waferU() << kWafer_offset_ | TC_idV9.waferV();
50  int thickness = triggerTools_.thicknessIndex(detid);
51 
52  int TC_12th = 0;
53  int Uprime = 0;
54  int Vprime = 0;
55  int rocnum = detIdToROC_.getROCNumber(TC_idV9.triggerCellU(), TC_idV9.triggerCellV(), 1);
56 
57  if (rocnum == 1) {
58  Uprime = TC_idV9.triggerCellU();
59  Vprime = TC_idV9.triggerCellV() - TC_idV9.triggerCellU();
60 
61  } else if (rocnum == 2) {
62  Uprime = TC_idV9.triggerCellU() - TC_idV9.triggerCellV() - 1;
63  Vprime = TC_idV9.triggerCellV();
64 
65  } else if (rocnum == 3) {
66  Uprime = TC_idV9.triggerCellU() - kRotate4_;
67  Vprime = TC_idV9.triggerCellV() - kRotate4_;
68  }
69 
70  TC_12th = (rocnum << kRocShift_) | ((Uprime << kUShift_ | Vprime) & kSplit_v9_);
71 
72  int TC_split = TC_12th;
73  if (stcSize_.at(thickness) == kSTCsizeCoarse_) {
74  TC_split = rocnum;
75  }
76 
77  return TC_wafer << kWafer_offset_ | TC_split;
78  }
79 
80  } else {
81  return -1;
82  }
83 }
84 
86  const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) {
87  std::unordered_map<unsigned, SuperTriggerCell> STCs;
88 
89  // first pass, fill the super trigger cells
90  for (const l1t::HGCalTriggerCell& tc : trigCellVecInput) {
91  if (tc.subdetId() == HGCHEB)
92  continue;
93  STCs[getSuperTriggerCellId(tc.detId())].add(tc);
94  }
95 
96  // second pass, write them out
97  for (const l1t::HGCalTriggerCell& tc : trigCellVecInput) {
98  //If scintillator use a simple threshold cut
99  if (tc.subdetId() == HGCHEB) {
100  trigCellVecOutput.push_back(tc);
101  } else {
102  const auto& stc = STCs[getSuperTriggerCellId(tc.detId())];
103  if (tc.detId() == stc.GetMaxId()) {
104  trigCellVecOutput.push_back(tc);
105  stc.assignEnergy(trigCellVecOutput.back());
106  }
107  }
108 
109  } // end of second loop
110 }
bool isScintillator(const DetId &id) const
void superTriggerCellSelectImpl(const std::vector< l1t::HGCalTriggerCell > &trigCellVecInput, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput)
int triggerCellU() const
get the cell #&#39;s in u,v or in x,y
HGCalConcentratorSuperTriggerCellImpl(const edm::ParameterSet &conf)
int iphi() const
get the phi index
int wafer() const
get the wafer #
Definition: HGCalDetId.h:42
int triggerCellV() const
Definition: DetId.h:18
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
int thicknessIndex(const DetId &, bool tc=false) const
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:39
static const int kHGCalPhiOffset
int getROCNumber(HGCalTriggerDetId const &id) const
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39