X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TOF%2FAliTOFtestDigitizer.C;h=5966e6e89a9a1fc4b11cf1bd6c91d1f53d90d375;hb=0c75a99d0162cd666b1793fb2d06dbb8f0fd1af0;hp=7a1d2049ab30486e7de60616590291bd1d366c4f;hpb=8e72349e296ed4ef59075df49a42d08adbbe4a0c;p=u%2Fmrichter%2FAliRoot.git diff --git a/TOF/AliTOFtestDigitizer.C b/TOF/AliTOFtestDigitizer.C index 7a1d2049ab3..5966e6e89a9 100644 --- a/TOF/AliTOFtestDigitizer.C +++ b/TOF/AliTOFtestDigitizer.C @@ -13,10 +13,13 @@ // file with digits // // input: -// TString fileNameSDigits ... input file with sdigits +// char* fileNameSignal ... input file with sdigits // TString fileNameDigits ... output file with digits // Int_t nEvents ... how many events to process // +// Updated to the new I/O: C. Zampolli +// +///////////////////////////////////////////////////////////////////// #if !defined(__CINT__) || defined(__MAKECINT__) #include "iostream.h" @@ -26,118 +29,45 @@ #include "TStopwatch.h" #endif -//#include "AliHits2SDigits.C" - -TFile* OpenFile(TString fileName); -Bool_t ImportgAlice(TFile *file); -void AliCopyN(TString inputFile, TString outputFile); -void AliCopy(TFile *inputFile, TFile *outputFile); -Int_t gDEBUG = 1; +Int_t AliTOFtestDigitizer(const char* fileNameSignal = "galice.root", + /*const char* fileNameSignal = "signal/galice.root", + const char* fileNameBkgrd = "bkgrd/galice.root",*/ + Int_t nEvents = -1, Int_t signalPerBkgrd = 1, + Int_t iTOF = 1) +{ + +// delete the current gAlice object, the one from input file will be used + if(gAlice) + { + delete AliRunLoader::Instance(); + delete gAlice; + gAlice=0x0; + } + AliRunDigitizer * manager = new AliRunDigitizer(1/*2*/,signalPerBkgrd); + manager->SetInputStream(0, fileNameSignal); + //manager->SetInputStream(1, fileNameBkgrd); + //manager->SetOutputFile(fileNameSignal); + if (nEvents >= 0) manager->SetNrOfEventsToWrite(nEvents); -Int_t AliTOFtestDigitizer(TString fileNameDigits="digits.root", - TString fileNameSDigits="rfio:sdigits.root", - Int_t nEvents = 1, Int_t iTOF = 1, Int_t iCopy = 1) -{ -// delete the current gAlice object, the one from input file -// will be used + if (iTOF) AliTOFDigitizer *dTOF = new AliTOFDigitizer(manager); - if(gAlice){ - delete gAlice; - gAlice = 0; - } // end if gAlice - AliRunDigitizer * manager = new AliRunDigitizer(1,1); - manager->SetInputStream(0,fileNameSDigits.Data()); - if (fileNameDigits != "") { - if (iCopy) { - AliCopyN(fileNameSDigits,fileNameDigits); - } - manager->SetOutputFile(fileNameDigits); - } - manager->SetNrOfEventsToWrite(nEvents); - if (iTOF) AliTOFDigitizer *dTOF = new AliTOFDigitizer(manager); TStopwatch timer; timer.Start(); manager->Exec("deb all"); timer.Stop(); timer.Print(); - delete manager; -} - - -//////////////////////////////////////////////////////////////////////// -void AliCopyN(TString inputFileName, TString outputFileName) { -// copy some objects - - TFile *inputFile = OpenFile(inputFileName); - if (!inputFile) return; - TFile *outputFile = TFile::Open(outputFileName.Data(),"update"); - if (!outputFile->IsOpen()) { - cerr<<"Can't open "<Close(); - delete inputFile; - outputFile->Close(); - delete outputFile; -} - -//////////////////////////////////////////////////////////////////////// -TFile* OpenFile(TString fileName) { - // open file fileName - TFile *file = TFile::Open(fileName.Data()); - if (!file->IsOpen()) { - cerr<<"Can't open "<Get("gAlice"); - if (!gAlice) return kFALSE; - return kTRUE; -} + return 0; -//////////////////////////////////////////////////////////////////////// -void AliCopy(TFile *inputFile, TFile *outputFile) { -// copy some objects - -// copy gAlice - if (gDEBUG) cout<<"Copy gAlice: "; - outputFile->cd(); - gAlice->Write(); - if (gDEBUG) cout<<"done"<TreeE(); - if (!treeE) { - cerr<<"No TreeE found "<SetBranchAddress("Header", &header); - treeE->SetBranchStatus("*",1); - TTree *treeENew = treeE->CloneTree(); - treeENew->Write(); - if (gDEBUG) cout<<"done"<(inputFile->Get("AliceGeom")); - if (!AliceGeom) { - cerr<<"AliceGeom was not found in the input file "<Write(); - if (gDEBUG) cout<<"done"<