Formatting changes.
[u/mrichter/AliRoot.git] / TPC / AliTPCSDigits2Digits.C
CommitLineData
9be6ad43 1#ifndef __CINT__
2 #include "alles.h"
3 #include "AliTPCtracker.h"
4#endif
5Int_t AliTPCSDigits2Digits(Int_t nevent=1)
6{
7
8 // new version by J.Belikov
9
10 // Connect the Root Galice file containing Geometry, Kine and Hits
11
88cb7938 12 const char * inFile_old = "galice.root";
9be6ad43 13 const char * inFile_new = "galice.root";
88cb7938 14
15 if (gAlice)
16 {
17 delete gAlice->GetRunLoader();
18 delete gAlice;//if everything was OK here it is already NULL
19 gAlice = 0x0;
20 }
21
9be6ad43 22 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old);
23 if (file) {file->Close(); delete file;}
88cb7938 24
25 AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","update");
26
27 if (!rl) {
9be6ad43 28 cerr<<"Can't open "<<inFile_new<<" !\n";
29 return 1;
30 }
31
32 // Get AliRun object from file or create it if not on file
33 // if (gAlice) delete gAlice;
88cb7938 34
35 rl->LoadgAlice();
36
37 gAlice = rl->GetAliRun();
9be6ad43 38 if (!gAlice) {
39 cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
88cb7938 40 delete rl;
9be6ad43 41 return 2;
42 }
43
9be6ad43 44 // gAlice->GetEvent(0);
88cb7938 45 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
46
47 AliLoader * tpcl = rl->GetLoader("TPCLoader");
7a09f434 48
88cb7938 49 if ((TPC == 0x0) || (tpcl == 0x0))
50 {
51 cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n";
52// delete rl;
53 return 3;
54 }
55
56 tpcl->LoadSDigits("READ");
57 tpcl->LoadDigits("RECREATE");
58 rl->CdGAFile();
59 AliTPCParamSR *dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60");
7a09f434 60 if(dig){
61 cerr<<"2 pad-length geom hits with 3 pad-lengths geom digits\n";
62 delete dig;
63 dig = new AliTPCParamSR();
64 }
65 else
66 {
67 dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
68 }
69 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
70 TPC->SetParam(dig);
71
9be6ad43 72
73 TStopwatch timer;
74 timer.Start();
75
76 for(Int_t eventn =0;eventn<nevent;eventn++){
77 printf("Processing event %d\n",eventn);
88cb7938 78 cout<<"rl->GetEvent(eventn);\n";
79 rl->GetEvent(eventn);
80 cout<<"TPC->SDigits2Digits2(eventn);\n";
9be6ad43 81 TPC->SDigits2Digits2(eventn);
82 }
83
9be6ad43 84 timer.Stop();
85 timer.Print();
86
88cb7938 87 delete rl;
9be6ad43 88 return 0;
89};
90
91
92
93
94
95
96
97
98
99
100
101