]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCFileHandler.cxx
- all digit raw data structures added to AliHLTTPCDigitData.h
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCFileHandler.cxx
index db36f49f69a45b21afabbca6eb38eb6ddb1ea04a..535792e6ccee148606873922ac5c4c46e986a9eb 100644 (file)
@@ -1,15 +1,45 @@
 // @(#) $Id$
-
-// Author: Uli Frankenfeld <mailto:franken@fi.uib.no>, Anders Vestbo <mailto:vestbo$fi.uib.no>, C. Loizides <mailto:loizides@ikf.uni-frankfurt.de>
-//*-- Copyright &copy ALICE HLT Group 
+// Original: AliHLTFileHandler.cxx,v 1.49 2005/06/23 17:46:55 hristov 
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: U. Frankenfeld, A. Vestbo, C. Loizides                *
+ *                  Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/** @file   AliHLTTPCFileHandler.cxx
+    @author U. Frankenfeld, A. Vestbo, C. Loizides, maintained by
+            Matthias Richter
+    @date   
+    @brief  file input for the TPC tracking code before migration to the
+            HLT component framework
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+                                                                          */
 
 #include <TClonesArray.h>
 #include <TSystem.h>
 #include <TMath.h>
 
-#ifdef use_newio
 #include <AliRunLoader.h>
-#endif
+#include <TObject.h>
+#include <TFile.h>
+#include <TTree.h>
 #include <AliTPCParamSR.h>
 #include <AliTPCDigitsArray.h>
 #include <AliTPCClustersArray.h>
 
 #include "AliHLTTPCLogging.h"
 #include "AliHLTTPCTransform.h"
-#include "AliHLTTPCMemHandler.h"
 #include "AliHLTTPCDigitData.h"
-#include "AliHLTTPCTrackSegmentData.h"
+//#include "AliHLTTPCTrackSegmentData.h"
 #include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCTrackArray.h"
+//#include "AliHLTTPCTrackArray.h"
 #include "AliHLTTPCFileHandler.h"
 
 #if __GNUC__ >= 3
 using namespace std;
 #endif
 
