00001
00002
00003
00004
00005 #ifndef __SICLUSTERS_H
00006 #define __SICLUSTERS_H 1
00007
00008 #include <vector>
00009 #include "GaudiKernel/MsgStream.h"
00010 #include "GaudiKernel/DataObject.h"
00011 #include "geometry/Point.h"
00012
00013 #include "gui/DisplayRep.h"
00014
00015 #define NVIEWS 2
00016 #define NPLANES 18
00017
00018 extern const CLID& CLID_SiClusters;
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00033
00034 class SiCluster
00035
00036 {
00037 public:
00038
00040 enum view {X,Y,XY};
00041
00042 friend class SiClusters;
00043
00044 public:
00045
00047 SiCluster(){}
00049 SiCluster(int id, int v, int ilayer,
00050 int istrip0, int istripf, double ToT, int tower = 0);
00052 virtual ~SiCluster() {}
00053
00055 inline void setPosition(Point p) {m_position = p;}
00057 inline void setID(int id) {m_id = id;}
00059 inline void flag(int flag=1) {m_flag = flag;}
00061 inline void unflag() {m_flag = 0;}
00062
00064 inline int tower() const {return m_tower;}
00066 inline int id() const {return m_id;}
00068 inline int plane() const {return m_plane;}
00070 inline view v() const {return m_view;}
00072 inline int chip() const {return m_chip;}
00074 inline double strip() const {return m_strip;}
00076 inline int firstStrip() const {return m_strip0;}
00078 inline int lastStrip() const {return m_stripf;}
00081 bool hitFlagged() const {return (m_flag!=0);}
00082
00084 Point position() const {return m_position;}
00086 inline double size() const {return m_size;}
00087
00089 void writeOut(MsgStream& log) const;
00091
00092 void draw(gui::DisplayRep& v, double pitch, double towerPitch);
00093
00094 protected:
00095
00097 void ini();
00098
00100 static enum view intToView(int);
00102 static int viewToInt(view v);
00103
00104 private:
00105
00107 int m_tower;
00109 int m_plane;
00111 SiCluster::view m_view;
00113 int m_chip;
00114
00116 int m_strip0;
00118 int m_stripf;
00120 double m_strip;
00121
00123 double m_size;
00125 double m_ToT;
00127 Point m_position;
00128
00130 int m_id;
00132 int m_flag;
00133
00134 };
00135
00136
00137
00138
00139
00140 class SiClusters : public DataObject
00141
00142 {
00143 public:
00144
00146 SiClusters(int nViews, int nPlanes, double stripPitch, double towerPitch);
00148 virtual ~SiClusters();
00149
00151 static const CLID& classID() {return CLID_SiClusters;}
00152 virtual const CLID& clID() const {return classID();}
00153
00155 void addCluster(SiCluster* cl);
00156
00158 int nHits() const {return m_clustersList.size();}
00160 SiCluster* getHit(int i) const {return m_clustersList[i];}
00161
00163 void flagHit(SiCluster::view v, int id, int iflag=1) {getHit(v,id)->flag(iflag);}
00165 void unflagHit(SiCluster::view v, int id) {getHit(v,id)->unflag();}
00167 bool hitFlagged(SiCluster::view v, int id) {return getHit(v,id)->hitFlagged();}
00168
00170 SiCluster* getHit(SiCluster::view v, int id) {return m_clustersList[id];}
00172 Point const position(SiCluster::view v, int id) {return getHit(v,id)->position();}
00174 double const size(SiCluster::view v, int id) {return getHit(v,id)->size();}
00175
00177 double const stripPitch() {return m_stripPitch;}
00179 double const towerPitch() {return m_towerPitch;}
00180
00183 std::vector<SiCluster*>& getHits(SiCluster::view v, int iplane)
00184 {return m_clustersByPlaneList[SiCluster::viewToInt(v)][iplane];}
00185
00187 int nHits(SiCluster::view v, int iplane)
00188 {return (int) getHits(v,iplane).size();}
00189
00191 void flagHitsInPlane(SiCluster::view v, int iplane);
00192
00194 virtual void clear();
00196 virtual void make() {}
00197
00199 void writeOut(MsgStream& log) const;
00201 void update(gui::DisplayRep& v) {draw(v);}
00202
00204 Point meanHit(SiCluster::view v, int iplane);
00206 Point meanHitInside(SiCluster::view v, int iplane, double size, Point Pini);
00209 Point nearestHitOutside(SiCluster::view v, int iplane, double inRadius,
00210 Point centerX, int& id);
00211
00213 int numberOfHitsNear( int iPlane, double inRadius, Point& x0);
00214 int numberOfHitsNear( int iPlane, double dX, double dY, Point& x0);
00215 int numberOfHitsNear( SiCluster::view v, int iPlane, double inRadius, Point& x0);
00216
00217 private:
00218
00219
00221 virtual void ini();
00222
00224 void draw(gui::DisplayRep& v);
00225
00226 private:
00227
00229 double m_stripPitch;
00231 double m_towerPitch;
00232
00237 int numViews;
00238 int numPlanes;
00239 std::vector<SiCluster*> m_clustersList;
00240 std::vector<SiCluster*>
00241 m_clustersByPlaneList[NVIEWS][NPLANES];
00242 };
00243
00244 #endif