]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCTestMerge.C
New class handling digitization and merging
[u/mrichter/AliRoot.git] / TPC / AliTPCTestMerge.C
1 #ifndef __CINT__
2   #include "alles.h"
3 #endif
4 Int_t AliTPCTestMerge(Int_t nevent=1)
5 {
6
7   // new version by J.Belikov
8
9   // Connect the Root Galice file containing Geometry, Kine and Hits
10
11   const char * inFile_old = "galice.root"; 
12   const char * inFile_new = "galice.root";
13   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old);
14   if (file) {file->Close(); delete file;}
15   file =  TFile::Open(inFile_new,"UPDATE");
16   if (!file->IsOpen()) {
17     cerr<<"Can't open "<<inFile_new<<" !\n";
18     return 1;
19   }
20
21   // Get AliRun object from file or create it if not on file
22   //if (gAlice) delete gAlice;
23   gAlice = (AliRun*)file->Get("gAlice");
24   if (!gAlice) {
25     cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
26     return 2;
27   }
28
29   // gAlice->GetEvent(0);
30   AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");      
31
32   TStopwatch timer;
33   timer.Start();
34   TTree  tree[100];   //
35   Int_t mask[100];
36   for(Int_t eventn =0;eventn<nevent;eventn++){
37   
38     printf("Processing event %d",eventn);
39     char  name[100];
40     sprintf(name,"TreeS_75x40_100x60_%d",eventn);
41     tree[eventn].Read(name);
42     tree[eventn].Dump();
43     mask[eventn] = 2<<(20+eventn);
44     
45   } 
46   TPC->Merge(tree,mask,nevent,nevent);
47   
48   file->Close(); delete file;
49   timer.Stop();
50   timer.Print();
51   delete gAlice; gAlice=0;
52   return 0;
53 };
54
55
56
57