new macros compliant with multiple events/files for TreeS,D,R
[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 }
34 delete dITS;
35 delete manager;
36 if(file){
37 file->Close();
38 delete file;
39 }
40 if(file2){
41 file2->Close();
42 delete file2;
43 }
af8e1c2d 44}
cc2535cd 45
46void writeAR(TFile * fin, TFile *fou) {
47 TDirectory *current = gDirectory;
48 TTree *Te;
49 TTree *TeNew;
50 AliHeader *alhe = new AliHeader();
51 Te = (TTree*)fin->Get("TE");
52 Te->SetBranchAddress("Header",&alhe);
53 Te->SetBranchStatus("*",1);
54 fou->cd();
55 TeNew = Te->CloneTree();
56 TeNew->Write(0,TObject::kOverwrite);
57 gAlice->Write(0,TObject::kOverwrite);
58 current->cd();
59 delete alhe;
60 cout<<"AliRun object written to file\n";
61}
62
63
64
65
66
67