]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
o add first version of lookup table corrections
authorwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Jul 2013 00:07:38 +0000 (00:07 +0000)
committerwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Jul 2013 00:07:38 +0000 (00:07 +0000)
o small updates

12 files changed:
TPC/Base/AliTPCCorrection.cxx
TPC/Base/AliTPCCorrection.h
TPC/Base/AliTPCCorrectionLookupTable.cxx [new file with mode: 0644]
TPC/Base/AliTPCCorrectionLookupTable.h [new file with mode: 0644]
TPC/CMakelibTPCbase.pkg
TPC/Rec/AliTPCclusterMI.cxx
TPC/Rec/AliTPCclusterMI.h
TPC/TPCbaseLinkDef.h
TPC/Upgrade/AliToyMCEventGenerator.cxx
TPC/Upgrade/AliToyMCReconstruction.cxx
TPC/Upgrade/AliToyMCReconstruction.h
TPC/Upgrade/macros/testRec.C

index b5da6e37026944356e0997a98c18b7509afef5af..81829e2d8e07cb5beb5c93aa92444ccaf07f6cdb 100644 (file)
@@ -353,6 +353,44 @@ void AliTPCCorrection::GetCorrectionIntegralDz(const Float_t x[],const Short_t r
   
 }
 
+void AliTPCCorrection::GetDistortionIntegralDz(const Float_t x[],const Short_t roc,Float_t dx[], Float_t delta){
+  //
+  // Integrate 3D distortion along drift lines
+  // To define the drift lines virtual function  AliTPCCorrection::GetCorrectionDz is used
+  //
+  // Input parameters:
+  //   x[]   - space point corrdinate
+  //   roc   - readout chamber identifier (important e.g to do not miss the side of detector)
+  //   delta - define the size of neighberhood
+  // Output parameter:
+  //   dx[] - array { integral(dx'/dz),  integral(dy'/dz) ,  integral(dz'/dz) }
+  
+  Float_t zroc= ((roc%36)<18) ? fgkTPCZ0:-fgkTPCZ0;
+  Double_t zdrift = TMath::Abs(x[2]-zroc);
+  Int_t    nsteps = Int_t(zdrift/delta)+1;
+  //
+  //
+  Float_t xyz[3]={x[0],x[1],x[2]};
+  Float_t dxyz[3]={x[0],x[1],x[2]};
+  Float_t sign=((roc%36)<18) ? 1.:-1.;
+  Double_t sumdz=0;
+  for (Int_t i=0;i<nsteps; i++){
+    Float_t deltaZ=delta;
+    if (xyz[2]+deltaZ>fgkTPCZ0) deltaZ=TMath::Abs(xyz[2]-fgkTPCZ0);
+    if (xyz[2]-deltaZ<-fgkTPCZ0) deltaZ=TMath::Abs(xyz[2]-fgkTPCZ0);
+    deltaZ*=sign;
+    GetCorrectionDz(xyz,roc,dxyz,delta);
+    xyz[0]-=deltaZ*dxyz[0];
+    xyz[1]-=deltaZ*dxyz[1];
+    xyz[2]-=deltaZ;           //
+    sumdz-=deltaZ*dxyz[2];
+  }
+  //
+  dx[0]=x[0]-xyz[0];
+  dx[1]=x[1]-xyz[1];
+  dx[2]=    dxyz[2];
+  
+}
 
 
 void AliTPCCorrection::Init() {
index d1d55dd92f45b6ce3a47c647af488e28a09fc996..195c0b4b93657933c4822439322f2a8908955228 100644 (file)
@@ -40,13 +40,14 @@ public:
 
   virtual void GetCorrectionDz(const Float_t x[],const Short_t roc,Float_t dx[], Float_t delta);
   virtual void GetCorrectionIntegralDz(const Float_t x[],const Short_t roc,Float_t dx[], Float_t delta);
-
+  
   // functions to distort a space point
           void DistortPoint (      Float_t x[],const Short_t roc);
           void DistortPointLocal(Float_t x[],const Short_t roc);
           void DistortPoint (const Float_t x[],const Short_t roc,Float_t xp[]);
   virtual void GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]);
-
+  virtual void GetDistortionIntegralDz(const Float_t x[],const Short_t roc,Float_t dx[], Float_t delta);
+  
   // initialization and update functions
   virtual void Init();
   virtual void Update(const TTimeStamp &timeStamp);
