]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSSDigits2Digits.C
Fixes added to make the slow simulation running with the current HEAD (from M. Masera)
[u/mrichter/AliRoot.git] / ITS / AliITSSDigits2Digits.C
CommitLineData
cc2535cd 1void writeAR(TFile * fin, TFile *fou);
2void AliITSSD2D(TString inFile, TString outFile);
3
4void AliITSSDigits2Digits(TString inFile= "galice.root", TString outFile = ""){
af8e1c2d 5 // This macro takes SDigits and produces Digits. No merging is done
6 // and only one galice.root file is used.
7 // Dynamically link some shared libs
8 TStopwatch timer;
9
10 if(gAlice){
11 delete gAlice;
12 gAlice = 0;
13 } // end if gAlice
14 cout << "Creating digits from summable digits for the ITS..." << endl;
cc2535cd 15 AliITSSD2D(inFile,outFile);
16 timer.Stop();
17 timer.Print();
18}
19
20void AliITSSD2D(TString inFile, TString outFile){
21 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
22 char ftmp[50];
23 sprintf(ftmp,"%s",inFile.Data());
24 manager->SetInputStream(0,ftmp);
25 if(outFile != "")manager->SetOutputFile(outFile);
26 AliITSDigitizer *dITS = new AliITSDigitizer(manager);
27 manager->Exec("");
28 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
29 TFile *file2 = 0;
30 if(outFile != ""){
31 file2 = new TFile(outFile,"UPDATE");
32 writeAR(file,file2);
33 }
cc2535cd 34 delete manager;
35 if(file){
36 file->Close();
37 delete file;
38 }
39 if(file2){
40 file2->Close();
41 delete file2;
42 }
af8e1c2d 43}
cc2535cd 44
45void writeAR(TFile * fin, TFile *fou) {
46 TDirectory *current = gDirectory;
47 TTree *Te;
48 TTree *TeNew;
49 AliHeader *alhe = new AliHeader();
50 Te = (TTree*)fin->Get("TE");
51 Te->SetBranchAddress("Header",&alhe);
52 Te->SetBranchStatus("*",1);
53 fou->cd();
54 TeNew = Te->CloneTree();
55 TeNew->Write(0,TObject::kOverwrite);
56 gAlice->Write(0,TObject::kOverwrite);
57 current->cd();
58 delete alhe;
59 cout<<"AliRun object written to file\n";
60}
61
62
63
64
65
66