CMS 3D CMS Logo

Region.h
Go to the documentation of this file.
1 #ifndef L1Trigger_Phase2L1ParticleFlow_Region_h
2 #define L1Trigger_Phase2L1ParticleFlow_Region_h
3 
6 
7 namespace l1tpf_impl {
8  struct Region : public InputRegion {
9  std::vector<PFParticle> pf;
10  std::vector<PFParticle> puppi;
12 
13  const bool relativeCoordinates; // whether the eta,phi in each region are global or relative to the region center
15  Region(float etamin,
16  float etamax,
17  float phicenter,
18  float phiwidth,
19  float etaextra,
20  float phiextra,
21  bool useRelativeCoordinates,
22  unsigned int ncalomax,
23  unsigned int nemcalomax,
24  unsigned int ntrackmax,
25  unsigned int nmuonmax,
26  unsigned int npfmax,
27  unsigned int npuppimax)
28  : InputRegion(0.5 * (etamin + etamax), etamin, etamax, phicenter, 0.5 * phiwidth, etaextra, phiextra),
29  pf(),
30  puppi(),
31  caloOverflow(),
33  trackOverflow(),
34  muonOverflow(),
35  pfOverflow(),
36  puppiOverflow(),
37  relativeCoordinates(useRelativeCoordinates),
38  ncaloMax(ncalomax),
39  nemcaloMax(nemcalomax),
40  ntrackMax(ntrackmax),
41  nmuonMax(nmuonmax),
42  npfMax(npfmax),
43  npuppiMax(npuppimax) {}
44 
46  static const char* inputTypeName(int inputType);
47 
48  enum OutputType {
49  any_type = 0,
58  };
59  static const char* outputTypeName(int outputType);
60 
61  unsigned int nInput(InputType type) const;
62  unsigned int nOutput(OutputType type, bool puppi, bool fiducial = true) const;
63 
64  // global coordinates
65  bool contains(float eta, float phi) const {
66  float dphi = deltaPhi(phiCenter, phi);
67  return (etaMin - etaExtra < eta && eta <= etaMax + etaExtra && -phiHalfWidth - phiExtra < dphi &&
68  dphi <= phiHalfWidth + phiExtra);
69  }
70  // global coordinates
71  bool fiducial(float eta, float phi) const {
72  float dphi = deltaPhi(phiCenter, phi);
73  return (etaMin < eta && eta <= etaMax && -phiHalfWidth < dphi && dphi <= phiHalfWidth);
74  }
75  // possibly local coordinates
76  bool fiducialLocal(float localEta, float localPhi) const {
77  if (relativeCoordinates) {
78  float dphi = deltaPhi(0.f, localPhi);
79  return (etaMin < localEta + etaCenter && localEta + etaCenter <= etaMax && -phiHalfWidth < dphi &&
80  dphi <= phiHalfWidth);
81  }
82  float dphi = deltaPhi(phiCenter, localPhi);
83  return (etaMin < localEta && localEta <= etaMax && -phiHalfWidth < dphi && dphi <= phiHalfWidth);
84  }
85  float regionAbsEta() const { return std::abs(etaCenter); }
87  float globalEta(float localEta) const { return relativeCoordinates ? localEta + etaCenter : localEta; }
88  float globalPhi(float localPhi) const { return relativeCoordinates ? localPhi + phiCenter : localPhi; }
89  float localEta(float globalEta) const { return relativeCoordinates ? globalEta - etaCenter : globalEta; }
91 
92  void zero() {
93  calo.clear();
94  emcalo.clear();
95  track.clear();
96  muon.clear();
97  pf.clear();
98  puppi.clear();
99  caloOverflow = 0;
100  emcaloOverflow = 0;
101  trackOverflow = 0;
102  muonOverflow = 0;
103  pfOverflow = 0;
104  puppiOverflow = 0;
105  }
106 
107  void inputSort();
108  };
109 
110 } // namespace l1tpf_impl
111 
112 #endif
float globalAbsEta(float localEta) const
Definition: Region.h:86
const unsigned int ncaloMax
Definition: Region.h:14
bool fiducial(float eta, float phi) const
Definition: Region.h:71
const unsigned int nemcaloMax
Definition: Region.h:14
const bool relativeCoordinates
Definition: Region.h:13
unsigned int caloOverflow
Definition: Region.h:11
float regionAbsEta() const
Definition: Region.h:85
unsigned int muonOverflow
Definition: Region.h:11
unsigned int pfOverflow
Definition: Region.h:11
const unsigned int ntrackMax
Definition: Region.h:14
static const char * outputTypeName(int outputType)
Definition: Region.cc:22
unsigned int nInput(InputType type) const
Definition: Region.cc:48
void inputSort()
Definition: Region.cc:113
static const char * inputTypeName(int inputType)
Definition: Region.cc:6
Region(float etamin, float etamax, float phicenter, float phiwidth, float etaextra, float phiextra, bool useRelativeCoordinates, unsigned int ncalomax, unsigned int nemcalomax, unsigned int ntrackmax, unsigned int nmuonmax, unsigned int npfmax, unsigned int npuppimax)
Definition: Region.h:15
unsigned int puppiOverflow
Definition: Region.h:11
unsigned int nOutput(OutputType type, bool puppi, bool fiducial=true) const
Definition: Region.cc:65
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
std::vector< PFParticle > puppi
Definition: Region.h:10
std::vector< PFParticle > pf
Definition: Region.h:9
bool contains(float eta, float phi) const
Definition: Region.h:65
unsigned int emcaloOverflow
Definition: Region.h:11
float globalEta(float localEta) const
Definition: Region.h:87
std::vector< PropagatedTrack > track
std::vector< CaloCluster > emcalo
const unsigned int npuppiMax
Definition: Region.h:14
unsigned int trackOverflow
Definition: Region.h:11
float globalPhi(float localPhi) const
Definition: Region.h:88
const unsigned int npfMax
Definition: Region.h:14
bool fiducialLocal(float localEta, float localPhi) const
Definition: Region.h:76
float localPhi(float globalPhi) const
Definition: Region.h:90
Definition: Common.h:9
float localEta(float globalEta) const
Definition: Region.h:89
const unsigned int nmuonMax
Definition: Region.h:14