]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSDetTypeRec.cxx
Possibility to calculate the DCA between two ESD track. The V0 and cascade vertexes...
[u/mrichter/AliRoot.git] / ITS / AliITSDetTypeRec.cxx
index 822bb85076dfeb4b350432fa9cfe529019bbc9a2..2871e7d51d5ab89104092b2a58a5af192895a250 100644 (file)
@@ -26,9 +26,7 @@
 #include "TTree.h"
 
 #include "AliCDBManager.h"
-#include "AliCDBStorage.h"
 #include "AliCDBEntry.h"
-
 #include "AliITSClusterFinder.h"
 #include "AliITSClusterFinderV2.h"
 #include "AliITSClusterFinderV2SPD.h"
 #include "AliITSClusterFinderSPD.h"
 #include "AliITSClusterFinderSDD.h"
 #include "AliITSClusterFinderSSD.h"
-#include "AliITSclusterV2.h"
-#include "AliITSgeom.h"
 #include "AliITSDetTypeRec.h"
 #include "AliITSRawCluster.h"
 #include "AliITSRawClusterSPD.h"
 #include "AliITSRawClusterSDD.h"
 #include "AliITSRawClusterSSD.h"
 #include "AliITSRecPoint.h"
-#include "AliITSresponseSDD.h"
+#include "AliITSCalibrationSDD.h"
 #include "AliITSsegmentationSPD.h"
 #include "AliITSsegmentationSDD.h"
 #include "AliITSsegmentationSSD.h"
+#include "AliLog.h"
 
 
 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
@@ -59,17 +56,7 @@ const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
 ClassImp(AliITSDetTypeRec)
 
 //________________________________________________________________
-AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
-fGeom(),        //
-fReconstruction(),// [NDet]
-fSegmentation(),  // [NDet]
-fCalibration(),   // [NMod]
-fPreProcess(),    // [] e.g. Find Calibration values
-fPostProcess(),   // [] e.g. find primary vertex
-fDigits(),        //! [NMod][NDigits]
-fClusterClassName(), // String with Cluster class name
-fDigClassName(),     // String with digit class name.
-fRecPointClassName(){// String with RecPoint class name
+AliITSDetTypeRec::AliITSDetTypeRec(): TObject(){
     // Default Constructor
     // Inputs:
     //    none.
@@ -77,21 +64,58 @@ fRecPointClassName(){// String with RecPoint class name
     //    none.
     // Return:
     //    A properly zero-ed AliITSDetTypeRec class.
+  fReconstruction = 0;
+  fSegmentation = 0;
+  fCalibration = 0;
+  fPreProcess = 0;
+  fPostProcess = 0;
+  fDigits = 0;;
+  for(Int_t i=0; i<3; i++){
+    fClusterClassName[i]=0;
+    fDigClassName[i]=0;
+    fRecPointClassName[i]=0;
+  }
+  fNdtype = 0;
+  fCtype = 0;
+  fNMod = 0;
+  fNctype = 0;
+  fRecPoints = 0;
+  fNRecPoints = 0;
+  SelectVertexer(" ");
+  fLoader = 0;
+  fRunNumber = 0;
+
+}
+//________________________________________________________________
+AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(){
+    // Standard Constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //   
 
-  fGeom = 0;
   fReconstruction = new TObjArray(fgkNdettypes);
   fSegmentation = 0;
   fCalibration = 0;
   fPreProcess = 0;
   fPostProcess = 0;
   fDigits = new TObjArray(fgkNdettypes);
+  for(Int_t i=0; i<3; i++){
+    fClusterClassName[i]=0;
+    fDigClassName[i]=0;
+    fRecPointClassName[i]=0;
+  }
   fNdtype = new Int_t[fgkNdettypes];
   fCtype = new TObjArray(fgkNdettypes);
   fNctype = new Int_t[fgkNdettypes];
-  fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+  fNMod = new Int_t [fgkNdettypes];
+  fNMod[0] = fgkDefaultNModulesSPD;
+  fNMod[1] = fgkDefaultNModulesSDD;
+  fNMod[2] = fgkDefaultNModulesSSD;
+  fRecPoints = new TClonesArray("AliITSRecPoint",3000);
   fNRecPoints = 0;
-  fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
-  fNClustersV2 = 0;
   
   for(Int_t i=0;i<fgkNdettypes;i++){
     fNdtype[i]=0;
@@ -99,12 +123,8 @@ fRecPointClassName(){// String with RecPoint class name
   }
   
   SelectVertexer(" ");
-  fLoader = 0;
-
-  fNMod[0] = fgkDefaultNModulesSPD;
-  fNMod[1] = fgkDefaultNModulesSDD;
-  fNMod[2] = fgkDefaultNModulesSSD;
-  
+  fLoader = loader;
   SetRunNumber();
 }
 //______________________________________________________________________
@@ -126,10 +146,28 @@ AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& /*source*/
 AliITSDetTypeRec::~AliITSDetTypeRec(){
  
   //Destructor
-  if(fGeom) delete fGeom;
-  if(fReconstruction) delete fReconstruction;
-  if(fSegmentation) delete fSegmentation;
-  if(fCalibration) delete fCalibration;
+  if(fReconstruction){
+    fReconstruction->Delete();
+    delete fReconstruction;
+    fReconstruction = 0;
+  }
+  if(fSegmentation){
+    fSegmentation->Delete();
+    delete fSegmentation;
+    fSegmentation = 0;
+  }
+  if(fCalibration){
+    AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();    
+    AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
+    AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
+    if(rspd) delete rspd;
+    if(rsdd) delete rsdd;
+    if(rssd) delete rssd;
+    fCalibration->Delete();
+    delete fCalibration;
+    fCalibration = 0;
+  }
   if(fPreProcess) delete fPreProcess;
   if(fPostProcess) delete fPostProcess;
 
@@ -143,11 +181,6 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){
     delete fRecPoints;
     fRecPoints=0;
   }
-  if(fClustersV2){
-    fClustersV2->Delete();
-    delete fClustersV2;
-    fClustersV2=0;
-  }
   if(fCtype) {
     fCtype->Delete();
     delete fCtype;
@@ -155,9 +188,11 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){
   }
   delete [] fNctype;
   delete [] fNdtype;
+  delete [] fNMod;
   if(fLoader) delete fLoader;
   
 }
+
 //___________________________________________________________________
 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
 
@@ -201,22 +236,22 @@ AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
 
 }
 //_______________________________________________________________________
-void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSresponse *cal){
+void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
 
   //Set calibration (response) for the module iMod of type dettype
   if (fCalibration==0) {
-    fCalibration = new TObjArray(fGeom->GetIndexMax());
+    fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
     fCalibration->SetOwner(kTRUE);
     fCalibration->Clear();
   }
 
   if (fCalibration->At(iMod) != 0)
-    delete (AliITSresponse*) fCalibration->At(iMod);
+    delete (AliITSCalibration*) fCalibration->At(iMod);
   fCalibration->AddAt(cal,iMod);
 
 }
 //_______________________________________________________________________
-AliITSresponse* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
+AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
   
   //Get calibration model for module type
   
@@ -225,7 +260,7 @@ AliITSresponse* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
     return 0; 
   }  
 
-  return (AliITSresponse*)fCalibration->At(iMod);
+  return (AliITSCalibration*)fCalibration->At(iMod);
 }
 
 //______________________________________________________________________
