]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSRecPoint.cxx
Disable test of requested CDB objects similarity in sim and rec in case the sim has...
[u/mrichter/AliRoot.git] / ITS / AliITSRecPoint.cxx
index 792ef046ed9ffea6998f8dd437e96746eef2a578..fe5b04e8479bc7465e497abaa079bda30bec19d7 100644 (file)
 //  "trackingV2".
 ///////////////////////////////////////////////////////////////////////////////
 
-
+#include <TGeoMatrix.h>
 #include "AliITSRecPoint.h"
-#include "AliITSgeom.h"
-ClassImp(AliITSRecPoint)
+#include "AliAlignObj.h"
 
-//_____________________________________________________________
-AliITSRecPoint::AliITSRecPoint(): AliCluster(),
-fXloc(0),
-fZloc(0),
-fdEdX(0),
-fIndex(0),
-fQ(0),
-fLayer(0),
-fNz(0),
-fNy(0),
-fChargeRatio(0),
-fType(0),
-fDeltaProb(0),
-fGeom(0){
-    // default creator
-}
+using std::ios;
+ClassImp(AliITSRecPoint)
 
 //_____________________________________________________________
-AliITSRecPoint::AliITSRecPoint(AliITSgeom* geom): AliCluster(),
+AliITSRecPoint::AliITSRecPoint(): 
+AliCluster(),
 fXloc(0),
 fZloc(0),
 fdEdX(0),
@@ -65,13 +51,15 @@ fNy(0),
 fChargeRatio(0),
 fType(0),
 fDeltaProb(0),
