CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloWindow.h
Go to the documentation of this file.
1 #ifndef CALOWINDOW_H_
2 #define CALOWINDOW_H_
3 
4 //#include <boost/shared_ptr.hpp>
5 
6 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
7 
8 #include <vector>
9 #include <iostream>
10 #include <map>
11 namespace pftools {
12 
17 class CaloRing {
18 public:
19 
24  CaloRing();
25 
31  CaloRing(unsigned nPanes);
32 
36  void reset();
37 
43  double getEnergy(unsigned pane) const;
44 
51  bool setEnergy(unsigned pane, double energy);
52 
59  bool addEnergy(unsigned pane, double energy);
60 
65  double totalE() const;
66 
71  std::vector<double> getEnergies() const {
72  return myPanes_;
73  }
74 
79  unsigned getNPanes() const {
80  return panes_;
81  }
82 
83  void printEnergies(std::ostream& s, double range = 1.0);
84 
85 
86 private:
87  unsigned panes_;
88  std::vector<double> myPanes_;
89 
90  friend std::ostream& operator<<(std::ostream& s, const CaloRing& caloRing);
91 
92 };
93 
94 class CaloWindow {
95 public:
96  /* Default constructor - do not use (this has to be here for Reflex to work?)*/
97  CaloWindow();
98 
104  CaloWindow(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
105 
106  void init(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
107 
114  bool addHit(double eta, double phi, double energy);
115 
122  std::map<unsigned, CaloRing> getRingDepositions() const {
123  return energies_;
124  }
125 
126  std::map<unsigned, double> getRingEnergySummations() const;
127 
128 
129  virtual ~CaloWindow();
130 
131  void reset();
132 
133  void printEnergies(std::ostream& s, double range = 1.0);
134 
140  std::vector<double> stream(double normalisation = 1.0) const;
141 
142 private:
143  //Where is the barycentre of this window?
144  double baryEta_;
145  double baryPhi_;
146  //How many rings is it composed of?
147  unsigned nRings_;
148  //What is the deltaR separation of the rings?
149  double deltaR_;
150  //How many panels will each calo ring be composed of? (central panel = 1)
151  unsigned nPanes_;
152 
153  //Angle in radians fromm which we start counting rings (offset from zero)
154  double axis_;
155 
156  /*
157  * Determines which window pane to put the hit in.
158  *
159  */
160  std::pair<unsigned, unsigned> relativePosition(double eta, double phi) const;
161 
162  //std::vector<boost::shared_ptr<std::vector<double> > > energies_;
163  std::map<unsigned, CaloRing> energies_;
164 
165 
166  friend std::ostream& operator<<(std::ostream& s,
167  const CaloWindow& caloWindow);
168 
169 };
170 
172 public:
174  }
175 
176  virtual ~TestCaloWindow() {
177  }
178 
179  void doTest();
180 };
181 
182 //typedef boost::shared_ptr<CaloWindow> CalowWindowPtr;
183 
184 }
185 #endif /* CALOWINDOW_H_ */
std::map< unsigned, CaloRing > energies_
Definition: CaloWindow.h:163
unsigned getNPanes() const
Definition: CaloWindow.h:79
unsigned panes_
Definition: CaloWindow.h:87
std::map< unsigned, double > getRingEnergySummations() const
Definition: CaloWindow.cc:246
T eta() const
double totalE() const
Definition: CaloWindow.cc:44
void printEnergies(std::ostream &s, double range=1.0)
Definition: CaloWindow.cc:113
std::vector< double > getEnergies() const
Definition: CaloWindow.h:71
bool addHit(double eta, double phi, double energy)
Definition: CaloWindow.cc:226
std::vector< double > stream(double normalisation=1.0) const
Definition: CaloWindow.cc:95
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool addEnergy(unsigned pane, double energy)
Definition: CaloWindow.cc:36
std::map< unsigned, CaloRing > getRingDepositions() const
Definition: CaloWindow.h:122
double getEnergy(unsigned pane) const
Definition: CaloWindow.cc:21
std::pair< unsigned, unsigned > relativePosition(double eta, double phi) const
Definition: CaloWindow.cc:160
friend std::ostream & operator<<(std::ostream &s, const CaloWindow &caloWindow)
friend std::ostream & operator<<(std::ostream &s, const CaloRing &caloRing)
bool setEnergy(unsigned pane, double energy)
Definition: CaloWindow.cc:28
void init(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis=0.0)
Definition: CaloWindow.cc:138
std::vector< double > myPanes_
Definition: CaloWindow.h:88
void printEnergies(std::ostream &s, double range=1.0)
Definition: CaloWindow.cc:60
string s
Definition: asciidump.py:422
virtual ~CaloWindow()
Definition: CaloWindow.cc:156
Definition: DDAxes.h:10