CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DataFormats/ParticleFlowReco/interface/CaloWindow.h

Go to the documentation of this file.
00001 #ifndef CALOWINDOW_H_
00002 #define CALOWINDOW_H_
00003 
00004 //#include <boost/shared_ptr.hpp>
00005 
00006 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 
00008 #include <vector>
00009 #include <iostream>
00010 #include <map>
00011 namespace pftools {
00012 
00017 class CaloRing {
00018 public:
00019 
00024         CaloRing();
00025 
00031         CaloRing(unsigned nPanes);
00032 
00036         void reset();
00037 
00043         double getEnergy(unsigned pane) const;
00044 
00051         bool setEnergy(unsigned pane, double energy);
00052 
00059         bool addEnergy(unsigned pane, double energy);
00060 
00065         double totalE() const;
00066 
00071         std::vector<double> getEnergies() const {
00072                 return myPanes_;
00073         }
00074 
00079         unsigned getNPanes() const {
00080                 return panes_;
00081         }
00082 
00083         void printEnergies(std::ostream& s, double range = 1.0);
00084 
00085 
00086 private:
00087         unsigned panes_;
00088         std::vector<double> myPanes_;
00089 
00090         friend std::ostream& operator<<(std::ostream& s, const CaloRing& caloRing);
00091 
00092 };
00093 
00094 class CaloWindow {
00095 public:
00096         /* Default constructor - do not use (this has to be here for Reflex to work?)*/
00097         CaloWindow();
00098 
00104         CaloWindow(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
00105 
00106         void init(double eta, double phi, unsigned nRings, double deltaR, unsigned nPanes, double axis = 0.0);
00107 
00114         bool addHit(double eta, double phi, double energy);
00115 
00122         std::map<unsigned, CaloRing> getRingDepositions() const {
00123                 return energies_;
00124         }
00125 
00126         std::map<unsigned, double> getRingEnergySummations() const;
00127 
00128 
00129         virtual ~CaloWindow();
00130 
00131         void reset();
00132 
00133         void printEnergies(std::ostream& s, double range = 1.0);
00134 
00140         std::vector<double> stream(double normalisation = 1.0) const;
00141 
00142 private:
00143         //Where is the barycentre of this window?
00144         double baryEta_;
00145         double baryPhi_;
00146         //How many rings is it composed of?
00147         unsigned nRings_;
00148         //What is the deltaR separation of the rings?
00149         double deltaR_;
00150         //How many panels will each calo ring be composed of? (central panel = 1)
00151         unsigned nPanes_;
00152 
00153         //Angle in radians fromm which we start counting rings (offset from zero)
00154         double axis_;
00155 
00156         /*
00157          * Determines which window pane to put the hit in.
00158          *
00159          */
00160         std::pair<unsigned, unsigned> relativePosition(double eta, double phi) const;
00161 
00162         //std::vector<boost::shared_ptr<std::vector<double> > > energies_;
00163         std::map<unsigned, CaloRing> energies_;
00164 
00165 
00166         friend std::ostream& operator<<(std::ostream& s,
00167                         const CaloWindow& caloWindow);
00168 
00169 };
00170 
00171 class TestCaloWindow {
00172 public:
00173         TestCaloWindow() {
00174         }
00175 
00176         virtual ~TestCaloWindow() {
00177         }
00178 
00179         void doTest();
00180 };
00181 
00182 //typedef boost::shared_ptr<CaloWindow> CalowWindowPtr;
00183 
00184 }
00185 #endif /* CALOWINDOW_H_ */