@@ -301,8 +336,8 @@ void AliITSDetTypeRec::SetDefaults(){
   
   //Set defaults for segmentation and response
 
-  if(fGeom==0){
-    Warning("SetDefaults","fGeom is 0!");
+  if(!GetITSgeom()){
+    Warning("SetDefaults","null pointer to AliITSgeomGeom !");
     return;
   }
 
@@ -311,24 +346,24 @@ void AliITSDetTypeRec::SetDefaults(){
 
   for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
     if(dettype==0){
-      seg = new AliITSsegmentationSPD(fGeom);
+      seg = new AliITSsegmentationSPD(GetITSgeom());
       SetSegmentationModel(dettype,seg);
       SetDigitClassName(dettype,"AliITSdigitSPD");
       SetClusterClassName(dettype,"AliITSRawClusterSPD");
 
     }
     if(dettype==1){
-      AliITSresponseSDD* res=(AliITSresponseSDD*) GetCalibrationModel(fGeom->GetStartSDD()); 
-      seg = new AliITSsegmentationSDD(fGeom,res);
+      AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD()); 
+      seg = new AliITSsegmentationSDD(GetITSgeom(),res);
       SetSegmentationModel(dettype,seg);
-      const char *kopt = res->ZeroSuppOption();
+      const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
       if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
       else SetDigitClassName(dettype,"AliITSdigitSDD");
       SetClusterClassName(dettype,"AliITSRawClusterSDD");
 
     }
     if(dettype==2){
-      AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(fGeom);
+      AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
       seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
       seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
       seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
@@ -343,56 +378,88 @@ void AliITSDetTypeRec::SetDefaults(){
 Bool_t AliITSDetTypeRec::GetCalibration() {
   // Get Default calibration if a storage is not defined.
 
-  Bool_t deleteManager = kFALSE;
-  if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
-    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    deleteManager = kTRUE;
+
+  AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
+  AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
+  AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
+  AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
+  AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
+  AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
+
+  if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
+       AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
+       AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+       AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+       
+       entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
+       entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
+       entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
+       entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
+       entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
+       entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
+       
+       AliCDBManager::Instance()->SetDefaultStorage(origStorage);
   }
-  AliCDBStorage *storage = AliCDBManager::Instance()->GetDefaultStorage();
 
-  AliCDBEntry *entrySPD = storage->Get("ITS/Calib/RespSPD", fRunNumber);
   TObjArray *respSPD = (TObjArray *)entrySPD->GetObject();
   entrySPD->SetObject(NULL);
   entrySPD->SetOwner(kTRUE);
-  AliCDBEntry *entrySDD = storage->Get("ITS/Calib/RespSDD", fRunNumber);
+  AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
+  entry2SPD->SetObject(NULL);
+  entry2SPD->SetOwner(kTRUE);
+    
   TObjArray *respSDD = (TObjArray *)entrySDD->GetObject();
   entrySDD->SetObject(NULL);
   entrySDD->SetOwner(kTRUE);
-  AliCDBEntry *entrySSD = storage->Get("ITS/Calib/RespSSD", fRunNumber);
+  AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
+  entry2SDD->SetObject(NULL);
+  entry2SDD->SetOwner(kTRUE);
+
   TObjArray *respSSD = (TObjArray *)entrySSD->GetObject();
   entrySSD->SetObject(NULL);
   entrySSD->SetOwner(kTRUE);
+
+  AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
+  entry2SSD->SetObject(NULL);
+  entry2SSD->SetOwner(kTRUE);
+
   // DB entries are dleted. In this waymetadeta objects are deleted as well
   delete entrySPD;
   delete entrySDD;
   delete entrySSD;
-  if(deleteManager){
-    AliCDBManager::Instance()->Destroy();
-    AliCDBManager::Instance()->UnsetDefaultStorage();
-    storage = 0;   // the storage is killed by AliCDBManager::Instance()->Destroy()
-  }
-  if ((! respSPD)||(! respSDD)||(! respSSD)) {
+  delete entry2SPD;
+  delete entry2SDD;
+  delete entry2SSD;
+
+  
+  if ((!pSPD)||(!pSDD)||(!pSSD) || (!respSPD) || (!respSDD) || (!respSSD)) {
     AliWarning("Can not get calibration from calibration database !");
     return kFALSE;
   }
-  
+
   fNMod[0] = respSPD->GetEntries();
   fNMod[1] = respSDD->GetEntries();
   fNMod[2] = respSSD->GetEntries();
   AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
               fNMod[0], fNMod[1], fNMod[2]));
-  AliITSresponse* res;
+  AliITSCalibration* res;
   for (Int_t i=0; i<fNMod[0]; i++) {
-    res = (AliITSresponse*) respSPD->At(i);
+    res = (AliITSCalibration*) respSPD->At(i);
+    res->SetResponse((AliITSresponse*)pSPD);
     SetCalibrationModel(i, res);
  }
   for (Int_t i=0; i<fNMod[1]; i++) {
-    res = (AliITSresponse*) respSDD->At(i);
+    res = (AliITSCalibration*) respSDD->At(i);
+    res->SetResponse((AliITSresponse*)pSDD);
     Int_t iMod = i + fNMod[0];
     SetCalibrationModel(iMod, res);
  }
   for (Int_t i=0; i<fNMod[2]; i++) {
-    res = (AliITSresponse*) respSSD->At(i);
+    res = (AliITSCalibration*) respSSD->At(i);
+    res->SetResponse((AliITSresponse*)pSSD);
     Int_t iMod = i + fNMod[0] + fNMod[1];
     SetCalibrationModel(iMod, res);
  }
@@ -406,8 +473,8 @@ void AliITSDetTypeRec::SetDefaultClusterFinders(){
   
   //set defaults for standard cluster finder
 
-  if(fGeom==0){
-    Warning("SetDefaults","fGeom is 0!");
+  if(!GetITSgeom()){
+    Warning("SetDefaults","null pointer to AliITSgeom!");
     return;
   }
 
@@ -456,8 +523,8 @@ void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
 
   //Set defaults for cluster finder V2
 
-  if(fGeom==0){
-    Warning("SetDefaults","fGeom is 0!");
+  if(!GetITSgeom()){
+    Warning("SetDefaults","Null pointer to AliITSgeom !");
     return;
   }
 
@@ -505,13 +572,11 @@ void AliITSDetTypeRec::MakeBranch(Option_t* option){
   //Creates branches for clusters and recpoints
   Bool_t cR = (strstr(option,"R")!=0);
   Bool_t cRF = (strstr(option,"RF")!=0);
-  Bool_t v2 = (strstr(option,"v2")!=0);
   
   if(cRF)cR = kFALSE;
 
   if(cR) MakeBranchR(0);
   if(cRF) MakeBranchRF(0);
-  if(v2) MakeBranchR(0,"v2");
 
 }
 
@@ -678,35 +743,23 @@ void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
 
   // only one branch for rec points for all detector types
   Bool_t oFast= (strstr(opt,"Fast")!=0);
-  Bool_t v2 = (strstr(opt,"v2")!=0);
   
   Char_t detname[10] = "ITS";
  
   
   if(oFast){
     sprintf(branchname,"%sRecPointsF",detname);
-  } else if(v2){
-    sprintf(branchname,"Clusters");
   } else {
     sprintf(branchname,"%sRecPoints",detname);
   }
   
-  if(v2){
-    
-    if(!fClustersV2)fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
-    if(fLoader->TreeR()){
-      if(fClustersV2==0x0) fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
-      MakeBranchInTree(fLoader->TreeR(),branchname,0,&fClustersV2,buffsz,99,file);
-      
-    }
-  }else{
-    if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
-    if (fLoader->TreeR()) {
-      if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
-                                                       1000);
-      MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
-    } // end if
-  }
+  if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+  if (fLoader->TreeR()) {
+    if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
+                                                     1000);
+    MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
+  } // end if
+
   
 }
 //______________________________________________________________________
@@ -723,26 +776,18 @@ void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
 
     if(!treeR) return;
     if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
-    TBranch *branch1;
-    sprintf(branchname,"Clusters");
-    branch1 = treeR->GetBranch(branchname);
-    if(branch1){
-      if(fClustersV2==0x0) fClustersV2 = new TClonesArray("AliITSclusterV2",3000);
-      branch1->SetAddress(&fClustersV2);
-    }
-    else{
-      TBranch *branch;
-      sprintf(branchname,"%sRecPoints",namedet);
+    TBranch *branch;
+    sprintf(branchname,"%sRecPoints",namedet);
+    branch = treeR->GetBranch(branchname);
+    if (branch) {
+      branch->SetAddress(&fRecPoints);
+    }else {
+      sprintf(branchname,"%sRecPointsF",namedet);
       branch = treeR->GetBranch(branchname);
       if (branch) {
-        branch->SetAddress(&fRecPoints);
-      }else {
-        sprintf(branchname,"%sRecPointsF",namedet);
-        branch = treeR->GetBranch(branchname);
-        if (branch) {
-         branch->SetAddress(&fRecPoints);
-        }
+       branch->SetAddress(&fRecPoints);
       }
+
     }
 }
 //____________________________________________________________________
@@ -759,20 +804,6 @@ void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
     TClonesArray &lrecp = *fRecPoints;
     new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
 }
-//______________________________________________________________________
-void AliITSDetTypeRec::AddClusterV2(const AliITSclusterV2 &r){
-    // Add a reconstructed space point to the list
-    // Inputs:
-    //      const AliITSClusterV2 &r class to be added to the tree
-    //                              of reconstructed points TreeR.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    TClonesArray &lrecp = *fClustersV2;
-    new(lrecp[fNClustersV2++]) AliITSclusterV2(r);
- }
 
 //______________________________________________________________________
 void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
@@ -788,8 +819,8 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t
   //                       be processed. If ="All" then all of the ITS
   //                       sub detectors are processed.
 
-  if(!fGeom){
-    Warning("DigitsToRecPoints","fGeom is null!");
+  if(!GetITSgeom()){
+    Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
     return;
   }
   if(!fLoader){
@@ -800,9 +831,14 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t
   const char *all = strstr(opt,"All");
   const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
                         strstr(opt,"SSD")};
-  if(!v2) SetDefaultClusterFinders();
-  else    SetDefaultClusterFindersV2();
-  
+  if(!v2) {
+    SetDefaultClusterFinders();
+    AliInfo("Original cluster finder has been selected\n");
+  }
+  else   { 
+    SetDefaultClusterFindersV2();
+    AliInfo("V2 cluster finder has been selected \n");
+  }
 
   TTree *treeC=fLoader->TreeC();
   if(!treeC){
@@ -811,10 +847,10 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t
   }
   AliITSClusterFinder *rec     = 0;
   Int_t id,module,first=0;
-  for(module=0;module<fGeom->GetIndexMax();module++){
-      id       = fGeom->GetModuleType(module);
+  for(module=0;module<GetITSgeom()->GetIndexMax();module++){
+      id       = GetITSgeom()->GetModuleType(module);
       if (!all && !det[id]) continue;
-      if(det[id]) first = fGeom->GetStartDet(id);
+      if(det[id]) first = GetITSgeom()->GetStartDet(id);
       rec = (AliITSClusterFinder*)GetReconstructionModel(id);
       TClonesArray *itsDigits  = DigitsAddress(id);
       if (!rec) {
@@ -839,7 +875,6 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t
       } // end if
       fLoader->TreeR()->Fill();
       ResetRecPoints();
-      ResetClustersV2();
       treeC->Fill();
       ResetClusters();
   } 
@@ -864,8 +899,8 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
   //      none.
   // Return:
   //      none.
-  if(!fGeom){
-    Warning("DigitsToRecPoints","fGeom is null!");
+  if(!GetITSgeom()){
+    Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
     return;
   }
   if(!fLoader){
@@ -879,12 +914,12 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
 
   if(!fLoader->TreeR()) fLoader->MakeTree("R");
   TTree* cTree = fLoader->TreeR();
-  TClonesArray *array=new TClonesArray("AliITSclusterV2",1000);
-  cTree->Branch("Clusters",&array);
+  TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
+  cTree->Branch("ITSRecPoints",&array);
   delete array;
  
-  TClonesArray** clusters = new TClonesArray*[fGeom->GetIndexMax()]; 
-  for (Int_t iModule = 0; iModule < fGeom->GetIndexMax(); iModule++) {
+  TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; 
+  for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
     clusters[iModule] = NULL;
   }
   for(id=0;id<3;id++){
@@ -898,13 +933,13 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
     rec->RawdataToClusters(rawReader,clusters);    
   } 
   Int_t nClusters =0;
-  for(Int_t iModule=0;iModule<fGeom->GetIndexMax();iModule++){
+  for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
     array = clusters[iModule];
     if(!array){
       Error("DigitsToRecPoints","data for module %d missing!",iModule);
-      array = new TClonesArray("AliITSclusterV2");
+      array = new TClonesArray("AliITSRecPoint");
     }
-    cTree->SetBranchAddress("Clusters",&array);
+    cTree->SetBranchAddress("ITSRecPoints",&array);
     cTree->Fill();
     nClusters+=array->GetEntriesFast();
     delete array;
@@ -912,7 +947,7 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
   fLoader->WriteRecPoints("OVERWRITE");
 
   delete[] clusters;
-  Info("DigitsToRecPoints", "total number of found clustersV2 in ITS: %d\n", 
+  Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n", 
        nClusters);
   
 }