00001 #ifndef SPACEPOINT_CC
00002 #define SPACEPOINT_CC
00003
00004 #include "spacepoint.hh"
00005
00006 namespace larlight {
00007
00008
00009 spacepoint::spacepoint(DATA::DATA_TYPE type) : data_base(type)
00010
00011 {
00012 if(_type!=DATA::SpacePoint) {
00013
00014 Message::send(MSG::ERROR,__FUNCTION__,
00015 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00016 _type=DATA::SpacePoint;
00017 }
00018
00019 clear_data();
00020
00021 }
00022
00023
00024 event_sps::event_sps(DATA::DATA_TYPE type) : std::vector<larlight::spacepoint>(),
00025 event_base(type)
00026
00027 {
00028 if(_type!=DATA::SpacePoint) {
00029
00030 Message::send(MSG::ERROR,__FUNCTION__,
00031 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00032 _type=DATA::SpacePoint;
00033 }
00034
00035 clear_data();
00036 }
00037
00038
00039 void event_sps::get_axis_range(Double_t &max, Double_t &min, const int axis) const
00040
00041 {
00042
00043 if(axis < 0 || axis>2) {
00044
00045 Message::get()->send(MSG::ERROR,__FUNCTION__,Form("Invalid axis index: %d",axis));
00046
00047 return;
00048
00049 }
00050
00051 for(size_t i=0; i<this->size(); ++i) {
00052
00053 if((this->at(i)).XYZ()[axis] > max) max = (this->at(i)).XYZ()[axis];
00054 if((this->at(i)).XYZ()[axis] > min) min = (this->at(i)).XYZ()[axis];
00055
00056 }
00057
00058 return;
00059 }
00060
00061
00062
00063 void event_sps::get_axis_range(Double_t &xmax, Double_t &xmin,
00064 Double_t &ymax, Double_t &ymin,
00065 Double_t &zmax, Double_t &zmin) const
00066
00067 {
00068
00069 for(size_t i=0; i<this->size(); ++i) {
00070
00071 if((this->at(i)).XYZ()[0] > xmax) xmax = (this->at(i)).XYZ()[0];
00072 if((this->at(i)).XYZ()[0] > xmin) xmin = (this->at(i)).XYZ()[0];
00073 if((this->at(i)).XYZ()[1] > ymax) ymax = (this->at(i)).XYZ()[1];
00074 if((this->at(i)).XYZ()[1] > ymin) ymin = (this->at(i)).XYZ()[1];
00075 if((this->at(i)).XYZ()[2] > zmax) zmax = (this->at(i)).XYZ()[2];
00076 if((this->at(i)).XYZ()[2] > zmin) zmin = (this->at(i)).XYZ()[2];
00077
00078 }
00079
00080 return;
00081 }
00082 }
00083 #endif
00084