CMS 3D CMS Logo

CaloCellId.cc
Go to the documentation of this file.
1 /* class CaloCellId
2  *
3  * Simple eta-phi cell identifier, mimic calorimetric tower structure
4  * phi is stored in radians
5  *
6  *
7  */
8 
10 
11 #include "CLHEP/Units/defs.h"
12 #include "CLHEP/Units/PhysicalConstants.h"
13 #include "CLHEP/Units/SystemOfUnits.h"
14 
15 #include <iostream>
16 #include <iomanip>
17 #include <cmath>
18 
19 CaloCellId::CaloCellId(double theEtaMin, double theEtaMax, double thePhiMin, double thePhiMax, System theSubSys)
20  : etaMin(theEtaMin), etaMax(theEtaMax), phiMin(thePhiMin), phiMax(thePhiMax), subSys(theSubSys) {}
21 
23  : etaMin(id.etaMin), etaMax(id.etaMax), phiMin(id.phiMin), phiMax(id.phiMax), subSys(id.subSys) {}
24 
26 
27 bool CaloCellId::operator==(const CaloCellId& id) const {
28  return (etaMin == id.etaMin && etaMax == id.etaMax && phiMin == id.phiMin && phiMax == id.phiMax &&
29  subSys == id.subSys)
30  ? true
31  : false;
32 }
33 
34 bool CaloCellId::isInCell(double thisEta, double thisPhi) {
35  double myPhi = thisPhi;
36 
37  bool itIs = false;
38  if (myPhi < -1. * CLHEP::pi) {
39  myPhi = myPhi + CLHEP::twopi;
40  } else if (myPhi > CLHEP::pi) {
41  myPhi = myPhi - CLHEP::twopi;
42  }
43  if (thisEta >= etaMin && thisEta < etaMax && myPhi >= phiMin && myPhi < phiMax) {
44  itIs = true;
45  }
46  return itIs;
47 }
48 
50  double etaAve = 0.5 * (etaMax + etaMin);
51  double theta = 2. * std::atan(std::exp(-1. * etaAve));
52  return theta;
53 }
54 
55 std::ostream& operator<<(std::ostream& os, const CaloCellId& id) {
56  os << "Eta range = [" << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getEtaMin()
57  << "," << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getEtaMax()
58  << "], Phi range = [" << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getPhiMin()
59  << "," << std::fixed << std::setw(7) << std::setfill(' ') << std::setprecision(4) << id.getPhiMax()
60  << "], subsystem = " << id.getSubSys();
61  return os;
62 }
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
CaloCellId::CaloCellId
CaloCellId(double theEtaMin, double theEtaMax, double thePhiMin, double thePhiMax, System theSubSys)
Definition: CaloCellId.cc:19
CaloCellId
Definition: CaloCellId.h:14
CaloCellId::isInCell
bool isInCell(double thisEta, double thisPhi)
Definition: CaloCellId.cc:34
CaloCellId::getThetaCell
double getThetaCell()
Definition: CaloCellId.cc:49
CaloCellId::System
System
Definition: CaloCellId.h:16
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
CaloCellId::subSys
System subSys
Definition: CaloCellId.h:39
CaloCellId::operator==
bool operator==(const CaloCellId &) const
Definition: CaloCellId.cc:27
funct::true
true
Definition: Factorize.h:173
CaloCellId.h
CaloCellId::phiMin
double phiMin
Definition: CaloCellId.h:37
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CaloCellId::~CaloCellId
virtual ~CaloCellId()
Definition: CaloCellId.cc:25
CaloCellId::phiMax
double phiMax
Definition: CaloCellId.h:38
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
operator<<
std::ostream & operator<<(std::ostream &os, const CaloCellId &id)
Definition: CaloCellId.cc:55
CaloCellId::etaMax
double etaMax
Definition: CaloCellId.h:36
pi
const Double_t pi
Definition: trackSplitPlot.h:36
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
CaloCellId::etaMin
double etaMin
Definition: CaloCellId.h:35