]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCHits2SDigits.C
Corrected initialization of arrays (Opteron)
[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 "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
16 Int_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
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";
35     return 1;
36    }
37
38   // Get AliRun object from file or create it if not on file
39   
40   rl->LoadgAlice();
41  
42   gAlice = rl->GetAliRun();
43   if (!gAlice) {
44     cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
45     delete rl;
46     return 2;
47   }
48
49   // gAlice->GetEvent(0);
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   
62   TStopwatch timer;
63   timer.Start();
64
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
69   for(Int_t eventn =0;eventn<nevent;eventn++){
70     printf("Processing event %d \n",eventn);
71     rl->GetEvent(eventn);
72     TPC->SetTreeAddress();
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);
76     
77     TPC->Hits2SDigits2(eventn);
78   } 
79
80   delete rl;
81   timer.Stop();
82   timer.Print();
83
84   return 0;
85 };
86
87
88
89