CMS 3D CMS Logo

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> const & 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 
91 std::ostream& operator<<(std::ostream& s, const CaloRing& caloRing);
92 
93 class CaloWindow {
94 public:
95  /* Default constructor - do not use (this has to be here for Reflex to work?)*/
96  CaloWindow();
97 
103  CaloWindow(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
104 
105  void init(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
106 
113  bool addHit(double eta, double phi, double energy);
114 
121  std::map<unsigned, CaloRing>const& getRingDepositions() const {
122  return energies_;
123  }
124 
125  std::map<unsigned, double> getRingEnergySummations() const;
126 
127 
128  virtual ~CaloWindow();
129 
130  void reset();
131 
132  void printEnergies(std::ostream& s, double range = 1.0);
133 
139  std::vector<double> stream(double normalisation = 1.0) const;
140 
141  double baryEta() const {return baryEta_;}
142  double baryPhi() const { return baryPhi_;}
143 
144 private:
145  //Where is the barycentre of this window?
146  double baryEta_;
147  double baryPhi_;
148  //How many rings is it composed of?
149  unsigned nRings_;
150  //What is the deltaR separation of the rings?
151  double deltaR_;
152  //How many panels will each calo ring be composed of? (central panel = 1)
153  unsigned nPanes_;
154 
155  //Angle in radians fromm which we start counting rings (offset from zero)
156  double axis_;
157 
158  /*
159  * Determines which window pane to put the hit in.
160  *
161  */
162  std::pair<unsigned, unsigned> relativePosition(double eta, double phi) const;
163 
164  //std::vector<boost::shared_ptr<std::vector<double> > > energies_;
165  std::map<unsigned, CaloRing> energies_;
166 
167 
168 
169 };
170 
171 std::ostream& operator<<(std::ostream& s,
172  const CaloWindow& caloWindow);
173 
175 public:
177  }
178 
179  virtual ~TestCaloWindow() {
180  }
181 
182  void doTest();
183 };
184 
185 //typedef boost::shared_ptr<CaloWindow> CalowWindowPtr;
186 
187 }
188 #endif /* CALOWINDOW_H_ */
std::map< unsigned, CaloRing > energies_
Definition: CaloWindow.h:165
unsigned getNPanes() const
Definition: CaloWindow.h:79
unsigned panes_
Definition: CaloWindow.h:87
int init
Definition: HydjetWrapper.h:67
double baryPhi() const
Definition: CaloWindow.h:142
double totalE() const
Definition: CaloWindow.cc:44
General option file parser.
Definition: Calibratable.h:15
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::map< unsigned, CaloRing > const & getRingDepositions() const
Definition: CaloWindow.h:121
bool addEnergy(unsigned pane, double energy)
Definition: CaloWindow.cc:36
double getEnergy(unsigned pane) const
Definition: CaloWindow.cc:21
bool setEnergy(unsigned pane, double energy)
Definition: CaloWindow.cc:28
std::vector< double > myPanes_
Definition: CaloWindow.h:88
void printEnergies(std::ostream &s, double range=1.0)
Definition: CaloWindow.cc:60
std::vector< double > const & getEnergies() const
Definition: CaloWindow.h:71
std::ostream & operator<<(std::ostream &s, const Calibratable &calib_)
Definition: Calibratable.cc:6
double baryEta() const
Definition: CaloWindow.h:141