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