00001
00006
00007
00008 #ifndef __ACD_RECON_H
00009 #define __ACD_RECON_H 1
00010 #include "GaudiKernel/Algorithm.h"
00011
00012 #include "data/IVetoData.h"
00013 #include "ntupleWriterSvc/INTupleWriterSvc.h"
00014 #include "GlastSvc/GlastDetSvc/IGlastDetSvc.h"
00015
00016 #include "instrument/DetectorConverter.h"
00017 #include "instrument/DetectorVolumes.h"
00018 #include "instrument/Scintillator.h"
00019 #include "geometry/Vector.h"
00020 #include <map>
00021
00022 class Ray;
00023 class IVetoData;
00024
00025 class acdReconAlg : public Algorithm
00026 {
00027 public:
00029 acdReconAlg(const std::string& name, ISvcLocator* pSvcLocator);
00030
00032 StatusCode initialize();
00034 StatusCode execute();
00036 StatusCode finalize();
00037
00038 protected:
00039
00040 private:
00041
00042
00043 void clear ();
00044
00045 void getParameters ();
00046
00047 StatusCode reconstruct (const IVetoData* v);
00048
00049 StatusCode acdTileDOCA();
00050
00052 StatusCode writeNTuple();
00053
00054 double DOCA (const Point &x0, const Vector &dir, std::vector<double> &doca_values);
00055
00056 double hitTileDist(const Point &x0, const Vector &dir);
00057
00059 static double threshold_energy;
00060 static int xNumTowers, yNumTowers, xNumTopTiles, yNumTopTiles, numSideRows;
00061
00062
00063
00064 const IVetoData *m_AcdData;
00065
00066
00067 IVetoData::Tile m_hit_tile;
00068
00070 std::string m_tupleName;
00072 INTupleWriterSvc *ntupleWriteSvc;
00073
00075 IGlastDetSvc *m_glastDetSvc;
00076
00077
00078 double m_totEnergy, m_tileCount, m_gammaDOCA, m_DOCA, m_act_dist;
00079 std::vector<double> m_rowDOCA_vec;
00080
00081
00082
00083 class TileParams;
00084 TileParams* m_tileParams;
00085
00086 };
00087
00088
00089 class acdReconAlg::TileParams : public DetectorConverter {
00090 public:
00091 TileParams(){ m_tileDims.clear(); }
00092 void forward ( const Scintillator& d )
00093 {
00094 if ( d.empty()) return;
00095 unsigned int id = d.type();
00096 const GlastDetector::_Volume * v = d.volume();
00097 const DetectorBox* db = dynamic_cast<const DetectorBox*> (d.volume());
00098 const Box& b = *db->box();
00099 double len = b.length();
00100 double wid = b.width();
00101 double height = b.height();
00102 m_tileDims[id] = Vector(len, wid, height);
00103 }
00104 void clear(){
00105 m_tileDims.clear();
00106 }
00107 void update(){};
00108
00109 double length(int id) { return m_tileDims[id].x(); };
00110 double width(int id) {return m_tileDims[id].y(); };
00111 double height(int id) {return m_tileDims[id].z(); };
00112
00113 private:
00114 std::map<int, Vector> m_tileDims;
00115 };
00116
00117 #endif