#!/usr/bin/env python # This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus # # MAUS is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # MAUS is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with MAUS. If not, see . # """ Defines the AnalysisTrack class. A generic track class that can be used to simplify the analysis of track data. """ # pylint: disable = W0311, R0902, R0904, R0913, C0103, W0102 class AnalysisTrack() : """ A simple, unified class that holds the essential information, when copied from MAUS data types, during various analyses. Some syntax was borrowed from XBoa for simplicity and because I like the interface! """ def __init__( self, trackpoints={}, chisq=0.0, ndf=0, p_value=1.0, status=0 ) : """ Initialise object. """ self.__trackpoints = trackpoints self.__chisq = chisq self.__ndf = ndf self.__p_value = p_value self.__status = status def __getitem__(self, index) : """ Return a trackpoint from the track at index ``index'' """ return self.__trackpoints[index] def __setitem__(self, index, item) : """ Set the value of the trackpoint in the track at index ``index'' """ self.__trackpoints[index] = item def __len__(self) : """ Return the number of trackpoints in the track> """ return len(self.__trackpoints) def get_trackpoint( self, index ) : """ Return a trackpoint from the track at index ``index'' """ return self.__trackpoints[index] def set_trackpoint( self, index, item ) : """ Set the value of the trackpoint in the track at index ``index'' """ self.__trackpoints[index] = item def get_p_value( self ) : """ Return the track p-value """ return self.__p_value def set_p_value( self, pvalue ) : """ Set the track p-value """ self.__p_value = pvalue def get_chisq( self ) : """ Return the track chisq squared """ return self.__chisq def set_chisq( self, chisq ) : """ Set the track chisq squared """ self.__chisq = chisq def get_ndf( self ) : """ Get the track No. Degrees of Freedom """ return self.__ndf def set_ndf( self, ndf ) : """ Set the track No. Degrees of Freedom """ self.__ndf = ndf def get_chisq_ndf(self) : """ Get the track Chisquared / No. Degrees of Freedom """ return self.__chisq / self.__ndf def set_status(self, status) : """ Set a undefined status flag """ self.__status = status def get_status(self) : """ Get the status flag """ return self.__status