From 0d319e67f9a76cbc46f186fbbc3cbfece861b916 Mon Sep 17 00:00:00 2001 From: vestbo Date: Fri, 12 Oct 2001 15:17:00 +0000 Subject: [PATCH] Added function AliDigits2RootFile --- HLT/src/AliL3FileHandler.cxx | 78 ++++++++++++++++++++++++++++++++++++ HLT/src/AliL3FileHandler.h | 1 + 2 files changed, 79 insertions(+) diff --git a/HLT/src/AliL3FileHandler.cxx b/HLT/src/AliL3FileHandler.cxx index 2bac33fb39f..86464eeff04 100644 --- a/HLT/src/AliL3FileHandler.cxx +++ b/HLT/src/AliL3FileHandler.cxx @@ -14,6 +14,7 @@ #include "AliL3MemHandler.h" #include "AliL3FileHandler.h" +#include "AliTPCDigitsArray.h" #include "AliTPCClustersArray.h" #include "AliTPCcluster.h" #include "AliTPCClustersRow.h" @@ -284,6 +285,83 @@ AliL3DigitRowData * AliL3FileHandler::AliDigits2Memory(UInt_t & nrow){ return data; } +void AliL3FileHandler::AliDigits2RootFile(AliL3DigitRowData *rowPt,Char_t *new_digitsfile) +{ + //Write digits to a new alirootfile. + + if(!fInAli) + { + printf("AliL3FileHandler::AliDigits2RootFile : No input alirootfile\n"); + return; + } + if(!fParam) + { + printf("AliL3FileHandler::AliDigits2RootFile : No parameter object. Run on rootfile\n"); + return; + } + if(!fTransformer) + { + printf("AliL3FileHandler::AliDigits2RootFile : No transform object\n"); + return; + } + + //Get the original digitstree: + fInAli->cd(); + AliTPCDigitsArray *old_array = new AliTPCDigitsArray(); + old_array->Setup(fParam); + old_array->SetClass("AliSimDigits"); + Bool_t ok = old_array->ConnectTree("TreeD_75x40_100x60"); + if(!ok) + { + printf("AliL3FileHandler::AliDigits2RootFile : No digits tree object\n"); + return; + } + + TFile *digFile = new TFile(new_digitsfile,"RECREATE"); + digFile->cd(); + + //setup a new one: + AliTPCDigitsArray *arr = new AliTPCDigitsArray; + arr->SetClass("AliSimDigits"); + arr->Setup(fParam); + arr->MakeTree(); + if(fRowMin !=0 || fRowMax != 175) + printf("\n AliL3FileHandler::AliDigits2RootFile : Rather stupid row numbers...%d %d\n\n",fRowMin,fRowMax); + for(Int_t i=fRowMin; i<=fRowMax; i++) + { + Int_t sector,row; + fTransformer->Slice2Sector(fSlice,i,sector,row); + AliDigits * dig = arr->CreateRow(sector,row); + AliDigits *old_dig = old_array->LoadRow(sector,row); + if(!old_dig) + printf("AliL3FileHandler::AliDigits2RootFile : No padrow %d %d\n",sector,row); + + AliL3DigitData *digPt = rowPt->fDigitData; + for(UInt_t j=0; jfNDigit; j++) + { + UShort_t charge = digPt[j].fCharge; + UChar_t pad = digPt[j].fPad; + UShort_t time = digPt[j].fTime; + dig->SetDigitFast(charge,time,pad); + ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,0),time,pad,0); + ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,1),time,pad,1); + ((AliSimDigits*)dig)->SetTrackIDFast(((AliSimDigits*)old_dig)->GetTrackID((Int_t)time,(Int_t)pad,2),time,pad,2); + + } + UpdateRowPointer(rowPt); + arr->StoreRow(sector,row); + arr->ClearRow(sector,row); + old_array->ClearRow(sector,row); + } + digFile->cd(); + char treeName[100]; + sprintf(treeName,"TreeD_%s",fParam->GetTitle()); + arr->GetTree()->Write(treeName,TObject::kOverwrite); + fParam->Write(fParam->GetTitle()); + digFile->Close(); + delete digFile; +} + ///////////////////////////////////////// Point IO Bool_t AliL3FileHandler::AliPoints2Binary(){ Bool_t out = kTRUE; diff --git a/HLT/src/AliL3FileHandler.h b/HLT/src/AliL3FileHandler.h index 6038b2f2959..4014292ac73 100644 --- a/HLT/src/AliL3FileHandler.h +++ b/HLT/src/AliL3FileHandler.h @@ -43,6 +43,7 @@ class AliL3FileHandler:public AliL3MemHandler{ Bool_t AliDigits2Binary(); AliL3DigitRowData *AliDigits2Memory(UInt_t & nrow); //Allocates Memory Bool_t AliDigits2CompBinary(); + void AliDigits2RootFile(AliL3DigitRowData *rowPt,Char_t *new_digitsfile); //Point IO Bool_t AliPoints2Binary(); -- 2.31.1