]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCHits2SDigits.C
Added cleanup in Loader dtor and Getter Reset()
[u/mrichter/AliRoot.git] / TPC / AliTPCHits2SDigits.C
CommitLineData
88cb7938 1#ifndef __CINT__
2 #include "alles.h"
3 #include "AliRun.h"
4 #include "AliRunLoader.h"
5 #include "AliLoader.h"
6 #include "AliMagF.h"
7 #include "AliTPCtracker.h"
8 #include "AliITS.h"
9 #include "AliITSgeom.h"
10 #include "AliITSRecPoint.h"
11 #include "AliITSclusterV2.h"
12 #include "AliITSsimulationFastPoints.h"
13 #include "AliITStrackerV2.h"
14
15#endif
9be6ad43 16Int_t AliTPCHits2SDigits(Int_t nevent=1)
17{
18
19 // new version by J.Belikov
20
21 // Connect the Root Galice file containing Geometry, Kine and Hits
22
88cb7938 23 //it assures full cleaning of prevous session
24 if (gAlice)
25 {
26 delete gAlice->GetRunLoader();
27 delete gAlice;//if everything was OK here it is already NULL
28 gAlice = 0x0;
29 }
30
31 AliRunLoader *rl = AliRunLoader::Open("galice.root","Event","update");
32 if (!rl)
33 {
34 cerr<<"Can't load RunLoader from "<<inFile_new<<" !\n";
9be6ad43 35 return 1;
88cb7938 36 }
9be6ad43 37
38 // Get AliRun object from file or create it if not on file
88cb7938 39
40 rl->LoadgAlice();
41
42 gAlice = rl->GetAliRun();
9be6ad43 43 if (!gAlice) {
44 cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
88cb7938 45 delete rl;
9be6ad43 46 return 2;
47 }
48
9be6ad43 49 // gAlice->GetEvent(0);
88cb7938 50 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
51 AliLoader * tpcl = rl->GetLoader("TPCLoader");
52 if ((TPC == 0x0) || (tpcl == 0x0))
53 {
54 cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n";
55 delete rl;
56 return 3;
57 }
58
59 tpcl->LoadHits("READ");
60 tpcl->LoadSDigits("RECREATE");
61
9be6ad43 62 TStopwatch timer;
63 timer.Start();
64
dbab3f1e 65 // uncomment lines below to set active sectors
66 //Int_t sec[10]={4,5,6,7,8,4+36,5+36,6+36,7+36,8+36};
67 //TPC->SetActiveSectors(sec,10);
68
9be6ad43 69 for(Int_t eventn =0;eventn<nevent;eventn++){
dbab3f1e 70 printf("Processing event %d \n",eventn);
88cb7938 71 rl->GetEvent(eventn);
72 TPC->SetTreeAddress();
dbab3f1e 73 TPC->SetActiveSectors(); // all sectors set active
74 printf("\nActive sectors\n");
75 for (Int_t i=0;i<72;i++) if (TPC->IsSectorActive(i)) printf("%d\t",i);
88cb7938 76
9be6ad43 77 TPC->Hits2SDigits2(eventn);
78 }
79
88cb7938 80 delete rl;
9be6ad43 81 timer.Stop();
82 timer.Print();
83
84 return 0;
85};
86
87
88
89