//-------------------------------------------------------------------------- // File and Version Information: // $Id:$ // // Description: // Class EmcXtal // // Software developed for the BaBar Detector at the SLAC B-Factory. // Adapted for the PANDA experiment at GSI // // Author List: // Gautier Hamel de Monchenault - CEN Saclay & Lawrence Berkeley Lab // Stephen J. Gowdy University of Edinburgh // Dima Melnichuk - adaption for PANDA // // Copyright Information: // Copyright (C) 1996 Lawrence Berkeley Laboratory // Copyright (C) 1996 CEA - Centre d'Etude de Saclay // Copyright (C) 1997 University of Edinburgh //------------------------------------------------------------------------ #include "TObject.h" #include "EmcXtal.h" #include "TwoCoordIndex.h" #include "TGeoArb8.h" #include "TVector3.h" #include "TRotation.h" #include //---------------- // Constructors -- //---------------- EmcXtal::EmcXtal(const TwoCoordIndex *id, const TGeoTrap &trap, const TVector3 &pos, const TRotation &rot, const TVector3 &reflect): fTCIIndex(id), fTrap(trap) { // calculate length of the crystal fLength=trap.GetDz()*2; // Obtain unitary vector in the direction of crystal in calorimeter TVector3 unit(0.,0.,1.), newpos(0.,0.,0.); unit*=rot; unit*=0.5*fLength; unit.SetXYZ(unit.X()*reflect.X(), unit.Y()*reflect.Y(), unit.Z()*reflect.Z()); newpos.SetXYZ(pos.X()*reflect.X(), pos.Y()*reflect.Y(), pos.Z()*reflect.Z()); fCentre = newpos; fFrontCentre = newpos-unit; fNormalToFrontFace = unit; } //-------------- // Destructor -- //-------------- EmcXtal::~EmcXtal() { } // ---------------------------------------- // -- Public Function Member Definitions -- // ---------------------------------------- bool EmcXtal::operator==( const EmcXtal& compare ) const { bool answer = false; if ( *fTCIIndex == *compare.fTCIIndex ) answer=true; return answer; } const TwoCoordIndex* EmcXtal::myIndex() const { return fTCIIndex; } const TVector3& EmcXtal::centre() const { return fCentre; } const TVector3& EmcXtal::frontCentre() const { return fFrontCentre; } const TVector3& EmcXtal::normalToFrontFace() const { return fNormalToFrontFace; } double EmcXtal::npAngle() const { return fNormalToFrontFace.Theta()-fCentre.Theta(); } ClassImp(EmcXtal)