-/** \class AliHLTTPCFileHandler
+/**
 <pre>
 //_____________________________________________________________
 // AliHLTTPCFileHandler
@@ -70,6 +99,34 @@ using namespace std;
 
 ClassImp(AliHLTTPCFileHandler)
 
+AliHLTTPCFileHandler::AliHLTTPCFileHandler(Bool_t b)
+  :
+  fInAli(NULL),
+  fUseRunLoader(kFALSE),
+  fParam(NULL),
+  fDigits(NULL),
+  fDigitsTree(NULL),
+  fMC(NULL),
+  fIndexCreated(kFALSE),
+  fUseStaticIndex(b)
+{
+  //Default constructor
+
+  for(Int_t i=0;i<AliHLTTPCTransform::GetNSlice();i++)
+    for(Int_t j=0;j<AliHLTTPCTransform::GetNRows();j++) 
+      fIndex[i][j]=-1;
+
+  if(fUseStaticIndex&&!fgStaticIndexCreated) CleanStaticIndex();
+}
+
+AliHLTTPCFileHandler::~AliHLTTPCFileHandler()
+{
+  //Destructor
+  if(fMC) CloseMCOutput();
+  FreeDigitsTree();
+  if(fInAli) CloseAliInput();
+}
+
 // of course on start up the index is not created
 Bool_t AliHLTTPCFileHandler::fgStaticIndexCreated=kFALSE;
 Int_t  AliHLTTPCFileHandler::fgStaticIndex[36][159]; 
@@ -136,35 +193,6 @@ Int_t AliHLTTPCFileHandler::LoadStaticIndex(Char_t *prefix,Int_t event)
   return 0;
 }
 
-AliHLTTPCFileHandler::AliHLTTPCFileHandler(Bool_t b)
-{
-  //Default constructor
-  fInAli = 0;
-#ifdef use_newio
-  fUseRunLoader = kFALSE;
-#endif
-  fParam = 0;
-  fMC =0;
-  fDigits=0;
-  fDigitsTree=0;
-  fIndexCreated=kFALSE;
-  fUseStaticIndex=b;
-
-  for(Int_t i=0;i<AliHLTTPCTransform::GetNSlice();i++)
-    for(Int_t j=0;j<AliHLTTPCTransform::GetNRows();j++) 
-      fIndex[i][j]=-1;
-
-  if(fUseStaticIndex&&!fgStaticIndexCreated) CleanStaticIndex();
-}
-
-AliHLTTPCFileHandler::~AliHLTTPCFileHandler()
-{
-  //Destructor
-  if(fMC) CloseMCOutput();
-  FreeDigitsTree();
-  if(fInAli) CloseAliInput();
-}
-
 void AliHLTTPCFileHandler::FreeDigitsTree()
 { 
   //free digits tree
@@ -176,9 +204,6 @@ void AliHLTTPCFileHandler::FreeDigitsTree()
     }
   delete fDigits;
   fDigits=0;
-#ifndef use_newio
-  fDigitsTree->Delete();
-#endif
   fDigitsTree=0;
 
   for(Int_t i=0;i<AliHLTTPCTransform::GetNSlice();i++){
@@ -227,7 +252,6 @@ void AliHLTTPCFileHandler::CloseMCOutput()
 Bool_t AliHLTTPCFileHandler::SetAliInput()
 { 
   //set ali input
-#ifdef use_newio
   fInAli->CdGAFile();
   fParam = (AliTPCParam*)gFile->Get("75x40_100x60_150x60");
   if(!fParam){
@@ -242,26 +266,6 @@ Bool_t AliHLTTPCFileHandler::SetAliInput()
       <<"No AliTPCParam "<<AliHLTTPCTransform::GetParamName()<<" in File "<<gFile->GetName()<<ENDLOG;
     return kFALSE;
   }
-#else
-  if(!fInAli->IsOpen()){
-    LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::SetAliInput","File Open")
-      <<"Ali File "<<fInAli->GetName()<<" does not exist"<<ENDLOG;
-    return kFALSE;
-  }
-  fParam = (AliTPCParam*)fInAli->Get(AliHLTTPCTransform::GetParamName());
-  if(!fParam){
-    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::SetAliInput","File")
-      <<"No TPC parameters found in \""<<fInAli->GetName()
-      <<"\", creating standard parameters "
-      <<"which might not be what you want!"<<ENDLOG;
-    fParam = new AliTPCParamSR;
-  }
-  if(!fParam){ 
-    LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::SetAliInput","File Open")
-      <<"No AliTPCParam "<<AliHLTTPCTransform::GetParamName()<<" in File "<<fInAli->GetName()<<ENDLOG;
-    return kFALSE;
-  }
-#endif
 
   return kTRUE;
 }
@@ -269,11 +273,7 @@ Bool_t AliHLTTPCFileHandler::SetAliInput()
 Bool_t AliHLTTPCFileHandler::SetAliInput(Char_t *name)
 { 
   //Open the AliROOT file with name.
-#ifdef use_newio
   fInAli= AliRunLoader::Open(name);
-#else
-  fInAli= new TFile(name,"READ");
-#endif
   if(!fInAli){
     LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::SetAliInput","File Open")
     <<"Pointer to fInAli = 0x0 "<<ENDLOG;
@@ -282,7 +282,6 @@ Bool_t AliHLTTPCFileHandler::SetAliInput(Char_t *name)
   return SetAliInput();
 }
 
-#ifdef use_newio
 Bool_t AliHLTTPCFileHandler::SetAliInput(AliRunLoader *runLoader)
 { 
   //set ali input as runloader
@@ -295,44 +294,16 @@ Bool_t AliHLTTPCFileHandler::SetAliInput(AliRunLoader *runLoader)
   }
   return SetAliInput();
 }
-#endif
-
-#ifdef use_newio
-Bool_t AliHLTTPCFileHandler::SetAliInput(TFile */*file*/)
-{
-  //Specify already opened AliROOT file to use as an input.
-  LOG(AliHLTTPCLog::kFatal,"AliHLTTPCFileHandler::SetAliInput","File Open")
-    <<"This function is not supported for NEWIO, check ALIHLT_USENEWIO settings in Makefile.conf"<<ENDLOG;
-  return kFALSE;
-}
-#else
-Bool_t AliHLTTPCFileHandler::SetAliInput(TFile *file)
-{ 
-  //Specify already opened AliROOT file to use as an input.
-  fInAli=file;
-  if(!fInAli){
-    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::SetAliInput","File Open")
-    <<"Pointer to fInAli = 0x0 "<<ENDLOG;
-    return kFALSE;
-  }
-  return SetAliInput();
-}
-#endif
 
 void AliHLTTPCFileHandler::CloseAliInput()
 { 
   //close ali input
-#ifdef use_newio
   if(fUseRunLoader) return;
-#endif
   if(!fInAli){
     LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::CloseAliInput","RunLoader")
       <<"Nothing to Close"<<ENDLOG;
     return;
   }
-#ifndef use_newio
-  if(fInAli->IsOpen()) fInAli->Close();
-#endif
 
   delete fInAli;
   fInAli = 0;
@@ -348,7 +319,6 @@ Bool_t AliHLTTPCFileHandler::IsDigit(Int_t event)
     <<"Pointer to fInAli = 0x0 "<<ENDLOG;
     return kTRUE;  //maybe you are using binary input which is Digits!
   }
