All the changes have been done in order to integrate in the standard
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Mar 2009 10:43:18 +0000 (10:43 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Mar 2009 10:43:18 +0000 (10:43 +0000)
reconstruction (AliReconstruction) the possibility to estimate the SPD
efficiency using the method of tracklets. By default, this estimation, as
well the others which use normal tracks, are switched off.

The AliITSTrackleterSPDEff now inherits from AliTracker.

Giuseppe

ITS/AliITSMultReconstructor.cxx
ITS/AliITSRecoParam.cxx
ITS/AliITSRecoParam.h
ITS/AliITSReconstructor.cxx
ITS/AliITSReconstructor.h
ITS/AliITSTrackleterSPDEff.cxx
ITS/AliITSTrackleterSPDEff.h
ITS/AliITStrackerMI.cxx
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h
STEER/AliReconstructor.h

index 398a25e..26dffa8 100644 (file)
@@ -71,6 +71,7 @@ ClassImp(AliITSMultReconstructor)
 
 //____________________________________________________________________
 AliITSMultReconstructor::AliITSMultReconstructor():
+TObject(),
 fClustersLay1(0),
 fClustersLay2(0),
 fDetectorIndexClustersLay1(0),
index a6edb7b..08000d0 100644 (file)
@@ -113,6 +113,13 @@ fAllowSharedClusters(kTRUE),
 fClusterErrorsParam(1),
 fComputePlaneEff(kFALSE),
 fHistoPlaneEff(kFALSE),
+fUseTrackletsPlaneEff(kFALSE),
+fMCTrackletsPlaneEff(kFALSE),
+fBkgTrackletsPlaneEff(kFALSE),
+fTrackleterPhiWindowL1(0.10),
+fTrackleterZetaWindowL1(0.6),
+fUpdateOncePerEventPlaneEff(kTRUE),
+fMinContVtxPlaneEff(3),
 fIPlanePlaneEff(0),
 fReadPlaneEffFromOCDB(kFALSE),
 fMinPtPlaneEff(0),
@@ -486,42 +493,60 @@ AliITSRecoParam *AliITSRecoParam::GetCosmicTestParam()
 AliITSRecoParam *AliITSRecoParam::GetPlaneEffParam(Int_t i)
 {
   //
-  // make special reconstruction parameters for Plane Efficiency study on layer i
+  // make special reconstruction parameters for Plane Efficiency study on layer i (0,5)
+  // 
+  // if i=-1, then the evaluation for both pixel layers is tried with the tracklet method
   //
-  if (i<0 || i>=AliITSgeomTGeo::kNLayers) {
-    printf("AliITSRecoParam::GetPlaneEffParam: index of ITS Plane not in the range [0,5]\n");
+ if (i<-1 || i>=AliITSgeomTGeo::kNLayers) {
+    printf("AliITSRecoParam::GetPlaneEffParam: index of ITS Plane nor in the range [0,5] neither =-1\n");
     printf("returning null pointer");
     return NULL;
   }
-  AliITSRecoParam *param;
-  param = GetHighFluxParam();
-  param->SetComputePlaneEff();
-  param->SetLayerToSkip(i);
-  param->SetIPlanePlaneEff(i);
-  // optimized setting for SPD0 (i==0)
-  if (i==0 || i==1) {
-    param->fMinPtPlaneEff = 0.200; // high pt particles
-    param->fMaxMissingClustersPlaneEff = 1; // at most 1 layer out of 5 without cluster
-    param->fRequireClusterInOuterLayerPlaneEff = kTRUE; // cluster on SPD1 must be
-    //param->fOnlyConstraintPlaneEff = kTRUE;
-  }
-  if (i==2 || i==3) {
-    param->fMinPtPlaneEff = 0.200; // high pt particles
-    param->fMaxMissingClustersPlaneEff = 1; // at most 1 layer out of 5 without cluster
-    param->fRequireClusterInOuterLayerPlaneEff = kTRUE;
-    //param->fOnlyConstraintPlaneEff = kTRUE;
-  }
-  if (i==4) {
-    param->fMinPtPlaneEff = 0.200; // high pt particles
-    param->fMaxMissingClustersPlaneEff = 0; // at most 1 layer out of 5 without cluster
-    param->fRequireClusterInOuterLayerPlaneEff = kTRUE;
-    //param->fOnlyConstraintPlaneEff = kTRUE;
+  if(i>=0) {  // Method using tracks (remove given plane from tracking)
+    AliITSRecoParam *param;
+    param = GetHighFluxParam();
+    param->SetComputePlaneEff();
+    param->SetLayerToSkip(i);
+    param->SetIPlanePlaneEff(i);
+    // optimized setting for SPD0 (i==0)
+    if (i==0 || i==1) {
+      param->fMinPtPlaneEff = 0.200; // high pt particles
+      param->fMaxMissingClustersPlaneEff = 1; // at most 1 layer out of 5 without cluster
+      param->fRequireClusterInOuterLayerPlaneEff = kTRUE; // cluster on SPD1 must be
+      //param->fOnlyConstraintPlaneEff = kTRUE;
+    }
+    if (i==2 || i==3) {
+      param->fMinPtPlaneEff = 0.200; // high pt particles
+      param->fMaxMissingClustersPlaneEff = 1; // at most 1 layer out of 5 without cluster
+      param->fRequireClusterInOuterLayerPlaneEff = kTRUE;
+      //param->fOnlyConstraintPlaneEff = kTRUE;
+    }
+    if (i==4) {
+      param->fMinPtPlaneEff = 0.200; // high pt particles
+      param->fMaxMissingClustersPlaneEff = 0; // at most 1 layer out of 5 without cluster
+      param->fRequireClusterInOuterLayerPlaneEff = kTRUE;
+      //param->fOnlyConstraintPlaneEff = kTRUE;
+    }
+    if (i==5) {
+      param->fMinPtPlaneEff = 0.200; // high pt particles
+    }
+    //
+    return param;
   }
-  if (i==5) {
-    param->fMinPtPlaneEff = 0.200; // high pt particles
+  else if (i==-1) { // Method using tracklets
+    AliITSRecoParam *param;
+    param = GetLowFluxParam();
+    param->SetIPlanePlaneEff(i);
+    param->SetComputePlaneEff(kTRUE,kFALSE);
+    param->SetUseTrackletsPlaneEff(kTRUE);
+    param->SetTrackleterPhiWindow(0.07);
+    param->SetTrackleterZetaWindow(0.4);
+    param->SetTrackleterPhiWindowL1(0.10);
+    param->SetTrackleterZetaWindowL1(0.6);
+    param->SetUpdateOncePerEventPlaneEff(kTRUE);
+    param->SetMinContVtxPlaneEff(3);
+    return param;
   }
-  //
-  return param;
 }
 //_____________________________________________________________________________
 void AliITSRecoParam::SetLayersParameters() 
index 99648a7..ad3ef8f 100644 (file)
@@ -198,6 +198,20 @@ class AliITSRecoParam : public AliDetectorRecoParam
       { fComputePlaneEff=eff; fHistoPlaneEff=his; return; }
   Bool_t GetComputePlaneEff() const { return fComputePlaneEff; }
   Bool_t GetHistoPlaneEff() const { return fHistoPlaneEff; }
+  void    SetUseTrackletsPlaneEff(Bool_t use=kTRUE) {fUseTrackletsPlaneEff=use; return;}
+  Bool_t  GetUseTrackletsPlaneEff() const {return fUseTrackletsPlaneEff;}
+  void    SetOptTrackletsPlaneEff(Bool_t mc=kFALSE,Bool_t bkg=kFALSE)
+           {fMCTrackletsPlaneEff=mc;fBkgTrackletsPlaneEff=bkg; return;}
+  Bool_t  GetMCTrackletsPlaneEff() const {return fMCTrackletsPlaneEff;}
+  Bool_t  GetBkgTrackletsPlaneEff() const {return fBkgTrackletsPlaneEff;}
+  void    SetTrackleterPhiWindowL1(Float_t w=0.10) {fTrackleterPhiWindowL1=w; return;}
+  Float_t GetTrackleterPhiWindowL1() const {return fTrackleterPhiWindowL1;}
+  void    SetTrackleterZetaWindowL1(Float_t w=0.6) {fTrackleterZetaWindowL1=w; return;}
+  Float_t GetTrackleterZetaWindowL1() const {return fTrackleterZetaWindowL1;}
+  void    SetUpdateOncePerEventPlaneEff(Bool_t use=kTRUE) {fUpdateOncePerEventPlaneEff=use; return;}
+  Bool_t  GetUpdateOncePerEventPlaneEff() const {return fUpdateOncePerEventPlaneEff;}
+  void    SetMinContVtxPlaneEff(Int_t n=3) {fMinContVtxPlaneEff=n; return;}
+  Int_t   GetMinContVtxPlaneEff() const {return fMinContVtxPlaneEff;}
   void   SetIPlanePlaneEff(Int_t i=0) {if(i<0 || i>=AliITSgeomTGeo::kNLayers) return; fIPlanePlaneEff=i; }
   Int_t  GetIPlanePlaneEff() const {return fIPlanePlaneEff;}
   void   SetReadPlaneEffFrom0CDB(Bool_t read=kTRUE) { fReadPlaneEffFromOCDB=read; }
@@ -236,7 +250,6 @@ class AliITSRecoParam : public AliDetectorRecoParam
   Int_t  GetInnerStartLayerSA() const { return fInnerStartLayerSA; }
   void   SetMinNPointsSA(Int_t np) { fMinNPointsSA=np; return; }
   Int_t  GetMinNPointsSA() const { return fMinNPointsSA;}
-
   void   SetFactorSAWindowSizes(Double_t fact=1.) { fFactorSAWindowSizes=fact; return; }
   Double_t GetFactorSAWindowSizes() const { return fFactorSAWindowSizes; }
 
@@ -436,6 +449,13 @@ class AliITSRecoParam : public AliDetectorRecoParam
   // Plane Efficiency evaluation
   Bool_t fComputePlaneEff;  // flag to enable computation of PlaneEfficiency
   Bool_t fHistoPlaneEff;  // flag to enable auxiliary PlaneEff histograms (e.g. residual distributions)
+  Bool_t fUseTrackletsPlaneEff; // flag to enable estimate of SPD PlaneEfficiency using tracklets
+  Bool_t fMCTrackletsPlaneEff; // flag to enable the use of MC info for corrections (SPD PlaneEff using tracklets)
+  Bool_t fBkgTrackletsPlaneEff; // flag to evaluate background instead of normal use (SPD PlaneEff using tracklets)
+  Float_t fTrackleterPhiWindowL1; // Search window in phi for inner layer (1) (SPD PlaneEff using tracklets)
+  Float_t fTrackleterZetaWindowL1; // Search window in zeta for inner layer (1) (SPD PlaneEff using tracklets)
+  Bool_t fUpdateOncePerEventPlaneEff; // option to update chip efficiency once/event (to avoid doubles)
+  Int_t  fMinContVtxPlaneEff; // min number of contributors to ESD vtx for SPD PlaneEff using tracklets
   Int_t  fIPlanePlaneEff; // index of the plane (in the range [0,5])  to study the efficiency
   Bool_t fReadPlaneEffFromOCDB; // enable initial reading of Plane Eff statistics from OCDB
                                // The analized events would be used to increase the statistics
@@ -487,7 +507,7 @@ class AliITSRecoParam : public AliDetectorRecoParam
   Bool_t fUseCosmicRunShiftsSSD; // SSD time shifts for cosmic run 2007/2008 (use for data taken up to 18 sept 2008)
 
 
-  ClassDef(AliITSRecoParam,17) // ITS reco parameters
+  ClassDef(AliITSRecoParam,18) // ITS reco parameters
 };
 
 #endif
index a669825..a2ef77d 100644 (file)
@@ -42,6 +42,7 @@
 #include "AliITSpidESD1.h"
 #include "AliITSpidESD2.h"
 #include "AliITSInitGeometry.h"
+#include "AliITSTrackleterSPDEff.h"
 
 
 ClassImp(AliITSReconstructor)
@@ -119,6 +120,27 @@ void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTr
   fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
   fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
 }
+//_____________________________________________________________________________
+AliTracker* AliITSReconstructor::CreateTrackleter() const
+{
+// create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
+  if(!GetRecoParam()->GetComputePlaneEff() && !GetRecoParam()->GetUseTrackletsPlaneEff()) return NULL;
+  //Int_t trackerOpt = GetRecoParam()->GetTracker();
+  AliTracker* trackleter;
+  trackleter = new AliITSTrackleterSPDEff();
+  AliITSTrackleterSPDEff *spdtrackleter=(AliITSTrackleterSPDEff*)trackleter;
+  // here set cuts (from RecoParam)
+  if(GetRecoParam()->GetBkgTrackletsPlaneEff()) spdtrackleter->SetReflectClusterAroundZAxisForLayer(1,kTRUE);
+  if(GetRecoParam()->GetMCTrackletsPlaneEff()) spdtrackleter->SetMC();
+  spdtrackleter->SetHistOn();
+  spdtrackleter->SetPhiWindow(GetRecoParam()->GetTrackleterPhiWindow());
+  spdtrackleter->SetZetaWindow(GetRecoParam()->GetTrackleterZetaWindow());
+  spdtrackleter->SetPhiWindowL1(GetRecoParam()->GetTrackleterPhiWindowL1());
+  spdtrackleter->SetZetaWindowL1(GetRecoParam()->GetTrackleterZetaWindowL1());
+  if(GetRecoParam()->GetUpdateOncePerEventPlaneEff()) spdtrackleter->SetUpdateOncePerEventPlaneEff();
+  //spdtrackleter->(GetRecoParam()->GetMinContVtxPlaneEff()); // to be implemented
+  return trackleter;
+}
 
 //_____________________________________________________________________________
 AliTracker* AliITSReconstructor::CreateTracker() const
@@ -141,13 +163,13 @@ AliTracker* AliITSReconstructor::CreateTracker() const
     sat->SetDetTypeRec(fDetTypeRec);
     if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
-    if(GetRecoParam()->GetInwardFindingSA()){
-      sat->SetInwardFinding();
-      sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
-    }else{
+       if(GetRecoParam()->GetInwardFindingSA()){
+       sat->SetInwardFinding();
+       sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
+       }else{
       sat->SetOutwardFinding();
       sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
-    }
+       }
     sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
   }
 
index 8867481..541c6b2 100644 (file)
@@ -32,6 +32,7 @@ public:
 
   virtual AliTracker*  CreateTracker() const;
   virtual AliVertexer* CreateVertexer() const;
+  virtual AliTracker*  CreateTrackleter() const;
 
   virtual void         FillESD(TTree* /*digitsTree*/, TTree* clustersTree, 
                               AliESDEvent* esd) const; 
index 2d4729e..38e9f99 100644 (file)
 #include <Riostream.h>
 #include <TClonesArray.h>
 
-#include "AliITSMultReconstructor.h"
+#include "AliTracker.h"
 #include "AliITSTrackleterSPDEff.h"
 #include "AliITSgeomTGeo.h"
 #include "AliLog.h"
 #include "AliITSPlaneEffSPD.h"
 #include "AliStack.h"
 #include "AliTrackReference.h"
-
+#include "AliRunLoader.h"
+#include "AliITSReconstructor.h"
+#include "AliITSRecPoint.h"
 //____________________________________________________________________
 ClassImp(AliITSTrackleterSPDEff)
 
 
 //____________________________________________________________________
 AliITSTrackleterSPDEff::AliITSTrackleterSPDEff():
-AliITSMultReconstructor(),
+AliTracker(),
+//
+fClustersLay1(0),
+fClustersLay2(0),
+fTracklets(0),
+fAssociationFlag(0),
+fNClustersLay1(0),
+fNClustersLay2(0),
+fNTracklets(0),
+fOnlyOneTrackletPerC2(0),
+fPhiWindow(0),
+fZetaWindow(0),
+fPhiOverlapCut(0),
+fZetaOverlapCut(0),
+fHistOn(0),
+fhClustersDPhiAcc(0),
+fhClustersDThetaAcc(0),
+fhClustersDZetaAcc(0),
+fhClustersDPhiAll(0),
+fhClustersDThetaAll(0),
+fhClustersDZetaAll(0),
+fhDPhiVsDThetaAll(0),
+fhDPhiVsDThetaAcc(0),
+fhDPhiVsDZetaAll(0),
+fhDPhiVsDZetaAcc(0),
+fhetaTracklets(0),
+fhphiTracklets(0),
+fhetaClustersLay1(0),
+fhphiClustersLay1(0),
+//
 fAssociationFlag1(0),
 fChipPredOnLay2(0),
 fChipPredOnLay1(0),
@@ -64,7 +95,7 @@ fPlaneEffSPD(0),
 fReflectClusterAroundZAxisForLayer0(kFALSE),
 fReflectClusterAroundZAxisForLayer1(kFALSE),
 fMC(0),
-fUseOnlyPrimaryForPred(0),
+fUseOnlyPrimaryForPred(1),
 fUseOnlySecondaryForPred(0), 
 fUseOnlySameParticle(0),
 fUseOnlyDifferentParticle(0),
@@ -95,7 +126,15 @@ fhetaClustersLay2(0),
 fhphiClustersLay2(0)
 {
    // default constructor
-
+// from AliITSMultReconstructor
+  SetPhiWindow();
+  SetZetaWindow();
+  SetOnlyOneTrackletPerC2();
+  fClustersLay1       = new Float_t*[300000];
+  fClustersLay2       = new Float_t*[300000];
+  fTracklets          = new Float_t*[300000];
+  fAssociationFlag    = new Bool_t[300000];
+//
   SetPhiWindowL1();
   SetZetaWindowL1();
   SetOnlyOneTrackletPerC1();
@@ -106,6 +145,12 @@ fhphiClustersLay2(0)
   fChipUpdatedInEvent = new Bool_t[1200];
 
   for(Int_t i=0; i<300000; i++) {
+    // from AliITSMultReconstructor
+    fClustersLay1[i]       = new Float_t[6];
+    fClustersLay2[i]       = new Float_t[6];
+    fTracklets[i]          = new Float_t[5];
+    fAssociationFlag[i]    = kFALSE;
+    //
     fAssociationFlag1[i]   = kFALSE;
   }
   for(Int_t i=0;i<1200; i++) fChipUpdatedInEvent[i] = kFALSE;
@@ -115,7 +160,37 @@ fhphiClustersLay2(0)
   fPlaneEffSPD = new AliITSPlaneEffSPD();
 }
 //______________________________________________________________________
-AliITSTrackleterSPDEff::AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff &mr) : AliITSMultReconstructor(mr),
+AliITSTrackleterSPDEff::AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff &mr) :  
+AliTracker(mr),
+// from AliITSMultReconstructor
+fClustersLay1(mr.fClustersLay1),
+fClustersLay2(mr.fClustersLay2),
+fTracklets(mr.fTracklets),
+fAssociationFlag(mr.fAssociationFlag),
+fNClustersLay1(mr.fNClustersLay1),
+fNClustersLay2(mr.fNClustersLay2),
+fNTracklets(mr.fNTracklets),
+fOnlyOneTrackletPerC2(mr.fOnlyOneTrackletPerC2),
+fPhiWindow(mr.fPhiWindow),
+fZetaWindow(mr.fZetaWindow),
+fPhiOverlapCut(mr.fPhiOverlapCut),
+fZetaOverlapCut(mr.fZetaOverlapCut),
+fHistOn(mr.fHistOn),
+fhClustersDPhiAcc(mr.fhClustersDPhiAcc),
+fhClustersDThetaAcc(mr.fhClustersDThetaAcc),
+fhClustersDZetaAcc(mr.fhClustersDZetaAcc),
+fhClustersDPhiAll(mr.fhClustersDPhiAll),
+fhClustersDThetaAll(mr.fhClustersDThetaAll),
+fhClustersDZetaAll(mr.fhClustersDZetaAll),
+fhDPhiVsDThetaAll(mr.fhDPhiVsDThetaAll),
+fhDPhiVsDThetaAcc(mr.fhDPhiVsDThetaAcc),
+fhDPhiVsDZetaAll(mr.fhDPhiVsDZetaAll),
+fhDPhiVsDZetaAcc(mr.fhDPhiVsDZetaAcc),
+fhetaTracklets(mr.fhetaTracklets),
+fhphiTracklets(mr.fhphiTracklets),
+fhetaClustersLay1(mr.fhetaClustersLay1),
+fhphiClustersLay1(mr.fhphiClustersLay1),
+//
 fAssociationFlag1(mr.fAssociationFlag1),
 fChipPredOnLay2(mr.fChipPredOnLay2),
 fChipPredOnLay1(mr.fChipPredOnLay1),
