00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef __CLDAQ_ROOT_USE
00020 #include "TRecordAssociation.hh"
00021 #include "TRecordDisplayCanvas.hh"
00022
00023 TRecordAssociation::TRecordAssociation( const Tstring& recid, const Tstring& secid, const Tstring& segid, const Tstring& eleid, Tint nbin, Tdouble xmin, Tdouble xmax, TRecordDisplayCanvas* cv, TH1D* h )
00024 : theRecordID( recid ),
00025 theSectionID( secid ),
00026 theSegmentID( segid ),
00027 theElementID( eleid ),
00028 theNumberOfBins( nbin ),
00029 theMinimumX( xmin ),
00030 theMaximumX( xmax ),
00031 theCanvas( cv ),
00032 theHistogram( h ),
00033 theValidAssociation( Tfalse )
00034 {
00035 checkValid();
00036 }
00037
00038 TRecordAssociation::TRecordAssociation( const TRecordAssociation& right )
00039 : theRecordID( right.theRecordID ),
00040 theSectionID( right.theSectionID ),
00041 theSegmentID( right.theSegmentID ),
00042 theElementID( right.theElementID ),
00043 theNumberOfBins( right.theNumberOfBins ),
00044 theMinimumX( right.theMinimumX ),
00045 theMaximumX( right.theMaximumX ),
00046 theCanvas( right.theCanvas ),
00047 theHistogram( right.theHistogram ),
00048 theValidAssociation( Tfalse )
00049 {
00050 checkValid();
00051 }
00052
00053 TRecordAssociation::~TRecordAssociation()
00054 {;}
00055
00056 const TRecordAssociation& TRecordAssociation::operator=( const TRecordAssociation& right )
00057 {
00058 theRecordID = right.theRecordID;
00059 theSectionID = right.theSectionID;
00060 theSegmentID = right.theSegmentID;
00061 theElementID = right.theElementID;
00062 theNumberOfBins = right.theNumberOfBins;
00063 theMinimumX = right.theMinimumX;
00064 theMaximumX = right.theMaximumX;
00065 theCanvas = right.theCanvas;
00066 theHistogram = right.theHistogram;
00067 theValidAssociation = Tfalse;
00068 checkValid();
00069 return *this;
00070 }
00071
00072 Tbool TRecordAssociation::operator==( const TRecordAssociation& right ) const
00073 {
00074 Tbool retval = Ttrue;
00075
00076 retval &= ( theRecordID == right.theRecordID );
00077 retval &= ( theSectionID == right.theSectionID );
00078 retval &= ( theSegmentID == right.theSegmentID );
00079 retval &= ( theElementID == right.theElementID );
00080
00081 return retval;
00082 }
00083
00084 Tbool TRecordAssociation::operator!=( const TRecordAssociation& right ) const
00085 {
00086 Tbool retval = Tfalse;
00087
00088 retval |= ( theRecordID != right.theRecordID );
00089 retval |= ( theSectionID != right.theSectionID );
00090 retval |= ( theSegmentID != right.theSegmentID );
00091 retval |= ( theElementID != right.theElementID );
00092
00093 return retval;
00094 }
00095
00096 Tostream& operator<<( Tostream& tos, const TRecordAssociation& right )
00097 {
00098
00099 tos << "ID: " << right.theRecordID << "/";
00100 tos << right.theSectionID << "/";
00101 tos << right.theSegmentID << "/";
00102 tos << right.theElementID;
00103 tos << ", Cv: " << right.theCanvas;
00104 tos << ", H1: " << right.theHistogram;
00105 if ( ! right.theValidAssociation ) {
00106 tos << " (Invalid)";
00107 }
00108
00109
00110
00111
00112 return tos;
00113 }
00114
00115 Tvoid TRecordAssociation::checkValid()
00116 {
00117 theValidAssociation = Tfalse;
00118 if ( theRecordID.empty() || theRecordID == "" ) {
00119 return;
00120 } else if ( theSectionID.empty() || theSectionID == "" ) {
00121 return;
00122 } else if ( theSegmentID.empty() || theSegmentID == "" ) {
00123 return;
00124 } else if ( theElementID.empty() || theElementID == "" ) {
00125 return;
00126 } else if ( theNumberOfBins < 0 ) {
00127 return;
00128 } else if ( !theCanvas || !theHistogram ) {
00129 return;
00130 } else {
00131 theValidAssociation = Ttrue;
00132 return;
00133 }
00134 }
00135
00136 #endif
00137
00138 #ifdef __CLDAQ_ROOT_DLL
00139 ClassImp(TRecordAssociation)
00140 #endif