-#ifdef use_newio
   AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader");
   if(!tpcLoader){
     LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandlerNewIO::IsDigit","File")
@@ -358,11 +328,6 @@ Bool_t AliHLTTPCFileHandler::IsDigit(Int_t event)
   fInAli->GetEvent(event);
   tpcLoader->LoadDigits();
   TTree *t=tpcLoader->TreeD();
-#else
-  Char_t name[1024];
-  sprintf(name,"TreeD_%s_%d",AliHLTTPCTransform::GetParamName(),event);
-  TTree *t=(TTree*)fInAli->Get(name);
-#endif
   if(t){
     LOG(AliHLTTPCLog::kInformational,"AliHLTTPCFileHandlerNewIO::IsDigit","File Type")
     <<"Found Digit Tree -> Use Fast Cluster Finder"<<ENDLOG;
@@ -376,7 +341,7 @@ Bool_t AliHLTTPCFileHandler::IsDigit(Int_t event)
 }
 
 ///////////////////////////////////////// Digit IO  
-Bool_t AliHLTTPCFileHandler::AliDigits2Binary(Int_t event,Bool_t altro)
+Bool_t AliHLTTPCFileHandler::AliDigits2BinaryFile(Int_t event,Bool_t altro)
 {
   //save alidigits as binary
   Bool_t out = kTRUE;
@@ -386,7 +351,7 @@ Bool_t AliHLTTPCFileHandler::AliDigits2Binary(Int_t event,Bool_t altro)
     data = AliAltroDigits2Memory(nrow,event);
   else
     data = AliDigits2Memory(nrow,event);
-  out = Memory2Binary(nrow,data);
+  out = Memory2BinaryFile(nrow,data);
   Free();
   return out;
 }
@@ -456,9 +421,10 @@ Bool_t AliHLTTPCFileHandler::CreateIndex()
   return kTRUE;
 }
 
-AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event)
+AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event, Byte_t* tgtBuffer, UInt_t *pTgtSize)
 {
-  //Read data from AliROOT file into memory, and store it in the HLT data format.
+  //Read data from AliROOT file into memory, and store it in the HLT data format
+  //in the provided buffer or an allocated buffer.
   //Returns a pointer to the data.
 
   AliHLTTPCDigitRowData *data = 0;
@@ -470,14 +436,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
     return 0; 
   }
 
