]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSSDigits2Digits.C
Typo corrected
[u/mrichter/AliRoot.git] / ITS / AliITSSDigits2Digits.C
1 void writeAR(TFile * fin, TFile *fou);
2 void AliITSSD2D(TString inFile, TString outFile);
3
4 void AliITSSDigits2Digits(TString inFile= "galice.root", TString outFile = ""){
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;
15     AliITSSD2D(inFile,outFile);
16     timer.Stop(); 
17     timer.Print();
18 }
19
20 void 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 manager;
35   if(file){
36     file->Write();
37   }
38   if(file2){
39     file2->Close();
40     delete file2;
41   }
42 }
43
44 void writeAR(TFile * fin, TFile *fou) {
45   TDirectory *current = gDirectory;
46   TTree *Te;
47   TTree *TeNew;
48   AliHeader *alhe = new AliHeader();
49   Te = (TTree*)fin->Get("TE");
50   Te->SetBranchAddress("Header",&alhe);
51   Te->SetBranchStatus("*",1);
52   fou->cd();
53   TeNew = Te->CloneTree();
54   TeNew->Write(0,TObject::kOverwrite);
55   gAlice->Write(0,TObject::kOverwrite);
56   current->cd();
57   delete alhe;
58   cout<<"AliRun object written to file\n";
59 }
60
61
62
63
64
65