@@ -172,7 +247,18 @@ AliITSTrackleterSPDEff& AliITSTrackleterSPDEff::operator=(const AliITSTrackleter
 //______________________________________________________________________
 AliITSTrackleterSPDEff::~AliITSTrackleterSPDEff(){
   // Destructor
-
+// from AliITSMultReconstructor
+ // delete arrays
+  for(Int_t i=0; i<300000; i++) {
+    delete [] fClustersLay1[i];
+    delete [] fClustersLay2[i];
+    delete [] fTracklets[i];
+  }
+  delete [] fClustersLay1;
+  delete [] fClustersLay2;
+  delete [] fTracklets;
+  delete [] fAssociationFlag;
+//
   // delete histograms
   DeleteHistos();
 
@@ -201,23 +287,25 @@ AliITSTrackleterSPDEff::~AliITSTrackleterSPDEff(){
 }
 //____________________________________________________________________
 void
-AliITSTrackleterSPDEff::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*, AliStack *pStack, TTree *tRef) {
+//AliITSTrackleterSPDEff::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*, AliStack *pStack, TTree *tRef) {
+AliITSTrackleterSPDEff::Reconstruct(AliStack *pStack, TTree *tRef) {
   //
-  // - calls LoadClusterArray that finds the position of the clusters
-  //   (in global coord) 
-  // - convert the cluster coordinates to theta, phi (seen from the
-  //   interaction vertex). Find the extrapolation/interpolation point.
+  // - you have to take care of the following, before of using Reconstruct
+  //   1) call LoadClusters(TTree* cl) that finds the position of the clusters (in global coord)
+  //   and  convert the cluster coordinates to theta, phi (seen from the
+  //   interaction vertex). 
+  //   2) call SetVertex(vtxPos, vtxErr) which set the position of the vertex
+  // - Find the extrapolation/interpolation point.
   // - Find the chip corresponding to that
   // - Check if there is a cluster near that point  
   //
-
   // reset counters
-  fNClustersLay1 = 0;
-  fNClustersLay2 = 0;
   fNTracklets = 0; 
-  fNSingleCluster = 0; 
-  // loading the clusters 
-  LoadClusterArrays(clusterTree);
+  // retrieve the vertex position
+  Float_t vtx[3];
+  vtx[0]=(Float_t)GetX();
+  vtx[1]=(Float_t)GetY();
+  vtx[2]=(Float_t)GetZ();
   // to study residual background (i.e. contribution from TT' to measured efficiency) 
   if(fReflectClusterAroundZAxisForLayer0) ReflectClusterAroundZAxisForLayer(0);
   if(fReflectClusterAroundZAxisForLayer1) ReflectClusterAroundZAxisForLayer(1);
@@ -908,7 +996,7 @@ Bool_t AliITSTrackleterSPDEff::PrimaryTrackChecker(Int_t ipart,AliStack* stack)
 //  AliStack::IsPhysicalPrimary() (note that there also Sigma0 are considered as 
 //  a stable particle: it has no effect on this analysis). 
 //  This method can be called only for MC events, where Kinematics is available.
-//  if fUseOnlyStableParticle is kTRUE (via SetseOnlyStableParticle) then it 
+//  if fUseOnlyStableParticle is kTRUE (via SetUseOnlyStableParticle) then it 
 //  returns kTRUE if also AliITSTrackleterSPDEff::DecayingTrackChecker() return 0.
 //  The latter (see below) try to verify if a primary particle is also "detectable".
 //
@@ -1340,7 +1428,7 @@ istream &operator>>(istream &is,AliITSTrackleterSPDEff &s){
 //______________________________________________________________________
 void AliITSTrackleterSPDEff::SavePredictionMC(TString filename) const {
 //
-// This Method write into an asci file (do not know why binary does not work)
+// This Method write into an either asci or root file 
 // the used cuts and the statistics  of the MC related quantities
 // The method SetMC() has to be called before 
 // Input TString filename: name of file for output (it deletes already existing 
@@ -1507,7 +1595,23 @@ Bool_t AliITSTrackleterSPDEff::SaveHists() {
 
   if (!GetHistOn()) return kFALSE;
 
-  AliITSMultReconstructor::SaveHists(); // this save the histograms of the base class
+//  AliITSMultReconstructor::SaveHists(); // this save the histograms of the base class
+  fhClustersDPhiAll->Write();
+  fhClustersDThetaAll->Write();
+  fhClustersDZetaAll->Write();
+  fhDPhiVsDThetaAll->Write();
+  fhDPhiVsDZetaAll->Write();
+
+  fhClustersDPhiAcc->Write();
+  fhClustersDThetaAcc->Write();
+  fhClustersDZetaAcc->Write();
+  fhDPhiVsDThetaAcc->Write();
+  fhDPhiVsDZetaAcc->Write();
+
+  fhetaTracklets->Write();
+  fhphiTracklets->Write();
+  fhetaClustersLay1->Write();
+  fhphiClustersLay1->Write();
 
   fhClustersDPhiInterpAll->Write();
   fhClustersDThetaInterpAll->Write();
@@ -1532,7 +1636,7 @@ Bool_t AliITSTrackleterSPDEff::WriteHistosToFile(TString filename, Option_t* opt
   // Also the histograms from the base class are saved 
   //
   if (!GetHistOn()) return kFALSE;
-  if (filename.IsNull() || filename.IsWhitespace()) {
+  if (filename.Data()=="") {
      AliWarning("WriteHistosToFile: null output filename!");
      return kFALSE;
   }
@@ -1552,6 +1656,40 @@ void AliITSTrackleterSPDEff::BookHistos() {
 // layers are computed in the interpolation phase
 //
   if (! GetHistOn()) { AliInfo("Call SetHistOn(kTRUE) first"); return;}
+//
+  fhClustersDPhiAcc   = new TH1F("dphiacc",  "dphi",  100,0.,0.1);
+  fhClustersDPhiAcc->SetDirectory(0);
+  fhClustersDThetaAcc = new TH1F("dthetaacc","dtheta",100,-0.1,0.1);
+  fhClustersDThetaAcc->SetDirectory(0);
+  fhClustersDZetaAcc = new TH1F("dzetaacc","dzeta",100,-1.,1.);
+  fhClustersDZetaAcc->SetDirectory(0);
+
+  fhDPhiVsDZetaAcc = new TH2F("dphiVsDzetaacc","",100,-1.,1.,100,0.,0.1);
+  fhDPhiVsDZetaAcc->SetDirectory(0);
+  fhDPhiVsDThetaAcc = new TH2F("dphiVsDthetaAcc","",100,-0.1,0.1,100,0.,0.1);
+  fhDPhiVsDThetaAcc->SetDirectory(0);
+
+  fhClustersDPhiAll   = new TH1F("dphiall",  "dphi",  100,0.0,0.5);
+  fhClustersDPhiAll->SetDirectory(0);
+  fhClustersDThetaAll = new TH1F("dthetaall","dtheta",100,-0.5,0.5);
+  fhClustersDThetaAll->SetDirectory(0);
+  fhClustersDZetaAll = new TH1F("dzetaall","dzeta",100,-5.,5.);
+  fhClustersDZetaAll->SetDirectory(0);
+
+  fhDPhiVsDZetaAll = new TH2F("dphiVsDzetaall","",100,-5.,5.,100,0.,0.5);
+  fhDPhiVsDZetaAll->SetDirectory(0);
+  fhDPhiVsDThetaAll = new TH2F("dphiVsDthetaAll","",100,-0.5,0.5,100,0.,0.5);
+  fhDPhiVsDThetaAll->SetDirectory(0);
+
+  fhetaTracklets  = new TH1F("etaTracklets",  "eta",  100,-2.,2.);
+  fhetaTracklets->SetDirectory(0);
+  fhphiTracklets  = new TH1F("phiTracklets",  "phi",  100, 0., 2*TMath::Pi());
+  fhphiTracklets->SetDirectory(0);
+  fhetaClustersLay1  = new TH1F("etaClustersLay1",  "etaCl1",  100,-2.,2.);
+  fhetaClustersLay1->SetDirectory(0);
+  fhphiClustersLay1  = new TH1F("phiClustersLay1", "phiCl1", 100, 0., 2*TMath::Pi());
+  fhphiClustersLay1->SetDirectory(0);
+//
   fhClustersDPhiInterpAcc   = new TH1F("dphiaccInterp",  "dphi Interpolation phase",  100,0.,0.1);
   fhClustersDPhiInterpAcc->SetDirectory(0);
   fhClustersDThetaInterpAcc = new TH1F("dthetaaccInterp","dtheta Interpolation phase",100,-0.1,0.1);
@@ -1588,6 +1726,22 @@ void AliITSTrackleterSPDEff::DeleteHistos() {
 // Private method to delete Histograms from memory 
 // it is called. e.g., by the destructor.
 //
+// form AliITSMultReconstructor
+  if(fhClustersDPhiAcc) {delete fhClustersDPhiAcc; fhClustersDPhiAcc=0;}
+  if(fhClustersDThetaAcc) {delete fhClustersDThetaAcc; fhClustersDThetaAcc=0;}
+  if(fhClustersDZetaAcc) {delete fhClustersDZetaAcc; fhClustersDZetaAcc=0;}
+  if(fhClustersDPhiAll) {delete fhClustersDPhiAll; fhClustersDPhiAll=0;}
+  if(fhClustersDThetaAll) {delete fhClustersDThetaAll; fhClustersDThetaAll=0;}
+  if(fhClustersDZetaAll) {delete fhClustersDZetaAll; fhClustersDZetaAll=0;}
+  if(fhDPhiVsDThetaAll) {delete fhDPhiVsDThetaAll; fhDPhiVsDThetaAll=0;}
+  if(fhDPhiVsDThetaAcc) {delete fhDPhiVsDThetaAcc; fhDPhiVsDThetaAcc=0;}
+  if(fhDPhiVsDZetaAll) {delete fhDPhiVsDZetaAll; fhDPhiVsDZetaAll=0;}
+  if(fhDPhiVsDZetaAcc) {delete fhDPhiVsDZetaAcc; fhDPhiVsDZetaAcc=0;}
+  if(fhetaTracklets) {delete fhetaTracklets; fhetaTracklets=0;}
+  if(fhphiTracklets) {delete fhphiTracklets; fhphiTracklets=0;}
+  if(fhetaClustersLay1) {delete fhetaClustersLay1; fhetaClustersLay1=0;}
+  if(fhphiClustersLay1) {delete fhphiClustersLay1; fhphiClustersLay1=0;}
+//
     if(fhClustersDPhiInterpAcc) {delete fhClustersDPhiInterpAcc; fhClustersDPhiInterpAcc=0;}
     if(fhClustersDThetaInterpAcc) {delete fhClustersDThetaInterpAcc; fhClustersDThetaInterpAcc=0;}
     if(fhClustersDZetaInterpAcc) {delete fhClustersDZetaInterpAcc; fhClustersDZetaInterpAcc=0;}
@@ -1720,3 +1874,115 @@ if(ilayer==1) {
 }
 return;
 }
+//____________________________________________________________________________
+Int_t AliITSTrackleterSPDEff::Clusters2Tracks(AliESDEvent *){
+// This method is used to find the tracklets. 
+// It is called from AliReconstruction
+// The vertex is supposed to be associated to the Tracker (i.e. to this) already
+// The cluster is supposed to be associated to the Tracker already
+// In case Monte Carlo is required, the appropriate linking to Stack and TrackRef is attempted 
+//
+  Int_t rc=1;
+  AliRunLoader* runLoader = AliRunLoader::Instance();
+  if (!runLoader) {
+    Error("Clusters2Tracks", "no run loader found");
+    return rc;
+  }
+  AliStack *pStack=0x0; TTree *tRefTree=0x0;
+  if(GetMC()) {
+    runLoader->LoadKinematics("read");
+    runLoader->LoadTrackRefs("read");
+    pStack= runLoader->Stack();
+    tRefTree= runLoader->TreeTR();
+  }
+  Reconstruct(pStack,tRefTree);
+  return 0;
+}
+//____________________________________________________________________________
+Int_t AliITSTrackleterSPDEff::PostProcess(AliESDEvent *){
+// 
+// It is called from AliReconstruction
+// 
+// 
+// 
+//
+  Int_t rc=0;
+  if(GetMC()) SavePredictionMC("TrackletsMCpred.root");
+  if(GetHistOn()) rc=(Int_t)WriteHistosToFile();
+  return rc;
+}
+//____________________________________________________________________
+void
+AliITSTrackleterSPDEff::LoadClusterArrays(TTree* itsClusterTree) {
+  // This method
+  // - gets the clusters from the cluster tree
+  // - convert them into global coordinates
+  // - store them in the internal arrays
+  // - count the number of cluster-fired chips
+
+  //AliDebug(1,"Loading clusters and cluster-fired chips ...");
+
+  fNClustersLay1 = 0;
+  fNClustersLay2 = 0;
+
+  TClonesArray* itsClusters = new TClonesArray("AliITSRecPoint");
+  TBranch* itsClusterBranch=itsClusterTree->GetBranch("ITSRecPoints");
+
+  itsClusterBranch->SetAddress(&itsClusters);
+
+  Int_t nItsSubs = (Int_t)itsClusterTree->GetEntries();
+  Float_t cluGlo[3]={0.,0.,0.};
+
+  // loop over the its subdetectors
+  for (Int_t iIts=0; iIts < nItsSubs; iIts++) {
+
+    if (!itsClusterTree->GetEvent(iIts))
+      continue;
+
+    Int_t nClusters = itsClusters->GetEntriesFast();
+
+    // number of clusters in each chip of the current module
+    Int_t layer = 0;
+
+    // loop over clusters
+    while(nClusters--) {
+      AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
+
+      layer = cluster->GetLayer();
+      if (layer>1) continue;
+
+      cluster->GetGlobalXYZ(cluGlo);
+      Float_t x = cluGlo[0];
+      Float_t y = cluGlo[1];
+      Float_t z = cluGlo[2];
+
+      if (layer==0) {
+        fClustersLay1[fNClustersLay1][0] = x;
+        fClustersLay1[fNClustersLay1][1] = y;
+        fClustersLay1[fNClustersLay1][2] = z;
+
+        for (Int_t i=0; i<3; i++)
+                fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i);
+        fNClustersLay1++;
+      }
+      if (layer==1) {
+        fClustersLay2[fNClustersLay2][0] = x;
+        fClustersLay2[fNClustersLay2][1] = y;
+        fClustersLay2[fNClustersLay2][2] = z;
+
+        for (Int_t i=0; i<3; i++)
+                fClustersLay2[fNClustersLay2][3+i] = cluster->GetLabel(i);
+        fNClustersLay2++;
+      }
+
+    }// end of cluster loop
+
+  } // end of its "subdetector" loop
+  if (itsClusters) {
+    itsClusters->Delete();
+    delete itsClusters;
+    itsClusters = 0;
+  }
+  AliDebug(1,Form("(clusters in layer 1 : %d,  layer 2: %d)",fNClustersLay1,fNClustersLay2));
+}
+
index e563cc3..514fc09 100644 (file)
@@ -9,8 +9,9 @@
 // 
 // AliITSTrackleterSPDEff - find SPD chips efficiencies by using tracklets.
 // 
-// This class has been derived from AliITSMultReconstructor (see
-// it for more details). It is the class for the Trackleter used to estimate
+// This class was originally derived from AliITSMultReconstructor (see
+// it for more details). Later on, the inheritance was changed to AliTracker
+// It is the class for the Trackleter used to estimate
 // SPD plane efficiency.
 // The trackleter prediction is built using the vertex and 1 cluster.
 
 //____________________________________________________________________
 
 class AliStack;
-#include "AliITSMultReconstructor.h"
+class TTree;
+class TH1F;
+class TH2F;
+#include "AliTracker.h"
 #include "AliITSPlaneEffSPD.h"
+#include "AliPlaneEff.h"
 
-class AliITSTrackleterSPDEff : public AliITSMultReconstructor 
+class AliITSTrackleterSPDEff : public  AliTracker
 {
 public:
   AliITSTrackleterSPDEff();
   virtual ~AliITSTrackleterSPDEff();
+  Int_t Clusters2Tracks(AliESDEvent *);
+  Int_t PostProcess(AliESDEvent *);
+
+  virtual Int_t PropagateBack(AliESDEvent*) {return 0;}
+  virtual Int_t RefitInward(AliESDEvent*) {return 0;}
+  Int_t LoadClusters(TTree* cl) {LoadClusterArrays(cl); return 0;} // see implementation in AliITSMultReconstructor
+  virtual void UnloadClusters() {return;}
+  virtual AliCluster *GetCluster(Int_t) const {return NULL;}
+
   // Main method to perform the trackleter and the SPD efficiency evaluation
-  void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes, AliStack* pStack=0x0, TTree* tRef=0x0);
+  void Reconstruct(AliStack* pStack=0x0, TTree* tRef=0x0);
 
   void SetReflectClusterAroundZAxisForLayer(Int_t ilayer,Bool_t b=kTRUE){  // method to study residual background:
     if(b) AliInfo(Form("All clusters on layer %d will be rotated by 180 deg around z",ilayer)); 
@@ -40,13 +54,26 @@ public:
     else AliInfo("Nothing done: input argument (ilayer) either 0 or 1");   // given layer is applied. In such a way 
   }                                                                        // you remove all the true tracklets.
 
+  void SetOnlyOneTrackletPerC2(Bool_t b = kTRUE) {fOnlyOneTrackletPerC2 = b;}
+  void SetPhiWindow(Float_t w=0.08) {fPhiWindow=w;}
+  void SetZetaWindow(Float_t w=1.) {fZetaWindow=w;}
+
   void SetPhiWindowL1(Float_t w=0.08) {fPhiWindowL1=w;}  // method to set the cuts in the interpolation
   void SetZetaWindowL1(Float_t w=1.) {fZetaWindowL1=w;}  // phase; use method of the base class for extrap.
   void SetOnlyOneTrackletPerC1(Bool_t b = kTRUE) {fOnlyOneTrackletPerC1 = b;} // as in the base class but 
+
+  Int_t GetNClustersLayer1() const {return fNClustersLay1;}
+  Int_t GetNClustersLayer2() const {return fNClustersLay2;}
+  Int_t GetNTracklets() const {return fNTracklets;}
+
+  Float_t* GetClusterLayer1(Int_t n) {return fClustersLay1[n];}
+  Float_t* GetClusterLayer2(Int_t n) {return fClustersLay2[n];}
+  Float_t* GetTracklet(Int_t n) {return fTracklets[n];}
                                                                              // for the inner layer
   void SetUpdateOncePerEventPlaneEff(Bool_t b = kTRUE) {fUpdateOncePerEventPlaneEff = b;}
   
-  AliITSPlaneEffSPD* GetPlaneEff() const {return fPlaneEffSPD;}  // return a pointer to the AliITSPlaneEffSPD
+  AliITSPlaneEffSPD* GetPlaneEffSPD() const {return fPlaneEffSPD;}  // return a pointer to the AliITSPlaneEffSPD
+  AliPlaneEff *GetPlaneEff() {return (AliPlaneEff*)fPlaneEffSPD;}   // return the pointer to AliPlaneEff
   
   void SetMC(Bool_t mc=kTRUE) {fMC=mc; fMC? InitPredictionMC() : DeletePredictionMC(); return;}  // switch on access to MC true 
   Bool_t GetMC() const {return fMC;}  // check the access to MC true
@@ -115,13 +142,52 @@ public:
   // write histograms into a root file on disk
   Bool_t WriteHistosToFile(TString filename="TrackleterSPDHistos.root",Option_t* option = "RECREATE");
   // switch on/off the extra histograms
-  void SetHistOn(Bool_t his=kTRUE) {AliITSMultReconstructor::SetHistOn(his); 
+  void SetHistOn(Bool_t his=kTRUE) {fHistOn=his; 
          if(GetHistOn()) {DeleteHistos(); BookHistos();} else DeleteHistos(); return;}
 
 protected:
   AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff& mr); // protected method: no copy allowed from outside
   AliITSTrackleterSPDEff& operator=(const AliITSTrackleterSPDEff& mr);
+//
+//// From AliITSMultReconstructor
+//
+  Float_t**     fClustersLay1;               // clusters in the 1st layer of ITS
+  Float_t**     fClustersLay2;               // clusters in the 2nd layer of ITS
+
+  Float_t**     fTracklets;            // tracklets
+  Bool_t*       fAssociationFlag;      // flag for the associations
 
+  Int_t         fNClustersLay1;        // Number of clusters (Layer1)
+  Int_t         fNClustersLay2;        // Number of clusters (Layer2)
+  Int_t         fNTracklets;           // Number of tracklets
+
+  // Following members are set via AliITSRecoParam
+  Bool_t        fOnlyOneTrackletPerC2;         // Allow only one tracklet per cluster in the outer layer
+  Float_t       fPhiWindow;                    // Search window in phi
+  Float_t       fZetaWindow;                   // Search window in eta
+  Float_t       fPhiOverlapCut;                // Fiducial window in phi for overlap cut
+  Float_t       fZetaOverlapCut;               // Fiducial window in eta for overlap cut
+
+  Bool_t        fHistOn;               // Option to define and fill the histograms
+
+  TH1F*         fhClustersDPhiAcc;     // Phi2 - Phi1 for tracklets
+  TH1F*         fhClustersDThetaAcc;   // Theta2 - Theta1 for tracklets
+  TH1F*         fhClustersDZetaAcc;    // z2 - z1projected for tracklets
+  TH1F*         fhClustersDPhiAll;     // Phi2 - Phi1 all the combinations
+  TH1F*         fhClustersDThetaAll;   // Theta2 - Theta1 all the combinations
+  TH1F*         fhClustersDZetaAll;    // z2 - z1projected all the combinations
+
+  TH2F*         fhDPhiVsDThetaAll;     // 2D plot for all the combinations
+  TH2F*         fhDPhiVsDThetaAcc;     // same plot for tracklets
+  TH2F*         fhDPhiVsDZetaAll;      // 2d plot for all the combination
+  TH2F*         fhDPhiVsDZetaAcc;      // same plot for tracklets
+
+  TH1F*         fhetaTracklets;        // Pseudorapidity distr. for tracklets
+  TH1F*         fhphiTracklets;        // Azimuthal (Phi) distr. for tracklets
+  TH1F*         fhetaClustersLay1;     // Pseudorapidity distr. for Clusters L. 1
+  TH1F*         fhphiClustersLay1;     // Azimuthal (Phi) distr. for Clusters L. 1
+//
+// 
   Bool_t*       fAssociationFlag1;    // flag for the associations (Layer 1)
   UInt_t*       fChipPredOnLay2;      // prediction for the chip traversed by the tracklet 
                                       // based on vtx and ClusterLay1 (to be used in extrapolation)
@@ -202,6 +268,8 @@ protected:
   // Method to apply a rotation by 180degree to all RecPoints (x->-x; y->-y) on a given layer
   void ReflectClusterAroundZAxisForLayer(Int_t ilayer); // to be used for backgnd estimation on real data 
 
+  void LoadClusterArrays(TTree* tree);
+
   ClassDef(AliITSTrackleterSPDEff,3)
 };
 // Input and output function for standard C++ input/output (for the cut values and MC statistics).
index 33dca2c..9b94031 100644 (file)
@@ -229,7 +229,8 @@ fPlaneEff(0) {
   fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
 
   // only for plane efficiency evaluation
-  if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff()) {
+  if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
+      AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()>=0) {
     Int_t iplane=AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff();
     if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(iplane))
       AliWarning(Form("Evaluation of Plane Eff for layer %d will be attempted without removing it from tracker",iplane));
@@ -730,7 +731,8 @@ Int_t AliITStrackerMI::RefitInward(AliESDEvent *event) {
       fTrackToFollow.ResetCovariance(10.);
 
     //Refitting...
-    Bool_t pe=AliITSReconstructor::GetRecoParam()->GetComputePlaneEff();
+    Bool_t pe=(AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
+               AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()>=0);
     AliDebug(2,Form("Refit LABEL %d  %d",t->GetLabel(),t->GetNumberOfClusters()));
     if (RefitAt(AliITSRecoParam::GetrInsideSPD1(),&fTrackToFollow,t,kTRUE,pe)) {
        AliDebug(2,"  refit OK");
index e446342..5968c99 100644 (file)
@@ -236,6 +236,8 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
 
   fRecoParam(),
 
+  fSPDTrackleter(NULL),
+
   fDiamondProfileSPD(NULL),
   fDiamondProfile(NULL),
   fDiamondProfileTPC(NULL),
@@ -329,6 +331,8 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
 
   fRecoParam(rec.fRecoParam),
 
+  fSPDTrackleter(NULL),
+
   fDiamondProfileSPD(rec.fDiamondProfileSPD),
   fDiamondProfile(rec.fDiamondProfile),
   fDiamondProfileTPC(rec.fDiamondProfileTPC),
@@ -453,6 +457,8 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
     fQACycles[iDet] = rec.fQACycles[iDet];
     fQAWriteExpert[iDet] = rec.fQAWriteExpert[iDet] ;
   } 
+
+  delete fSPDTrackleter; fSPDTrackleter = NULL;
     
   delete fDiamondProfileSPD; fDiamondProfileSPD = NULL;
   if (rec.fDiamondProfileSPD) fDiamondProfileSPD = new AliESDVertex(*rec.fDiamondProfileSPD);
@@ -1616,6 +1622,13 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
       }
     }
 
+    // For Plane Efficiency: run the SPD trackleter
+    if (fRunPlaneEff && fSPDTrackleter) {
+      if (!RunSPDTrackleting(fesd)) {
+        if (fStopOnError) {CleanUp(); return kFALSE;}
+      }
+    }
+
     // Muon tracking
     if (!fRunTracking.IsNull()) {
       if (fRunMuonTracking) {
@@ -2014,6 +2027,55 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
   eventNr++;
   return kTRUE;
 }
+//_____________________________________________________________________________
+Bool_t AliReconstruction::RunSPDTrackleting(AliESDEvent*& esd)
+{
+// run the SPD trackleting (for SPD efficiency purpouses)
+
+  AliCodeTimerAuto("")
+
+  Double_t vtxPos[3] = {0, 0, 0};
+  Double_t vtxErr[3] = {0.0, 0.0, 0.0};
+/*
+  TArrayF mcVertex(3);
+  // if(MC)
+  if (fRunLoader->GetHeader() && fRunLoader->GetHeader()->GenEventHeader()) {
+    fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex);
+    for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i];
+  }
+*/
+  const AliESDVertex *vertex = esd->GetVertex();
+  if(!vertex){
+    AliWarning("Vertex not found");
+    return kFALSE;
+  }
+  vertex->GetXYZ(vtxPos);
+  vertex->GetSigmaXYZ(vtxErr);
+  if (fSPDTrackleter) {
+    AliInfo("running the SPD Trackleter for Plane Efficiency Evaluation");
+
+    // load clusters
+    fLoader[0]->LoadRecPoints("read");
+    TTree* tree = fLoader[0]->TreeR();
+    if (!tree) {
+      AliError("Can't get the ITS cluster tree");
+      return kFALSE;
+    }
+    fSPDTrackleter->LoadClusters(tree);
+    fSPDTrackleter->SetVertex(vtxPos, vtxErr);
+    // run trackleting
+    if (fSPDTrackleter->Clusters2Tracks(esd) != 0) {
+      AliError("AliITSTrackleterSPDEff Clusters2Tracks failed");
+     // fLoader[0]->UnloadRecPoints();
+      return kFALSE;
+    }
+//fSPDTrackleter->UnloadRecPoints();
+  } else {
+    AliWarning("SPDTrackleter not available");
+    return kFALSE;
+  }
+  return kTRUE;
+}
 
 //_____________________________________________________________________________
 Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd)
@@ -2699,6 +2761,9 @@ void AliReconstruction::CleanUp()
   delete fRunInfo;
   fRunInfo = NULL;
 
+  delete fSPDTrackleter;
+  fSPDTrackleter = NULL;
+
   delete ftVertexer;
   ftVertexer = NULL;
   
@@ -2872,10 +2937,10 @@ Bool_t AliReconstruction::FinishPlaneEff() {
  //  Return: kTRUE if all operations have been done properly, kFALSE otherwise
  //
  Bool_t ret=kFALSE;
- //for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
+ //for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
  for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS
    //if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
-   if(fTracker[iDet]) {
+   if(fTracker[iDet] && fTracker[iDet]->GetPlaneEff()) {
       AliPlaneEff *planeeff=fTracker[iDet]->GetPlaneEff();
       TString name=planeeff->GetName();
       name+=".root";
@@ -2888,6 +2953,15 @@ Bool_t AliReconstruction::FinishPlaneEff() {
         ret*=planeeff->WriteHistosToFile(hname,"RECREATE");
       }
    }
+   if(fSPDTrackleter) {
+     AliPlaneEff *planeeff=fSPDTrackleter->GetPlaneEff();
+      TString name="AliITSPlaneEffSPDtracklet.root";
+      TFile* pefile = TFile::Open(name, "RECREATE");
+      ret=(Bool_t)planeeff->Write();
+      pefile->Close();
+      AliESDEvent *dummy=NULL;
+      ret=(Bool_t)fSPDTrackleter->PostProcess(dummy); // take care of writing other files
+   }
  }
  return ret;
 }
@@ -2896,7 +2970,7 @@ Bool_t AliReconstruction::InitPlaneEff() {
 //
  // Here execute all the necessary operations, before of the tracking phase,
  // for the evaluation of PlaneEfficiencies, in case required for some detectors.
- // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency 
+ // E.g., read from a DataBase file a first evaluation of the PlaneEfficiency
  // which should be updated/recalculated.
  //
  // This Preliminary version will work only FOR ITS !!!!!
@@ -2905,7 +2979,17 @@ Bool_t AliReconstruction::InitPlaneEff() {
  //  Input: none
  //  Return: kTRUE if all operations have been done properly, kFALSE otherwise
  //
- AliWarning(Form("Implementation of this method not yet done !! Method return kTRUE"));
+ AliWarning(Form("Implementation of this method not yet completed !! Method return kTRUE"));
+
+  fSPDTrackleter = NULL;
+  AliReconstructor* itsReconstructor = GetReconstructor(0);
+  if (itsReconstructor) {
+    fSPDTrackleter = itsReconstructor->CreateTrackleter(); // this is NULL unless required in RecoParam
+  }
+  if (fSPDTrackleter) { 
+    AliInfo("Trackleter for SPD has been created");
+  }
+
  return kTRUE;
 }
 
index c24404b..b842764 100644 (file)
@@ -169,6 +169,7 @@ private:
   Bool_t         RunVertexFinder(AliESDEvent*& esd);
   Bool_t         RunHLTTracking(AliESDEvent*& esd);
   Bool_t         RunMuonTracking(AliESDEvent*& esd);
+  Bool_t         RunSPDTrackleting(AliESDEvent*& esd);
   Bool_t         RunTracking(AliESDEvent*& esd);
   Bool_t         CleanESD(AliESDEvent *esd);
   Bool_t         FillESD(AliESDEvent*& esd, const TString& detectors);
@@ -250,6 +251,7 @@ private:
   AliRecoParam   fRecoParam;                      // container for the reco-param objects for detectors
   AliLoader*     fLoader[kNDetectors];   //! detector loaders
   AliTracker*    fTracker[kNDetectors];  //! trackers
+  AliTracker*    fSPDTrackleter;           //! trackleter [for SPD Plane Efficiency purposes]
   AliESDVertex*  fDiamondProfileSPD;       // (x,y) diamond profile from SPD for AliITSVertexer3D(Z)
   AliESDVertex*  fDiamondProfile;          // (x,y) diamond profile for AliVertexerTracks (ITS+TPC)
   AliESDVertex*  fDiamondProfileTPC;       // (x,y) diamond profile from TPC for AliVertexerTracks
index e722dc7..bad7595 100644 (file)
@@ -40,6 +40,8 @@ public:
     {return NULL;}
   virtual AliTracker*  CreateTracker() const 
     {return NULL;}
+  virtual AliTracker*  CreateTrackleter() const 
+    {return NULL;}
 
   virtual void         FillESD(TTree* digitsTree, TTree* clustersTree, 
                               AliESDEvent* esd) const;