// -- // -- // Implementation for TTree output in PHOS DA // for calibrating energy by pi0 and MIP. // -- // -- Author: Hisayuki Torii (Hiroshima Univ.) // -- #include #include "AliPHOSDATreeEvent.h" ClassImp(AliPHOSDATreeEvent) //------------------------------------------------------------------------ AliPHOSDATreeEvent::AliPHOSDATreeEvent(const AliPHOSDATreeEvent& evt){ // Copy Constructor fNDigits = evt.fNDigits; if( fNDigits > 0 ){ fDigits = new AliPHOSDATreeDigit[fNDigits]; int ndigits = fNDigits; while( ndigits-- ){ fDigits[ndigits] = evt.fDigits[ndigits]; } } else { fDigits = 0; } // fNClusters = evt.fNClusters; if( fNClusters > 0 ){ fClusters = new AliPHOSDATreeCluster[fNClusters]; int nclusters = fNClusters; while( nclusters-- ){ fClusters[nclusters] = evt.fClusters[nclusters]; } } else { fClusters = 0; } } //------------------------------------------------------------------------ AliPHOSDATreeEvent& AliPHOSDATreeEvent::operator=(const AliPHOSDATreeEvent& evt){ // Copy Operator if( fNDigits > 0 ) delete[] fDigits; fNDigits = evt.fNDigits; if( fNDigits > 0 ){ fDigits = new AliPHOSDATreeDigit[fNDigits]; int ndigits = fNDigits; while( ndigits-- ){ fDigits[ndigits] = evt.fDigits[ndigits]; } } else { fDigits = 0; } // if( fNClusters > 0 ) delete[] fClusters; fNClusters = evt.fNClusters; if( fNClusters > 0 ){ fClusters = new AliPHOSDATreeCluster[fNClusters]; int nclusters = fNClusters; while( nclusters-- ){ fClusters[nclusters] = evt.fClusters[nclusters]; } } else { fClusters = 0; } return *this; } //------------------------------------------------------------------------ bool AliPHOSDATreeEvent::Fill(float energy,int row,int col){ // Fill new digit information AliPHOSDATreeDigit digit(energy,row,col); return Fill(digit); } //------------------------------------------------------------------------ bool AliPHOSDATreeEvent::Fill(AliPHOSDATreeDigit& digit){ // Fill new digit information AliPHOSDATreeDigit* newDigits = new AliPHOSDATreeDigit[fNDigits+1]; int ndigits = fNDigits; newDigits[ndigits] = digit; while( ndigits-- ){ newDigits[ndigits] = fDigits[ndigits]; } if( fNDigits>0 ) delete[] fDigits; fDigits = newDigits; fNDigits++; return true; } //------------------------------------------------------------------------ bool AliPHOSDATreeEvent::Clusterize(AliPHOSDATreeDigit& digit){ //Input digit information into clustering bool status = false; int nclusters = fNClusters; while( nclusters-- && !status ){ if( fClusters[nclusters].IsNeighbor(digit) ){ status = fClusters[nclusters].Append(digit); } } //std::cout<<" DEBUGDEBUG:: status = "< "<0 ) delete[] fClusters; fClusters = newClusters; } else { if( fNClusters>0 ) delete[] fClusters; fClusters = 0; fNClusters = 0; } return true; } //------------------------------------------------------------------------ void AliPHOSDATreeEvent::Print(char* opt){ // Print Out char* when = ctime(&fTime); std::cout<<" AliPHOSDATreeEvent:: fNDigits = "<["<["<["<["<