#include "AliTPCclusterMI.h"
#include "AliTPCclusterInfo.h"
#include "AliTrackPointArray.h"
#include "AliGeomManager.h"
#include "AliLog.h"
ClassImp(AliTPCclusterMI)
AliTPCclusterMI::AliTPCclusterMI():
AliCluster(),
fInfo(0),
fTimeBin(0),
fPad(0),
fQ(0),
fMax(0),
fType(0),
fUsed(0),
fDetector(0),
fRow(0)
{
}
AliTPCclusterMI::AliTPCclusterMI(const AliTPCclusterMI & cluster):
AliCluster(cluster),
fInfo(0),
fTimeBin(cluster.fTimeBin),
fPad(cluster.fPad),
fQ(cluster.fQ),
fMax(cluster.fMax),
fType(cluster.fType),
fUsed(cluster.fUsed),
fDetector(cluster.fDetector),
fRow(cluster.fRow)
{
if (cluster.fInfo) fInfo = new AliTPCclusterInfo(*(cluster.fInfo));
}
AliTPCclusterMI & AliTPCclusterMI::operator = (const AliTPCclusterMI & cluster)
{
if (this == &cluster) return (*this);
(AliCluster&)(*this) = (AliCluster&)cluster;
fQ = cluster.fQ;
fType = cluster.fType;
fMax = cluster.fMax;
fUsed = cluster.fUsed;
fDetector = cluster.fDetector;
fRow = cluster.fRow;
fTimeBin = cluster.fTimeBin;
fPad = cluster.fPad;
delete fInfo;
fInfo = 0;
if (cluster.fInfo) fInfo = new AliTPCclusterInfo(*(cluster.fInfo));
return *this;
}
AliTPCclusterMI::AliTPCclusterMI(Int_t *lab, Float_t *hit) :
AliCluster(0,hit,0.,0.,lab),
fInfo(0),
fTimeBin(0),
fPad(0),
fQ(0),
fMax(0),
fType(0),
fUsed(0),
fDetector(0),
fRow(0)
{
fQ = (UShort_t)hit[4];
fInfo = 0;
}
AliTPCclusterMI::~AliTPCclusterMI() {
if (fInfo) delete fInfo;
fInfo = 0;
}
Bool_t AliTPCclusterMI::IsSortable() const
{
return kTRUE;
}
Int_t AliTPCclusterMI::Compare(const TObject* obj) const
{
AliTPCclusterMI * o2 = (AliTPCclusterMI*)obj;
return (o2->GetY()>GetY())? -1:1;
}
void AliTPCclusterMI::SetDetector(Int_t detector){
fDetector = (UChar_t)(detector%72);
AliGeomManager::ELayerID id = (fDetector<36) ?
AliGeomManager::kTPC1 :AliGeomManager::kTPC2 ;
Int_t modId = (fDetector<36)?fDetector: fDetector-36;
SetVolumeId(AliGeomManager::LayerToVolUID(id,modId));
}
void AliTPCclusterMI::SetInfo(AliTPCclusterInfo * info) {
if (fInfo) delete fInfo;
fInfo = info;
}
AliTPCclusterMI* AliTPCclusterMI::MakeCluster(AliTrackPoint* ) {
return NULL;
}
AliTrackPoint* AliTPCclusterMI::MakePoint() {
AliTrackPoint* point = new AliTrackPoint();
Float_t xyz[3]={0.};
Float_t cov[6]={0.};
GetGlobalXYZ(xyz);
GetGlobalCov(cov);
point->SetXYZ(xyz);
point->SetCov(cov);
return point;
}
void AliTPCclusterMI::SetGlobalTrackPoint( const AliCluster &cl, AliTrackPoint &point )
{
Float_t xyz[3]={0.};
Float_t cov[6]={0.};
cl.GetGlobalXYZ(xyz);
cl.GetGlobalCov(cov);
point.SetXYZ(xyz);
point.SetCov(cov);
}