During simulation: fill STU region w/ non null time sums
[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"
88cb7938 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
9be6ad43 15Int_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
88cb7938 22 //it assures full cleaning of prevous session
23 if (gAlice)
24 {
33c3c91a 25 delete AliRunLoader::Instance();
88cb7938 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";
9be6ad43 34 return 1;
88cb7938 35 }
9be6ad43 36
37 // Get AliRun object from file or create it if not on file
88cb7938 38
39 rl->LoadgAlice();
40
41 gAlice = rl->GetAliRun();
9be6ad43 42 if (!gAlice) {
43 cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
88cb7938 44 delete rl;
9be6ad43 45 return 2;
46 }
47
9be6ad43 48 // gAlice->GetEvent(0);
88cb7938 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
9be6ad43 61 TStopwatch timer;
62 timer.Start();
63
dbab3f1e 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
9be6ad43 68 for(Int_t eventn =0;eventn<nevent;eventn++){
dbab3f1e 69 printf("Processing event %d \n",eventn);
88cb7938 70 rl->GetEvent(eventn);
71 TPC->SetTreeAddress();
dbab3f1e 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);
88cb7938 75
9be6ad43 76 TPC->Hits2SDigits2(eventn);
77 }
78
88cb7938 79 delete rl;
9be6ad43 80 timer.Stop();
81 timer.Print();
82
83 return 0;
84};
85
86
87
88