diff --git a/TPC/Base/AliTPCCorrectionLookupTable.cxx b/TPC/Base/AliTPCCorrectionLookupTable.cxx
new file mode 100644 (file)
index 0000000..90a8f2c
--- /dev/null
@@ -0,0 +1,311 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include <TMath.h>
+#include <TMatrixF.h>
+
+#include <AliLog.h>
+#include <AliTPCROC.h>
+
+#include "AliTPCCorrection.h"
+
+#include "AliTPCCorrectionLookupTable.h"
+
+ClassImp(AliTPCCorrectionLookupTable)
+
+//_________________________________________________________________________________________
+AliTPCCorrectionLookupTable::AliTPCCorrectionLookupTable()
+: AliTPCCorrection()
+, fNR(90)
+, fNPhi(144)
+, fNZ(130)
+, fLimitsRows()
+, fLimitsPhiSlices()
+, fLimitsColumns()
+, fLookUpDxDist(0x0)
+, fLookUpDyDist(0x0)
+, fLookUpDzDist(0x0)
+, fLookUpDxCorr(0x0)
+, fLookUpDyCorr(0x0)
+, fLookUpDzCorr(0x0)
+{
+  //
+  //
+  //
+}
+//_________________________________________________________________________________________
+AliTPCCorrectionLookupTable::~AliTPCCorrectionLookupTable()
+{
+  //
+  // dtor
+  //
+
+  ResetTables();
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]) {
+  //
+  // Get interpolated Distortion
+  //
+
+  GetInterpolation(x,roc,dx,fLookUpDxDist,fLookUpDyDist,fLookUpDzDist,1);
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
+  //
+  // Get interplolated correction
+  //
+  GetInterpolation(x,roc,dx,fLookUpDxCorr,fLookUpDyCorr,fLookUpDzCorr,0);
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::GetInterpolation(const Float_t x[],const Short_t roc,Float_t dx[],
+                                                   TMatrixF **mDx, TMatrixF **mDy, TMatrixF **mDz,
+                                                   Int_t type)
+{
+  //
+  // Calculates the correction/distotring from a lookup table
+  // type: 0 = correction
+  //       1 = distortion
+  //
+
+//   Float_t typeSign=-1;
+//   if (type==1) typeSign=1;
+  
+  Int_t   order     = 1 ;    // FIXME: hardcoded? Linear interpolation = 1, Quadratic = 2
+  
+  Double_t r, phi, z ;
+  Int_t    sign;
+  
+  r      =  TMath::Sqrt( x[0]*x[0] + x[1]*x[1] ) ;
+  phi    =  TMath::ATan2(x[1],x[0]) ;
+  if ( phi < 0 ) phi += TMath::TwoPi() ;                   // Table uses phi from 0 to 2*Pi
+  z      =  x[2] ;                                         // Create temporary copy of x[2]
+  
+  if ( (roc%36) < 18 ) {
+    sign =  1;       // (TPC A side)
+  } else {
+    sign = -1;       // (TPC C side)
+  }
+  
+  if ( sign==1  && z <  fgkZOffSet ) z =  fgkZOffSet;    // Protect against discontinuity at CE
+  if ( sign==-1 && z > -fgkZOffSet ) z = -fgkZOffSet;    // Protect against discontinuity at CE
+
+
+  if ( (sign==1 && z<0) || (sign==-1 && z>0) ) // just a consistency check
+    AliError("ROC number does not correspond to z coordinate! Calculation of distortions is most likely wrong!");
+  
+  // Get the Er and Ephi field integrals plus the integral over Z
+    dx[0] = Interpolate3DTable(order, r, z, phi,
+                               fNR, fNZ, fNPhi,
+                               fLimitsRows.GetMatrixArray(),
+                               fLimitsColumns.GetMatrixArray(),
+                               fLimitsPhiSlices.GetMatrixArray(),
+                               mDx  );
+    dx[1] = Interpolate3DTable(order, r, z, phi,
+                               fNR, fNZ, fNPhi,
+                               fLimitsRows.GetMatrixArray(),
+                               fLimitsColumns.GetMatrixArray(),
+                               fLimitsPhiSlices.GetMatrixArray(),
+                               mDy);
+    dx[2] = Interpolate3DTable(order, r, z, phi,
+                               fNR, fNZ, fNPhi,
+                               fLimitsRows.GetMatrixArray(),
+                               fLimitsColumns.GetMatrixArray(),
+                               fLimitsPhiSlices.GetMatrixArray(),
+                               mDz   );
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::CreateLookupTable(AliTPCCorrection &tpcCorr, Int_t /*rows*//*=90*/, Int_t /*phiSlices*//*=144*/, Int_t /*columns*//*=130*/ )
+{
+  //
+  //
+  //
+
+  // create distortion lookup table
+
+  const Float_t delta=5.; // 5cm
+  Float_t x[3]={0.,0.,0.};
+  Float_t dx[3]={0.,0.,0.};
+  
+  for (Int_t iPhi=0; iPhi<fNPhi; ++iPhi){
+    Double_t phi=fLimitsPhiSlices(iPhi);
+    //
+    TMatrixF &mDxDist   = *fLookUpDxDist[iPhi];
+    TMatrixF &mDyDist   = *fLookUpDyDist[iPhi];
+    TMatrixF &mDzDist   = *fLookUpDzDist[iPhi];
+    //
+    TMatrixF &mDxCorr   = *fLookUpDxCorr[iPhi];
+    TMatrixF &mDyCorr   = *fLookUpDyCorr[iPhi];
+    TMatrixF &mDzCorr   = *fLookUpDzCorr[iPhi];
+    
+    for (Int_t ir=0; ir<fNR; ++ir){
+      Double_t r=fLimitsRows(ir);
+      x[0]=r * TMath::Cos(phi);
+      x[1]=r * TMath::Sin(phi);
+      
+      for (Int_t iz=0; iz<fNZ; ++iz){
+        Double_t z=fLimitsColumns(iz);
+        x[2]=z;
+        //TODO: change hardcoded value for r>133.?
+        Int_t roc=TMath::Nint(phi*TMath::RadToDeg()/20.)%18;
+        if (r>133.) roc+=36;
+        if (z<0)    roc+=18;
+
+        tpcCorr.GetDistortionIntegralDz(x,roc,dx,delta);
+        mDxDist(ir,iz)=dx[0];
+        mDyDist(ir,iz)=dx[1];
+        mDzDist(ir,iz)=dx[2];
+        
+        tpcCorr.GetCorrectionIntegralDz(x,roc,dx,delta);
+        mDxCorr(ir,iz)=dx[0];
+        mDyCorr(ir,iz)=dx[1];
+        mDzCorr(ir,iz)=dx[2];
+        
+      }
+    }
+  }
+
+  // create correction lookup table
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::InitTables()
+{
+  //
+  //
+  //
+  fLookUpDxCorr = new TMatrixF*[fNPhi];
+  fLookUpDyCorr = new TMatrixF*[fNPhi];
+  fLookUpDzCorr = new TMatrixF*[fNPhi];
+  
+  fLookUpDxDist = new TMatrixF*[fNPhi];
+  fLookUpDyDist = new TMatrixF*[fNPhi];
+  fLookUpDzDist = new TMatrixF*[fNPhi];
+
+  for (Int_t iPhi=0; iPhi<fNPhi; ++iPhi){
+    fLookUpDxCorr[iPhi] = new TMatrixF(fNR,fNZ);
+    fLookUpDyCorr[iPhi] = new TMatrixF(fNR,fNZ);
+    fLookUpDzCorr[iPhi] = new TMatrixF(fNR,fNZ);
+    
+    fLookUpDxDist[iPhi] = new TMatrixF(fNR,fNZ);
+    fLookUpDyDist[iPhi] = new TMatrixF(fNR,fNZ);
+    fLookUpDzDist[iPhi] = new TMatrixF(fNR,fNZ);
+  }
+
+  SetupDefaultLimits();
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::ResetTables()
+{
+  //
+  // Reset the lookup tables
+  //
+
+  if (!fLookUpDxCorr) return;
+  
+  for (Int_t iPhi=0; iPhi<fNPhi; ++iPhi){
+    delete fLookUpDxCorr[iPhi];
+    delete fLookUpDyCorr[iPhi];
+    delete fLookUpDzCorr[iPhi];
+
+    delete fLookUpDxDist[iPhi];
+    delete fLookUpDyDist[iPhi];
+    delete fLookUpDzDist[iPhi];
+  }
+
+  delete [] fLookUpDxCorr;
+  delete [] fLookUpDyCorr;
+  delete [] fLookUpDzCorr;
+  
+  delete [] fLookUpDxDist;
+  delete [] fLookUpDyDist;
+  delete [] fLookUpDzDist;
+  
+  fLookUpDxCorr   = 0x0;
+  fLookUpDyCorr = 0x0;
+  fLookUpDzCorr    = 0x0;
+  
+  fLookUpDxDist   = 0x0;
+  fLookUpDyDist = 0x0;
+  fLookUpDzDist    = 0x0;
+
+  fLimitsRows.ResizeTo(1);
+  fLimitsPhiSlices.ResizeTo(1);
+  fLimitsColumns.ResizeTo(1);
+}
+
+//_________________________________________________________________________________________
+void AliTPCCorrectionLookupTable::SetupDefaultLimits()
+{
+  //
+  // Set default limits for tables
+  //
+
+  fLimitsRows.ResizeTo(fNR);
+  fLimitsPhiSlices.ResizeTo(fNPhi);
+  fLimitsColumns.ResizeTo(fNZ);
+
+  Double_t *limRList   = fLimitsRows.GetMatrixArray();
+  Double_t *limPhiList = fLimitsPhiSlices.GetMatrixArray();
+  Double_t *limZList   = fLimitsColumns.GetMatrixArray();
+  
+  AliTPCROC * roc = AliTPCROC::Instance();
+  const Double_t rLow =  TMath::Floor(roc->GetPadRowRadii(0,0))-1; // first padRow plus some margin
+  
+  // fulcrums in R
+  limRList[0] = rLow;
+  for (Int_t i = 1; i<fNR; i++) {
+    limRList[i] = limRList[i-1] + 3.5;     // 3.5 cm spacing
+    if (limRList[i]<90 ||limRList[i]>245){
+      limRList[i] = limRList[i-1] + 0.5; // 0.5 cm spacing
+    } else if (limRList[i]<100 || limRList[i]>235){
+      limRList[i] = limRList[i-1] + 1.5;  // 1.5 cm spacing
+    } else if (limRList[i]<120 || limRList[i]>225){
+      limRList[i] = limRList[i-1] + 2.5;  // 2.5 cm spacing
+    }
+  }
+
+  // fulcrums in Z
+  limZList[0] = -249.5;
+  limZList[fNZ-1] = 249.5;
+  for (Int_t j = 1; j<fNZ/2; j++) {
+    limZList[j] = limZList[j-1];
+    if      (TMath::Abs(limZList[j])< 0.15){
+      limZList[j] = limZList[j-1] + 0.09; // 0.09 cm spacing
+    } else if(TMath::Abs(limZList[j])< 0.6){
+      limZList[j] = limZList[j-1] + 0.4; // 0.4 cm spacing
+    } else if      (TMath::Abs(limZList[j])< 2.5 || TMath::Abs(limZList[j])>248){
+      limZList[j] = limZList[j-1] + 0.5; // 0.5 cm spacing
+    } else if (TMath::Abs(limZList[j])<10 || TMath::Abs(limZList[j])>235){
+      limZList[j] = limZList[j-1] + 1.5;  // 1.5 cm spacing
+    } else if (TMath::Abs(limZList[j])<25 || TMath::Abs(limZList[j])>225){
+      limZList[j] = limZList[j-1] + 2.5;  // 2.5 cm spacing
+    } else{
+      limZList[j] = limZList[j-1] + 4;  // 4 cm spacing
+    }
+
+    limZList[fNZ-j-1] = -limZList[j];
+  }
+  
+  // fulcrums in phi
+  for (Int_t k = 0; k<fNPhi; k++)
+    limPhiList[k] = TMath::TwoPi()*k/(fNPhi-1);
+  
+}
diff --git a/TPC/Base/AliTPCCorrectionLookupTable.h b/TPC/Base/AliTPCCorrectionLookupTable.h
new file mode 100644 (file)
index 0000000..7d99930
--- /dev/null
@@ -0,0 +1,59 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////////////////////////////////
+// AliTPCCorrectionLookupTable class                                              //
+// Authors: Jens Wiechula                                            //
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliTPCCorrection.h"
+#include <TVectorD.h>
+#include <TMatrixFfwd.h>
+
+class AliTPCCorrectionLookupTable : public AliTPCCorrection {
+
+public:
+  AliTPCCorrectionLookupTable();
+  virtual ~AliTPCCorrectionLookupTable();
+
+  
+  virtual void GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]);
+  virtual void GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]);
+
+  void CreateLookupTable(AliTPCCorrection &tpcCorr, Int_t rows=90, Int_t phiSlices=144, Int_t columns=130 );
+
+
+// private:
+
+  // sizes of lookup tables
+  Int_t     fNR;                      // number of rows (r) used for lookup table
+  Int_t     fNPhi;                 // number of phi slices used for lookup table
+  Int_t     fNZ;                   // number of columns (z) used for lookup table
+  //
+  TVectorD  fLimitsRows;                 // bin limits in row direction
+  TVectorD  fLimitsPhiSlices;            // bin limits in phi direction
+  TVectorD  fLimitsColumns;              // bin limits in z direction
+  // for distortion
+  TMatrixF **fLookUpDxDist;        //[fNPhi] Array to store electric field integral (int Er/Ez)
+  TMatrixF **fLookUpDyDist;      //[fNPhi] Array to store electric field integral (int Er/Ez)
+  TMatrixF **fLookUpDzDist;         //[fNPhi] Array to store electric field integral (int Er/Ez)
+
+  // for correction
+  TMatrixF **fLookUpDxCorr;        //[fNPhi] Array to store electric field integral (int Er/Ez)
+  TMatrixF **fLookUpDyCorr;      //[fNPhi] Array to store electric field integral (int Er/Ez)
+  TMatrixF **fLookUpDzCorr;         //[fNPhi] Array to store electric field integral (int Er/Ez)
+
+  void InitTables();
+  void ResetTables();
+  void SetupDefaultLimits();
+
+  void GetInterpolation(const Float_t x[],const Short_t roc,Float_t dx[],
+                        TMatrixF **mR, TMatrixF **mPhi, TMatrixF **mZ,
+                        Int_t type);
+
+  AliTPCCorrectionLookupTable(const AliTPCCorrectionLookupTable &corr);
+  AliTPCCorrectionLookupTable& operator= (const AliTPCCorrectionLookupTable &corr);
+  ClassDef(AliTPCCorrectionLookupTable,1);  // TPC corrections dumped into a lookup table
+};
+
+
index aa3424d9ca69f39c82616b23a0c46b37acc3da82..c0684e0be9e1ae363b66b424b89a33841ceefb5c 100644 (file)
@@ -86,6 +86,7 @@ set ( SRCS
     Base/AliTPCROCVoltError3D.cxx 
     Base/AliTPCSpaceCharge.cxx 
     Base/AliTPCSpaceCharge3D.cxx 
+    Base/AliTPCCorrectionLookupTable.cxx
     Base/AliXRDPROOFtoolkit.cxx 
     Base/AliTPCExBEffective.cxx 
     Base/AliTPCExBEffectiveSector.cxx 
index 083d6cf658ec1b2a50d86554751e9e55620a0f78..9c0c709d1c57f32f2b5cca01afe9748731cc34db 100644 (file)
@@ -189,3 +189,17 @@ AliTrackPoint* AliTPCclusterMI::MakePoint() {
 
   return point;
 }
+
+void AliTPCclusterMI::MakePoint( AliTrackPoint &point ) {
+  //
+  // make AliTrackPoint out of AliTPCclusterMI
+  //
+  
+  Float_t xyz[3]={0.};
+  Float_t cov[6]={0.};
+  GetGlobalXYZ(xyz);
+  GetGlobalCov(cov);
+  // voluem ID to add later ....
+  point.SetXYZ(xyz);
+  point.SetCov(cov);
+}
index 273d4e9ad2b925d30f7cc3d6c7ca754850e0ee7a..65b609f57adc685002732f90f4d9c38eb9ae3cea 100644 (file)
@@ -13,8 +13,7 @@
 #include "AliCluster.h"
 #include "TMath.h"
 #include "AliTPCclusterInfo.h"
-
-class AliTrackPoint;
+#include <AliTrackPointArray.h>
 
 //_____________________________________________________________________________
 class AliTPCclusterMI : public AliCluster {
@@ -49,6 +48,7 @@ public:
   //
   AliTPCclusterMI*  MakeCluster(AliTrackPoint* point);
   AliTrackPoint*    MakePoint();
+  void MakePoint(AliTrackPoint &point);
 
 private:
   AliTPCclusterInfo * fInfo;  // pointer to the cluster debug info
index 6b23ff4c2cc3a5082c0b16a4239b0857beeed39d..5b2046a56b035f67db8784c28b94ca04693bee14 100644 (file)
                                                        //  + OROC qudarant (OROC has 4 separate pad planes) alignment 
 #pragma link C++ class AliTPCSpaceCharge+;             // Distortions due to space charge in the TPC - rotational symetric
 #pragma link C++ class AliTPCSpaceCharge3D+;           // Distortions due to space charge in the TPC - 3D calculation
-
+#pragma link C++ class AliTPCCorrectionLookupTable+;   // Lookup table created from distortions
 #pragma link C++ class AliTPCExBEffective+;            // Cover ExB effect of non-explained physical model - not used
                                                        // --- still used in CalibMacros --- move to attic if removed there
 #pragma link C++ class AliTPCExBEffectiveSector+;      // sectorwise above
index ca5306af1c1ba0536eeb120fee7f84e56344a9f0..5ca8dd250ceb05b575b48ac40c9564c6b5044086 100644 (file)
@@ -132,9 +132,9 @@ void AliToyMCEventGenerator::CreateSpacePoints(AliToyMCTrack &trackIn,
     track.GetXYZ(xyz);
     
     //!!! Why is this smeared
-    xyz[0]+=gRandom->Gaus(0,0.000005);
-    xyz[1]+=gRandom->Gaus(0,0.000005);
-    xyz[2]+=gRandom->Gaus(0,0.000005);
+//     xyz[0]+=gRandom->Gaus(0,0.000005);
+//     xyz[1]+=gRandom->Gaus(0,0.000005);
+//     xyz[2]+=gRandom->Gaus(0,0.000005);
     
     xyzf[0]=Float_t(xyz[0]);
     xyzf[1]=Float_t(xyz[1]);
@@ -286,29 +286,32 @@ void AliToyMCEventGenerator::ConvertTrackPointsToLocalClusters(AliTrackPointArra
       grXZ=(TGraph*)arrGraphsXZ.At(sec);
       if (!grXY) continue;
 
-      if(grXY->GetN()>1 && grXZ->GetN()>1) { //causes segmentation violation if N==1
-               splXY=new TSpline3("splXY",grXY);
-       splXZ=new TSpline3("splXZ",grXZ);
-      }
-      else {
+//       if(grXY->GetN()>1 && grXZ->GetN()>1) { //causes segmentation violation if N==1
+//             splXY=new TSpline3("splXY",grXY);
+//     splXZ=new TSpline3("splXZ",grXZ);
+//       }
+//       else {
        //TODO: make a cluster also in the sector w only one space point?
-       continue;
+//     continue;
        // Double_t tempX=0., tempY = 0., tempZ = 0.;
        
        // grXY->GetPoint(0,tempX,localY);
        // grXZ->GetPoint(0,tempX,localZ);
-      }
+//       }
 
     }
     secOld=sec;
 
     // check we are in an active area
-    if (splXY->FindX(localX)<1 || splXZ->FindX(localX)<1) continue;
+//     if (splXY->FindX(localX)<1 || splXZ->FindX(localX)<1) continue;
+    if ( localX<grXY->GetX()[0] || localX>grXY->GetX()[grXY->GetN()-1] || localX<grXZ->GetX()[0] || localX>grXZ->GetX()[grXZ->GetN()-1]) continue;
     
     //get interpolated value at the center for the pad row
     //  using splines
-    const Double_t localY=splXY->Eval(localX/*,0x0,"S"*/);
-    const Double_t localZ=splXZ->Eval(localX/*,0x0,"S"*/);
+//     const Double_t localY=splXY->Eval(localX/*,0x0,"S"*/);
+//     const Double_t localZ=splXZ->Eval(localX/*,0x0,"S"*/);
+    const Double_t localY=grXY->Eval(localX/*,0x0,"S"*/);
+    const Double_t localZ=grXZ->Eval(localX/*,0x0,"S"*/);
     Float_t xyz[3]={localX,localY,localZ};
 
     if (!SetupCluster(tempCl,xyz,sec,t0)) continue;
index 41192b6e8644d0976044cec0e110aa93a38added..d98b3b7a5e62c1cf408c42f176b333bb1ca597bc 100644 (file)
 
 #include "AliToyMCReconstruction.h"
 
+/*
+
+
+
+*/
 
 //____________________________________________________________________________________
 AliToyMCReconstruction::AliToyMCReconstruction() : TObject()
@@ -138,7 +143,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
       Float_t zLength=GetZLength(0);
 
       // crate time0 seed, steered by fCreateT0seed
-      printf("t0 seed\n");
+//       printf("t0 seed\n");
       fTime0=-1.;
       fCreateT0seed=kTRUE;
       dummy = GetSeedFromTrack(tr);
@@ -151,7 +156,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
         // set fCreateT0seed now to false to get the seed in z coordinates
         fTime0 = t0seed.GetZ()-zLength/vdrift;
         fCreateT0seed = kFALSE;
-        printf("seed (%.2g)\n",fTime0);
+//         printf("seed (%.2g)\n",fTime0);
         dummy  = GetSeedFromTrack(tr);
         if (dummy) {
           seed = *dummy;
@@ -159,7 +164,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
 
           // create fitted track
           if (fDoTrackFit){
-            printf("track\n");
+//             printf("track\n");
             dummy = GetFittedTrackFromSeed(tr, &seed);
             track = *dummy;
             delete dummy;
@@ -168,7 +173,7 @@ void AliToyMCReconstruction::RunReco(const char* file, Int_t nmaxEv)
           // propagate seed to 0
           const Double_t kMaxSnp = 0.85;
           const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
-//           AliTrackerBase::PropagateTrackTo(&seed,0,kMass,5,kTRUE,kMaxSnp,0,kFALSE,kFALSE);
+          AliTrackerBase::PropagateTrackTo(&seed,0,kMass,5,kTRUE,kMaxSnp,0,kFALSE,fUseMaterial);
           
         }
       }
@@ -627,7 +632,7 @@ AliExternalTrackParam* AliToyMCReconstruction::GetSeedFromTrack(const AliToyMCTr
     const Int_t sign=1-2*((sector/18)%2);
     
     if ( (fClusterType == 1) && (fCorrectionType != kNoCorrection) ) {
-      printf("correction type: %d\n",(Int_t)fCorrectionType);
+//       printf("correction type: %d\n",(Int_t)fCorrectionType);
 
       // the settings below are for the T0 seed
       // for known T0 the z position is already calculated in SetTrackPointFromCluster
@@ -660,7 +665,7 @@ AliExternalTrackParam* AliToyMCReconstruction::GetSeedFromTrack(const AliToyMCTr
     // if fTime0 < 0 we assume that we create a seed for the T0 estimate
     AliTrackerBase::PropagateTrackTo(seed,0,kMass,5,kTRUE,kMaxSnp,0,kFALSE,kFALSE);
     if (TMath::Abs(seed->GetX())>3) {
-      printf("Could not propagate track to 0, %.2f, %.2f, %.2f\n",seed->GetX(),seed->GetAlpha(),seed->Pt());
+//       printf("Could not propagate track to 0, %.2f, %.2f, %.2f\n",seed->GetX(),seed->GetAlpha(),seed->Pt());
     }
   }
   
@@ -704,7 +709,7 @@ void AliToyMCReconstruction::SetTrackPointFromCluster(const AliTPCclusterMI *cl,
     const Int_t sector=cl->GetDetector();
     const Int_t sign=1-2*((sector/18)%2);
     const Float_t zT0=( GetZLength(sector) - (cl->GetTimeBin()-fTime0)*GetVDrift() )*sign;
-    printf(" z:  %.2f  %.2f\n",xyz[2],zT0);
+//     printf(" z:  %.2f  %.2f\n",xyz[2],zT0);
     xyz[2]=zT0;
     p.SetXYZ(xyz);
   }
@@ -779,9 +784,7 @@ AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliT
     if (TMath::Abs(prot.GetX())<kRTPC0) continue;
     if (TMath::Abs(prot.GetX())>kRTPC1) continue;
     //
-    Bool_t res=kTRUE;
-    if (fUseMaterial) res=AliTrackerBase::PropagateTrackTo(track,prot.GetX(),kMass,5,kFALSE,kMaxSnp);
-    else res=AliTrackerBase::PropagateTrackTo(track,prot.GetX(),kMass,5,kFALSE,kMaxSnp,0,kFALSE,kFALSE);
+    Bool_t res=AliTrackerBase::PropagateTrackTo(track,prot.GetX(),kMass,5,kFALSE,kMaxSnp,0,kFALSE,fUseMaterial);
 
     if (!res) break;
     
@@ -800,14 +803,12 @@ AliExternalTrackParam* AliToyMCReconstruction::GetFittedTrackFromSeed(const AliT
     if (!track->Update(pointPos,pointCov)) {printf("no update\n"); break;}
   }
 
-  if (fUseMaterial) AliTrackerBase::PropagateTrackTo2(track,refX,kMass,5.,kTRUE,kMaxSnp);
-  else AliTrackerBase::PropagateTrackTo2(track,refX,kMass,5.,kTRUE,kMaxSnp,0,kFALSE,kFALSE);
+  AliTrackerBase::PropagateTrackTo2(track,refX,kMass,5.,kTRUE,kMaxSnp,0,kFALSE,fUseMaterial);
 
   // rotate fittet track to the frame of the original track and propagate to same reference
   track->Rotate(tr->GetAlpha());
   
-  if (fUseMaterial) AliTrackerBase::PropagateTrackTo2(track,refX,kMass,1.,kFALSE,kMaxSnp);
-  else AliTrackerBase::PropagateTrackTo2(track,refX,kMass,1.,kFALSE,kMaxSnp,0,kFALSE,kFALSE);
+  AliTrackerBase::PropagateTrackTo2(track,refX,kMass,1.,kFALSE,kMaxSnp,0,kFALSE,fUseMaterial);
   
   return track;
 }
@@ -963,6 +964,10 @@ TTree* AliToyMCReconstruction::ConnectTrees (const char* files) {
     TPRegexp reg(".*([0-9]_[0-9]_[0-9]_[0-9]{3}_[0-9]{2}).debug.root");
     TObjArray *arrMatch=0x0;
     arrMatch=reg.MatchS(name);
+    TString matchName;
+    if (arrMatch && arrMatch->At(1)) matchName=arrMatch->At(1)->GetName();
+    else matchName=Form("%02d",ifile);
+    delete arrMatch;
     
     if (!tFirst) {
       TFile *f=TFile::Open(name.Data());
@@ -973,10 +978,10 @@ TTree* AliToyMCReconstruction::ConnectTrees (const char* files) {
         continue;
       }
       
-      t->SetName(arrMatch->At(1)->GetName());
+      t->SetName(matchName.Data());
       tFirst=t;
     } else {
-      tFirst->AddFriend(Form("t%s=Tracks",arrMatch->At(1)->GetName()), name.Data());
+      tFirst->AddFriend(Form("t%s=Tracks",matchName.Data()), name.Data());
 //       tFirst->AddFriend(Form("t%d=Tracks",ifile), name.Data());
     }
   }
index 1c13e6a43f706cb3c171c10e591d11772d6c1f16..32dee9d183b78a494f39b523062f6f726806a010 100644 (file)
@@ -27,8 +27,8 @@ public:
   void RunRecoAllClustersStandardTracking(const char* file, Int_t nmaxEv=-1);
   
   // reconstruction settings
-  void      SetRecoSettings(Int_t clusterType, Int_t seedingRow, Int_t seedingDist, ECorrType correctionType)
-                           { fClusterType=clusterType; fSeedingRow=seedingRow, fSeedingDist=seedingDist, fCorrectionType=correctionType; }
+  void      SetRecoSettings(Bool_t idealTracking, Int_t clusterType, ECorrType correctionType, Int_t seedingRow=140, Int_t seedingDist=10)
+                           { fIdealTracking=idealTracking; fClusterType=clusterType; fSeedingRow=seedingRow, fSeedingDist=seedingDist, fCorrectionType=correctionType; }
   
   void      SetClusterType(Int_t type)  { fClusterType = type;    }
   Int_t     GetClusterType()  const     { return fClusterType;    }
index 8d5a5029b724aa3e6a18ed82188ae3d1de72deaa..fcd1635b58637a47daddd9209d7dbc198d35314c 100644 (file)
@@ -623,8 +623,15 @@ void testResolution(const char* filename, Int_t nmaxEv=-1, Bool_t useMaterial=kF
 }
 
 //____________________________________________________________________________
-void ConnectTrees (const char* files, TObjArray &arr) {
+void ConnectTrees (const char* files, TObjArray &arrTrees) {
   TString s=gSystem->GetFromPipe(Form("ls %s",files));
 
-  
+  TObjArray *arrFiles=s.Tokenize("\n");
+  for (Int_t ifile=0; ifile<arrFiles->GetEntriesFast(); ++ifile){
+    TFile f(arrFiles->At(ifile)->GetName());
+    if (!f.IsOpen() || f.IsZombie()) continue;
+    TTree *t=f.Get("Tracks");
+    if (!t) continue;
+    arrTrees.Add
+  }
 }