-fGeom(geom) {
-    // default creator
-
+fDriftTime(0.),
+fDriftSide(0)
+{
+    // default constructor
 }
 
 //________________________________________________________________________
-AliITSRecPoint::AliITSRecPoint(Int_t module,AliITSgeom* geom,Int_t *lab,Float_t *hit, Int_t *info):AliCluster(lab,hit),
+AliITSRecPoint::AliITSRecPoint(Int_t *lab,Float_t *hit, Int_t *info, Bool_t local):
+AliCluster(AliGeomManager::LayerToVolUID((info[2]+AliGeomManager::kSPD1),lab[3]&0x3FF),hit,0,0,lab),
 fXloc(0),
 fZloc(0),
 fdEdX(0),
@@ -83,38 +71,71 @@ fNy(info[0]),
 fChargeRatio(0),
 fType(0),
 fDeltaProb(0),
-fGeom(geom)
+fDriftTime(0.),
+fDriftSide(0)
 {
   //standard constructor used in AliITSClusterFinderV2
 
+  if (!local) { // Cluster V2
+    Double_t txyz[3] = {GetX(), GetY(), GetZ()};
+    Double_t lxyz[3] = {0, 0, 0};
+    GetTracking2LocalMatrix()->LocalToMaster(txyz,lxyz);
+    fXloc = lxyz[0]; fZloc = lxyz[2];
+    if(fLayer==4) hit[5]=-hit[5];
+    if( (fLayer==4) || (fLayer==5) ) SetSigmaYZ(hit[5]); 
+  }
+  else {
+    switch (fLayer) {
+    case 0:
+    case 1:
+      fdEdX = 0;
+      break;
+    case 2:
+    case 3:
+      fdEdX=fQ*1e-6;
+      break;
+    case 4:
+      fdEdX=fQ*2.16;
+      SetSigmaYZ(hit[5]);
+      break;
+    case 5:
+      fdEdX=fQ*2.16;
+      hit[5]=-hit[5];
+      SetSigmaYZ(hit[5]);
+      break;
+    default:
+      AliError(Form("Wrong ITS layer %d (0 -> 5)",fLayer));
+      break;
+    }
+    fXloc = hit[0];
+    fZloc = hit[1];
+    Double_t lxyz[3] = {fXloc, 0, fZloc};
+    Double_t txyz[3] = {0, 0, 0};
+    GetTracking2LocalMatrix()->MasterToLocal(lxyz,txyz);
+
+    SetX(0.); SetY(txyz[1]); SetZ(txyz[2]);
 
-  fType=0;
-  fDeltaProb=0.;
-  
-  fGeom = geom;
-  fGeom->TrackingV2ToDetL(module,fY,fZ,fXloc,fZloc);
-  if(module<fGeom->GetStartSDD()) fdEdX=0.;
-  if(module>=fGeom->GetStartSDD() && module<fGeom->GetStartSSD()){
-    fdEdX=fQ*1e-6;
   }
-  if(module>=fGeom->GetStartSSD()) fdEdX=fQ*2.16;
-  
-  
+
 }
+
 //_______________________________________________________________________
-AliITSRecPoint::AliITSRecPoint(const AliITSRecPoint& pt):AliCluster(pt),
-fXloc(pt.fXloc),
-fZloc(pt.fZloc),
-fdEdX(pt.fdEdX),
-fIndex(pt.fIndex),
-fQ(pt.fQ),
-fLayer(pt.fLayer),
-fNz(pt.fNz),
-fNy(pt.fNy),
-fChargeRatio(pt.fChargeRatio),
-fType(pt.fType),
-fDeltaProb(pt.fDeltaProb),
-fGeom(pt.fGeom){
+AliITSRecPoint::AliITSRecPoint(const AliITSRecPoint& pt):
+  AliCluster(pt),
+  fXloc(pt.fXloc),
+  fZloc(pt.fZloc),
+  fdEdX(pt.fdEdX),
+  fIndex(pt.fIndex),
+  fQ(pt.fQ),
+  fLayer(pt.fLayer),
+  fNz(pt.fNz),
+  fNy(pt.fNy),
+  fChargeRatio(pt.fChargeRatio),
+  fType(pt.fType),
+  fDeltaProb(pt.fDeltaProb),
+  fDriftTime(pt.fDriftTime),
+  fDriftSide(pt.fDriftSide)
+{
   //Copy constructor
 
 }
@@ -129,23 +150,6 @@ AliITSRecPoint& AliITSRecPoint::operator=(const AliITSRecPoint& source){
 
 }
 
-//________________________________________________________________________
-AliITSRecPoint::AliITSRecPoint(Int_t *lab,Float_t *hit, Int_t *info):AliCluster(lab,hit),
-fXloc(0),
-fZloc(0),
-fdEdX(0),
-fIndex(lab[3]),
-fQ(hit[4]),
-fLayer(info[2]),
-fNz(info[1]),
-fNy(info[0]),
-fChargeRatio(0),
-fType(0),
-fDeltaProb(0),
-fGeom(0){
-  //standard constructor used in AliITSClusterFinderV2
-}
-
 //----------------------------------------------------------------------
 void AliITSRecPoint::Print(ostream *os){
     ////////////////////////////////////////////////////////////////////////
@@ -166,24 +170,124 @@ void AliITSRecPoint::Print(ostream *os){
 #endif
  
     fmt = os->setf(ios::fixed);  // set fixed floating point output
-    *os << fTracks[0]<< " " << fTracks[1] << " " << fTracks[2] << " ";
-    *os << fXloc << " " << fZloc << " " << fQ << " ";
+    *os << GetLabel(0) << " " << GetLabel(1) << " " << GetLabel(2) << " ";
     fmt = os->setf(ios::scientific); // set scientific for dEdX.
-    *os << fdEdX << " ";
+    *os << GetX() <<" " << GetY() << " " << GetZ() << " " ;
+    *os << GetSigmaY2() << " " << GetSigmaZ2() << " " << GetSigmaYZ() << " ";
+    fmt = os->setf(ios::fixed);
+    *os << GetVolumeId() << " "<< Misalign() /*fIsMisaligned*/ << " ";
+    fmt = os->setf(ios::scientific); // set scientific for dEdX.
+    *os << fXloc << " " << fZloc << " " << fdEdX << " ";
     fmt = os->setf(ios::fixed); // every fixed
-    *os << fSigmaY2 << " " << fSigmaZ2;
+    *os << fIndex <<" " << fQ << " "<<fLayer <<" "<<fNz<<" "<<fNy<<" ";
+    *os << fChargeRatio<<" " << fType << " " << fDeltaProb << " " << fDriftTime<< " " << fDriftSide;
     os->flags(fmt); // reset back to old formating.
     return;
 }
+
+//----------------------------------------------------------------------
+Int_t AliITSRecPoint::GetNpixels() const {
+//
+// returns the number of pixels used for the SPD clusters
+//
+
+ if(fLayer > 1) return -1;
+ else return fType;
+
+}
+
+//----------------------------------------------------------------------
+Int_t AliITSRecPoint::GetSPDclusterType() const {
+//
+// returns an Int_t with encoded information on cluster size
+//    type <= 16: cluster type identifier according to conventional numbering
+//    type >  16: Npixels+1000*Ny+1000000*Nz
+//
+
+ Int_t type = -1;
+ if(fLayer > 1) return type;
+ else {
+
+   switch (fType) {
+     case 1 : type = 1 ;break;
+     case 2 : if(fNy == 2) type = 2;
+              else         type = 3;
+              break;
+     case 3 : if(fNy == 3)      type = 4;
+              else if(fNz == 3) type = 6;
+              else              type = 5;
+              break;
+     case 4 : if(fNz == 1)                  type = 7;
+              else if(fNz == 2 && fNy == 2) type = 8;
+              else if(fNy == 2 && fNz == 3) type = 11;
+              else if(fNy == 3 && fNz == 2) type = 9;
+              else                          type = 15;
+              break;
+     case 5 : if(fNy == 3 && fNz == 2)  type = 10;
+              if(fNy == 2 && fNz == 3 ) type = 12;
+              if(fNy == 5)              type = 16;
+              else                      type = fType+1000*fNy+1000000*fNz;
+              break; 
+     case 6 : if(fNy ==3 && fNz == 2) type = 13;
+              if(fNy ==2 && fNz == 3) type = 14;
+              else                    type = fType+1000*fNy+1000000*fNz;
+              break; 
+     default: type = fType+1000*fNy+1000000*fNz;
+              break; 
+   }  
+
+   return type;
+ }
+}
+
+//----------------------------------------------------------------------
+Int_t AliITSRecPoint::GetSDDclusterType() const {
+// returns an Int_t with encoded information on cluster size
+// Byte1 = fNz Byte0=fNy, other two bytes empty for extra information
+// max. allowed cluster size = 255
+  Int_t typ=(fNz&0xFF)<<8;
+  typ+=fNy&0xFF;
+  if(fDriftSide==1) typ+=1<<16;
+  return typ;
+}
+//----------------------------------------------------------------------
+void  AliITSRecPoint::DecodeSDDclusterType(Int_t cluType, Int_t &cluSizAn, Int_t& cluSizTb, Int_t &drSide){
+// Extract cluster sizes and drift side from cluster type 
+  cluSizTb=cluType&0xFF;
+  cluSizAn=(cluType>>8)&0xFF;
+  drSide=(cluType>>16);
+  return;
+}
+//----------------------------------------------------------------------
+Int_t AliITSRecPoint::GetSSDclusterType() const {
+// returns an Int_t with encoded information on cluster size
+// Byte1 = fNz Byte0=fNy, other two bytes empty for extra information
+// max. allowed cluster size = 255
+  Int_t typ=(fNz&0xFF)<<8;
+  typ+=fNy&0xFF;
+  return typ;
+}
+
 //----------------------------------------------------------------------
 void AliITSRecPoint::Read(istream *is){
 ////////////////////////////////////////////////////////////////////////
 // Standard input format for this class.
 ////////////////////////////////////////////////////////////////////////
+    Bool_t mis;
+    Int_t lab[4];
+    Float_t hit[6];
+    lab[3] = 0; // ??
+    *is >> lab[0] >> lab[1] >> lab[2];
+    SetLabel(lab[0],0); SetLabel(lab[1],1); SetLabel(lab[2],2);
+    *is >> hit[0] >> hit[1] >> hit[2] >> hit[3] >> hit[4] >> hit[5];
+    SetX(hit[0]);SetY(hit[1]);SetZ(hit[2]);SetSigmaY2(hit[3]);
+    SetSigmaZ2(hit[4]);//fSigmaYZ=hit[5];
+    *is >> lab[0] >> mis;
+    SetVolumeId(lab[0]);// fIsMisalinged = mis;
+    *is >> fXloc >> fZloc >> fdEdX;
+    *is >> fIndex >> fQ >> fLayer >> fNz >> fNy >> fChargeRatio >> fType;
+    *is >> fDeltaProb >> fDriftTime >> fDriftSide;
 
-    *is >> fTracks[0] >> fTracks[1] >> fTracks[2] >> fXloc >> fZloc >> fQ;
-    *is >> fdEdX >> fSigmaY2 >> fSigmaZ2;
     return;
 }
 //----------------------------------------------------------------------