CMS 3D CMS Logo

Region.cc
Go to the documentation of this file.
3 #include <algorithm>
4 #include <cassert>
5 
7  switch (InputType(type)) {
8  case calo_type:
9  return "Calo";
10  case emcalo_type:
11  return "EmCalo";
12  case track_type:
13  return "TK";
14  case l1mu_type:
15  return "Mu";
16  case n_input_types:
17  throw cms::Exception(
18  "LogicError", "n_input_types is not a type to be used, but only a compile-time const for iterating on types");
19  }
20  return "NO_SUCH_INPUT_TYPE";
21 }
23  switch (OutputType(type)) {
24  case any_type:
25  return "";
26  case charged_type:
27  return "Charged";
28  case neutral_type:
29  return "Neutral";
30  case electron_type:
31  return "Electron";
32  case pfmuon_type:
33  return "Muon";
34  case charged_hadron_type:
35  return "ChargedHadron";
36  case neutral_hadron_type:
37  return "NeutralHadron";
38  case photon_type:
39  return "Photon";
40  case n_output_types:
41  throw cms::Exception(
42  "LogicError",
43  "n_output_types is not a type to be used, but only a compile-time const for iterating on types");
44  }
45  return "NO_SUCH_OUTPUT_TYPE";
46 }
47 
49  switch (type) {
50  case calo_type:
51  return calo.size();
52  case emcalo_type:
53  return emcalo.size();
54  case track_type:
55  return track.size();
56  case l1mu_type:
57  return muon.size();
58  case n_input_types:
59  throw cms::Exception(
60  "LogicError", "n_input_types is not a type to be used, but only a compile-time const for iterating on types");
61  }
62  return 9999;
63 }
64 
65 unsigned int l1tpf_impl::Region::nOutput(OutputType type, bool usePuppi, bool fiducial) const {
66  unsigned int ret = 0;
67  for (const auto &p : (usePuppi ? puppi : pf)) {
68  if (p.hwPt <= 0)
69  continue;
70  if (fiducial && !fiducialLocal(p.floatEta(), p.floatPhi()))
71  continue;
72  switch (type) {
73  case any_type:
74  ret++;
75  break;
76  case charged_type:
77  if (p.intCharge() != 0)
78  ret++;
79  break;
80  case neutral_type:
81  if (p.intCharge() == 0)
82  ret++;
83  break;
84  case electron_type:
85  if (p.hwId == l1t::PFCandidate::Electron)
86  ret++;
87  break;
88  case pfmuon_type:
89  if (p.hwId == l1t::PFCandidate::Muon)
90  ret++;
91  break;
92  case charged_hadron_type:
94  ret++;
95  break;
96  case neutral_hadron_type:
98  ret++;
99  break;
100  case photon_type:
101  if (p.hwId == l1t::PFCandidate::Photon)
102  ret++;
103  break;
104  case n_output_types:
105  throw cms::Exception(
106  "LogicError",
107  "n_output_types is not a type to be used, but only a compile-time const for iterating on types");
108  }
109  }
110  return ret;
111 }
112 
114  std::sort(calo.begin(), calo.end());
115  std::sort(emcalo.begin(), emcalo.end());
116  std::sort(track.begin(), track.end());
117  std::sort(muon.begin(), muon.end());
118  if (ncaloMax > 0 && calo.size() > ncaloMax) {
119  caloOverflow = calo.size() - ncaloMax;
120  calo.resize(ncaloMax);
121  }
122  if (nemcaloMax > 0 && emcalo.size() > nemcaloMax) {
123  emcaloOverflow = emcalo.size() - nemcaloMax;
124  emcalo.resize(nemcaloMax);
125  }
126  if (ntrackMax > 0 && track.size() > ntrackMax) {
127  trackOverflow = track.size() - ntrackMax;
128  track.resize(ntrackMax);
129  }
130 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
l1t::PFCandidate::Photon
Definition: PFCandidate.h:15
PFCandidate.h
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
muon
Definition: MuonCocktails.h:17
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
l1t::PFCandidate::Electron
Definition: PFCandidate.h:15
l1tpf_impl::Region::emcalo_type
Definition: Region.h:45
l1tpf_impl::Region::n_input_types
Definition: Region.h:45
l1tpf_impl::Region::OutputType
OutputType
Definition: Region.h:48
Region.h
l1tpf_impl::Region::track_type
Definition: Region.h:45
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
l1t::PFCandidate::ChargedHadron
Definition: PFCandidate.h:15
l1tpf_impl::Region::l1mu_type
Definition: Region.h:45
l1tpf_impl::Region::inputTypeName
static const char * inputTypeName(int inputType)
Definition: Region.cc:6
l1t::PFCandidate::Muon
Definition: PFCandidate.h:15
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
l1tpf_impl::Region::calo_type
Definition: Region.h:45
Exception
Definition: hltDiff.cc:246
l1tpf_impl::Region::InputType
InputType
Definition: Region.h:45
calo
Definition: Common.h:9
l1t::PFCandidate::NeutralHadron
Definition: PFCandidate.h:15
l1tpf_impl::Region::inputSort
void inputSort()
Definition: Region.cc:113
l1tpf_impl::Region::outputTypeName
static const char * outputTypeName(int outputType)
Definition: Region.cc:22
PileupJetID_cfi.usePuppi
usePuppi
Definition: PileupJetID_cfi.py:36
alignBH_cfg.fiducial
tuple fiducial
Definition: alignBH_cfg.py:19
l1tpf_impl::Region::nOutput
unsigned int nOutput(OutputType type, bool puppi, bool fiducial=true) const
Definition: Region.cc:65
l1tpf_impl::Region::nInput
unsigned int nInput(InputType type) const
Definition: Region.cc:48