00001
00002
00003 #include "reconstruction/data/RecoVetoData.h"
00004 #include "instrument/Scintillator.h"
00005
00006
00007
00008 using namespace std;
00009 #include <iomanip>
00010
00011 RecoVetoData::RecoVetoData ()
00012 {
00013 }
00014
00015
00016 RecoVetoData::~RecoVetoData ()
00017 {
00018 clear();
00019 }
00020
00021 void RecoVetoData::printOn (ostream& cout) const
00022 {
00023 cout << "\nRecoVetoData:\n";
00024 for( const_iterator it = begin(); it != end(); ++it){
00025 const IVetoData::Tile& v = *it;
00026 cout << '\t' << v.type() << '\t' << setprecision(3)
00027 << v.position() << '\t' << v.energy() <<'\n';
00028 }
00029 }
00030
00031 void RecoVetoData::load (const Scintillator& tile)
00032 {
00033 float energy = tile.energy();
00034 if( energy >0.0 ) {
00035
00036 CoordTransform T = tile.localToGlobal();
00037 Point p(0,0,0);
00038 p.transform(T);
00039 tileList.push_back(Tile(p, tile.type(), energy) );
00040 }
00041
00042 }
00043
00044
00045 void RecoVetoData::readData (istream& in)
00046 {
00047 int X, Y, Z, E;
00048
00049 int numV;
00050 Id type;
00051 in>> numV ;
00052
00053 for(int i=0; i<numV; i++) {
00054
00055 in >> type >> E >> X >> Y >> Z;
00056 tileList.push_back( Tile(Point(X/1e3, Y/1e3, Z/1e3), type, E/1e6));
00057 }
00058 }
00059
00060 void RecoVetoData::writeData (ostream& out)
00061 {
00062 int numV = tileList.size();
00063
00064 out<<numV<<'\n';
00065
00066 for( const_iterator it = begin(); it != end(); ++it) {
00067 const Tile& v = *it;
00068 out << v.type() << ' '
00069 << static_cast<int>(1e6*v.energy()) << ' '
00070 << static_cast<int>(1e3*v.position().x())<< ' '
00071 << static_cast<int>(1e3*v.position().y())<< ' '
00072 << static_cast<int>(1e3*v.position().z())<< '\n';
00073 }
00074 }
00075
00076 void RecoVetoData::clear ()
00077 {
00078 tileList.clear();
00079 }