]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/UPGRADE/AliITSUClusterPix.cxx
Added charge to the clusters tree
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUClusterPix.cxx
index 60ebdbbb86cb52a9b562ccd17d2188c59fef586a..20c8232f8793c8c8c9237a73d86865bdd3cf0004 100644 (file)
@@ -2,7 +2,8 @@
 #include "AliITSUGeomTGeo.h"
 #include "AliLog.h"
 #include <TGeoMatrix.h>
-#include <TMath.h>
+#include <TString.h>
+
 using namespace TMath;
 
 ClassImp(AliITSUClusterPix)
@@ -12,7 +13,9 @@ UInt_t           AliITSUClusterPix::fgMode = 0;
 
 //_____________________________________________________
 AliITSUClusterPix::AliITSUClusterPix()
-  : fNxNz(0)
+  : fCharge(0)
+  , fRecoInfo(0)
+  , fNxNzN(0)
 {
   // default constructor
 }
@@ -26,7 +29,9 @@ AliITSUClusterPix::~AliITSUClusterPix()
 //_____________________________________________________
 AliITSUClusterPix::AliITSUClusterPix(const AliITSUClusterPix& cluster) 
   :AliCluster(cluster)
-  ,fNxNz(cluster.fNxNz)
+  ,fCharge(cluster.fCharge)
+  ,fRecoInfo(cluster.fRecoInfo)
+  ,fNxNzN(cluster.fNxNzN)
 {
   // copy constructor
 }
@@ -36,7 +41,9 @@ AliITSUClusterPix& AliITSUClusterPix::operator=(const AliITSUClusterPix& cluster
 {
   // = 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;
@@ -57,20 +64,25 @@ TGeoHMatrix* AliITSUClusterPix::GetMatrix(Bool_t ) const
 }
 
 //______________________________________________________________________________
-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");
   //
 }
@@ -238,7 +250,7 @@ void AliITSUClusterPix::GetTrackingXYZ(Float_t xyz[3]) 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];
   //
 }
 
@@ -246,25 +258,31 @@ void AliITSUClusterPix::GetTrackingXYZ(Float_t xyz[3]) const
 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;
@@ -274,21 +292,36 @@ Int_t AliITSUClusterPix::Compare(const TObject* obj)  const
 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;
+}