/** CbmMuchDigiMatch.cxx **@author M.Ryzhinskiy **@since 23.03.07 **@version 1.0 ** ** Data class for matching CbmMuchDigi with CbmMuchPoint. Up to three ** matches are possible. ** The indizes of CbmMuchDigi and CbmMuchDigiMatch correspond in their ** respective arrays. ** The class holds the indices of all MuchPoints corresponding to ** the MuchDigi. **/ #include using std::cout; using std::endl; #include "CbmMuchDigiMatch.h" // ----- Default onstructor -------------------------------------------- CbmMuchDigiMatch::CbmMuchDigiMatch() { fRefIndex[0] = fRefIndex[1] = fRefIndex[2] = -1; }; // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------ CbmMuchDigiMatch::CbmMuchDigiMatch(Int_t iPoint) { if ( iPoint < 0 ) { cout << "-W- CbmMuchDigiMatch: Illegal MuchPoint index " << iPoint << endl; fRefIndex[0] = -1; } else fRefIndex[0] = iPoint; fRefIndex[1] = fRefIndex[2] = -1; }; // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- CbmMuchDigiMatch::~CbmMuchDigiMatch() { }; // ------------------------------------------------------------------------- // ----- Public method AddPoint ---------------------------------------- Int_t CbmMuchDigiMatch::AddPoint(Int_t iPoint) { if ( iPoint < 0 ) { cout << "-W- CbmMuchDigiMatch::AddPoint: Illegal MuchPoint index " << iPoint << endl; return 0; } for (Int_t i=0; i<3; i++) { if (fRefIndex[i] == iPoint) return i+1; // the point already added if ( fRefIndex[i] == -1 ) { fRefIndex[i] = iPoint; return i+1; } } return 4; } // ------------------------------------------------------------------------- // ----- Public method GetRefIndex ------------------------------------- Int_t CbmMuchDigiMatch::GetRefIndex(Int_t i) const { if ( i<0 || i>2 ) { cout << "-W- CbmMuchDigiMatch::GetRefIndex: Illegal index number " << i << endl; return -1; } return fRefIndex[i]; } // ------------------------------------------------------------------------- ClassImp(CbmMuchDigiMatch)