#include "AliITSUGeomTGeo.h"
#include "AliLog.h"
#include <TGeoMatrix.h>
-#include <TMath.h>
+#include <TString.h>
+
using namespace TMath;
ClassImp(AliITSUClusterPix)
//_____________________________________________________
AliITSUClusterPix::AliITSUClusterPix()
- : fNxNz(0)
+ : fCharge(0)
+ , fRecoInfo(0)
+ , fNxNzN(0)
{
// default constructor
}
//_____________________________________________________
AliITSUClusterPix::AliITSUClusterPix(const AliITSUClusterPix& cluster)
:AliCluster(cluster)
- ,fNxNz(cluster.fNxNz)
+ ,fCharge(cluster.fCharge)
+ ,fRecoInfo(cluster.fRecoInfo)
+ ,fNxNzN(cluster.fNxNzN)
{
// copy constructor
}
{
// = op
if(&cluster == this) return *this;
- fNxNz = cluster.fNxNz;
+ fNxNzN = cluster.fNxNzN;
+ fCharge = cluster.fCharge;
+ fRecoInfo = cluster.fRecoInfo;
TObject::operator=(cluster);
AliCluster::operator=(cluster);
return *this;
//______________________________________________________________________________
TGeoHMatrix* AliITSUClusterPix::GetMatrix(Bool_t ) const
{
- // get module matrix (sensor!)
+ // get chip matrix (sensor!)
return (TGeoHMatrix*)fgGeom->GetMatrixSens(GetVolumeId());
}
//______________________________________________________________________________
-void AliITSUClusterPix::Print(Option_t* /*option*/) const
+void AliITSUClusterPix::Print(Option_t* option) const
{
// Print cluster information.
- printf("Cluster of module %5d, <nx>=%3d <nz>=%3d |Err^2:%.3e %.3e %+.3e |",GetVolumeId(),GetNx(),GetNz(),
- GetSigmaY2(),GetSigmaZ2(),GetSigmaYZ());
- printf("XYZ: %+.4e %+.4e %+.4e in frame ",GetX(),GetY(),GetZ());
- if (IsFrameLoc()) printf("LOC");
- else if (IsFrameGlo()) printf("GLO");
- else if (IsFrameTrk()) printf("TRK");
- if (!IsFrameGlo() && fgGeom) {
+ TString str = option;
+ str.ToLower();
+ printf("Cl.in mod %5d, nx:%3d nz:%3d n:%d |Err^2:%.3e %.3e %+.3e |",GetVolumeId(),GetNx(),GetNz(),
+ GetNPix(),GetSigmaY2(),GetSigmaZ2(),GetSigmaYZ());
+ printf("XYZ: (%+.4e %+.4e %+.4e ",GetX(),GetY(),GetZ());
+ if (IsFrameLoc()) printf("LOC)");
+ else if (IsFrameGlo()) printf("GLO)");
+ else if (IsFrameTrk()) printf("TRK)");
+ if (str.Contains("glo") && !IsFrameGlo() && fgGeom) {
Float_t g[3];
GetGlobalXYZ(g);
- printf(" (%+.4e %+.4e %+.4e in GLO)",g[0],g[1],g[2]);
+ printf(" (%+.4e %+.4e %+.4e GLO)",g[0],g[1],g[2]);
}
+ printf(" MClb:");
+ for (int i=0;i<3;i++) printf(" %5d",GetLabel(i));
+ if (TestBit(kSplit)) printf(" Spl");
printf("\n");
//
}
{
// Get the global coordinates of the cluster
// All the needed information is taken only
- // from TGeo.
+ // from TGeo (single precision).
if (IsFrameGlo()) {
xyz[0] = GetX();
xyz[1] = GetY();
xyz[2] = GetZ();
+ return kTRUE;
}
//
Double_t lxyz[3] = {0, 0, 0};
return kTRUE;
}
+//______________________________________________________________________________
+Bool_t AliITSUClusterPix::GetGlobalXYZ(Double_t xyz[3]) const
+{
+ // Get the global coordinates of the cluster
+ // All the needed information is taken only
+ // from TGeo (double precision).
+ if (IsFrameGlo()) {
+ xyz[0] = GetX();
+ xyz[1] = GetY();
+ xyz[2] = GetZ();
+ return kTRUE;
+ }
+ //
+ Double_t lxyz[3] = {0, 0, 0};
+ if (IsFrameTrk()) {
+ const TGeoHMatrix *mt = GetTracking2LocalMatrix();
+ if (!mt) return kFALSE;
+ Double_t txyz[3] = {GetX(), GetY(), GetZ()};
+ mt->LocalToMaster(txyz,lxyz);
+ }
+ else {
+ lxyz[0] = GetX(); lxyz[1] = GetY(); lxyz[2] = GetZ();
+ }
+ //
+ TGeoHMatrix *ml = GetMatrix();
+ if (!ml) return kFALSE;
+ ml->LocalToMaster(lxyz,xyz);
+ return kTRUE;
+}
+
+
//______________________________________________________________________________
Bool_t AliITSUClusterPix::GetGlobalCov(Float_t cov[6]) const
{
}
// now in local frame
GetTracking2LocalMatrix()->MasterToLocal(loc,trk);
- for (int i=3;i--;) xyz[i] = loc[i];
+ for (int i=3;i--;) xyz[i] = trk[i];
//
}
Int_t AliITSUClusterPix::Compare(const TObject* obj) const
{
// compare clusters accodring to specific mode
- const AliITSUClusterPix* px = dynamic_cast<const AliITSUClusterPix*>(obj);
+ const AliITSUClusterPix* px = (const AliITSUClusterPix*)obj;
float xyz[3],xyz1[3];
- if (fgMode & kSortLoc) { // sorting in local frame
- GetLocalXYZ(xyz);
- px->GetLocalXYZ(xyz1);
- if (xyz[2]<xyz1[2]) return -1; // sort in Z then in X
- if (xyz[2]>xyz1[2]) return 1;
- if (xyz[0]<xyz1[0]) return -1;
- if (xyz[0]>xyz1[0]) return 1;
- return 0;
+ if (fgMode & kSortIdLocXZ) { // sorting in local frame
+ if (GetVolumeId()==px->GetVolumeId()) {
+ GetLocalXYZ(xyz);
+ px->GetLocalXYZ(xyz1);
+ if (xyz[0]<xyz1[0]) return -1; // sort in X
+ if (xyz[0]>xyz1[0]) return 1;
+ if (xyz[2]<xyz1[2]) return -1; // then in Z
+ if (xyz[2]>xyz1[2]) return 1;
+ return 0;
+ }
+ return int(GetVolumeId())-int(px->GetVolumeId());
}
- if (fgMode & kSortTrk) { // sorting in tracking frame
- GetTrackingXYZ(xyz);
- px->GetTrackingXYZ(xyz1);
- if (xyz[2]<xyz1[2]) return -1; // sort in Z then in Y
- if (xyz[2]>xyz1[2]) return 1;
- if (xyz[1]<xyz1[1]) return -1;
- if (xyz[1]>xyz1[1]) return 1;
- return 0;
+ if (fgMode & kSortIdTrkYZ) { // sorting in tracking frame
+ if (GetVolumeId()==px->GetVolumeId()) {
+ GetTrackingXYZ(xyz);
+ px->GetTrackingXYZ(xyz1);
+ if (xyz[1]<xyz1[1]) return -1; // sort in Y
+ if (xyz[1]>xyz1[1]) return 1;
+ if (xyz[2]<xyz1[2]) return -1; // then in Z
+ if (xyz[2]>xyz1[2]) return 1;
+ return 0;
+ }
+ return int(GetVolumeId())-int(px->GetVolumeId());
}
AliFatal(Form("Unknown modr for sorting: %d",fgMode));
return 0;
Bool_t AliITSUClusterPix::IsEqual(const TObject* obj) const
{
// compare clusters accodring to specific mode
- const AliITSUClusterPix* px = dynamic_cast<const AliITSUClusterPix*>(obj);
+ const AliITSUClusterPix* px = (const AliITSUClusterPix*)obj;
const Float_t kTol = 1e-5;
float xyz[3],xyz1[3];
- if (fgMode & kSortLoc) { // sorting in local frame
+ if (fgMode & kSortIdLocXZ) { // sorting in local frame
+ if (GetVolumeId()!=px->GetVolumeId()) return kFALSE;
GetLocalXYZ(xyz);
px->GetLocalXYZ(xyz1);
- if (Abs(xyz[2]-xyz1[2])<kTol && Abs(xyz[0]-xyz1[0])<kTol) return kTRUE;
- return kFALSE;
+ return (Abs(xyz[0]-xyz1[0])<kTol && Abs(xyz[2]-xyz1[2])<kTol) ? kTRUE : kFALSE;
}
- if (fgMode & kSortTrk) { // sorting in tracking frame
+ if (fgMode & kSortIdTrkYZ) { // sorting in tracking frame
+ if (GetVolumeId()!=px->GetVolumeId()) return kFALSE;
GetTrackingXYZ(xyz);
px->GetTrackingXYZ(xyz1);
- if (Abs(xyz[2]-xyz1[2])<kTol && Abs(xyz[1]-xyz1[1])<kTol) return kTRUE;
- return kFALSE;
+ return (Abs(xyz[1]-xyz1[1])<kTol && Abs(xyz[2]-xyz1[2])<kTol) ? kTRUE : kFALSE;
}
AliFatal(Form("Unknown modr for sorting: %d",fgMode));
return kFALSE;
}
+
+//______________________________________________________________________________
+Bool_t AliITSUClusterPix::HasCommonTrack(const AliCluster* cl) const
+{
+ // check if clusters have common tracks
+ int lbi,lbj;
+ for (int i=0;i<3;i++) {
+ if ((lbi=GetLabel(i))<0) break;
+ for (int j=0;j<3;j++) {
+ if ((lbj=cl->GetLabel(j))<0) break;
+ if (lbi==lbj) return kTRUE;
+ }
+ }
+ return kFALSE;
+}