-#ifndef use_newio
-  if(!fInAli->IsOpen()){
-    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::AliDigits2Memory","File")
-    <<"No Input avalible: TFile not opened"<<ENDLOG;
-    return 0;
-  }
-#endif
-
   if(!fDigitsTree)
     if(!GetDigitsTree(event)) return 0;
 
@@ -492,22 +450,38 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
       <<"No TPC digits (entries==0)!"<<ENDLOG;
     nrow = (UInt_t)(fRowMax-fRowMin+1);
     Int_t size = nrow*sizeof(AliHLTTPCDigitRowData);
-    data=(AliHLTTPCDigitRowData*) Allocate(size);
+    if (tgtBuffer!=NULL && pTgtSize!=NULL && *pTgtSize>0) {
+      if (size<=*pTgtSize) {
+       data=reinterpret_cast<AliHLTTPCDigitRowData*>(tgtBuffer);
+      } else {
+      }
+    } else {
+      data=reinterpret_cast<AliHLTTPCDigitRowData*>(Allocate(size));
+    }
     AliHLTTPCDigitRowData *tempPt = data;
+    if (data) {
+    if (pTgtSize) *pTgtSize=size;
     for(Int_t r=fRowMin;r<=fRowMax;r++){
       tempPt->fRow = r;
       tempPt->fNDigit = 0;
       tempPt++;
     }
+    }
     return data;
   }
 
   Int_t * ndigits = new Int_t[fRowMax+1];
   Float_t xyz[3];
 
