Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TowerArray.h

Go to the documentation of this file.
00001 // $Id: TowerArray.h,v 1.3 2001/01/23 03:41:32 burnett Exp $
00002 //
00003 // This file is part of Gismo 2
00004 //
00005 //
00006 #ifndef __TOWERARRAY_H
00007 #define __TOWERARRAY_H
00008 
00009 #include "gismo/DetectorFrame.h"
00010 #include <vector>
00011 class Volume;
00012 class Point;
00013 class MCParticle;
00014 
00016 class TowerElement
00017 {
00018 public:
00019     friend class TowerArray;
00020     TowerElement(long i=0, float e=0)
00021         : m_index(i), m_energy(e)
00022     {}
00023     
00024     bool operator<(const TowerElement& rhs)const{return m_index < rhs.m_index;}
00025     bool operator==(const TowerElement&rhs)const{return m_index == rhs.m_index;}
00026     float operator+=(float e){return m_energy+= e;}
00027     ~TowerElement();
00028     
00029     float energy()const{return m_energy;}
00030     long index()const{return m_index;}
00031     
00032 private:
00033     long  m_index;
00034     // unique index reflecting position (TowerArray knows)
00035     
00036     float m_energy, simEnergy;
00037     // accumulated deposited energy, smeared
00038 };
00039 
00040 typedef std::vector<TowerElement > TowerElementList;
00041 
00042 
00048 class TowerArray : public DetectorFrame , public TowerElementList
00049 {
00050     
00051 public:
00053     TowerArray( int nx, int ny, float lx, float ly, float z, float eR)
00054         : xSegmentation(nx), ySegmentation(ny)
00055         , xWidth(lx) , yWidth(ly)
00056         , zPlane(z)
00057         , energyResolution(eR)
00058     {}
00059     
00061     virtual ~TowerArray();
00062     
00064     virtual void score(MCParticle* );
00065     
00067     float scoreTower(long, float);
00068     
00070     virtual void clear();
00071     
00073     virtual void draw(gui::DisplayRep&)const;
00074     
00076     int hits()const;
00077     Point xtalPos(unsigned i)const;
00078     long xtalId(unsigned i)const;
00079     float energy(unsigned i)const;
00080     
00082     virtual void readData(std::istream&);
00083     virtual void writeData(std::ostream&);
00084     
00086     virtual void writeParameters(std::ostream&)const;
00087     
00088     virtual void printOn(std::ostream&)const;
00089     
00090     const char* nameOf()const {return "TowerArray";}
00091     
00092     virtual void generateResponse();
00093     Point *meanEnergy(float, float *, int *);
00094     
00096     float displayScale()const {return s_display_scale;}
00097     static float s_display_scale;
00098     
00099 protected:
00100     
00101     int xSegmentation,
00102         ySegmentation;
00103     // the number of elements in the respective directions
00104     
00105     float xWidth,
00106         yWidth;
00107     // total size of the array
00108     
00109     float zPlane;
00110     // position of plane where boxes relecting response should be displayed
00111     
00112     float energyResolution;
00113     // root(E) - Gaussian energy resolution
00114     
00115     
00116     virtual long calculateIndex(const Point&)const;
00117     // return an appropriate index to identify the element
00118     
00119     virtual void calculateBin(long,float&,float&)const;
00120     // determine bin corner from index
00121     
00122     TowerElement* towers(int i){return begin()+i;}
00123     const TowerElement* towers(int i)const{return begin()+i;}
00124     
00125     
00126 };
00127 
00128 
00129 
00130 
00131 #endif
00132 

Generated at Wed Nov 21 12:20:27 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000