+  // The digits of the current event have been indexed: all digits are organized in
+  // rows, all digits of one row are stored in a AliSimDigits object (fDigit) which
+  // are stored in the digit tree.
+  // The index map relates the AliSimDigits objects in the tree to dedicated pad rows
+  // in the TPC
+  // This loop filters the pad rows according to the slice no set via Init
   for(Int_t r=fRowMin;r<=fRowMax;r++){
     Int_t n=fIndex[fSlice][r];
-    if(n!=-1){ //data on that row
+    if(n!=-1){ // there is data on that row available
       fDigitsTree->GetEvent(n);
       fParam->AdjustSectorRow(fDigits->GetID(),sector,row);
       AliHLTTPCTransform::Sector2Slice(lslice,lrow,sector,row);
@@ -547,7 +521,16 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
   LOG(AliHLTTPCLog::kDebug,"AliHLTTPCFileHandler::AliDigits2Memory","Digits")
     <<AliHLTTPCLog::kDec<<"Found "<<ndigitcount<<" Digits"<<ENDLOG;
   
-  data=(AliHLTTPCDigitRowData*) Allocate(size);
+  if (tgtBuffer!=NULL && pTgtSize!=NULL && *pTgtSize>0) {
+    if (size<=*pTgtSize) {
+      data=reinterpret_cast<AliHLTTPCDigitRowData*>(tgtBuffer);
+    } else {
+    }
+  } else {
+    data=reinterpret_cast<AliHLTTPCDigitRowData*>(Allocate(size));
+  }
+  if (pTgtSize) *pTgtSize=size;
+  if (data==NULL) return NULL;
   nrow = (UInt_t)nrows;
   AliHLTTPCDigitRowData *tempPt = data;
 
@@ -591,11 +574,9 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliDigits2Memory(UInt_t & nrow,Int
        tempPt->fDigitData[localcount].fCharge=dig;
        tempPt->fDigitData[localcount].fPad=pad;
        tempPt->fDigitData[localcount].fTime=time;
-#ifdef do_mc
        tempPt->fDigitData[localcount].fTrackID[0] = fDigits->GetTrackID(time,pad,0);
        tempPt->fDigitData[localcount].fTrackID[1] = fDigits->GetTrackID(time,pad,1);
        tempPt->fDigitData[localcount].fTrackID[2] = fDigits->GetTrackID(time,pad,2);
-#endif
        localcount++;
       } while (fDigits->Next());
     }
@@ -625,13 +606,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliAltroDigits2Memory(UInt_t & nro
     <<"No Input avalible: Pointer to TFile == NULL"<<ENDLOG;
     return 0; 
   }
-#ifndef use_newio
-  if(!fInAli->IsOpen()){
-    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::AliAltroDigits2Memory","File")
-    <<"No Input avalible: TFile not opened"<<ENDLOG;
-    return 0;
-  }
-#endif
   if(eventmerge == kTRUE && event >= 1024)
     {
       LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliAltroDigits2Memory","TrackIDs")
@@ -640,16 +614,10 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliAltroDigits2Memory(UInt_t & nro
     }
   delete fDigits;
   fDigits=0;
-#ifdef use_newio 
   /* Dont understand why we have to do 
      reload the tree, but otherwise the code crashes */
   fDigitsTree=0;
   if(!GetDigitsTree(event)) return 0;
-#else
-  if(!fDigitsTree){
-    if(!GetDigitsTree(event)) return 0;
-  }
-#endif
 
   UShort_t dig;
   Int_t time,pad,sector,row;
@@ -940,7 +908,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliAltroDigits2Memory(UInt_t & nro
          tempPt->fDigitData[localcount].fCharge=dig;
          tempPt->fDigitData[localcount].fPad=pad;
          tempPt->fDigitData[localcount].fTime=time;
-#ifdef do_mc
          tempPt->fDigitData[localcount].fTrackID[0] = (fDigits->GetTrackIDFast(time,pad,0)-2);
          tempPt->fDigitData[localcount].fTrackID[1] = (fDigits->GetTrackIDFast(time,pad,1)-2);
          tempPt->fDigitData[localcount].fTrackID[2] = (fDigits->GetTrackIDFast(time,pad,2)-2);
@@ -953,7 +920,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliAltroDigits2Memory(UInt_t & nro
              tempPt->fDigitData[localcount].fTrackID[1] += ((event&0x3ff)<<22);
              tempPt->fDigitData[localcount].fTrackID[2] += ((event&0x3ff)<<22);
            }
-#endif
          localcount++;
        }
       }
@@ -971,7 +937,6 @@ AliHLTTPCDigitRowData * AliHLTTPCFileHandler::AliAltroDigits2Memory(UInt_t & nro
 Bool_t AliHLTTPCFileHandler::GetDigitsTree(Int_t event)
 {
   //Connects to the TPC digit tree in the AliROOT file.
-#ifdef use_newio
   AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader");
   if(!tpcLoader){
     LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::GetDigitsTree","File")
@@ -981,12 +946,6 @@ Bool_t AliHLTTPCFileHandler::GetDigitsTree(Int_t event)
   fInAli->GetEvent(event);
   tpcLoader->LoadDigits();
   fDigitsTree = tpcLoader->TreeD();
-#else  
-  fInAli->cd();
-  Char_t dname[100];
-  sprintf(dname,"TreeD_%s_%d",AliHLTTPCTransform::GetParamName(),event);
-  fDigitsTree = (TTree*)fInAli->Get(dname);
-#endif
   if(!fDigitsTree) 
     {
       LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::GetDigitsTree","Digits Tree")
@@ -999,7 +958,7 @@ Bool_t AliHLTTPCFileHandler::GetDigitsTree(Int_t event)
   else return kTRUE;
 }
 
-void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_t *new_digitsfile)
+void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_t *newDigitsfile)
 {
   //Write the data stored in rowPt, into a new AliROOT file.
   //The data is stored in the AliROOT format 
@@ -1022,7 +981,6 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
       return;
     }
 
-#ifdef use_newio
   //Get the original digitstree:
   AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader");
   if(!tpcLoader){
@@ -1033,11 +991,11 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
   tpcLoader->LoadDigits();
   TTree *t=tpcLoader->TreeD();
 
-  AliTPCDigitsArray *old_array = new AliTPCDigitsArray();
-  old_array->Setup(fParam);
-  old_array->SetClass("AliSimDigits");
+  AliTPCDigitsArray *oldArray = new AliTPCDigitsArray();
+  oldArray->Setup(fParam);
+  oldArray->SetClass("AliSimDigits");
 
-  Bool_t ok = old_array->ConnectTree(t);
+  Bool_t ok = oldArray->ConnectTree(t);
   if(!ok)
     {
       LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliDigits2RootFile","File")
@@ -1045,7 +1003,7 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
       return;
     }
 
-  tpcLoader->SetDigitsFileName(new_digitsfile);
+  tpcLoader->SetDigitsFileName(newDigitsfile);
   tpcLoader->MakeDigitsContainer();
     
   //setup a new one, or connect it to the existing one:
@@ -1053,68 +1011,6 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
   arr->SetClass("AliSimDigits");
   arr->Setup(fParam);
   arr->MakeTree(tpcLoader->TreeD());
-#else
-  
-  //Get the original digitstree:
-  Char_t dname[100];
-  sprintf(dname,"TreeD_%s_0",AliHLTTPCTransform::GetParamName());
-
-  fInAli->cd();
-  AliTPCDigitsArray *old_array = new AliTPCDigitsArray();
-  old_array->Setup(fParam);
-  old_array->SetClass("AliSimDigits");
-
-  Bool_t ok = old_array->ConnectTree(dname);
-  if(!ok)
-    {
-      LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliDigits2RootFile","File")
-       <<"No digits tree object." <<ENDLOG;
-      return;
-    }
-
-  Bool_t create=kFALSE;
-  TFile *digFile;
-  
-  if(gSystem->AccessPathName(new_digitsfile))
-    {
-      LOG(AliHLTTPCLog::kInformational,"AliHLTTPCFileHandler::AliDigits2RootFile","File")
-       <<"Creating new file "<<new_digitsfile<<ENDLOG;
-      create = kTRUE;
-      digFile = TFile::Open(new_digitsfile,"RECREATE");
-      fParam->Write(fParam->GetTitle());
-    }
-  else
-    {
-      create = kFALSE;
-      digFile = TFile::Open(new_digitsfile,"UPDATE");
-      
-    }
-  if(!digFile->IsOpen())
-    {
-      LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliDigits2RootFile","Rootfile")
-       <<"Error opening rootfile "<<new_digitsfile<<ENDLOG;
-      return;
-    }
-  
-  digFile->cd();
-    
-  //setup a new one, or connect it to the existing one:
-  AliTPCDigitsArray *arr = new AliTPCDigitsArray(); 
-  arr->SetClass("AliSimDigits");
-  arr->Setup(fParam);
-  if(create)
-    arr->MakeTree();
-  else
-    {
-      Bool_t ok = arr->ConnectTree(dname);
-      if(!ok)
-       {
-         LOG(AliHLTTPCLog::kError,"AliHLTTPCFileHandler::AliDigits2RootFile","Rootfile")
-           <<"No digits tree object in existing file"<<ENDLOG;
-         return;
-       }
-    }
-#endif
 
   Int_t digcounter=0,trackID[3];
 
@@ -1128,14 +1024,14 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
       Int_t sector,row;
       AliHLTTPCTransform::Slice2Sector(fSlice,i,sector,row);
       
-      AliSimDigits *old_dig = (AliSimDigits*)old_array->LoadRow(sector,row);
+      AliSimDigits *oldDig = (AliSimDigits*)oldArray->LoadRow(sector,row);
       AliSimDigits * dig = (AliSimDigits*)arr->CreateRow(sector,row);
-      old_dig->ExpandBuffer();
-      old_dig->ExpandTrackBuffer();
+      oldDig->ExpandBuffer();
+      oldDig->ExpandTrackBuffer();
       dig->ExpandBuffer();
       dig->ExpandTrackBuffer();
       
-      if(!old_dig)
+      if(!oldDig)
        LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::AliDigits2RootFile","Data")
          <<"No padrow " << sector << " " << row <<ENDLOG;
 
@@ -1159,7 +1055,7 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
          //Tricks to get and set the correct track id's. 
          for(Int_t t=0; t<3; t++)
            {
-             Int_t label = old_dig->GetTrackIDFast(time,pad,t);
+             Int_t label = oldDig->GetTrackIDFast(time,pad,t);
              if(label > 1)
                trackID[t] = label - 2;
              else if(label==0)
@@ -1178,24 +1074,17 @@ void AliHLTTPCFileHandler::AliDigits2RootFile(AliHLTTPCDigitRowData *rowPt,Char_
       UpdateRowPointer(rowPt);
       arr->StoreRow(sector,row);
       arr->ClearRow(sector,row);  
-      old_array->ClearRow(sector,row);
+      oldArray->ClearRow(sector,row);
     }
 
   char treeName[100];
   sprintf(treeName,"TreeD_%s_0",fParam->GetTitle());
   
-#ifdef use_newio
   arr->GetTree()->SetName(treeName);
   arr->GetTree()->AutoSave();
   tpcLoader->WriteDigits("OVERWRITE");
-#else
-  digFile->cd();
-  arr->GetTree()->SetName(treeName);
-  arr->GetTree()->AutoSave();
-  digFile->Close();
-#endif
   delete arr;
-  delete old_array;
+  delete oldArray;
 }
 
 ///////////////////////////////////////// Point IO  
@@ -1220,16 +1109,8 @@ AliHLTTPCSpacePointData * AliHLTTPCFileHandler::AliPoints2Memory(UInt_t & npoint
     <<"No Input avalible: no object fInAli"<<ENDLOG;
     return 0;
   }
-#ifndef use_newio
-  if(!fInAli->IsOpen()){
-    LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::AliPoints2Memory","File")
-    <<"No Input avalible: TFile not opend"<<ENDLOG;
-    return 0;
-  }
-#endif
 
   TDirectory *savedir = gDirectory;
-#ifdef use_newio
   AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader");
   if(!tpcLoader){
     LOG(AliHLTTPCLog::kWarning,"AliHLTTPCFileHandler::AliPoints2Memory","File")
@@ -1243,16 +1124,6 @@ AliHLTTPCSpacePointData * AliHLTTPCFileHandler::AliPoints2Memory(UInt_t & npoint
   carray.Setup(fParam);
   carray.SetClusterType("AliTPCcluster");
   Bool_t clusterok = carray.ConnectTree(tpcLoader->TreeR());
-#else
-  fInAli->cd();
-  
-  Char_t cname[100];
-  sprintf(cname,"TreeC_TPC_%d",eventn);
-  AliTPCClustersArray carray;
-  carray.Setup(fParam);
-  carray.SetClusterType("AliTPCcluster");
-  Bool_t clusterok = carray.ConnectTree(cname);
-#endif
 
   if(!clusterok) return 0;
 
@@ -1292,8 +1163,8 @@ AliHLTTPCSpacePointData * AliHLTTPCFileHandler::AliPoints2Memory(UInt_t & npoint
     Int_t row = rows[i];
     Int_t sector = sects[i];
     AliHLTTPCTransform::Sector2Slice(lslice,lrow,sector,row);
-    Int_t entries_in_row = clusterrow[i]->GetArray()->GetEntriesFast();
-    for(Int_t j = 0;j<entries_in_row;j++){
+    Int_t entriesInRow = clusterrow[i]->GetArray()->GetEntriesFast();
+    for(Int_t j = 0;j<entriesInRow;j++){
       AliTPCcluster *c = (AliTPCcluster*)(*clusterrow[i])[j];
       data[n].fZ = c->GetZ();
       data[n].fY = c->GetY();